2011-01-12 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jan 2011 00:22:53 +0000 (00:22 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jan 2011 00:22:53 +0000 (00:22 +0000)
        Reviewed by Sam Weinig.

        Detect, identify and recover from WebProcess crashes in run-webkit-tests
        https://bugs.webkit.org/show_bug.cgi?id=52330

        * Scripts/old-run-webkit-tests: Detect when the regression test tool reports
        a web process crash.
        * WebKitTestRunner/TestController.cpp:
        (WTR::TestController::initialize): Set up a processDidCrash
        callback.
        (WTR::TestController::processDidCrash): Report that the Web process
        crashed.
        * WebKitTestRunner/TestController.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75655 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/old-run-webkit-tests
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h

index 34a317f..8d02d44 100644 (file)
@@ -1,3 +1,19 @@
+2011-01-12  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Detect, identify and recover from WebProcess crashes in run-webkit-tests
+        https://bugs.webkit.org/show_bug.cgi?id=52330
+
+        * Scripts/old-run-webkit-tests: Detect when the regression test tool reports
+        a web process crash.
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::initialize): Set up a processDidCrash
+        callback.
+        (WTR::TestController::processDidCrash): Report that the Web process
+        crashed.
+        * WebKitTestRunner/TestController.h:
+
 2011-01-12  David Levin  <levin@chromium.org>
 
         Reviewed by Shinichiro Hamaji.
index 7fbb5da..a8882ad 100755 (executable)
@@ -113,7 +113,7 @@ sub splitpath($);
 sub stopRunningTestsEarlyIfNeeded();
 sub stripExtension($);
 sub stripMetrics($$);
-sub testCrashedOrTimedOut($$$$$);
+sub testCrashedOrTimedOut($$$$$$);
 sub toCygwinPath($);
 sub toURL($);
 sub toWindowsPath($);
@@ -806,8 +806,9 @@ for my $test (@tests) {
 
     unless ($readResults->{status} eq "success") {
         my $crashed = $readResults->{status} eq "crashed";
-        testCrashedOrTimedOut($test, $base, $crashed, $actual, $error);
-        countFinishedTest($test, $base, $crashed ? "crash" : "timedout", 0);
+        my $webProcessCrashed = $readResults->{status} eq "webProcessCrashed";
+        testCrashedOrTimedOut($test, $base, $crashed, $webProcessCrashed, $actual, $error);
+        countFinishedTest($test, $base, $webProcessCrashed ? "webProcessCrash" : $crashed ? "crash" : "timedout", 0);
         last if stopRunningTestsEarlyIfNeeded();
         next;
     }
@@ -916,7 +917,7 @@ for my $test (@tests) {
 
     if (dumpToolDidCrash()) {
         $result = "crash";
-        testCrashedOrTimedOut($test, $base, 1, $actual, $error);
+        testCrashedOrTimedOut($test, $base, 1, 0, $actual, $error);
     } elsif (!defined $expected) {
         if ($verbose) {
             print "new " . ($resetResults ? "result" : "test");
@@ -1139,6 +1140,7 @@ if ($ignoreMetrics) {
 print HTML htmlForResultsSection(@{$tests{mismatch}}, "Tests where results did not match expected results", \&linksForMismatchTest);
 print HTML htmlForResultsSection(@{$tests{timedout}}, "Tests that timed out", \&linksForErrorTest);
 print HTML htmlForResultsSection(@{$tests{crash}}, "Tests that caused the DumpRenderTree tool to crash", \&linksForErrorTest);
+print HTML htmlForResultsSection(@{$tests{webProcessCrash}}, "Tests that caused the Web process to crash", \&linksForErrorTest);
 print HTML htmlForResultsSection(@{$tests{error}}, "Tests that had stderr output", \&linksForErrorTest);
 print HTML htmlForResultsSection(@{$tests{new}}, "Tests that had no expected results (probably new)", \&linksForNewTest);
 
@@ -1702,13 +1704,13 @@ sub countFinishedTest($$$$)
     push @{$tests{$result}}, $test;
 }
 
-sub testCrashedOrTimedOut($$$$$)
+sub testCrashedOrTimedOut($$$$$$)
 {
-    my ($test, $base, $didCrash, $actual, $error) = @_;
+    my ($test, $base, $didCrash, $webProcessCrashed, $actual, $error) = @_;
 
-    printFailureMessageForTest($test, $didCrash ? "crashed" : "timed out");
+    printFailureMessageForTest($test, $webProcessCrashed ? "Web process crashed" : $didCrash ? "crashed" : "timed out");
 
-    sampleDumpTool() unless $didCrash;
+    sampleDumpTool() unless $didCrash || $webProcessCrashed;
 
     my $dir = dirname(File::Spec->catdir($testResultsDirectory, $base));
     mkpath $dir;
@@ -2157,6 +2159,10 @@ sub readFromDumpToolWithTimer(**)
             }
         }
         if (defined($lineError)) {
+            if ($lineError =~ /#CRASHED - WebProcess/) {
+                $status = "webProcessCrashed";
+                last;
+            }
             if ($lineError =~ /#CRASHED/) {
                 $status = "crashed";
                 last;
@@ -2394,10 +2400,11 @@ sub printResults
         new => "were new",
         timedout => "timed out",
         crash => "crashed",
+        webProcessCrash => "Web process crashed",
         error => "had stderr output"
     );
 
-    for my $type ("match", "mismatch", "new", "timedout", "crash", "error") {
+    for my $type ("match", "mismatch", "new", "timedout", "crash", "webProcessCrash", "error") {
         my $typeCount = $counts{$type};
         next unless $typeCount;
         my $typeText = $text{$type};
index 764bd50..58fdfb6 100644 (file)
@@ -272,7 +272,7 @@ void TestController::initialize(int argc, const char* argv[])
         0, // didFinishProgress
         0, // didBecomeUnresponsive
         0, // didBecomeResponsive
-        0, // processDidExit
+        processDidCrash, // processDidCrash
         0 // didChangeBackForwardList
     };
     WKPageSetPageLoaderClient(m_mainWebView->page(), &pageLoaderClient);
@@ -395,6 +395,11 @@ void TestController::didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKT
     static_cast<TestController*>(const_cast<void*>(clientInfo))->didFinishLoadForFrame(page, frame);
 }
 
+void TestController::processDidCrash(WKPageRef page, const void* clientInfo)
+{
+    static_cast<TestController*>(const_cast<void*>(clientInfo))->processDidCrash(page);
+}
+
 void TestController::didFinishLoadForFrame(WKPageRef page, WKFrameRef frame)
 {
     if (m_state != Resetting)
@@ -411,4 +416,10 @@ void TestController::didFinishLoadForFrame(WKPageRef page, WKFrameRef frame)
     shared().notifyDone();
 }
 
+void TestController::processDidCrash(WKPageRef page)
+{
+    fputs("#CRASHED - WebProcess\n", stderr);
+    fflush(stderr);
+}
+
 } // namespace WTR
index ef41314..fc8bd30 100644 (file)
@@ -82,6 +82,9 @@ private:
     static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void*);
     void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame);
 
+    static void processDidCrash(WKPageRef, const void* clientInfo);
+    void processDidCrash(WKPageRef);
+
 
     OwnPtr<TestInvocation> m_currentInvocation;