Skip to content

Commit 8396a71

Browse files
committed
test: Enable multiple levels of verbosity
Enable passing a number to "-v" in order to set the level of verbosity. Print detailed test failure information at verbosity level 1 or higher. Display summary messages at the verbosity level 2 or higher. Print detailed test information at verbosity level 3 or higher, whether the test failed or not. This enables a more readable output style that includes detailed failure information when a failure occurs.
1 parent f4b521d commit 8396a71

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tests/scripts/run-test-suites.pl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626

2727
use Getopt::Long;
2828

29-
my $verbose;
30-
GetOptions( "verbose|v" => \$verbose );
29+
my $verbose = 0;
30+
GetOptions( "verbose|v:1" => \$verbose );
3131

3232
# All test suites = executable files, excluding source files, debug
3333
# and profiling information, etc. We can't just grep {! /\./} because
@@ -67,6 +67,11 @@ sub pad_print_center {
6767

6868
if( $result =~ /PASSED/ ) {
6969
print "PASS\n";
70+
if( $verbose > 2 ) {
71+
pad_print_center( 72, '-', "Begin $suite" );
72+
print $result;
73+
pad_print_center( 72, '-', "End $suite" );
74+
}
7075
} else {
7176
$failed_suites++;
7277
print "FAIL\n";
@@ -80,7 +85,7 @@ sub pad_print_center {
8085
my ($passed, $tests, $skipped) = $result =~ /([0-9]*) \/ ([0-9]*) tests.*?([0-9]*) skipped/;
8186
$total_tests_run += $tests - $skipped;
8287

83-
if ( $verbose ) {
88+
if( $verbose > 1 ) {
8489
print "(test cases passed:", $suite_cases_passed,
8590
" failed:", $suite_cases_failed,
8691
" skipped:", $suite_cases_skipped,
@@ -98,7 +103,7 @@ sub pad_print_center {
98103
print $failed_suites ? "FAILED" : "PASSED";
99104
printf " (%d suites, %d tests run)\n", scalar @suites, $total_tests_run;
100105

101-
if ( $verbose ) {
106+
if( $verbose > 1 ) {
102107
print " test cases passed :", $total_cases_passed, "\n";
103108
print " failed :", $total_cases_failed, "\n";
104109
print " skipped :", $total_cases_skipped, "\n";

0 commit comments

Comments
 (0)