develooper Front page | perl.cvs.parrot | Postings from November 2008

[svn:parrot] r32572 - trunk/languages/perl6/tools

From:
pmichaud
Date:
November 12, 2008 06:22
Subject:
[svn:parrot] r32572 - trunk/languages/perl6/tools
Message ID:
20081112142238.AFA96CB9AF@x12.develooper.com
Author: pmichaud
Date: Wed Nov 12 06:22:38 2008
New Revision: 32572

Modified:
   trunk/languages/perl6/tools/test_summary.pl

Log:
[rakudo]: update test_summary.pl to report failures, output < 80 cols


Modified: trunk/languages/perl6/tools/test_summary.pl
==============================================================================
--- trunk/languages/perl6/tools/test_summary.pl	(original)
+++ trunk/languages/perl6/tools/test_summary.pl	Wed Nov 12 06:22:38 2008
@@ -23,7 +23,7 @@
 my $fh;
 open($fh, '<', $testlist) || die "Can't read $testlist: $!";
 
-my @tfiles;
+my (@tfiles, %tname);
 while (<$fh>) {
     /^ *#/ && next;
     my ($specfile) = split ' ', $_;
@@ -41,13 +41,16 @@
 @tfiles = sort @tfiles;
 my $max = 0;
 for my $tfile (@tfiles) {
-    my $tname = $tfile; $tname =~ s!^t/spec/!!;
+    my $tname = $tfile; $tname =~ s!^t/spec/!!; 
+    $tname = substr($tname, 0, 49);
     if (length($tname) > $max) { $max = length($tname); }
+    $tname{$tfile} = $tname;
 }
 
 $| = 1;
 printf "%s  plan test pass fail todo skip\n", ' ' x $max;
 my %sum;
+my @fail;
 for my $tfile (@tfiles) {
     my $th;
     open($th, '<', $tfile) || die "Can't read $tfile: $!\n";
@@ -56,14 +59,14 @@
        if (/^\s*plan\D*(\d+)/) { $plan = $1; last; }
     }
     close($th);
-    my $tname = $tfile; $tname =~ s!^t/spec/!!;
+    my $tname = $tname{$tfile};
     printf "%s%s..%4d", $tname, '.' x ($max - length($tname)), $plan;
     my $cmd = "../../parrot perl6.pbc $tfile";
     my @results = split "\n", `$cmd`;
     my ($test, $pass, $fail, $todo, $skip) = (0,0,0,0,0);
     my (%skip, %todopass, %todofail);
     for (@results) {
-        next unless /^(not )?ok +\d+/;
+        next unless /^(not )?ok +(\d+)/;
         $test++;
         if    (/#\s*SKIP\s*(.*)/i) { $skip++; $skip{$1}++; }
         elsif (/#\s*TODO\s*(.*)/i) {
@@ -72,11 +75,18 @@
             if (/^ok /) { $todopass{$reason}++ }
             else        { $todofail{$reason}++ }
         }
-        elsif (/^not ok +\d+/)     { $fail++; }
+        elsif (/^not ok +(.*)/) {
+            $fail++;
+            push @fail, "$tname $1";
+        }
         elsif (/^ok +\d+/)         { $pass++; }
     }
     my $abort = $plan - $test;
-    if ($abort > 0) { $fail += $abort; $test += $abort; }
+    if ($abort > 0) { 
+        $fail += $abort; 
+        push @fail, "$tname aborted $abort test(s)";
+        $test += $abort; 
+    }
     printf " %4d %4d %4d %4d %4d\n", $test, $pass, $fail, $todo, $skip;
     $sum{'plan'} += $plan;
     $sum{'test'} += $test;
@@ -95,7 +105,12 @@
     }
 }
 
-my $total = "  ".scalar(@tfiles)." test files";
+print "----------------\n";
+if (@fail) {
+    print "Failure summary:\n";
+    foreach (@fail) { print "    $_\n"; }
+}
+my $total = scalar(@tfiles)." test files";
 $total .= ' ' x ($max-length($total));
 printf "%s  %4d %4d %4d %4d %4d %4d\n",
     $total, $sum{'plan'}, $sum{'test'}, $sum{'pass'},



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About