Changeset 71263 in webkit
- Timestamp:
- Nov 3, 2010 1:51:16 PM (13 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r71249 r71263 1 2010-11-03 Adam Roben <aroben@apple.com> 2 3 Stop waiting for messages from the web process after a timeout elapses 4 5 TestController::runUntil now takes a timeout parameter that specifies 6 how long to wait for the condition to become true. WebKitTestRunner 7 takes a --timeout flag that specifies how long the timeout should be. 8 run-webkit-tests passes this flag to WebKitTestRunner so its timeout 9 will be similar to run-webkit-tests. 10 11 Fixes <http://webkit.org/b/43047> <rdar://problem/8365833> 12 WebKitTestRunner waits forever if the web process crashes 13 14 Reviewed by Darin Adler and Anders Carlsson. 15 16 * Scripts/old-run-webkit-tests: 17 (top level): Moved the GuardMalloc timeout adjustment here from 18 readFromDumpToolWithTimer. 19 (openDumpTool): Make WTR use a timeout similar to but slightly shorter 20 than the one that was specified on the command line. 21 22 * WebKitTestRunner/TestController.cpp: 23 (WTR::TestController::TestController): Initialize our timeout values. 24 (WTR::TestController::initialize): Parse the --timeout flag and use it 25 to modify our timeout values. 26 (WTR::TestController::resetStateToConsistentValues): Changed to use a 27 short timeout while waiting for the web process to reset and to return 28 a boolean indicating whether we were able to reset the web process. 29 Uses a 5-second timeout while waiting for the process to be reset. 30 (WTR::TestController::runTest): Changed to return a boolean indicating 31 whether we were able to reset the web process (and thus run the test). 32 (WTR::TestController::runUntil): Call through to platformRunUntil. 33 34 (WTR::TestController::runTestingServerLoop): 35 (WTR::TestController::run): 36 Changed to bail if any test can't be run. This will cause the process 37 to exit. (Unfortunately this will make run-webkit-tests think we 38 crashed; see <http://webkit.org/b/48943>.) 39 40 * WebKitTestRunner/TestController.h: Added platformRunUntil, 41 m_longTimeout, and m_shortTimeout. 42 43 * WebKitTestRunner/TestInvocation.cpp: 44 (WTR::TestInvocation::invoke): Use a short timeout when waiting for the 45 initial response and a long timeout when waiting for the test to 46 complete. Check whether runUntil timed out and print an error message 47 if so. 48 49 * WebKitTestRunner/mac/TestControllerMac.mm: 50 (WTR::TestController::platformRunUntil): Renamed from runUntil. Pass 51 [NSDate distantPast] to -[NSRunLoop runMode:beforeDate:] so that we 52 won't block waiting for the run loop. Only loop until the timeout 53 elapses. 54 55 * WebKitTestRunner/qt/TestControllerQt.cpp: 56 (WTR::TestController::platformRunUntil): Renamed from runUntil. Added a 57 FIXME about honoring the timeout. 58 59 * WebKitTestRunner/win/TestControllerWin.cpp: 60 (WTR::TestController::platformRunUntil): Renamed from runUntil. Use 61 ::MsgWaitForMultipleObjectsEx to implement the timeout. Changed to use 62 ::PeekMessageW so that we don't block waiting for messages to become 63 available. 64 1 65 2010-11-03 Adam Roben <aroben@apple.com> 2 66 -
trunk/WebKitTools/Scripts/old-run-webkit-tests
r70773 r71263 374 374 } 375 375 376 $timeoutSeconds *= 10 if $guardMalloc; 377 376 378 $stripEditingCallbacks = isCygwin() unless defined $stripEditingCallbacks; 377 379 … … 1484 1486 } 1485 1487 1488 if ($useWebKitTestRunner) { 1489 # Make WebKitTestRunner use a similar timeout. We don't use the exact same timeout to avoid 1490 # race conditions. 1491 push @args, "--timeout", $timeoutSeconds - 5; 1492 } 1493 1486 1494 $CLEAN_ENV{MallocStackLogging} = 1 if $shouldCheckLeaks; 1487 1495 … … 2090 2098 2091 2099 my $maximumSecondsWithoutOutput = $timeoutSeconds; 2092 $maximumSecondsWithoutOutput *= 10 if $guardMalloc;2093 2100 my $microsecondsToWaitBeforeReadingAgain = 1000; 2094 2101 -
trunk/WebKitTools/WebKitTestRunner/TestController.cpp
r70790 r71263 36 36 namespace WTR { 37 37 38 static const double defaultLongTimeout = 30; 39 static const double defaultShortTimeout = 5; 40 38 41 static WKURLRef blankURL() 39 42 { … … 57 60 , m_state(Initial) 58 61 , m_doneResetting(false) 62 , m_longTimeout(defaultLongTimeout) 63 , m_shortTimeout(defaultShortTimeout) 59 64 { 60 65 initialize(argc, argv); … … 147 152 std::string argument(argv[i]); 148 153 154 if (argument == "--timeout" && i + 1 < argc) { 155 m_longTimeout = atoi(argv[++i]); 156 // Scale up the short timeout to match. 157 m_shortTimeout = defaultShortTimeout * m_longTimeout / defaultLongTimeout; 158 continue; 159 } 149 160 if (argument == "--pixel-tests") { 150 161 m_dumpPixels = true; … … 254 265 } 255 266 256 voidTestController::resetStateToConsistentValues()267 bool TestController::resetStateToConsistentValues() 257 268 { 258 269 m_state = Resetting; … … 286 297 287 298 WKPageLoadURL(m_mainWebView->page(), blankURL()); 288 TestController::runUntil(m_doneResetting); 289 } 290 291 void TestController::runTest(const char* test) 292 { 293 resetStateToConsistentValues(); 299 runUntil(m_doneResetting, ShortTimeout); 300 return m_doneResetting; 301 } 302 303 bool TestController::runTest(const char* test) 304 { 305 if (!resetStateToConsistentValues()) 306 return false; 294 307 295 308 m_state = RunningTest; … … 297 310 m_currentInvocation->invoke(); 298 311 m_currentInvocation.clear(); 312 313 return true; 299 314 } 300 315 … … 310 325 continue; 311 326 312 runTest(filenameBuffer); 327 if (!runTest(filenameBuffer)) 328 break; 313 329 } 314 330 } … … 319 335 runTestingServerLoop(); 320 336 else { 321 for (size_t i = 0; i < m_paths.size(); ++i) 322 runTest(m_paths[i].c_str()); 337 for (size_t i = 0; i < m_paths.size(); ++i) { 338 if (!runTest(m_paths[i].c_str())) 339 break; 340 } 323 341 } 342 } 343 344 void TestController::runUntil(bool& done, TimeoutDuration timeoutDuration) 345 { 346 platformRunUntil(done, timeoutDuration == ShortTimeout ? m_shortTimeout : m_longTimeout); 324 347 } 325 348 -
trunk/WebKitTools/WebKitTestRunner/TestController.h
r70723 r71263 54 54 WKContextRef context() { return m_context.get(); } 55 55 56 // Helper 57 static void runUntil(bool& done); 56 // Runs the run loop until `done` is true or the timeout elapses. 57 enum TimeoutDuration { ShortTimeout, LongTimeout }; 58 void runUntil(bool& done, TimeoutDuration); 58 59 59 60 private: … … 62 63 63 64 void runTestingServerLoop(); 64 voidrunTest(const char* pathOrURL);65 bool runTest(const char* pathOrURL); 65 66 66 67 void platformInitialize(); 67 68 void platformInitializeContext(); 69 void platformRunUntil(bool& done, double timeout); 68 70 void initializeInjectedBundlePath(); 69 71 void initializeTestPluginDirectory(); 70 72 71 voidresetStateToConsistentValues();73 bool resetStateToConsistentValues(); 72 74 73 75 // WKContextInjectedBundleClient … … 103 105 State m_state; 104 106 bool m_doneResetting; 107 108 double m_longTimeout; 109 double m_shortTimeout; 105 110 }; 106 111 -
trunk/WebKitTools/WebKitTestRunner/TestInvocation.cpp
r70723 r71263 121 121 WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), 0); 122 122 123 TestController::runUntil(m_gotInitialResponse); 123 TestController::shared().runUntil(m_gotInitialResponse, TestController::ShortTimeout); 124 if (!m_gotInitialResponse) { 125 dump("Timed out waiting for initial response from web process\n"); 126 return; 127 } 124 128 if (m_error) { 125 129 dump("FAIL\n"); … … 129 133 WKPageLoadURL(TestController::shared().mainWebView()->page(), m_url.get()); 130 134 131 TestController::runUntil(m_gotFinalMessage); 135 TestController::shared().runUntil(m_gotFinalMessage, TestController::LongTimeout); 136 if (!m_gotFinalMessage) { 137 dump("Timed out waiting for final message from web process\n"); 138 return; 139 } 132 140 if (m_error) { 133 141 dump("FAIL\n"); -
trunk/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm
r70723 r71263 46 46 } 47 47 48 void TestController:: runUntil(bool& done)48 void TestController::platformRunUntil(bool& done, double timeout) 49 49 { 50 while (!done) 51 [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; 50 CFAbsoluteTime end = CFAbsoluteTimeGetCurrent() + timeout; 51 while (!done && CFAbsoluteTimeGetCurrent() < end) 52 [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]]; 52 53 } 53 54 -
trunk/WebKitTools/WebKitTestRunner/qt/TestControllerQt.cpp
r70060 r71263 84 84 } 85 85 86 void TestController:: runUntil(bool& done)86 void TestController::platformRunUntil(bool& done, double) 87 87 { 88 // FIXME: Honor the timeout parameter <http://webkit.org/b/48941>. 88 89 RunUntilConditionLoop::start(done); 89 90 ASSERT(done); -
trunk/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
r65831 r71263 121 121 } 122 122 123 void TestController:: runUntil(bool& done)123 void TestController::platformRunUntil(bool& done, double timeout) 124 124 { 125 DWORD end = ::GetTickCount() + timeout * 1000; 125 126 while (!done) { 127 DWORD now = ::GetTickCount(); 128 if (now > end) 129 return; 130 131 DWORD result = ::MsgWaitForMultipleObjectsEx(0, 0, end - now, QS_ALLINPUT, 0); 132 if (result == WAIT_TIMEOUT) 133 return; 134 135 ASSERT(result == WAIT_OBJECT_0); 136 // There are messages in the queue. Process them. 126 137 MSG msg; 127 BOOL result = GetMessage(&msg, 0, 0, 0); 128 if (result == -1) 129 return; 130 TranslateMessage(&msg); 131 DispatchMessage(&msg); 138 while (::PeekMessageW(&msg, 0, 0, 0, PM_REMOVE)) { 139 ::TranslateMessage(&msg); 140 ::DispatchMessageW(&msg); 141 } 132 142 } 133 143 }
Note: See TracChangeset
for help on using the changeset viewer.