aboutsummaryrefslogtreecommitdiff
path: root/test-suite/unit-tests/src
diff options
context:
space:
mode:
authorJim Fehrle2018-05-18 12:03:19 -0700
committerJim Fehrle2018-07-23 08:25:11 -0700
commita6131723faa8699e485a88fae8cc2323b82a8461 (patch)
treeadffb12de7e173d3a948976fd1b6de669be2bf77 /test-suite/unit-tests/src
parent496d9d4007f59e6114dae9a94ee5a39d241484cf (diff)
Make the out_channel for the log file accessible so tests can write to it (e.g. for debugging)
Diffstat (limited to 'test-suite/unit-tests/src')
-rw-r--r--test-suite/unit-tests/src/utest.ml8
-rw-r--r--test-suite/unit-tests/src/utest.mli8
2 files changed, 12 insertions, 4 deletions
diff --git a/test-suite/unit-tests/src/utest.ml b/test-suite/unit-tests/src/utest.ml
index 069e6a4bf3..0cb1780ec9 100644
--- a/test-suite/unit-tests/src/utest.ml
+++ b/test-suite/unit-tests/src/utest.ml
@@ -42,10 +42,12 @@ let run_one logit test =
let results = perform_test (fun _ -> ()) test in
process_results results
-(* run list of OUnit test cases, log results *)
-let run_tests ml_fn tests =
+let open_log_out_ch ml_fn =
let log_fn = ml_fn ^ ".log" in
- let out_ch = open_out log_fn in
+ open_out log_fn
+
+(* run list of OUnit test cases, log results *)
+let run_tests ml_fn out_ch tests =
let cprintf s = cfprintf out_ch s in
let ceprintf s = cfprintf stderr s in
let logit = logger out_ch in
diff --git a/test-suite/unit-tests/src/utest.mli b/test-suite/unit-tests/src/utest.mli
index 70928228bf..2e0f26e96b 100644
--- a/test-suite/unit-tests/src/utest.mli
+++ b/test-suite/unit-tests/src/utest.mli
@@ -9,4 +9,10 @@ val mk_bool_test : string -> string -> bool -> OUnit.test
(* the string argument should be the name of the .ml file
containing the tests; use __FILE__ for that purpose.
*)
-val run_tests : string -> OUnit.test list -> unit
+val run_tests : string -> out_channel -> OUnit.test list -> unit
+
+(** open output channel for the test log file *)
+(* the string argument should be the name of the .ml file
+ containing the tests; use __FILE__ for that purpose.
+ *)
+val open_log_out_ch : string -> out_channel