Merge remote-tracking branch 'upstream-public/pr/2061' into development

This commit is contained in:
Jaeden Amero 2018-12-07 16:07:21 +00:00
commit d07ef47150
2 changed files with 27 additions and 11 deletions

View File

@ -76,7 +76,7 @@ TEST_OUTPUT=out_${PPID}
cd tests cd tests
# Step 2a - Unit Tests # Step 2a - Unit Tests
perl scripts/run-test-suites.pl -v |tee unit-test-$TEST_OUTPUT perl scripts/run-test-suites.pl -v 2 |tee unit-test-$TEST_OUTPUT
echo echo
# Step 2b - System Tests # Step 2b - System Tests

View File

@ -24,14 +24,10 @@ use strict;
use utf8; use utf8;
use open qw(:std utf8); use open qw(:std utf8);
use constant FALSE => 0; use Getopt::Long;
use constant TRUE => 1;
my $verbose; my $verbose = 0;
my $switch = shift; GetOptions( "verbose|v:1" => \$verbose );
if ( defined($switch) && ( $switch eq "-v" || $switch eq "--verbose" ) ) {
$verbose = TRUE;
}
# All test suites = executable files, excluding source files, debug # All test suites = executable files, excluding source files, debug
# and profiling information, etc. We can't just grep {! /\./} because # and profiling information, etc. We can't just grep {! /\./} because
@ -50,10 +46,20 @@ my ($failed_suites, $total_tests_run, $failed, $suite_cases_passed,
$suite_cases_failed, $suite_cases_skipped, $total_cases_passed, $suite_cases_failed, $suite_cases_skipped, $total_cases_passed,
$total_cases_failed, $total_cases_skipped ); $total_cases_failed, $total_cases_skipped );
sub pad_print_center {
my( $width, $padchar, $string ) = @_;
my $padlen = ( $width - length( $string ) - 2 ) / 2;
print $padchar x( $padlen ), " $string ", $padchar x( $padlen ), "\n";
}
for my $suite (@suites) for my $suite (@suites)
{ {
print "$suite ", "." x ( 72 - length($suite) - 2 - 4 ), " "; print "$suite ", "." x ( 72 - length($suite) - 2 - 4 ), " ";
my $result = `$prefix$suite`; my $command = "$prefix$suite";
if( $verbose ) {
$command .= ' -v';
}
my $result = `$command`;
$suite_cases_passed = () = $result =~ /.. PASS/g; $suite_cases_passed = () = $result =~ /.. PASS/g;
$suite_cases_failed = () = $result =~ /.. FAILED/g; $suite_cases_failed = () = $result =~ /.. FAILED/g;
@ -61,15 +67,25 @@ for my $suite (@suites)
if( $result =~ /PASSED/ ) { if( $result =~ /PASSED/ ) {
print "PASS\n"; print "PASS\n";
if( $verbose > 2 ) {
pad_print_center( 72, '-', "Begin $suite" );
print $result;
pad_print_center( 72, '-', "End $suite" );
}
} else { } else {
$failed_suites++; $failed_suites++;
print "FAIL\n"; print "FAIL\n";
if( $verbose ) {
pad_print_center( 72, '-', "Begin $suite" );
print $result;
pad_print_center( 72, '-', "End $suite" );
}
} }
my ($passed, $tests, $skipped) = $result =~ /([0-9]*) \/ ([0-9]*) tests.*?([0-9]*) skipped/; my ($passed, $tests, $skipped) = $result =~ /([0-9]*) \/ ([0-9]*) tests.*?([0-9]*) skipped/;
$total_tests_run += $tests - $skipped; $total_tests_run += $tests - $skipped;
if ( $verbose ) { if( $verbose > 1 ) {
print "(test cases passed:", $suite_cases_passed, print "(test cases passed:", $suite_cases_passed,
" failed:", $suite_cases_failed, " failed:", $suite_cases_failed,
" skipped:", $suite_cases_skipped, " skipped:", $suite_cases_skipped,
@ -87,7 +103,7 @@ print "-" x 72, "\n";
print $failed_suites ? "FAILED" : "PASSED"; print $failed_suites ? "FAILED" : "PASSED";
printf " (%d suites, %d tests run)\n", scalar @suites, $total_tests_run; printf " (%d suites, %d tests run)\n", scalar @suites, $total_tests_run;
if ( $verbose ) { if( $verbose > 1 ) {
print " test cases passed :", $total_cases_passed, "\n"; print " test cases passed :", $total_cases_passed, "\n";
print " failed :", $total_cases_failed, "\n"; print " failed :", $total_cases_failed, "\n";
print " skipped :", $total_cases_skipped, "\n"; print " skipped :", $total_cases_skipped, "\n";