Changeset 177363 in webkit
- Timestamp:
- Dec 16, 2014 10:32:21 AM (9 years ago)
- Location:
- trunk/Tools
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r177357 r177363 1 2014-12-15 Alexey Proskuryakov <ap@apple.com> 2 3 Sort out timeout implementations in DRT and WKTR 4 https://bugs.webkit.org/show_bug.cgi?id=139671 5 6 Reviewed by Simon Fraser. 7 8 Test timeout implementation had many deficiencies, please see the bug for details. 9 Most notably, we shouldn't have the tool confused about timeouts vs. failures, and 10 [ Slow ] modifiers should work a lot better. 11 12 * DumpRenderTree/TestRunner.cpp: (TestRunner::TestRunner): 13 * DumpRenderTree/TestRunner.h: (TestRunner::setCustomTimeout): 14 * DumpRenderTree/mac/DumpRenderTree.mm: (runTest): 15 * DumpRenderTree/mac/TestRunnerMac.mm: (TestRunner::setWaitToDump): 16 DumpRenderTree already read the --timeout option from command line, and webkitpy 17 was already configured to pass it on Mac and iOS. Let's actually use it. 18 TestCommand already had the same 30 second default, so this doesn't change behavior 19 when DRT is ran manually without the option. 20 Windows DumpRenderTree will need to be fixed separately (that's easy). 21 22 * DumpRenderTree/TestRunner.cpp: (TestRunner::waitToDumpWatchdogTimerFired()): 23 Don't print the timeout message to stdout to match WebKitTestRunner. It would be 24 slightly better to use stderr in both, as this is an out of band message, but 25 that's a larger refactoring, and the difference is minimal in practice. 26 27 * Scripts/webkitpy/layout_tests/controllers/single_test_runner.py: 28 (SingleTestRunner.__init__): Ensure that script and tool timeouts are substantially 29 different. We want the tool to reliably detect timeouts that can be detected, and 30 not race with the script for that. 31 32 * Scripts/webkitpy/port/base.py: (Port.default_timeout_ms): Don't make WebKit2 33 timeout longer than WebKit1 one, I doubt that this is necessary. Now that the value 34 is honored inmore cases, that could make tests run slower. 35 * Scripts/webkitpy/port/driver.py: 36 (Driver.__init__): 37 (Driver.run_test): 38 (Driver.cmd_line): 39 (Driver._check_for_driver_timeout): 40 Detect tests that have the timeout output, and make these have the proper Timeout result. 41 42 * Scripts/webkitpy/port/ios.py: (IOSSimulatorPort.default_timeout_ms): Remove an 43 incorrect recent change - 80 * 1000 is 80 seconds, not 80 milliseconds. 44 45 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 46 (WTR::TestRunner::setCustomTimeout): Deleted. 47 * WebKitTestRunner/InjectedBundle/TestRunner.h: 48 (WTR::TestRunner::setCustomTimeout): 49 * WebKitTestRunner/InjectedBundle/efl/TestRunnerEfl.cpp: 50 (WTR::TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded): 51 * WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm: 52 (WTR::TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded): 53 * WebKitTestRunner/InjectedBundle/win/TestRunnerWin.cpp: 54 (WTR::TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded): 55 * WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp: 56 (WTR::TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded): 57 Updated to use a timeout passed from UI process, which used to be ignored. 58 59 * WebKitTestRunner/TestController.cpp: 60 (WTR::TestController::TestController): 61 (WTR::TestController::runUntil): 62 (WTR::TestController::getCustomTimeout): Deleted. 63 * WebKitTestRunner/TestController.h: 64 Delete unused m_timeout. First, it was always 0, and second, we don't need it at all. 65 Changed default message timeouts to match new run-webkit-tests timeout. These don't 66 affect ports where timeout is passed per test (shouldn't they all be like that?). 67 68 * WebKitTestRunner/TestInvocation.cpp: 69 (WTR::TestInvocation::invoke): 70 (WTR::TestInvocation::setCustomTimeout): Deleted. 71 * WebKitTestRunner/TestInvocation.h: 72 (WTR::TestInvocation::setCustomTimeout): 73 (WTR::TestInvocation::customTimeout): 74 Ditto. 75 1 76 2014-12-16 Grzegorz Czajkowski <g.czajkowski@samsung.com> 2 77 -
trunk/Tools/DumpRenderTree/TestRunner.cpp
r176677 r177363 116 116 , m_expectedPixelHash(expectedPixelHash) 117 117 , m_titleTextDirection("ltr") 118 , m_timeout(0) 118 119 { 119 120 } … … 2258 2259 { 2259 2260 const char* message = "FAIL: Timed out waiting for notifyDone to be called\n"; 2260 fprintf(stderr, "%s", message);2261 2261 fprintf(stdout, "%s", message); 2262 2262 notifyDone(); -
trunk/Tools/DumpRenderTree/TestRunner.h
r176677 r177363 357 357 bool hasPendingWebNotificationClick() const { return m_hasPendingWebNotificationClick; } 358 358 359 void setCustomTimeout(int duration) { m_timeout = duration; } 360 359 361 private: 360 362 TestRunner(const std::string& testURL, const std::string& expectedPixelHash); … … 432 434 static JSStaticValue* staticValues(); 433 435 static JSStaticFunction* staticFunctions(); 436 437 int m_timeout; 434 438 }; 435 439 -
trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
r176917 r177363 1864 1864 1865 1865 gTestRunner = TestRunner::create(testURL, command.expectedPixelHash); 1866 gTestRunner->setCustomTimeout(command.timeout); 1866 1867 topLoadingFrame = nil; 1867 1868 #if !PLATFORM(IOS) -
trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm
r176677 r177363 647 647 } 648 648 649 static const CFTimeInterval waitToDumpWatchdogInterval = 30.0;650 651 649 static void waitUntilDoneWatchdogFired(CFRunLoopTimerRef timer, void* info) 652 650 { … … 657 655 { 658 656 m_waitToDump = waitUntilDone; 659 if (m_waitToDump && shouldSetWaitToDumpWatchdog())660 setWaitToDumpWatchdog(CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + waitToDumpWatchdogInterval, 0, 0, 0, waitUntilDoneWatchdogFired, NULL));657 if (m_waitToDump && m_timeout && shouldSetWaitToDumpWatchdog()) 658 setWaitToDumpWatchdog(CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + m_timeout / 1000.0, 0, 0, 0, waitUntilDoneWatchdogFired, NULL)); 661 659 } 662 660 -
trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py
r173557 r177363 56 56 self._results_directory = results_directory 57 57 self._driver = driver 58 self._timeout = test_input.timeout59 58 self._worker_name = worker_name 60 59 self._test_name = test_input.test_name … … 62 61 self._reference_files = test_input.reference_files 63 62 self._stop_when_done = stop_when_done 63 64 self._timeout = test_input.timeout 65 if self._timeout > 5000: 66 # Timeouts are detected by both script and tool; tool detected timeouts are 67 # better, because they contain partial output. Give the tool some time to 68 # report the timeout instead of being killed. 69 self._timeout = int(self._timeout) - 5000 64 70 65 71 if self._reference_files: -
trunk/Tools/Scripts/webkitpy/port/base.py
r177034 r177363 139 139 140 140 def default_timeout_ms(self): 141 if self.get_option('webkit_test_runner'):142 # Add some more time to WebKitTestRunner because it needs to syncronise the state143 # with the web process and we want to detect if there is a problem with that in the driver.144 return 80 * 1000145 141 return 35 * 1000 146 142 -
trunk/Tools/Scripts/webkitpy/port/driver.py
r177034 r177363 138 138 self._crashed_pid = None 139 139 140 self._driver_timed_out = False 141 140 142 # WebKitTestRunner can report back subprocesses that became unresponsive 141 143 # This could mean they crashed. … … 173 175 self.start(driver_input.should_run_pixel_test, driver_input.args) 174 176 test_begin_time = time.time() 177 self._driver_timed_out = False 175 178 self.error_from_test = str() 176 179 self.err_seen_eof = False … … 185 188 crashed = self.has_crashed() 186 189 timed_out = self._server_process.timed_out 190 driver_timed_out = self._driver_timed_out 187 191 pid = self._server_process.pid() 188 192 … … 214 218 return DriverOutput(text, image, actual_image_hash, audio, 215 219 crash=crashed, test_time=time.time() - test_begin_time, measurements=self._measurements, 216 timeout=timed_out , error=self.error_from_test,220 timeout=timed_out or driver_timed_out, error=self.error_from_test, 217 221 crashed_process_name=self._crashed_process_name, 218 222 crashed_pid=self._crashed_pid, crash_log=crash_log, pid=pid) … … 350 354 if self._no_timeout: 351 355 cmd.append('--no-timeout') 352 # FIXME: We need to pass --timeout=SECONDS to WebKitTestRunner for WebKit2.353 356 354 357 cmd.extend(self._port.get_option('additional_drt_flag', [])) … … 359 362 cmd.append('-') 360 363 return cmd 364 365 def _check_for_driver_timeout(self, out_line): 366 if out_line == "FAIL: Timed out waiting for notifyDone to be called": 367 self._driver_timed_out = True 361 368 362 369 def _check_for_driver_crash(self, error_line): -
trunk/Tools/Scripts/webkitpy/port/ios.py
r177129 r177363 83 83 if self.get_option('guard_malloc'): 84 84 return 350 * 1000 85 if not self.get_option('webkit_test_runner'):86 # DumpRenderTree.app waits for the WebThread to run before dumping its output. In practice87 # it seems sufficient to wait up to 80ms to ensure that the WebThread ran and hence output88 # for the test is dumped.89 return 80 * 100090 85 return super(IOSSimulatorPort, self).default_timeout_ms() 91 86 -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r176011 r177363 55 55 56 56 namespace WTR { 57 58 const double TestRunner::waitToDumpWatchdogTimerInterval = 30;59 57 60 58 PassRefPtr<TestRunner> TestRunner::create() … … 94 92 , m_globalFlag(false) 95 93 , m_customFullScreenBehavior(false) 94 , m_timeout(30000) 96 95 , m_databaseDefaultQuota(-1) 97 96 , m_databaseMaxQuota(-1) … … 163 162 164 163 m_waitToDump = false; 165 }166 167 void TestRunner::setCustomTimeout(int timeout)168 {169 m_timeout = timeout;170 164 } 171 165 -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r176921 r177363 264 264 bool callShouldCloseOnWebView(); 265 265 266 void setCustomTimeout(int duration) ;266 void setCustomTimeout(int duration) { m_timeout = duration; } 267 267 268 268 // Work queue. … … 281 281 282 282 private: 283 static const double waitToDumpWatchdogTimerInterval;284 285 283 TestRunner(); 286 284 -
trunk/Tools/WebKitTestRunner/InjectedBundle/efl/TestRunnerEfl.cpp
r161666 r177363 54 54 return; 55 55 56 m_waitToDumpWatchdogTimer = ecore_timer_loop_add(waitToDumpWatchdogTimerInterval, 57 waitToDumpWatchdogTimerCallback, 0); 56 m_waitToDumpWatchdogTimer = ecore_timer_loop_add(m_timeout / 1000.0, waitToDumpWatchdogTimerCallback, 0); 58 57 } 59 58 -
trunk/Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp
r176921 r177363 50 50 51 51 m_waitToDumpWatchdogTimer.scheduleAfterDelay("[WTR] waitToDumpWatchdogTimerCallback", [this] { waitToDumpWatchdogTimerFired(); }, 52 std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>( waitToDumpWatchdogTimerInterval)));52 std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(m_timeout / 1000.0))); 53 53 } 54 54 -
trunk/Tools/WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm
r161666 r177363 53 53 return; 54 54 55 m_waitToDumpWatchdogTimer = adoptCF(CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + waitToDumpWatchdogTimerInterval, 0, 0, 0, WTR::waitUntilDoneWatchdogTimerFired, NULL)); 55 CFTimeInterval interval = m_timeout / 1000.0; 56 m_waitToDumpWatchdogTimer = adoptCF(CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + interval, 0, 0, 0, WTR::waitUntilDoneWatchdogTimerFired, NULL)); 56 57 CFRunLoopAddTimer(CFRunLoopGetCurrent(), m_waitToDumpWatchdogTimer.get(), kCFRunLoopCommonModes); 57 58 } -
trunk/Tools/WebKitTestRunner/InjectedBundle/win/TestRunnerWin.cpp
r161666 r177363 57 57 return; 58 58 59 m_waitToDumpWatchdogTimer = ::SetTimer(0, waitToDumpWatchdogTimerIdentifier, waitToDumpWatchdogTimerInterval * 1000, WTR::waitToDumpWatchdogTimerFired);59 m_waitToDumpWatchdogTimer = ::SetTimer(0, waitToDumpWatchdogTimerIdentifier, m_timeout, WTR::waitToDumpWatchdogTimerFired); 60 60 } 61 61 -
trunk/Tools/WebKitTestRunner/TestController.cpp
r177234 r177363 71 71 const unsigned TestController::w3cSVGViewHeight = 360; 72 72 73 // defaultLongTimeout + defaultShortTimeout should be less than 80,73 // defaultLongTimeout + defaultShortTimeout should be less than 35, 74 74 // the default timeout value of the test harness so we can detect an 75 75 // unresponsive web process. 76 static const double defaultLongTimeout = 60; 77 static const double defaultShortTimeout = 15; 76 // These values are only used by ports that don't have --timeout option passed to WebKitTestRunner. 77 static const double defaultLongTimeout = 25; 78 static const double defaultShortTimeout = 5; 78 79 static const double defaultNoTimeout = -1; 79 80 … … 111 112 , m_useWaitToDumpWatchdogTimer(true) 112 113 , m_forceNoTimeout(false) 113 , m_timeout(0)114 114 , m_didPrintWebProcessCrashedMessage(false) 115 115 , m_shouldExitWhenWebProcessCrashes(true) … … 193 193 { 194 194 TestController::shared().handleUserMediaPermissionRequest(permissionRequest); 195 }196 197 int TestController::getCustomTimeout()198 {199 return m_timeout;200 195 } 201 196 … … 980 975 timeout = m_longTimeout; 981 976 break; 982 case CustomTimeout:983 timeout = m_timeout;984 break;985 977 case NoTimeout: 986 978 default: -
trunk/Tools/WebKitTestRunner/TestController.h
r176011 r177363 69 69 70 70 // Runs the run loop until `done` is true or the timeout elapses. 71 enum TimeoutDuration { ShortTimeout, LongTimeout, NoTimeout , CustomTimeout};71 enum TimeoutDuration { ShortTimeout, LongTimeout, NoTimeout }; 72 72 bool useWaitToDumpWatchdogTimer() { return m_useWaitToDumpWatchdogTimer; } 73 73 void runUntil(bool& done, TimeoutDuration); … … 75 75 76 76 void configureViewForTest(const TestInvocation&); 77 78 int getCustomTimeout();79 77 80 78 bool beforeUnloadReturnValue() const { return m_beforeUnloadReturnValue; } … … 232 230 bool m_forceNoTimeout; 233 231 234 int m_timeout;235 236 232 bool m_didPrintWebProcessCrashedMessage; 237 233 bool m_shouldExitWhenWebProcessCrashes; -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r176659 r177363 118 118 } 119 119 120 void TestInvocation::setCustomTimeout(int timeout)121 {122 m_timeout = timeout;123 }124 125 120 static bool shouldLogFrameLoadDelegates(const char* pathOrURL) 126 121 { … … 165 160 166 161 WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), beginTestMessageBody.get()); 167 168 TestController::TimeoutDuration timeoutToUse = TestController::LongTimeout;169 162 170 163 TestController::shared().runUntil(m_gotInitialResponse, TestController::ShortTimeout); … … 179 172 WKPageLoadURL(TestController::shared().mainWebView()->page(), m_url.get()); 180 173 181 if (TestController::shared().useWaitToDumpWatchdogTimer()) { 182 if (m_timeout > 0) 183 timeoutToUse = TestController::CustomTimeout; 184 } else 185 timeoutToUse = TestController::NoTimeout; 186 TestController::shared().runUntil(m_gotFinalMessage, timeoutToUse); 174 TestController::shared().runUntil(m_gotFinalMessage, TestController::NoTimeout); 187 175 188 176 if (!m_gotFinalMessage) { -
trunk/Tools/WebKitTestRunner/TestInvocation.h
r169845 r177363 45 45 void setIsPixelTest(const std::string& expectedPixelHash); 46 46 47 void setCustomTimeout(int duration); 47 void setCustomTimeout(int duration) { m_timeout = duration; } 48 int customTimeout() const { return m_timeout; } 48 49 49 50 void invoke();
Note: See TracChangeset
for help on using the changeset viewer.