Skip to content

Commit 48ca29e

Browse files
committed
Add a run_tests build command without file output for CI
1 parent 081ef65 commit 48ca29e

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

examples/ocaml/Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,14 @@ test.exe: parser/fip.cmx mvalue.cmx ir.cmx test_harness.cmx
8888

8989
# Running test suite
9090
run: test.bc
91-
./test.bc "multi" $(TESTS_DIR) "results/y$(YEAR)"
91+
./test.bc "multi" $(TESTS_DIR) "results/y_$(YEAR)"
92+
93+
runfile: test.bc
94+
./test.bc "raw" $(FILE) "results/f_$(notdir $(FILE))"
9295

9396
runx: test.exe
94-
./test.exe "multi" $(TESTS_DIR) "results/y$(YEAR)"
97+
./test.exe "multi" $(TESTS_DIR) "results/y_$(YEAR)"
98+
99+
# run_tests uses an empty string to disable the file output (output is enabled on stdout).
100+
run_tests: test.exe
101+
./test.exe "multi" $(TESTS_DIR) ""

examples/ocaml/test_harness.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,10 @@ let run_test_directory (directory : string) (output_file_name : string) : unit =
181181
List.combine file_list
182182
(List.map compute_discrepancies_from_file_2020 file_list)
183183
in
184-
let _oc = open_out (output_file_name ^ "_disc.txt") in
184+
let _oc =
185+
if String.length output_file_name = 0 then stdout
186+
else open_out (output_file_name ^ "_disc.txt")
187+
in
185188
let oc = Format.formatter_of_out_channel _oc in
186189
let print_discrepancy_report fmt files_discrepancies_list =
187190
Format.pp_print_list print_file_discrepancies fmt files_discrepancies_list

0 commit comments

Comments
 (0)