Skip to content

Commit d07ef47

Browse files
committed
Merge remote-tracking branch 'upstream-public/pr/2061' into development
2 parents 8ef1f48 + 60ca6e5 commit d07ef47

File tree

2 files changed

+27
-11
lines changed

2 files changed

+27
-11
lines changed

tests/scripts/basic-build-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ TEST_OUTPUT=out_${PPID}
7676
cd tests
7777

7878
# Step 2a - Unit Tests
79-
perl scripts/run-test-suites.pl -v |tee unit-test-$TEST_OUTPUT
79+
perl scripts/run-test-suites.pl -v 2 |tee unit-test-$TEST_OUTPUT
8080
echo
8181

8282
# Step 2b - System Tests

tests/scripts/run-test-suites.pl

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,10 @@
2424
use utf8;
2525
use open qw(:std utf8);
2626

27-
use constant FALSE => 0;
28-
use constant TRUE => 1;
27+
use Getopt::Long;
2928

30-
my $verbose;
31-
my $switch = shift;
32-
if ( defined($switch) && ( $switch eq "-v" || $switch eq "--verbose" ) ) {
33-
$verbose = TRUE;
34-
}
29+
my $verbose = 0;
30+
GetOptions( "verbose|v:1" => \$verbose );
3531

3632
# All test suites = executable files, excluding source files, debug
3733
# and profiling information, etc. We can't just grep {! /\./} because
@@ -50,26 +46,46 @@
5046
$suite_cases_failed, $suite_cases_skipped, $total_cases_passed,
5147
$total_cases_failed, $total_cases_skipped );
5248

49+
sub pad_print_center {
50+
my( $width, $padchar, $string ) = @_;
51+
my $padlen = ( $width - length( $string ) - 2 ) / 2;
52+
print $padchar x( $padlen ), " $string ", $padchar x( $padlen ), "\n";
53+
}
54+
5355
for my $suite (@suites)
5456
{
5557
print "$suite ", "." x ( 72 - length($suite) - 2 - 4 ), " ";
56-
my $result = `$prefix$suite`;
58+
my $command = "$prefix$suite";
59+
if( $verbose ) {
60+
$command .= ' -v';
61+
}
62+
my $result = `$command`;
5763

5864
$suite_cases_passed = () = $result =~ /.. PASS/g;
5965
$suite_cases_failed = () = $result =~ /.. FAILED/g;
6066
$suite_cases_skipped = () = $result =~ /.. ----/g;
6167

6268
if( $result =~ /PASSED/ ) {
6369
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+
}
6475
} else {
6576
$failed_suites++;
6677
print "FAIL\n";
78+
if( $verbose ) {
79+
pad_print_center( 72, '-', "Begin $suite" );
80+
print $result;
81+
pad_print_center( 72, '-', "End $suite" );
82+
}
6783
}
6884

6985
my ($passed, $tests, $skipped) = $result =~ /([0-9]*) \/ ([0-9]*) tests.*?([0-9]*) skipped/;
7086
$total_tests_run += $tests - $skipped;
7187

72-
if ( $verbose ) {
88+
if( $verbose > 1 ) {
7389
print "(test cases passed:", $suite_cases_passed,
7490
" failed:", $suite_cases_failed,
7591
" skipped:", $suite_cases_skipped,
@@ -87,7 +103,7 @@
87103
print $failed_suites ? "FAILED" : "PASSED";
88104
printf " (%d suites, %d tests run)\n", scalar @suites, $total_tests_run;
89105

90-
if ( $verbose ) {
106+
if( $verbose > 1 ) {
91107
print " test cases passed :", $total_cases_passed, "\n";
92108
print " failed :", $total_cases_failed, "\n";
93109
print " skipped :", $total_cases_skipped, "\n";

0 commit comments

Comments
 (0)