diff options
| author | Gabriel Scherer <gabriel.scherer@gmail.com> | 2018-02-26 11:27:25 +0100 |
|---|---|---|
| committer | Gabriel Scherer <gabriel.scherer@gmail.com> | 2018-02-26 14:53:44 +0100 |
| commit | 03e8d25f5a3e47d9c858910ddda9a5a686cf4fe1 (patch) | |
| tree | 0858a2cea08ee34e8badba2a56a2db647cc6356a | |
| parent | 70eb179b20d401b2fad43d3ddfd2752fc7925ab1 (diff) | |
| download | ocaml-03e8d25f5a3e47d9c858910ddda9a5a686cf4fe1.tar.gz | |
ocamltest: also announce system errors as unexpected errors
If you forget to commit a test file with your patch (but include
it in ocamltests), ocamltest will fail (print a message to
standard error and return a non-zero code), but until now it would
not print the standard-format "testing ... => unexpected error"
message which makes the failure visible to the summarize.awk
script.
This commit ensures that such early failures still result in an
explicit unexpected-error message being shown in the standard way,
in addition to stderr-level error reporting.
| -rw-r--r-- | ocamltest/main.ml | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ocamltest/main.ml b/ocamltest/main.ml index d0e441fc61..b4774c52f2 100644 --- a/ocamltest/main.ml +++ b/ocamltest/main.ml @@ -38,6 +38,13 @@ let is_test filename = | _ -> false *) +(* this primitive announce should be used for tests + that were aborted on system error before ocamltest + could parse them *) +let announce_test_error test_filename error = + Printf.printf " ... testing '%s' => unexpected error (%s)\n%!" + (Filename.basename test_filename) error + let tsl_block_of_file test_filename = let input_channel = open_in test_filename in let lexbuf = Lexing.from_channel input_channel in @@ -49,10 +56,12 @@ let tsl_block_of_file test_filename = let tsl_block_of_file_safe test_filename = try tsl_block_of_file test_filename with | Sys_error message -> - Printf.eprintf "%s\n" message; + Printf.eprintf "%s\n%!" message; + announce_test_error test_filename message; exit 1 | Parsing.Parse_error -> - Printf.eprintf "Could not read test block in %s\n" test_filename; + Printf.eprintf "Could not read test block in %s\n%!" test_filename; + announce_test_error test_filename "could not read test block"; exit 1 let print_usage () = |
