From eae869e8db4eb5dee23ca8d34234594694120540 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 4 Mar 2010 23:15:10 -0800 Subject: [PATCH] Make failed tests more clear in the output. --- unit_tests/run_tests.pl | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/unit_tests/run_tests.pl b/unit_tests/run_tests.pl index afc29e22..3e00852a 100755 --- a/unit_tests/run_tests.pl +++ b/unit_tests/run_tests.pl @@ -112,6 +112,7 @@ sub compare_files { my $pass = 0; my $fail = 0; my $skip = 0; +my @fails = (); my $result = ''; chdir($testdir) or die("Failed to chdir('$testdir'): $!\n"); @@ -126,6 +127,7 @@ sub compare_files { print(" ... $module / $testtype ...\n"); my $fname = readdir(TESTDIR); while (defined $fname) { + my $isfail = 0; my $origfname = $fname; $fname = readdir(TESTDIR); # set for next iteration. next if (-d $origfname); @@ -136,6 +138,7 @@ sub compare_files { $result = 'PASS'; $pass++; } elsif ($rc == 0) { + $isfail = 1; $result = 'FAIL'; $fail++; } elsif ($rc == -1) { @@ -148,7 +151,9 @@ sub compare_files { } else { $reason = ''; } - print("$result ${origfname}${reason}\n"); + my $output = "$result ${origfname}${reason}\n"; + print($output); + push(@fails, $output) if $isfail; $totaltests++; } @@ -156,6 +161,20 @@ sub compare_files { } } +if (scalar(@fails)) { + print("\n\n"); + print("*************************************************************\n"); + print("*************************************************************\n"); + print("** SOME TESTS FAILED! PLEASE CORRECT THE FOLLOWING ISSUES. **\n"); + print("*************************************************************\n"); + print("*************************************************************\n"); + print("\n"); + foreach (@fails) { + print $_; + } + print("\n\n"); +} + print("\n$totaltests tests, $pass passed, $fail failed, $skip skipped.\n\n"); exit(($fail > 0) ? 1 : 0);