let run_one_test conf logger shared test_path test_fun =
let () = OUnitLogger.report logger (TestEvent (test_path, EStart)) in
let non_fatal = ref [] in
let main_result_full =
with_ctxt conf logger shared non_fatal test_path
(fun ctxt ->
let check_env = OUnitCheckEnv.create () in
let result_full =
try
test_fun ctxt;
OUnitCheckEnv.check ctxt check_env;
test_path, RSuccess, None
with e ->
OUnitTest.result_full_of_exception ctxt e
in
report_result_full ctxt result_full)
in
let result_full, other_result_fulls =
match main_result_full, List.rev !non_fatal with
| (_, RSuccess, _), [] ->
main_result_full, []
| (_, RSuccess, _), hd :: tl ->
OUnitResultSummary.worst_result_full hd tl
| _, lst ->
OUnitResultSummary.worst_result_full main_result_full lst
in
OUnitLogger.report logger (TestEvent (test_path, EEnd));
result_full, other_result_fulls