Changeset 80033 in webkit
- Timestamp:
- Mar 1, 2011 1:29:15 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r80024 r80033 1 2011-03-01 Adam Roben <aroben@apple.com> 2 3 Give up if a crash log for the web process is taking too long to be saved on Windows 4 5 This should keep the bots from getting stuck while waiting for a crash log, if writing a 6 crash log ever hangs or the UI process for some reason doesn't notice it's finished. 7 8 Fixes <http://webkit.org/b/55499> WebKitTestRunner can hang forever waiting for a crash log 9 to be saved for the web process 10 11 Reviewed by Steve Falkenburg. 12 13 * WebKitTestRunner/win/TestControllerWin.cpp: 14 (WTR::runRunLoopUntil): Moved code to run the run loop here here from platformRunUntil. 15 Generalized the code slightly to handle the optional object to wait on. 16 (WTR::TestController::platformRunUntil): Use the new runRunLoopUntil function, and also use 17 it (with a timeout) when waiting for a crash log for the web process to be saved. This will 18 prevent us from waiting forever. 19 1 20 2011-03-01 Adam Roben <aroben@apple.com> 2 21 -
trunk/Tools/WebKitTestRunner/win/TestControllerWin.cpp
r80009 r80033 41 41 static HANDLE webProcessCrashingEvent; 42 42 static const char webProcessCrashingEventName[] = "WebKitTestRunner.WebProcessCrashing"; 43 // This is the longest we'll wait (in seconds) for the web process to finish crashing and a crash 44 // log to be saved. This interval should be just a tiny bit longer than it will ever reasonably 45 // take to save a crash log. 46 static const double maximumWaitForWebProcessToCrash = 60; 43 47 44 48 #ifdef DEBUG_ALL … … 135 139 } 136 140 137 void TestController::platformRunUntil(bool& done, double timeout) 141 enum RunLoopResult { TimedOut, ObjectSignaled, ConditionSatisfied }; 142 143 static RunLoopResult runRunLoopUntil(bool& condition, HANDLE object, double timeout) 138 144 { 139 145 DWORD end = ::GetTickCount() + timeout * 1000; 140 while (! done) {146 while (!condition) { 141 147 DWORD now = ::GetTickCount(); 142 148 if (now > end) 143 return; 144 145 DWORD result = ::MsgWaitForMultipleObjectsEx(1, &webProcessCrashingEvent, end - now, QS_ALLINPUT, MWMO_INPUTAVAILABLE); 149 return TimedOut; 150 151 DWORD objectCount = object ? 1 : 0; 152 const HANDLE* objects = object ? &object : 0; 153 DWORD result = ::MsgWaitForMultipleObjectsEx(objectCount, objects, end - now, QS_ALLINPUT, MWMO_INPUTAVAILABLE); 146 154 if (result == WAIT_TIMEOUT) 147 return; 148 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); 155 return TimedOut; 156 157 if (objectCount && result >= WAIT_OBJECT_0 && result < WAIT_OBJECT_0 + objectCount) 158 return ObjectSignaled; 159 160 ASSERT(result == WAIT_OBJECT_0 + objectCount); 172 161 // There are messages in the queue. Process them. 173 162 MSG msg; … … 177 166 } 178 167 } 168 169 return ConditionSatisfied; 170 } 171 172 void TestController::platformRunUntil(bool& done, double timeout) 173 { 174 RunLoopResult result = runRunLoopUntil(done, webProcessCrashingEvent, timeout); 175 if (result == TimedOut || result == ConditionSatisfied) 176 return; 177 ASSERT(result == ObjectSignaled); 178 179 // The web process is crashing. A crash log might be being saved, which can take a long 180 // time, and we don't want to time out while that happens. 181 182 // First, let the test harness know this happened so it won't think we've hung. But 183 // make sure we don't exit just yet! 184 m_shouldExitWhenWebProcessCrashes = false; 185 processDidCrash(); 186 m_shouldExitWhenWebProcessCrashes = true; 187 188 // Then spin a run loop until it finishes crashing to give time for a crash log to be saved. If 189 // it takes too long for a crash log to be saved, we'll just give up. 190 bool neverSetCondition = false; 191 result = runRunLoopUntil(neverSetCondition, 0, maximumWaitForWebProcessToCrash); 192 ASSERT_UNUSED(result, result == TimedOut); 193 exit(1); 179 194 } 180 195
Note: See TracChangeset
for help on using the changeset viewer.