WebKit Bugzilla
Attachment 175356 Details for
Bug 90968
: [NRWT] Pass --timeout to DRT/WTR if a test is marked as SLOW
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
per_test_timeout_L_changelog.patch (text/plain), 18.36 KB, created by
János Badics
on 2012-11-21 00:25:59 PST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
János Badics
Created:
2012-11-21 00:25:59 PST
Size:
18.36 KB
patch
obsolete
>diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 57d9b39..550ad06 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,63 @@ >+2012-11-20 János Badics <jbadics@inf.u-szeged.hu> >+ >+ [Qt][NRWT] Pass --timeout to DRT/WTR if a test is marked as SLOW. >+ https://bugs.webkit.org/show_bug.cgi?id=90968. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added functionality in DRT and WTR to use any timeout value while running >+ slow tests (eventually, any test). Now NRWT --time-out-ms determines the >+ timeout value for the test. Added a flag in NRWT (supports_per_test_timeout) >+ to indicate whether the current port supports setting timeout value >+ per test (it's False by default; I enabled it only on Qt). >+ Also corrected a typo in driver.py >+ >+ * DumpRenderTree/DumpRenderTree.h: >+ (TestCommand::TestCommand): >+ (TestCommand): >+ * DumpRenderTree/DumpRenderTreeCommon.cpp: >+ (parseInputLine): >+ * DumpRenderTree/qt/DumpRenderTreeQt.cpp: >+ (WebCore::DumpRenderTree::processLine): >+ * Scripts/webkitpy/layout_tests/port/base.py: >+ (Port.supports_per_test_timeout): >+ * Scripts/webkitpy/layout_tests/port/driver.py: >+ (Driver.run_test): >+ (Driver._command_from_driver_input): >+ * Scripts/webkitpy/layout_tests/port/qt.py: >+ (QtPort.supports_per_test_timeout): >+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: >+ (WTR::InjectedBundle::InjectedBundle): >+ (WTR::InjectedBundle::didReceiveMessage): >+ (WTR::InjectedBundle::beginTesting): >+ * WebKitTestRunner/InjectedBundle/InjectedBundle.h: >+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp: >+ (WTR::TestRunner::setCustomTimeout): >+ (WTR): >+ * WebKitTestRunner/InjectedBundle/TestRunner.h: >+ (TestRunner): >+ * WebKitTestRunner/InjectedBundle/qt/TestRunnerQt.cpp: >+ (WTR::TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded): >+ * WebKitTestRunner/TestController.cpp: >+ (WTR::TestController::TestController): >+ (WTR::TestController::getCustomTimeout): >+ (WTR): >+ (WTR::TestCommand::TestCommand): >+ (TestCommand): >+ (WTR::parseInputLine): >+ (WTR::TestController::runTest): >+ * WebKitTestRunner/TestController.h: >+ (TestController): >+ * WebKitTestRunner/TestInvocation.cpp: >+ (WTR::TestInvocation::TestInvocation): >+ (WTR::TestInvocation::setCustomTimeout): >+ (WTR): >+ (WTR::TestInvocation::invoke): >+ * WebKitTestRunner/TestInvocation.h: >+ (TestInvocation): >+ * WebKitTestRunner/qt/TestControllerQt.cpp: >+ (WTR::TestController::platformRunUntil): >+ > 2012-11-20 Zan Dobersek <zandobersek@gmail.com> > > webkitpy unit tests should run serially when checking code coverage >diff --git a/Tools/DumpRenderTree/DumpRenderTree.h b/Tools/DumpRenderTree/DumpRenderTree.h >index 4c6a472..62789b5 100644 >--- a/Tools/DumpRenderTree/DumpRenderTree.h >+++ b/Tools/DumpRenderTree/DumpRenderTree.h >@@ -66,11 +66,12 @@ void dump(); > void displayWebView(); > > struct TestCommand { >- TestCommand() : shouldDumpPixels(false) { } >+ TestCommand() : shouldDumpPixels(false), timeout(30000) { } > > std::string pathOrURL; > bool shouldDumpPixels; > std::string expectedPixelHash; >+ int timeout; // in ms > }; > > TestCommand parseInputLine(const std::string&); >diff --git a/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp b/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp >index 48d8322..3cb97eb 100644 >--- a/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp >+++ b/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp >@@ -66,17 +66,20 @@ TestCommand parseInputLine(const std::string& inputLine) > if (!tokenizer.hasNext()) > die(inputLine); > >- result.pathOrURL = tokenizer.next(); >- if (!tokenizer.hasNext()) >- return result; >- > std::string arg = tokenizer.next(); >- if (arg != std::string("-p") && arg != std::string("--pixel-test")) >- die(inputLine); >- result.shouldDumpPixels = true; >- >- if (tokenizer.hasNext()) >- result.expectedPixelHash = tokenizer.next(); >+ result.pathOrURL = arg; >+ while (tokenizer.hasNext()) { >+ arg = tokenizer.next(); >+ if (arg == std::string("--timeout")) { >+ std::string timeoutToken = tokenizer.next(); >+ result.timeout = atoi(timeoutToken.c_str()); >+ } else if (arg == std::string("-p") || arg == std::string("--pixel-test")) { >+ result.shouldDumpPixels = true; >+ if (tokenizer.hasNext()) >+ result.expectedPixelHash = tokenizer.next(); >+ } else >+ die(inputLine); >+ } > > return result; > } >diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp >index 34ee5ad..e641cdc 100755 >--- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp >+++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp >@@ -721,6 +721,8 @@ void DumpRenderTree::processLine(const QString &input) > open(QUrl::fromLocalFile(fi.absoluteFilePath())); > } > >+ if (command.timeout > 0) >+ setTimeout(command.timeout); > fflush(stdout); > } > >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/base.py b/Tools/Scripts/webkitpy/layout_tests/port/base.py >index a19af09..796cf46 100755 >--- a/Tools/Scripts/webkitpy/layout_tests/port/base.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/base.py >@@ -150,6 +150,9 @@ class Port(object): > def additional_drt_flag(self): > return [] > >+ def supports_per_test_timeout(self): >+ return False >+ > def default_pixel_tests(self): > # FIXME: Disable until they are run by default on build.webkit.org. > return False >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/driver.py b/Tools/Scripts/webkitpy/layout_tests/port/driver.py >index 7993d05..539612e 100644 >--- a/Tools/Scripts/webkitpy/layout_tests/port/driver.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/driver.py >@@ -151,7 +151,7 @@ class Driver(object): > the driver in an indeterminate state. The upper layers of the program > are responsible for cleaning up and ensuring things are okay. > >- Returns a DriverOuput object. >+ Returns a DriverOutput object. > """ > start_time = time.time() > self.start(driver_input.should_run_pixel_test, driver_input.args) >@@ -354,6 +354,8 @@ class Driver(object): > assert not driver_input.image_hash or driver_input.should_run_pixel_test > > # ' is the separator between arguments. >+ if self._port.supports_per_test_timeout(): >+ command += "'--timeout'%s" % driver_input.timeout > if driver_input.should_run_pixel_test: > command += "'--pixel-test" > if driver_input.image_hash: >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/qt.py b/Tools/Scripts/webkitpy/layout_tests/port/qt.py >index 55f13ee..856b933 100644 >--- a/Tools/Scripts/webkitpy/layout_tests/port/qt.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/qt.py >@@ -80,6 +80,9 @@ class QtPort(Port): > # The Qt port builds DRT as part of the main build step > return True > >+ def supports_per_test_timeout(self): >+ return True >+ > def _path_to_driver(self): > return self._build_path('bin/%s' % self.driver_name()) > >diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp >index 0684d6d..11c0cab 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp >+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp >@@ -55,6 +55,7 @@ InjectedBundle::InjectedBundle() > , m_dumpPixels(false) > , m_useWaitToDumpWatchdogTimer(true) > , m_useWorkQueue(false) >+ , m_timeout(0) > { > } > >@@ -154,6 +155,9 @@ void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messag > WKRetainPtr<WKStringRef> useWaitToDumpWatchdogTimerKey(AdoptWK, WKStringCreateWithUTF8CString("UseWaitToDumpWatchdogTimer")); > m_useWaitToDumpWatchdogTimer = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, useWaitToDumpWatchdogTimerKey.get()))); > >+ WKRetainPtr<WKStringRef> timeoutKey(AdoptWK, WKStringCreateWithUTF8CString("Timeout")); >+ m_timeout = (int)WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, timeoutKey.get()))); >+ > WKRetainPtr<WKStringRef> ackMessageName(AdoptWK, WKStringCreateWithUTF8CString("Ack")); > WKRetainPtr<WKStringRef> ackMessageBody(AdoptWK, WKStringCreateWithUTF8CString("BeginTest")); > WKBundlePostMessage(m_bundle, ackMessageName.get(), ackMessageBody.get()); >@@ -266,6 +270,8 @@ void InjectedBundle::beginTesting(WKDictionaryRef settings) > m_testRunner->setAcceptsEditing(true); > m_testRunner->setTabKeyCyclesThroughElements(true); > >+ m_testRunner->setCustomTimeout(m_timeout); >+ > page()->prepare(); > > WKBundleClearAllDatabases(m_bundle); >diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h >index 41469ec..fb623d4 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h >+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h >@@ -156,6 +156,7 @@ private: > bool m_dumpPixels; > bool m_useWaitToDumpWatchdogTimer; > bool m_useWorkQueue; >+ int m_timeout; > > WKRetainPtr<WKImageRef> m_pixelResult; > WKRetainPtr<WKArrayRef> m_repaintRects; >diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >index a294da7..db0e6a2 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >@@ -166,6 +166,11 @@ void TestRunner::notifyDone() > m_waitToDump = false; > } > >+void TestRunner::setCustomTimeout(int timeout) >+{ >+ m_timeout = timeout; >+} >+ > unsigned TestRunner::numberOfActiveAnimations() const > { > // FIXME: Is it OK this works only for the main frame? >diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >index 48b922c..ac7e84e 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >@@ -261,6 +261,8 @@ public: > > bool callShouldCloseOnWebView(); > >+ void setCustomTimeout(int duration); >+ > // Work queue. > void queueBackNavigation(unsigned howFarBackward); > void queueForwardNavigation(unsigned howFarForward); >@@ -313,6 +315,8 @@ private: > bool m_globalFlag; > bool m_customFullScreenBehavior; > >+ int m_timeout; >+ > bool m_userStyleSheetEnabled; > WKRetainPtr<WKStringRef> m_userStyleSheetLocation; > >diff --git a/Tools/WebKitTestRunner/InjectedBundle/qt/TestRunnerQt.cpp b/Tools/WebKitTestRunner/InjectedBundle/qt/TestRunnerQt.cpp >index 1671ac7..95ed46d 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/qt/TestRunnerQt.cpp >+++ b/Tools/WebKitTestRunner/InjectedBundle/qt/TestRunnerQt.cpp >@@ -74,13 +74,18 @@ void TestRunner::invalidateWaitToDumpWatchdogTimer() > > void TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded() > { >+ int timerInterval; > if (qgetenv("QT_WEBKIT2_DEBUG") == "1") > return; > > if (m_waitToDumpWatchdogTimer.isActive()) > return; >+ if (m_timeout > 0) >+ timerInterval = m_timeout; >+ else >+ timerInterval = waitToDumpWatchdogTimerInterval * 1000; > >- m_waitToDumpWatchdogTimer.start(waitToDumpWatchdogTimerInterval * 1000); >+ m_waitToDumpWatchdogTimer.start(timerInterval); > } > > JSRetainPtr<JSStringRef> TestRunner::pathToLocalResource(JSStringRef url) >diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp >index 145c270..2e51eda 100644 >--- a/Tools/WebKitTestRunner/TestController.cpp >+++ b/Tools/WebKitTestRunner/TestController.cpp >@@ -93,6 +93,7 @@ TestController::TestController(int argc, const char* argv[]) > , m_noTimeout(defaultNoTimeout) > , m_useWaitToDumpWatchdogTimer(true) > , m_forceNoTimeout(false) >+ , m_timeout(0) > , m_didPrintWebProcessCrashedMessage(false) > , m_shouldExitWhenWebProcessCrashes(true) > , m_beforeUnloadReturnValue(true) >@@ -169,6 +170,11 @@ static void decidePolicyForGeolocationPermissionRequest(WKPageRef, WKFrameRef, W > TestController::shared().handleGeolocationPermissionRequest(permissionRequest); > } > >+int TestController::getCustomTimeout() >+{ >+ return m_timeout; >+} >+ > WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*) > { > PlatformWebView* view = new PlatformWebView(WKPageGetContext(oldPage), WKPageGetPageGroup(oldPage)); >@@ -585,11 +591,12 @@ bool TestController::resetStateToConsistentValues() > } > > struct TestCommand { >- TestCommand() : shouldDumpPixels(false) { } >+ TestCommand() : shouldDumpPixels(false), timeout(0) { } > > std::string pathOrURL; > bool shouldDumpPixels; > std::string expectedPixelHash; >+ int timeout; > }; > > class CommandTokenizer { >@@ -651,17 +658,20 @@ TestCommand parseInputLine(const std::string& inputLine) > if (!tokenizer.hasNext()) > die(inputLine); > >- result.pathOrURL = tokenizer.next(); >- if (!tokenizer.hasNext()) >- return result; >- > std::string arg = tokenizer.next(); >- if (arg != std::string("-p") && arg != std::string("--pixel-test")) >- die(inputLine); >- result.shouldDumpPixels = true; >- >- if (tokenizer.hasNext()) >- result.expectedPixelHash = tokenizer.next(); >+ result.pathOrURL = arg; >+ while (tokenizer.hasNext()) { >+ arg = tokenizer.next(); >+ if (arg == std::string("--timeout")) { >+ std::string timeoutToken = tokenizer.next(); >+ result.timeout = atoi(timeoutToken.c_str()); >+ } else if (arg == std::string("-p") || arg == std::string("--pixel-test")) { >+ result.shouldDumpPixels = true; >+ if (tokenizer.hasNext()) >+ result.expectedPixelHash = tokenizer.next(); >+ } else >+ die(inputLine); >+ } > > return result; > } >@@ -675,6 +685,8 @@ bool TestController::runTest(const char* inputLine) > m_currentInvocation = adoptPtr(new TestInvocation(command.pathOrURL)); > if (command.shouldDumpPixels || m_shouldDumpPixelsForAllTests) > m_currentInvocation->setIsPixelTest(command.expectedPixelHash); >+ if (command.timeout > 0) >+ m_currentInvocation->setCustomTimeout(command.timeout); > > m_currentInvocation->invoke(); > m_currentInvocation.clear(); >diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h >index 56c3c47..fe3e67d 100644 >--- a/Tools/WebKitTestRunner/TestController.h >+++ b/Tools/WebKitTestRunner/TestController.h >@@ -64,6 +64,8 @@ public: > bool useWaitToDumpWatchdogTimer() { return m_useWaitToDumpWatchdogTimer; } > void runUntil(bool& done, TimeoutDuration); > void notifyDone(); >+ >+ int getCustomTimeout(); > > bool beforeUnloadReturnValue() const { return m_beforeUnloadReturnValue; } > void setBeforeUnloadReturnValue(bool value) { m_beforeUnloadReturnValue = value; } >@@ -165,6 +167,8 @@ private: > bool m_useWaitToDumpWatchdogTimer; > bool m_forceNoTimeout; > >+ int m_timeout; >+ > bool m_didPrintWebProcessCrashedMessage; > bool m_shouldExitWhenWebProcessCrashes; > >diff --git a/Tools/WebKitTestRunner/TestInvocation.cpp b/Tools/WebKitTestRunner/TestInvocation.cpp >index ef17437..2b2d2d6 100644 >--- a/Tools/WebKitTestRunner/TestInvocation.cpp >+++ b/Tools/WebKitTestRunner/TestInvocation.cpp >@@ -100,6 +100,7 @@ TestInvocation::TestInvocation(const std::string& pathOrURL) > : m_url(AdoptWK, createWKURL(pathOrURL.c_str())) > , m_pathOrURL(pathOrURL) > , m_dumpPixels(false) >+ , m_timeout(0) > , m_gotInitialResponse(false) > , m_gotFinalMessage(false) > , m_gotRepaint(false) >@@ -118,6 +119,11 @@ void TestInvocation::setIsPixelTest(const std::string& expectedPixelHash) > m_expectedPixelHash = expectedPixelHash; > } > >+void TestInvocation::setCustomTimeout(int timeout) >+{ >+ m_timeout = timeout; >+} >+ > static const unsigned w3cSVGWidth = 480; > static const unsigned w3cSVGHeight = 360; > static const unsigned normalWidth = 800; >@@ -185,6 +191,10 @@ void TestInvocation::invoke() > WKRetainPtr<WKBooleanRef> useWaitToDumpWatchdogTimerValue = adoptWK(WKBooleanCreate(TestController::shared().useWaitToDumpWatchdogTimer())); > WKDictionaryAddItem(beginTestMessageBody.get(), useWaitToDumpWatchdogTimerKey.get(), useWaitToDumpWatchdogTimerValue.get()); > >+ WKRetainPtr<WKStringRef> timeoutKey = adoptWK(WKStringCreateWithUTF8CString("Timeout")); >+ WKRetainPtr<WKUInt64Ref> timeoutValue = adoptWK(WKUInt64Create(m_timeout)); >+ WKDictionaryAddItem(beginTestMessageBody.get(), timeoutKey.get(), timeoutValue.get()); >+ > WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), beginTestMessageBody.get()); > > TestController::shared().runUntil(m_gotInitialResponse, TestController::ShortTimeout); >diff --git a/Tools/WebKitTestRunner/TestInvocation.h b/Tools/WebKitTestRunner/TestInvocation.h >index c14b060..7366f07 100644 >--- a/Tools/WebKitTestRunner/TestInvocation.h >+++ b/Tools/WebKitTestRunner/TestInvocation.h >@@ -40,6 +40,8 @@ public: > > void setIsPixelTest(const std::string& expectedPixelHash); > >+ void setCustomTimeout(int duration); >+ > void invoke(); > void didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody); > WKRetainPtr<WKTypeRef> didReceiveSynchronousMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody); >@@ -62,6 +64,8 @@ private: > bool m_dumpPixels; > std::string m_expectedPixelHash; > >+ int m_timeout; >+ > // Invocation state > bool m_gotInitialResponse; > bool m_gotFinalMessage; >diff --git a/Tools/WebKitTestRunner/qt/TestControllerQt.cpp b/Tools/WebKitTestRunner/qt/TestControllerQt.cpp >index 04ddb8b..3b0d920 100644 >--- a/Tools/WebKitTestRunner/qt/TestControllerQt.cpp >+++ b/Tools/WebKitTestRunner/qt/TestControllerQt.cpp >@@ -66,8 +66,10 @@ void TestController::platformRunUntil(bool& condition, double timeout) > QElapsedTimer timer; > timer.start(); > while (!condition) { >- if (timer.elapsed() > timeoutInMSecs) >+ if (timer.elapsed() > timeoutInMSecs) { >+ condition = !condition; > return; >+ } > QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, timeoutInMSecs - timer.elapsed()); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 90968
:
163359
|
163643
|
164136
|
165331
|
168204
|
172558
|
172596
|
175201
|
175356
|
176956