Skip to content

Commit 79e4f4e

Browse files
committed
test: Print verbosely on failures in verbose mode
Update the test runner to print detail about why the test failed when it fails, if the runner is running in verbose mode.
1 parent 2b5be1e commit 79e4f4e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tests/scripts/run-test-suites.pl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,20 @@
5050
$suite_cases_failed, $suite_cases_skipped, $total_cases_passed,
5151
$total_cases_failed, $total_cases_skipped );
5252

53+
sub pad_print_center {
54+
my( $width, $padchar, $string ) = @_;
55+
my $padlen = ( $width - length( $string ) - 2 ) / 2;
56+
print $padchar x( $padlen ), " $string ", $padchar x( $padlen ), "\n";
57+
}
58+
5359
for my $suite (@suites)
5460
{
5561
print "$suite ", "." x ( 72 - length($suite) - 2 - 4 ), " ";
56-
my $result = `$prefix$suite`;
62+
my $command = "$prefix$suite";
63+
if( $verbose ) {
64+
$command .= ' -v';
65+
}
66+
my $result = `$command`;
5767

5868
$suite_cases_passed = () = $result =~ /.. PASS/g;
5969
$suite_cases_failed = () = $result =~ /.. FAILED/g;
@@ -64,6 +74,11 @@
6474
} else {
6575
$failed_suites++;
6676
print "FAIL\n";
77+
if( $verbose ) {
78+
pad_print_center( 72, '-', "Begin $suite" );
79+
print $result;
80+
pad_print_center( 72, '-', "End $suite" );
81+
}
6782
}
6883

6984
my ($passed, $tests, $skipped) = $result =~ /([0-9]*) \/ ([0-9]*) tests.*?([0-9]*) skipped/;

0 commit comments

Comments
 (0)