Modified: trunk/Tools/ChangeLog (86921 => 86922)
--- trunk/Tools/ChangeLog 2011-05-20 02:39:21 UTC (rev 86921)
+++ trunk/Tools/ChangeLog 2011-05-20 04:10:49 UTC (rev 86922)
@@ -2,6 +2,15 @@
Reviewed by Adam Roben.
+ Detect hangs in run-api-tests
+ https://bugs.webkit.org/show_bug.cgi?id=48043
+
+ * Scripts/run-api-tests: Added test timeouts
+
+2011-05-19 Dmitry Lomov <[email protected]>
+
+ Reviewed by Adam Roben.
+
run-api-tests should run one test per process
https://bugs.webkit.org/show_bug.cgi?id=61088
Modified: trunk/Tools/Scripts/run-api-tests (86921 => 86922)
--- trunk/Tools/Scripts/run-api-tests 2011-05-20 02:39:21 UTC (rev 86921)
+++ trunk/Tools/Scripts/run-api-tests 2011-05-20 04:10:49 UTC (rev 86922)
@@ -45,6 +45,9 @@
sub runAllTestsInSuite($);
sub runTest($$);
+# Timeout for individual test, in sec
+my $timeout = 10;
+
my $showHelp = 0;
my $verbose = 0;
my $dump = 0;
@@ -131,6 +134,7 @@
print " Test: $testName -> ";
my $result = 0;
+ my $timedOut = 0;
if (isAppleMacWebKit()) {
my $productDir = productDir();
$ENV{DYLD_FRAMEWORK_PATH} = $productDir;
@@ -159,10 +163,20 @@
close($childOut);
close($childErr);
close(DEVNULL) unless ($verbose);
+ eval {
+ local $SIG{ALRM} = sub { die "alarm\n" };
+ alarm $timeout;
+ waitpid($pid, 0);
+ alarm 0;
+ $result = $?;
+ };
+ if ($@) {
+ die unless $@ eq "alarm\n";
+ kill SIGTERM, $pid or kill SIGKILL, $pid;
+ $timedOut = 1;
+ };
- waitpid($pid, 0);
- $result = $?;
- } elsif (isAppleWinWebKit()) {
+ } elsif (isAppleWinWebKit()) {
my $apiTesterNameSuffix;
if (configurationForVisualStudio() ne "Debug_All") {
$apiTesterNameSuffix = "";
@@ -170,17 +184,28 @@
$apiTesterNameSuffix = "_debug";
}
my $apiTesterPath = File::Spec->catfile(productDir(), "TestWebKitAPI$apiTesterNameSuffix.exe");
- $result = system { $apiTesterPath } $apiTesterPath, $gtestArg, @ARGV;
+ eval {
+ local $SIG{ALRM} = sub { die "alarm\n" };
+ alarm $timeout;
+ $result = system { $apiTesterPath } $apiTesterPath, $gtestArg, @ARGV;
+ alarm 0;
+ };
+ if ($@) {
+ die unless $@ eq "alarm\n";
+ $timedOut = 1;
+ };
} else {
die "run-api-tests is not supported on this platform.\n"
}
-
- if (!$result) {
+
+ if ($timedOut) {
+ print BOLD YELLOW, "Timeout", RESET, "\n";
+ } elsif (!$result) {
print BOLD GREEN, "Passed", RESET, "\n";
} else {
print BOLD RED, "Failed", RESET, "\n";
}
- return $result;
+ return $timedOut || $result;
}
sub populateTests()