diff options
author | Richard Levitte <levitte@openssl.org> | 2016-06-05 23:01:24 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2016-06-06 10:03:01 +0200 |
commit | 78e91586fbeb2c3a54d2a8a28dadeeb1eb0f57a8 (patch) | |
tree | bc40236e808971c51465aae748816ab5f2eca02d /test | |
parent | 35d2e3275f9b313ed63754641118ecbbc7873413 (diff) |
tests: Shut the shell up unless verbose
In rare cases, the shell we run test programs in may have complaints.
Shut those up unless testing verbosely.
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/recipes/01-test_abort.t | 1 | ||||
-rw-r--r-- | test/testlib/OpenSSL/Test.pm | 17 |
2 files changed, 17 insertions, 1 deletions
diff --git a/test/recipes/01-test_abort.t b/test/recipes/01-test_abort.t index a6a7f3151a..2f121e25bf 100644 --- a/test/recipes/01-test_abort.t +++ b/test/recipes/01-test_abort.t @@ -13,5 +13,4 @@ setup("test_abort"); plan tests => 1; -open STDERR, ">", "/dev/null"; is(run(test(["aborttest"])), 0, "Testing that abort is caught correctly"); diff --git a/test/testlib/OpenSSL/Test.pm b/test/testlib/OpenSSL/Test.pm index 8a7d0a0ac9..1e9730bcdc 100644 --- a/test/testlib/OpenSSL/Test.pm +++ b/test/testlib/OpenSSL/Test.pm @@ -353,6 +353,16 @@ sub run { my $r = 0; my $e = 0; + # In non-verbose, we want to shut up the command interpreter, in case + # it has something to complain about. On VMS, it might complain both + # on stdout and stderr + *save_STDOUT = *STDOUT; + *save_STDERR = *STDERR; + if ($ENV{HARNESS_ACTIVE} && !$ENV{HARNESS_VERBOSE}) { + open STDOUT, ">", devnull(); + open STDERR, ">", devnull(); + } + # The dance we do with $? is the same dance the Unix shells appear to # do. For example, a program that gets aborted (and therefore signals # SIGABRT = 6) will appear to exit with the code 134. We mimic this @@ -366,6 +376,13 @@ sub run { $r = $hooks{exit_checker}->($e); } + if ($ENV{HARNESS_ACTIVE} && !$ENV{HARNESS_VERBOSE}) { + close STDOUT; + close STDERR; + } + *STDOUT = *save_STDOUT; + *STDERR = *save_STDERR; + print STDERR "$prefix$display_cmd => $e\n" if !$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE}; |