Diff
Modified: trunk/Tools/ChangeLog (110381 => 110382)
--- trunk/Tools/ChangeLog 2012-03-10 18:42:05 UTC (rev 110381)
+++ trunk/Tools/ChangeLog 2012-03-10 18:44:59 UTC (rev 110382)
@@ -1,3 +1,51 @@
+2012-03-09 Zan Dobersek <[email protected]>
+
+ [WK2] run-perf-tests should be able to run with WTR
+ https://bugs.webkit.org/show_bug.cgi?id=80042
+
+ Reviewed by Martin Robinson.
+
+ Add an option to PerfTestRunner to use WebKitTestRunner instead of
+ DumpRenderTree and add the '--no-timeout' flag to WebKitTestRunner
+ to avoid timing out when running performance tests.
+
+ * Scripts/webkitpy/performance_tests/perftestsrunner.py:
+ (PerfTestsRunner._parse_args):
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::InjectedBundle): Initialize m_useWaitToDumpWatchdogTimer
+ to true.
+ (WTR::InjectedBundle::didReceiveMessage): Unpack the 'BeginTest' message
+ as a dictionary containing DumpPixels and UseWaitToDumpWatchdogTimer keys.
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+ (WTR::InjectedBundle::useWaitToDumpWatchdogTimer): Make m_useWaitToDumpWatchdogTimer
+ publicly accessible.
+ * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+ (WTR::LayoutTestController::waitUntilDone): Only initialize the watchdog if it
+ is required.
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::TestController): Initialize m_useWaitToDumpWatchdogTimer
+ to true.
+ (WTR::TestController::initialize): Set m_useWaitToDumpWatchdogTimer to false
+ if '--no-timeout' option is present.
+ (WTR::TestController::runUntil): Translate TimeoutDuration to a proper timeout
+ value, or -1.0 if timeout should not occur.
+ * WebKitTestRunner/TestController.h:
+ (WTR::TestController::useWaitToDumpWatchdogTimer): Make m_useWaitToDumpWatchdogTimer
+ publicly accessible.
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::invoke): Pack the 'BeginTest' message as a dictionary,
+ containing DumpPixels and UseWaitToDumpWatchdogTimer keys and corresponding values.
+ Waiting for final message should not time out if not necessary.
+ * WebKitTestRunner/gtk/TestControllerGtk.cpp:
+ (WTR::TestController::platformRunUntil): Only set up a timeout if necessary.
+ * WebKitTestRunner/qt/TestControllerQt.cpp:
+ (WTR::TestController::platformRunUntil): Ditto.
+ * WebKitTestRunner/mac/TestControllerMac.mm:
+ (WTR::TestController::platformRunUntil): Add a FIXME, indicating functionality
+ is missing.
+ * WebKitTestRunner/win/TestControllerWin.cpp:
+ (WTR::TestController::platformRunUntil): Ditto.
+
2012-03-09 Jon Lee <[email protected]>
Rename NotificationPresenter to NotificationClient
Modified: trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py (110381 => 110382)
--- trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py 2012-03-10 18:42:05 UTC (rev 110381)
+++ trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py 2012-03-10 18:44:59 UTC (rev 110382)
@@ -99,6 +99,8 @@
help="Path to a JSON file to be merged into the JSON file when --output-json-path is present"),
optparse.make_option("--test-results-server",
help="Upload the generated JSON file to the specified server when --output-json-path is present"),
+ optparse.make_option("--webkit-test-runner", "-2", action=""
+ help="Use WebKitTestRunner rather than DumpRenderTree."),
]
option_list = (perf_option_list + print_options)
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (110381 => 110382)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2012-03-10 18:42:05 UTC (rev 110381)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2012-03-10 18:44:59 UTC (rev 110382)
@@ -51,6 +51,7 @@
, m_topLoadingFrame(0)
, m_state(Idle)
, m_dumpPixels(false)
+ , m_useWaitToDumpWatchdogTimer(true)
{
}
@@ -131,9 +132,15 @@
{
if (WKStringIsEqualToUTF8CString(messageName, "BeginTest")) {
ASSERT(messageBody);
- ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
- m_dumpPixels = WKBooleanGetValue(static_cast<WKBooleanRef>(messageBody));
+ ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
+ WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
+ WKRetainPtr<WKStringRef> dumpPixelsKey(AdoptWK, WKStringCreateWithUTF8CString("DumpPixels"));
+ m_dumpPixels = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, dumpPixelsKey.get())));
+
+ WKRetainPtr<WKStringRef> useWaitToDumpWatchdogTimerKey(AdoptWK, WKStringCreateWithUTF8CString("UseWaitToDumpWatchdogTimer"));
+ m_useWaitToDumpWatchdogTimer = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, useWaitToDumpWatchdogTimerKey.get())));
+
WKRetainPtr<WKStringRef> ackMessageName(AdoptWK, WKStringCreateWithUTF8CString("Ack"));
WKRetainPtr<WKStringRef> ackMessageBody(AdoptWK, WKStringCreateWithUTF8CString("BeginTest"));
WKBundlePostMessage(m_bundle, ackMessageName.get(), ackMessageBody.get());
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h (110381 => 110382)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h 2012-03-10 18:42:05 UTC (rev 110381)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h 2012-03-10 18:44:59 UTC (rev 110382)
@@ -76,6 +76,7 @@
void setTopLoadingFrame(WKBundleFrameRef frame) { m_topLoadingFrame = frame; }
bool shouldDumpPixels() const { return m_dumpPixels; }
+ bool useWaitToDumpWatchdogTimer() const { return m_useWaitToDumpWatchdogTimer; }
void postNewBeforeUnloadReturnValue(bool);
void postAddChromeInputField();
@@ -125,6 +126,7 @@
State m_state;
bool m_dumpPixels;
+ bool m_useWaitToDumpWatchdogTimer;
WKRetainPtr<WKImageRef> m_pixelResult;
WKRetainPtr<WKArrayRef> m_repaintRects;
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp (110381 => 110382)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp 2012-03-10 18:42:05 UTC (rev 110381)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp 2012-03-10 18:44:59 UTC (rev 110382)
@@ -150,7 +150,8 @@
void LayoutTestController::waitUntilDone()
{
m_waitToDump = true;
- initializeWaitToDumpWatchdogTimerIfNeeded();
+ if (InjectedBundle::shared().useWaitToDumpWatchdogTimer())
+ initializeWaitToDumpWatchdogTimerIfNeeded();
}
void LayoutTestController::waitToDumpWatchdogTimerFired()
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (110381 => 110382)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2012-03-10 18:42:05 UTC (rev 110381)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2012-03-10 18:44:59 UTC (rev 110382)
@@ -46,6 +46,7 @@
static const double defaultLongTimeout = 30;
static const double defaultShortTimeout = 5;
+static const double defaultNoTimeout = -1;
static WKURLRef blankURL()
{
@@ -72,6 +73,8 @@
, m_doneResetting(false)
, m_longTimeout(defaultLongTimeout)
, m_shortTimeout(defaultShortTimeout)
+ , m_noTimeout(defaultNoTimeout)
+ , m_useWaitToDumpWatchdogTimer(true)
, m_didPrintWebProcessCrashedMessage(false)
, m_shouldExitWhenWebProcessCrashes(true)
, m_beforeUnloadReturnValue(true)
@@ -248,6 +251,11 @@
continue;
}
+ if (argument == "--no-timeout") {
+ m_useWaitToDumpWatchdogTimer = false;
+ continue;
+ }
+
if (argument == "--skip-pixel-test-if-no-baseline") {
m_skipPixelTestOption = true;
continue;
@@ -537,7 +545,21 @@
void TestController::runUntil(bool& done, TimeoutDuration timeoutDuration)
{
- platformRunUntil(done, timeoutDuration == ShortTimeout ? m_shortTimeout : m_longTimeout);
+ double timeout;
+ switch (timeoutDuration) {
+ case ShortTimeout:
+ timeout = m_shortTimeout;
+ break;
+ case LongTimeout:
+ timeout = m_longTimeout;
+ break;
+ case NoTimeout:
+ default:
+ timeout = m_noTimeout;
+ break;
+ }
+
+ platformRunUntil(done, timeout);
}
// WKContextInjectedBundleClient
Modified: trunk/Tools/WebKitTestRunner/TestController.h (110381 => 110382)
--- trunk/Tools/WebKitTestRunner/TestController.h 2012-03-10 18:42:05 UTC (rev 110381)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2012-03-10 18:44:59 UTC (rev 110382)
@@ -54,7 +54,8 @@
WKContextRef context() { return m_context.get(); }
// Runs the run loop until `done` is true or the timeout elapses.
- enum TimeoutDuration { ShortTimeout, LongTimeout };
+ enum TimeoutDuration { ShortTimeout, LongTimeout, NoTimeout };
+ bool useWaitToDumpWatchdogTimer() { return m_useWaitToDumpWatchdogTimer; }
void runUntil(bool& done, TimeoutDuration);
void notifyDone();
@@ -127,6 +128,8 @@
double m_longTimeout;
double m_shortTimeout;
+ double m_noTimeout;
+ bool m_useWaitToDumpWatchdogTimer;
bool m_didPrintWebProcessCrashedMessage;
bool m_shouldExitWhenWebProcessCrashes;
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (110381 => 110382)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2012-03-10 18:42:05 UTC (rev 110381)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2012-03-10 18:44:59 UTC (rev 110382)
@@ -140,9 +140,18 @@
sizeWebViewForCurrentTest(m_pathOrURL.c_str());
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("BeginTest"));
- WKRetainPtr<WKBooleanRef> dumpPixels = adoptWK(WKBooleanCreate(m_dumpPixels));
- WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), dumpPixels.get());
+ WKRetainPtr<WKMutableDictionaryRef> beginTestMessageBody = adoptWK(WKMutableDictionaryCreate());
+ WKRetainPtr<WKStringRef> dumpPixelsKey = adoptWK(WKStringCreateWithUTF8CString("DumpPixels"));
+ WKRetainPtr<WKBooleanRef> dumpPixelsValue = adoptWK(WKBooleanCreate(m_dumpPixels));
+ WKDictionaryAddItem(beginTestMessageBody.get(), dumpPixelsKey.get(), dumpPixelsValue.get());
+
+ WKRetainPtr<WKStringRef> useWaitToDumpWatchdogTimerKey = adoptWK(WKStringCreateWithUTF8CString("UseWaitToDumpWatchdogTimer"));
+ WKRetainPtr<WKBooleanRef> useWaitToDumpWatchdogTimerValue = adoptWK(WKBooleanCreate(TestController::shared().useWaitToDumpWatchdogTimer()));
+ WKDictionaryAddItem(beginTestMessageBody.get(), useWaitToDumpWatchdogTimerKey.get(), useWaitToDumpWatchdogTimerValue.get());
+
+ WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), beginTestMessageBody.get());
+
TestController::shared().runUntil(m_gotInitialResponse, TestController::ShortTimeout);
if (!m_gotInitialResponse) {
dump("Timed out waiting for initial response from web process\n");
@@ -158,7 +167,7 @@
WKPageLoadURL(TestController::shared().mainWebView()->page(), m_url.get());
- TestController::shared().runUntil(m_gotFinalMessage, TestController::LongTimeout);
+ TestController::shared().runUntil(m_gotFinalMessage, TestController::shared().useWaitToDumpWatchdogTimer() ? TestController::LongTimeout : TestController::NoTimeout);
if (!m_gotFinalMessage)
dump("Timed out waiting for final message from web process\n");
else if (m_error)
Modified: trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp (110381 => 110382)
--- trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp 2012-03-10 18:42:05 UTC (rev 110381)
+++ trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp 2012-03-10 18:44:59 UTC (rev 110382)
@@ -64,7 +64,8 @@
void TestController::platformRunUntil(bool&, double timeout)
{
cancelTimeout();
- gTimeoutSourceId = g_timeout_add(timeout * 1000, timeoutCallback, 0);
+ if (timeout != m_noTimeout)
+ gTimeoutSourceId = g_timeout_add(timeout * 1000, timeoutCallback, 0);
gtk_main();
}
Modified: trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm (110381 => 110382)
--- trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm 2012-03-10 18:42:05 UTC (rev 110381)
+++ trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm 2012-03-10 18:44:59 UTC (rev 110382)
@@ -53,6 +53,7 @@
void TestController::platformRunUntil(bool& done, double timeout)
{
+ // FIXME: No timeout should occur if timeout is equal to m_noTimeout (necessary when running performance tests).
CFAbsoluteTime end = CFAbsoluteTimeGetCurrent() + timeout;
CFDateRef endDate = CFDateCreate(0, end);
while (!done && CFAbsoluteTimeGetCurrent() < end)
Modified: trunk/Tools/WebKitTestRunner/qt/TestControllerQt.cpp (110381 => 110382)
--- trunk/Tools/WebKitTestRunner/qt/TestControllerQt.cpp 2012-03-10 18:42:05 UTC (rev 110381)
+++ trunk/Tools/WebKitTestRunner/qt/TestControllerQt.cpp 2012-03-10 18:44:59 UTC (rev 110382)
@@ -55,8 +55,8 @@
void TestController::platformRunUntil(bool& condition, double timeout)
{
- if (qgetenv("QT_WEBKIT2_DEBUG") == "1") {
- // Never timeout if we are debugging.
+ if (qgetenv("QT_WEBKIT2_DEBUG") == "1" || timeout == m_noTimeout) {
+ // Never timeout if we are debugging or not meant to timeout.
while (!condition)
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 50);
return;
Modified: trunk/Tools/WebKitTestRunner/win/TestControllerWin.cpp (110381 => 110382)
--- trunk/Tools/WebKitTestRunner/win/TestControllerWin.cpp 2012-03-10 18:42:05 UTC (rev 110381)
+++ trunk/Tools/WebKitTestRunner/win/TestControllerWin.cpp 2012-03-10 18:44:59 UTC (rev 110382)
@@ -172,6 +172,7 @@
void TestController::platformRunUntil(bool& done, double timeout)
{
+ // FIXME: No timeout should occur if timeout is equal to m_noTimeout (necessary when running performance tests).
RunLoopResult result = runRunLoopUntil(done, webProcessCrashingEvent, timeout);
if (result == TimedOut || result == ConditionSatisfied)
return;