Revision: 6536
          http://ipcop.svn.sourceforge.net/ipcop/?rev=6536&view=rev
Author:   gespinasse
Date:     2012-04-09 12:58:24 +0000 (Mon, 09 Apr 2012)
Log Message:
-----------
Change glib to match on |FAIL$ instead of | FAIL$ as hacking the glib test 
suite badly, I produced sometime ^FAIL$

Use $Term::ANSIColor::AUTORESET = 1 so RESET if automaticly done after each 
line, once every comma is suppressed
This require changing 'BOLD, BLUE,' to 'BOLD BLUE'

Use $ENV{ANSI_COLORS_DISABLED} = 1 to disable color formatting when redirected 
to a file

Reset color to default if interrupted by ctrl-c

Add strict and warnings directives and fix a missing my before first 
$errorstring.

Modified Paths:
--------------
    ipcop/trunk/tools/error-parser

Modified: ipcop/trunk/tools/error-parser
===================================================================
--- ipcop/trunk/tools/error-parser      2012-04-09 12:56:26 UTC (rev 6535)
+++ ipcop/trunk/tools/error-parser      2012-04-09 12:58:24 UTC (rev 6536)
@@ -1,8 +1,24 @@
 #!/usr/bin/perl
 
+use strict;
+use warnings;
+
 # for nice colors
 use Term::ANSIColor qw(:constants);
+$Term::ANSIColor::AUTORESET = 1;
+# if output is redirected to a file, suppress color formatting to be more 
readable
+if (! -t STDOUT) {
+       $ENV{ANSI_COLORS_DISABLED} = 1;
+}
 
+# Restore default terminal color on Ctrl-C (when program is interrupted)
+# That work but is not perfect as it look harder to stop error-parser when 
called from error-parser-all
+sub INT_handler {
+       print RESET;
+       exit 0;
+}
+$SIG{'INT'} = 'INT_handler';
+
 my $f;
 my $package;   # without the package version, so we could simply parse 
different directories in one liners
 my $testdir;
@@ -49,7 +65,7 @@
        if ( $f =~ m!^gcc! && $f !~ m!summary! ) { next; }      # skip gcc not 
the summary
        if ( $f =~ m!^cairo-([\.\d])+\-03! ) { print "\t$testdir/$f no more 
used, could be removed\n"; next; }
 
-       print RESET "Reading $f";
+       print "Reading $f";
 
        if ( $f =~ m!^bc! ) {
                # There is always errors and we don't care if there is not too 
much
@@ -63,7 +79,7 @@
                if ( $error < 15 ) {
                        print "\t $error errors considered ok\n";
                } else {
-                       print BOLD, BLUE, "\t $error errors considered too 
much\n", RESET;
+                       print BOLD BLUE "\t $error errors considered too 
much\n";
                }
        } elsif ( $f =~ m!^cairo-.*-summary-.*! ) {
                print "\n"; # Case with no error is not considered actually.
@@ -71,22 +87,22 @@
                open FILE, "$testdir/$f" or die $!;
                while (my $line = <FILE>) {
                        if ( $line =~ m!Failures per surface - image: 
(\d*)\.$!) { $error = $1; }
-                       print BOLD, BLUE, "$line" if ($line !~ m!^make! );
+                       print  BOLD BLUE "$line" if ($line !~ m!^make! );
                }
                close (FILE);
                # Stay with 'Approximately' as it is convenient to use | grep 
Approx to only see error count on quick check
-               print RESET " Approximately $error error(s) with $testdir/$f\n";
+               print " Approximately $error error(s) with $testdir/$f\n";
        } else {
                # FAILED | UNEXPECTED PASS from autoconf lib/general.m4
                # ^ERROR:|^FAIL:|^XPASS: from automake and derivated
                # ' program timed out' from gcc
                # ': FAIL |:    FAIL|CRASH" from cairo (separated with space in 
middle, with tab in end of line)
                # perl packages (not all) use '^not ok' to fail, but this is 
too often for broken tests with TODO, trying to match that give false alarm.
-               $errorstring = "^FAIL:|^ERROR:|^XPASS:| FAILED | UNEXPECTED 
PASS |^UNSUPPORTED ";
+               my $errorstring = "^FAIL:|^ERROR:|^XPASS:| FAILED | UNEXPECTED 
PASS |^UNSUPPORTED ";
                $errorstring .= "| program timed out|: FAIL |:  FAIL|CRASH";
 
                # glib
-               if ( $f =~ m!glib[^c]! ) { $errorstring .= '| FAIL$'; }
+               if ( $f =~ m!glib[^c]! ) { $errorstring .= '|FAIL$'; }
 
                # 'generated an error' come from libxml2, try to compile (if 
that compile) --with-minimum --with-output to trigger error
                # DBD-SQLite print twice that same message and should be still 
ok, so only match for libxml2
@@ -108,7 +124,7 @@
                                if ( $line !~ m! Error \d* \(ignored\)! ) {
                                        if ($error==0) { print "\n"; }
                                        $error++;
-                                       print BOLD, BLUE, "$line", RESET if 
($error < 50);
+                                       print BOLD BLUE "$line" if ($error < 
50);
                                }
                        }
                }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn

Reply via email to