Commit e724ce26 authored by Kim Nguyễn's avatar Kim Nguyễn
Browse files

Take stderr into account for failing tests.

parent 4afe89e0
...@@ -36,11 +36,16 @@ let compile_rule f cdo = ...@@ -36,11 +36,16 @@ let compile_rule f cdo =
(action (with-accepted-exit-codes 0 (run cduce --compile %%{deps}))))\n" (action (with-accepted-exit-codes 0 (run cduce --compile %%{deps}))))\n"
f cdo f cdo
let run_rule cdo output code = let run_rule cdo output kind =
let write_output, close, code =
match kind with
Good -> "ignore-stderr (with-stdout-to", ")", "0"
| Bad -> "with-outputs-to", "", "(not 0)"
in
Format.printf Format.printf
"(rule (deps %s) (target %s) "(rule (deps %s) (target %s)
(action (ignore-stderr (with-stdout-to %%{target} (with-accepted-exit-codes %s (run cduce --run %%{deps}))))))\n" (action (%s %%{target} (with-accepted-exit-codes %s (run cduce --run %%{deps})))%s))\n"
cdo output code cdo output write_output code close
let diff_rule base exp out = let diff_rule base exp out =
Format.printf Format.printf
...@@ -48,14 +53,13 @@ let diff_rule base exp out = ...@@ -48,14 +53,13 @@ let diff_rule base exp out =
let gen_test kind ext acc f = let gen_test kind ext acc f =
if check_file f ext then begin if check_file f ext then begin
let code = match kind with Good -> "0" | Bad -> "(not 0)" in
let base = Filename.remove_extension f in let base = Filename.remove_extension f in
let cdo = base ^ ".cdo" in let cdo = base ^ ".cdo" in
let out = base ^ ".out" in let out = base ^ ".out" in
let exp = base ^ ".exp" in let exp = base ^ ".exp" in
Format.printf "; begin: %s\n" f; Format.printf "; begin: %s\n" f;
compile_rule f cdo; compile_rule f cdo;
run_rule cdo out code; run_rule cdo out kind;
diff_rule base exp out; diff_rule base exp out;
Format.printf "; end: %s\n\n" f; Format.printf "; end: %s\n\n" f;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment