From 04f0efca0f1346c849109f9152dd981a76acc079 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Wed, 10 Sep 2008 01:03:37 -0400 Subject: [PATCH] wvtestrunner: timeouts and CRLF support. 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 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/wvtestrunner.pl b/wvtestrunner.pl index 9eace82..0938b75 100755 --- a/wvtestrunner.pl +++ b/wvtestrunner.pl @@ -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"); -- 2.39.2