]> rtime.felk.cvut.cz Git - wvtest.git/commitdiff
wvtestrunner: timeouts and CRLF support.
authorAvery Pennarun <apenwarr@gmail.com>
Wed, 10 Sep 2008 05:03:37 +0000 (01:03 -0400)
committerAvery Pennarun <apenwarr@gmail.com>
Fri, 1 May 2009 01:15:10 +0000 (21:15 -0400)
We now time out if there are no test results for 120 seconds.  Also handle
surprise CRLFs in the input stream.

(cherry picked from commit ff9cd2868155ff91201e457008a1bfe0da3e6e40)

wvtestrunner.pl

index 9eace827ed74209d15a6caee7446c6554cb48e9d..0938b753dfd1db82feb855c5886e357e6409b133 100755 (executable)
@@ -32,7 +32,7 @@ sub bigkill($)
        print "\n" . join("\n", @log) . "\n";
     }
     
-    print STDERR "Killed by signal.\n";
+    print STDERR "\n! Killed by signal    FAILED\n";
 
     ($pid > 0) || die("pid is '$pid'?!\n");
 
@@ -50,7 +50,11 @@ sub bigkill($)
 
 # parent
 local $SIG{INT} = sub { bigkill($pid); };
-local $SIG{TERM} = sub { bikill($pid); };
+local $SIG{TERM} = sub { bigkill($pid); };
+local $SIG{ALRM} = sub { 
+    print STDERR "Alarm timed out!  No test results for too long.\n";
+    bigkill($pid);
+};
 
 sub colourize($)
 {
@@ -76,9 +80,12 @@ my $insection = 0;
 while (<$fh>)
 {
     chomp;
+    s/\r//g;
     
     if (/^\s*Testing "(.*)" in (.*):\s*$/)
     {
+        alarm(120);
+    
        my ($sect, $file) = ($1, $2);
        
        if ($insection) {
@@ -91,6 +98,8 @@ while (<$fh>)
     }
     elsif (/^!\s*(.*?)\s+(\S+)\s*$/)
     {
+        alarm(120);
+    
        my ($name, $result) = ($1, $2);
        my $pass = ($result eq "ok");