Skip to content

Commit

Permalink
test/run_tests.pl: Enhance the semantics of HARNESS_VERBOSE_FAILURES …
Browse files Browse the repository at this point in the history
…(VF)

Make the improved semantics of VFO replace the previous VF and remove VFO
Add warnings about overriding use of HARNESS_VERBOSE* variables

Reviewed-by: Paul Dale <[email protected]>
(Merged from openssl#12279)
  • Loading branch information
DDvO committed Jul 3, 2020
1 parent ea4ee15 commit e4522e1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 24 deletions.
6 changes: 3 additions & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -1603,9 +1603,9 @@ that isn't a problem in OpenSSL itself (like an OS malfunction or a Perl issue).
You may want increased verbosity, that can be accomplished as described in
section [Test Failures of test/README.md](test/README.md#test-failures).

You may want to selectively specify which test(s) to perform. This can be done
sing the `make` variable `TESTS` as described in section [Running Selected Tests
of test/README.md](test/README.md#running-selected-tests).
You may also want to selectively specify which test(s) to perform. This can be
done using the `make` variable `TESTS` as described in section [Running
Selected Tests of test/README.md](test/README.md#running-selected-tests).

If you find a problem with OpenSSL itself, try removing any
compiler optimization flags from the `CFLAGS` line in the Makefile and
Expand Down
12 changes: 4 additions & 8 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,17 @@ Full verbosity, showing full output of all successful and failed test cases
$ mms /macro=(V=1) test ! OpenVMS
$ nmake V=1 test # Windows

Verbosity on test failure (`VERBOSE_FAILURE` or `VF`, Unix example shown):
Verbosity on failed (sub-)tests only (`VERBOSE_FAILURE` or `VF`):

$ make test VF=1

Verbosity on failed (sub-)tests only (`VERBOSE_FAILURES_ONLY` or `VFO`):

$ make test VFO=1

Verbosity on failed (sub-)tests, in addition progress on succeeded (sub-)tests
(`VERBOSE_FAILURES_PROGRESS` or `VFP`):
(`VERBOSE_FAILURE_PROGRESS` or `VFP`):

$ make test VFP=1

If you want to run just one or a few specific tests, you can use
the `make` variable `TESTS` to specify them, like this:
the make variable TESTS to specify them, like this:

$ make TESTS='test_rsa test_dsa' test # Unix
$ mms/macro="TESTS=test_rsa test_dsa" test ! OpenVMS
Expand All @@ -50,7 +46,7 @@ the `make` variable `TESTS` to specify them, like this:
And of course, you can combine (Unix examples shown):

$ make test TESTS='test_rsa test_dsa' VF=1
$ make test TESTS="test_cmp_*" VFO=1
$ make test TESTS="test_cmp_*" VFP=1

You can find the list of available tests like this:

Expand Down
27 changes: 14 additions & 13 deletions test/run_tests.pl
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
use strict;
use warnings;

# Recognise VERBOSE and V which is common on other projects.
# Additionally, also recognise VERBOSE_FAILURE and VF.
# Recognise VERBOSE aka V which is common on other projects.
# Additionally, recognise VERBOSE_FAILURE aka VF.
# and recognise VERBOSE_FAILURE_PROGRESS aka VFP.
BEGIN {
$ENV{HARNESS_VERBOSE} = "yes" if $ENV{VERBOSE} || $ENV{V};
$ENV{HARNESS_VERBOSE_FAILURE} = "yes" if $ENV{VERBOSE_FAILURE} || $ENV{VF};
$ENV{HARNESS_VERBOSE_FAILURES_ONLY} = "yes"
if $ENV{VERBOSE_FAILURES_ONLY} || $ENV{VFO};
$ENV{HARNESS_VERBOSE_FAILURES_PROGRESS} = "yes"
if $ENV{VERBOSE_FAILURES_PROGRESS} || $ENV{VFP};
$ENV{HARNESS_VERBOSE_FAILURE_PROGRESS} = "yes"
if $ENV{VERBOSE_FAILURE_PROGRESS} || $ENV{VFP};
}

use File::Spec::Functions qw/catdir catfile curdir abs2rel rel2abs/;
Expand Down Expand Up @@ -53,9 +52,13 @@ BEGIN
my %openssl_args = ();

$openssl_args{'failure_verbosity'} = $ENV{HARNESS_VERBOSE} ? 0 :
$ENV{HARNESS_VERBOSE_FAILURE} ? 3 :
$ENV{HARNESS_VERBOSE_FAILURES_PROGRESS} ? 2 :
$ENV{HARNESS_VERBOSE_FAILURES_ONLY} ? 1 : 0;
$ENV{HARNESS_VERBOSE_FAILURE_PROGRESS} ? 2 :
1; # $ENV{HARNESS_VERBOSE_FAILURE}
print "Warning: HARNESS_VERBOSE overrides HARNESS_VERBOSE_FAILURE*\n"
if ($ENV{HARNESS_VERBOSE} && ($ENV{HARNESS_VERBOSE_FAILURE}
|| $ENV{HARNESS_VERBOSE_FAILURE_PROGRESS}));
print "Warning: HARNESS_VERBOSE_FAILURE_PROGRESS overrides HARNESS_VERBOSE_FAILURE\n"
if ($ENV{HARNESS_VERBOSE_FAILURE_PROGRESS} && $ENV{HARNESS_VERBOSE_FAILURE});

my $outfilename = $ENV{HARNESS_TAP_COPY};
open $openssl_args{'tap_copy'}, ">$outfilename"
Expand Down Expand Up @@ -153,9 +156,7 @@ sub find_matching_tests {
if defined $fh;

my $failure_verbosity = $openssl_args{failure_verbosity};
if ($failure_verbosity == 3) {
push @failure_output, $self->as_string;
} elsif ($failure_verbosity > 0) {
if ($failure_verbosity > 0) {
my $is_plan = $self->is_plan;
my $tests_planned = $is_plan && $self->tests_planned;
my $is_test = $self->is_test;
Expand Down Expand Up @@ -201,7 +202,7 @@ sub find_matching_tests {
print $_, "\n" foreach (("", @failure_output));
}
# Echo any trailing comments etc.
print "$output_buffer" if $failure_verbosity != 3;
print "$output_buffer";
};
}

Expand Down

0 comments on commit e4522e1

Please sign in to comment.