Changeset 80009 in webkit
- Timestamp:
- Mar 1, 2011 10:13:54 AM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r80008 r80009 1 2011-03-01 Adam Roben <aroben@apple.com> 2 3 Save a crash log when the web process crashes 4 5 On Windows, WebKitTestRunner now detects when the web process is crashing and waits to exit 6 until it has finished crashing, which guarantees that the crash log will have had time to be 7 saved, too. On Mac, we always wait until ReportCrash has exited before capturing the crash 8 log, so all we have to do is choose the right crash log out of the CrashReporter directory. 9 10 Fixes <http://webkit.org/b/44121> <rdar://problem/8320759> When the web process crashes and 11 a crash log is being saved, WebKitTestRunner thinks the web process has become unresponsive 12 13 Reviewed by Sam Weinig. 14 15 * Scripts/old-run-webkit-tests: 16 (testCrashedOrTimedOut): Don't kill WebKitTestRunner when the web process crashes. It will 17 kill itself. On Windows, this will cause us to wait until the crash log has been saved. On 18 Mac, it should have no effect. Capture saved crash logs for web process crashes, too. 19 (captureSavedCrashLog): Added $webProcessCrashed argument. On Mac, look for 20 WebProces_*.crash files when the web process crashes. 21 22 * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: 23 (WTR::InjectedBundle::initialize): Added an initializationUserData argument. Updated for 24 initializePlatformDefaults -> platformInitialize rename. Pass the initializationUserData 25 along to platformInitialize. 26 27 * WebKitTestRunner/InjectedBundle/InjectedBundle.h: See above. 28 29 * WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp: 30 (WKBundleInitialize): Pass along the initializationUserData to the InjectedBundle. 31 32 * WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm: 33 (WTR::InjectedBundle::platformInitialize): 34 * WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp: 35 (WTR::InjectedBundle::platformInitialize): 36 Updated function signature. 37 38 * WebKitTestRunner/InjectedBundle/win/InjectedBundleWin.cpp: 39 (WTR::exceptionFilter): Added. Tells the UI process we're crashing by signaling the 40 webProcessCrashingEvent, then lets the crash continue as normal. 41 42 (WTR::InjectedBundle::platformInitialize): Hook up exceptionFilter. Retrieve the name of the 43 event we should use to tell the UI process we're crashing from the initializationUserData, 44 and get a handle to that event. 45 46 * WebKitTestRunner/TestController.cpp: 47 (WTR::TestController::TestController): Initialize new members. 48 (WTR::TestController::processDidCrash): Removed unnecessary WKPageRef argument. Changed to 49 only print the "#CRASHED - WebProcess" message once, since this can be called more than once 50 when a crash log is being saved on Windows. Exit right away if specified. (This is the 51 default.) 52 53 * WebKitTestRunner/TestController.h: Added new members. 54 55 * WebKitTestRunner/win/TestControllerWin.cpp: 56 (WTR::TestController::platformInitialize): Set up the event the web process will use to tell 57 us it's crashing. 58 (WTR::TestController::platformRunUntil): Pass MWMO_INPUTAVAILABLE to 59 ::MsgWaitForMultipleObjectsEx so we'll process messages that have already been seen by 60 ::PeekMessage. (This is unrelated to the bug fix.) Notice when the webProcessCrashingEvent 61 has been signaled. When this happens, print the "#CRASHED - WebProcess" message right away 62 so the test harness will know the web process has crashed and not try to kill us, then wait 63 for the web process to finish crashing so a crash log will have time to be saved. 64 (WTR::toWK): Simple hepler function. 65 (WTR::TestController::platformInitializeContext): Pass along the name of the event the web 66 process should use to tell us it is crashing in the context's initialization user data. 67 1 68 2011-03-01 Dimitri Glazkov <dglazkov@chromium.org> 2 69 -
trunk/Tools/Scripts/old-run-webkit-tests
r79819 r80009 78 78 sub buildPlatformResultHierarchy(); 79 79 sub buildPlatformTestHierarchy(@); 80 sub captureSavedCrashLog($ );80 sub captureSavedCrashLog($$); 81 81 sub checkPythonVersion(); 82 82 sub closeCygpaths(); … … 1736 1736 recordActualResultsAndDiff($base, $actual); 1737 1737 1738 kill 9, $dumpToolPID unless $didCrash; 1738 # There's no point in killing the dump tool when it's crashed. And it will kill itself when the 1739 # web process crashes. 1740 kill 9, $dumpToolPID unless $didCrash || $webProcessCrashed; 1739 1741 1740 1742 closeDumpTool(); 1741 1743 1742 captureSavedCrashLog($base ) if $didCrash;1744 captureSavedCrashLog($base, $webProcessCrashed) if $didCrash || $webProcessCrashed; 1743 1745 1744 1746 return unless isCygwin() && !$didCrash && $base =~ /^http/; … … 1749 1751 } 1750 1752 1751 sub captureSavedCrashLog($ )1752 { 1753 my ($base ) = @_;1753 sub captureSavedCrashLog($$) 1754 { 1755 my ($base, $webProcessCrashed) = @_; 1754 1756 1755 1757 my $crashLog; … … 1759 1761 $glob = File::Spec->catfile($testResultsDirectory, $windowsCrashLogFilePrefix . "*.txt"); 1760 1762 } elsif (isAppleMacWebKit()) { 1761 $glob = File::Spec->catfile("~", "Library", "Logs", "CrashReporter", $dumpToolName. "_*.crash");1763 $glob = File::Spec->catfile("~", "Library", "Logs", "CrashReporter", ($webProcessCrashed ? "WebProcess" : $dumpToolName) . "_*.crash"); 1762 1764 1763 1765 # Even though the dump tool has exited, CrashReporter might still be running. We need to -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
r79612 r80009 73 73 } 74 74 75 void InjectedBundle::initialize(WKBundleRef bundle )75 void InjectedBundle::initialize(WKBundleRef bundle, WKTypeRef initializationUserData) 76 76 { 77 77 m_bundle = bundle; … … 87 87 WKBundleSetClient(m_bundle, &client); 88 88 89 initializePlatformDefaults();89 platformInitialize(initializationUserData); 90 90 91 91 activateFonts(); -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
r79612 r80009 46 46 47 47 // Initialize the InjectedBundle. 48 void initialize(WKBundleRef );48 void initialize(WKBundleRef, WKTypeRef initializationUserData); 49 49 50 50 WKBundleRef bundle() const { return m_bundle; } … … 83 83 void didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody); 84 84 85 void initializePlatformDefaults();85 void platformInitialize(WKTypeRef initializationUserData); 86 86 void resetLocalSettings(); 87 87 -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp
r71175 r80009 34 34 void WKBundleInitialize(WKBundleRef bundle, WKTypeRef initializationUserData) 35 35 { 36 WTR::InjectedBundle::shared().initialize(bundle );36 WTR::InjectedBundle::shared().initialize(bundle, initializationUserData); 37 37 } -
trunk/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm
r79612 r80009 28 28 namespace WTR { 29 29 30 void InjectedBundle:: initializePlatformDefaults()30 void InjectedBundle::platformInitialize(WKTypeRef) 31 31 { 32 32 NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: -
trunk/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp
r79612 r80009 28 28 namespace WTR { 29 29 30 void InjectedBundle:: initializePlatformDefaults()30 void InjectedBundle::platformInitialize(WKTypeRef) 31 31 { 32 32 } -
trunk/Tools/WebKitTestRunner/InjectedBundle/win/InjectedBundleWin.cpp
r79612 r80009 28 28 namespace WTR { 29 29 30 void InjectedBundle::initializePlatformDefaults() 30 static HANDLE webProcessCrashingEvent; 31 32 static LONG WINAPI exceptionFilter(EXCEPTION_POINTERS*) 31 33 { 34 // Let the UI process know right away that we crashed. It might take a long time for us to 35 // finish crashing if a crash log is being saved. 36 ::SetEvent(webProcessCrashingEvent); 37 38 return EXCEPTION_CONTINUE_SEARCH; 39 } 40 41 void InjectedBundle::platformInitialize(WKTypeRef initializationUserData) 42 { 43 ::SetUnhandledExceptionFilter(exceptionFilter); 44 45 ASSERT_ARG(initializationUserData, initializationUserData); 46 ASSERT_ARG(initializationUserData, WKGetTypeID(initializationUserData) == WKStringGetTypeID()); 47 48 WKStringRef string = static_cast<WKStringRef>(initializationUserData); 49 Vector<char> buffer(WKStringGetMaximumUTF8CStringSize(string)); 50 WKStringGetUTF8CString(string, buffer.data(), buffer.size()); 51 52 // The UI process should already have created this event. We're just getting another HANDLE to it. 53 webProcessCrashingEvent = ::CreateEventA(0, FALSE, FALSE, buffer.data()); 54 ASSERT(webProcessCrashingEvent); 32 55 } 33 56 -
trunk/Tools/WebKitTestRunner/TestController.cpp
r79612 r80009 64 64 , m_longTimeout(defaultLongTimeout) 65 65 , m_shortTimeout(defaultShortTimeout) 66 , m_didPrintWebProcessCrashedMessage(false) 67 , m_shouldExitWhenWebProcessCrashes(true) 66 68 { 67 69 initialize(argc, argv); … … 471 473 void TestController::processDidCrash(WKPageRef page, const void* clientInfo) 472 474 { 473 static_cast<TestController*>(const_cast<void*>(clientInfo))->processDidCrash( page);475 static_cast<TestController*>(const_cast<void*>(clientInfo))->processDidCrash(); 474 476 } 475 477 … … 490 492 } 491 493 492 void TestController::processDidCrash(WKPageRef page) 493 { 494 fputs("#CRASHED - WebProcess\n", stderr); 495 fflush(stderr); 494 void TestController::processDidCrash() 495 { 496 // This function can be called multiple times when crash logs are being saved on Windows, so 497 // ensure we only print the crashed message once. 498 if (!m_didPrintWebProcessCrashedMessage) { 499 fputs("#CRASHED - WebProcess\n", stderr); 500 fflush(stderr); 501 m_didPrintWebProcessCrashedMessage = true; 502 } 503 504 if (m_shouldExitWhenWebProcessCrashes) 505 exit(1); 496 506 } 497 507 -
trunk/Tools/WebKitTestRunner/TestController.h
r76559 r80009 84 84 85 85 static void processDidCrash(WKPageRef, const void* clientInfo); 86 void processDidCrash( WKPageRef);86 void processDidCrash(); 87 87 88 88 static WKPageRef createOtherPage(WKPageRef oldPage, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*); … … 118 118 double m_longTimeout; 119 119 double m_shortTimeout; 120 121 bool m_didPrintWebProcessCrashedMessage; 122 bool m_shouldExitWhenWebProcessCrashes; 120 123 }; 121 124 -
trunk/Tools/WebKitTestRunner/win/TestControllerWin.cpp
r79695 r80009 39 39 namespace WTR { 40 40 41 static HANDLE webProcessCrashingEvent; 42 static const char webProcessCrashingEventName[] = "WebKitTestRunner.WebProcessCrashing"; 43 41 44 #ifdef DEBUG_ALL 42 45 const LPWSTR testPluginDirectoryName = L"TestNetscapePlugin_Debug"; … … 110 113 // linked with older versions of qtmlclientlib.dll. 111 114 addQTDirToPATH(); 115 116 webProcessCrashingEvent = ::CreateEventA(0, FALSE, FALSE, webProcessCrashingEventName); 112 117 } 113 118 … … 138 143 return; 139 144 140 DWORD result = ::MsgWaitForMultipleObjectsEx( 0, 0, end - now, QS_ALLINPUT, 0);145 DWORD result = ::MsgWaitForMultipleObjectsEx(1, &webProcessCrashingEvent, end - now, QS_ALLINPUT, MWMO_INPUTAVAILABLE); 141 146 if (result == WAIT_TIMEOUT) 142 147 return; 143 148 144 ASSERT(result == WAIT_OBJECT_0); 149 if (result == WAIT_OBJECT_0) { 150 // The web process is crashing. A crash log might be being saved, which can take a long 151 // time, and we don't want to time out while that happens. 152 153 // First, let the test harness know this happened so it won't think we've hung. But 154 // make sure we don't exit just yet! 155 m_shouldExitWhenWebProcessCrashes = false; 156 processDidCrash(); 157 m_shouldExitWhenWebProcessCrashes = true; 158 159 // Then spin a run loop until it finishes crashing to give time for a crash log to be saved. 160 MSG msg; 161 while (BOOL bRet = ::GetMessageW(&msg, 0, 0, 0)) { 162 if (bRet == -1) 163 break; 164 ::TranslateMessage(&msg); 165 ::DispatchMessageW(&msg); 166 } 167 168 exit(1); 169 } 170 171 ASSERT(result == WAIT_OBJECT_0 + 1); 145 172 // There are messages in the queue. Process them. 146 173 MSG msg; … … 152 179 } 153 180 181 static WKRetainPtr<WKStringRef> toWK(const char* string) 182 { 183 return WKRetainPtr<WKStringRef>(AdoptWK, WKStringCreateWithUTF8CString(string)); 184 } 185 154 186 void TestController::platformInitializeContext() 155 187 { 156 188 // FIXME: Make DRT pass with Windows native controls. <http://webkit.org/b/25592> 157 189 WKContextSetShouldPaintNativeControls(m_context.get(), false); 190 191 WKContextSetInitializationUserDataForInjectedBundle(m_context.get(), toWK(webProcessCrashingEventName).get()); 158 192 } 159 193
Note: See TracChangeset
for help on using the changeset viewer.