[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
aroben at apple.com
aroben at apple.com
Wed Dec 22 15:27:00 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 97db2ce44b90a38a69c67378936717702c2e1411
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Nov 3 20:51:16 2010 +0000
Stop waiting for messages from the web process after a timeout elapses
TestController::runUntil now takes a timeout parameter that specifies
how long to wait for the condition to become true. WebKitTestRunner
takes a --timeout flag that specifies how long the timeout should be.
run-webkit-tests passes this flag to WebKitTestRunner so its timeout
will be similar to run-webkit-tests.
Fixes <http://webkit.org/b/43047> <rdar://problem/8365833>
WebKitTestRunner waits forever if the web process crashes
Reviewed by Darin Adler and Anders Carlsson.
* Scripts/old-run-webkit-tests:
(top level): Moved the GuardMalloc timeout adjustment here from
readFromDumpToolWithTimer.
(openDumpTool): Make WTR use a timeout similar to but slightly shorter
than the one that was specified on the command line.
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::TestController): Initialize our timeout values.
(WTR::TestController::initialize): Parse the --timeout flag and use it
to modify our timeout values.
(WTR::TestController::resetStateToConsistentValues): Changed to use a
short timeout while waiting for the web process to reset and to return
a boolean indicating whether we were able to reset the web process.
Uses a 5-second timeout while waiting for the process to be reset.
(WTR::TestController::runTest): Changed to return a boolean indicating
whether we were able to reset the web process (and thus run the test).
(WTR::TestController::runUntil): Call through to platformRunUntil.
(WTR::TestController::runTestingServerLoop):
(WTR::TestController::run):
Changed to bail if any test can't be run. This will cause the process
to exit. (Unfortunately this will make run-webkit-tests think we
crashed; see <http://webkit.org/b/48943>.)
* WebKitTestRunner/TestController.h: Added platformRunUntil,
m_longTimeout, and m_shortTimeout.
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::invoke): Use a short timeout when waiting for the
initial response and a long timeout when waiting for the test to
complete. Check whether runUntil timed out and print an error message
if so.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformRunUntil): Renamed from runUntil. Pass
[NSDate distantPast] to -[NSRunLoop runMode:beforeDate:] so that we
won't block waiting for the run loop. Only loop until the timeout
elapses.
* WebKitTestRunner/qt/TestControllerQt.cpp:
(WTR::TestController::platformRunUntil): Renamed from runUntil. Added a
FIXME about honoring the timeout.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformRunUntil): Renamed from runUntil. Use
::MsgWaitForMultipleObjectsEx to implement the timeout. Changed to use
::PeekMessageW so that we don't block waiting for messages to become
available.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71263 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index acedee2..4f709c0 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,5 +1,69 @@
2010-11-03 Adam Roben <aroben at apple.com>
+ Stop waiting for messages from the web process after a timeout elapses
+
+ TestController::runUntil now takes a timeout parameter that specifies
+ how long to wait for the condition to become true. WebKitTestRunner
+ takes a --timeout flag that specifies how long the timeout should be.
+ run-webkit-tests passes this flag to WebKitTestRunner so its timeout
+ will be similar to run-webkit-tests.
+
+ Fixes <http://webkit.org/b/43047> <rdar://problem/8365833>
+ WebKitTestRunner waits forever if the web process crashes
+
+ Reviewed by Darin Adler and Anders Carlsson.
+
+ * Scripts/old-run-webkit-tests:
+ (top level): Moved the GuardMalloc timeout adjustment here from
+ readFromDumpToolWithTimer.
+ (openDumpTool): Make WTR use a timeout similar to but slightly shorter
+ than the one that was specified on the command line.
+
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::TestController): Initialize our timeout values.
+ (WTR::TestController::initialize): Parse the --timeout flag and use it
+ to modify our timeout values.
+ (WTR::TestController::resetStateToConsistentValues): Changed to use a
+ short timeout while waiting for the web process to reset and to return
+ a boolean indicating whether we were able to reset the web process.
+ Uses a 5-second timeout while waiting for the process to be reset.
+ (WTR::TestController::runTest): Changed to return a boolean indicating
+ whether we were able to reset the web process (and thus run the test).
+ (WTR::TestController::runUntil): Call through to platformRunUntil.
+
+ (WTR::TestController::runTestingServerLoop):
+ (WTR::TestController::run):
+ Changed to bail if any test can't be run. This will cause the process
+ to exit. (Unfortunately this will make run-webkit-tests think we
+ crashed; see <http://webkit.org/b/48943>.)
+
+ * WebKitTestRunner/TestController.h: Added platformRunUntil,
+ m_longTimeout, and m_shortTimeout.
+
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::invoke): Use a short timeout when waiting for the
+ initial response and a long timeout when waiting for the test to
+ complete. Check whether runUntil timed out and print an error message
+ if so.
+
+ * WebKitTestRunner/mac/TestControllerMac.mm:
+ (WTR::TestController::platformRunUntil): Renamed from runUntil. Pass
+ [NSDate distantPast] to -[NSRunLoop runMode:beforeDate:] so that we
+ won't block waiting for the run loop. Only loop until the timeout
+ elapses.
+
+ * WebKitTestRunner/qt/TestControllerQt.cpp:
+ (WTR::TestController::platformRunUntil): Renamed from runUntil. Added a
+ FIXME about honoring the timeout.
+
+ * WebKitTestRunner/win/TestControllerWin.cpp:
+ (WTR::TestController::platformRunUntil): Renamed from runUntil. Use
+ ::MsgWaitForMultipleObjectsEx to implement the timeout. Changed to use
+ ::PeekMessageW so that we don't block waiting for messages to become
+ available.
+
+2010-11-03 Adam Roben <aroben at apple.com>
+
Add a plugin test that evaluates JS after removing the plugin element
from the document
diff --git a/WebKitTools/Scripts/old-run-webkit-tests b/WebKitTools/Scripts/old-run-webkit-tests
index e40b3ad..2cef18b 100755
--- a/WebKitTools/Scripts/old-run-webkit-tests
+++ b/WebKitTools/Scripts/old-run-webkit-tests
@@ -373,6 +373,8 @@ if ($useWebKitTestRunner) {
}
}
+$timeoutSeconds *= 10 if $guardMalloc;
+
$stripEditingCallbacks = isCygwin() unless defined $stripEditingCallbacks;
my $ignoreSkipped = $treatSkipped eq "ignore";
@@ -1483,6 +1485,12 @@ sub openDumpTool()
unshift @args, "valgrind", "--suppressions=$platformBaseDirectory/qt/SuppressedValgrindErrors";
}
+ if ($useWebKitTestRunner) {
+ # Make WebKitTestRunner use a similar timeout. We don't use the exact same timeout to avoid
+ # race conditions.
+ push @args, "--timeout", $timeoutSeconds - 5;
+ }
+
$CLEAN_ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
$dumpToolPID = open3(\*OUT, \*IN, \*ERROR, launchWithEnv(@args, %CLEAN_ENV)) or die "Failed to start tool: $dumpTool\n";
@@ -2089,7 +2097,6 @@ sub readFromDumpToolWithTimer(**)
setFileHandleNonBlocking($fhError, 1);
my $maximumSecondsWithoutOutput = $timeoutSeconds;
- $maximumSecondsWithoutOutput *= 10 if $guardMalloc;
my $microsecondsToWaitBeforeReadingAgain = 1000;
my $timeOfLastSuccessfulRead = time;
diff --git a/WebKitTools/WebKitTestRunner/TestController.cpp b/WebKitTools/WebKitTestRunner/TestController.cpp
index c88062a..8ca0529 100644
--- a/WebKitTools/WebKitTestRunner/TestController.cpp
+++ b/WebKitTools/WebKitTestRunner/TestController.cpp
@@ -35,6 +35,9 @@
namespace WTR {
+static const double defaultLongTimeout = 30;
+static const double defaultShortTimeout = 5;
+
static WKURLRef blankURL()
{
static WKURLRef staticBlankURL = WKURLCreateWithUTF8CString("about:blank");
@@ -56,6 +59,8 @@ TestController::TestController(int argc, const char* argv[])
, m_usingServerMode(false)
, m_state(Initial)
, m_doneResetting(false)
+ , m_longTimeout(defaultLongTimeout)
+ , m_shortTimeout(defaultShortTimeout)
{
initialize(argc, argv);
controller = this;
@@ -146,6 +151,12 @@ void TestController::initialize(int argc, const char* argv[])
for (int i = 1; i < argc; ++i) {
std::string argument(argv[i]);
+ if (argument == "--timeout" && i + 1 < argc) {
+ m_longTimeout = atoi(argv[++i]);
+ // Scale up the short timeout to match.
+ m_shortTimeout = defaultShortTimeout * m_longTimeout / defaultLongTimeout;
+ continue;
+ }
if (argument == "--pixel-tests") {
m_dumpPixels = true;
continue;
@@ -253,7 +264,7 @@ void TestController::initialize(int argc, const char* argv[])
WKPageSetPageLoaderClient(m_mainWebView->page(), &pageLoaderClient);
}
-void TestController::resetStateToConsistentValues()
+bool TestController::resetStateToConsistentValues()
{
m_state = Resetting;
@@ -285,17 +296,21 @@ void TestController::resetStateToConsistentValues()
m_doneResetting = false;
WKPageLoadURL(m_mainWebView->page(), blankURL());
- TestController::runUntil(m_doneResetting);
+ runUntil(m_doneResetting, ShortTimeout);
+ return m_doneResetting;
}
-void TestController::runTest(const char* test)
+bool TestController::runTest(const char* test)
{
- resetStateToConsistentValues();
+ if (!resetStateToConsistentValues())
+ return false;
m_state = RunningTest;
m_currentInvocation.set(new TestInvocation(test));
m_currentInvocation->invoke();
m_currentInvocation.clear();
+
+ return true;
}
void TestController::runTestingServerLoop()
@@ -309,7 +324,8 @@ void TestController::runTestingServerLoop()
if (strlen(filenameBuffer) == 0)
continue;
- runTest(filenameBuffer);
+ if (!runTest(filenameBuffer))
+ break;
}
}
@@ -318,11 +334,18 @@ void TestController::run()
if (m_usingServerMode)
runTestingServerLoop();
else {
- for (size_t i = 0; i < m_paths.size(); ++i)
- runTest(m_paths[i].c_str());
+ for (size_t i = 0; i < m_paths.size(); ++i) {
+ if (!runTest(m_paths[i].c_str()))
+ break;
+ }
}
}
+void TestController::runUntil(bool& done, TimeoutDuration timeoutDuration)
+{
+ platformRunUntil(done, timeoutDuration == ShortTimeout ? m_shortTimeout : m_longTimeout);
+}
+
// WKContextInjectedBundleClient
void TestController::didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo)
diff --git a/WebKitTools/WebKitTestRunner/TestController.h b/WebKitTools/WebKitTestRunner/TestController.h
index b12f1b2..1396c94 100644
--- a/WebKitTools/WebKitTestRunner/TestController.h
+++ b/WebKitTools/WebKitTestRunner/TestController.h
@@ -53,22 +53,24 @@ public:
WKPageNamespaceRef pageNamespace() { return m_pageNamespace.get(); }
WKContextRef context() { return m_context.get(); }
- // Helper
- static void runUntil(bool& done);
+ // Runs the run loop until `done` is true or the timeout elapses.
+ enum TimeoutDuration { ShortTimeout, LongTimeout };
+ void runUntil(bool& done, TimeoutDuration);
private:
void initialize(int argc, const char* argv[]);
void run();
void runTestingServerLoop();
- void runTest(const char* pathOrURL);
+ bool runTest(const char* pathOrURL);
void platformInitialize();
void platformInitializeContext();
+ void platformRunUntil(bool& done, double timeout);
void initializeInjectedBundlePath();
void initializeTestPluginDirectory();
- void resetStateToConsistentValues();
+ bool resetStateToConsistentValues();
// WKContextInjectedBundleClient
static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef messageBody, const void*);
@@ -102,6 +104,9 @@ private:
};
State m_state;
bool m_doneResetting;
+
+ double m_longTimeout;
+ double m_shortTimeout;
};
} // namespace WTR
diff --git a/WebKitTools/WebKitTestRunner/TestInvocation.cpp b/WebKitTools/WebKitTestRunner/TestInvocation.cpp
index 04a56f1..e88de53 100644
--- a/WebKitTools/WebKitTestRunner/TestInvocation.cpp
+++ b/WebKitTools/WebKitTestRunner/TestInvocation.cpp
@@ -120,7 +120,11 @@ void TestInvocation::invoke()
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("BeginTest"));
WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), 0);
- TestController::runUntil(m_gotInitialResponse);
+ TestController::shared().runUntil(m_gotInitialResponse, TestController::ShortTimeout);
+ if (!m_gotInitialResponse) {
+ dump("Timed out waiting for initial response from web process\n");
+ return;
+ }
if (m_error) {
dump("FAIL\n");
return;
@@ -128,7 +132,11 @@ void TestInvocation::invoke()
WKPageLoadURL(TestController::shared().mainWebView()->page(), m_url.get());
- TestController::runUntil(m_gotFinalMessage);
+ TestController::shared().runUntil(m_gotFinalMessage, TestController::LongTimeout);
+ if (!m_gotFinalMessage) {
+ dump("Timed out waiting for final message from web process\n");
+ return;
+ }
if (m_error) {
dump("FAIL\n");
return;
diff --git a/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm b/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm
index be9aa33..268f718 100644
--- a/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm
+++ b/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm
@@ -45,10 +45,11 @@ void TestController::initializeTestPluginDirectory()
m_testPluginDirectory.adopt(WKStringCreateWithCFString((CFStringRef)[[NSBundle mainBundle] bundlePath]));
}
-void TestController::runUntil(bool& done)
+void TestController::platformRunUntil(bool& done, double timeout)
{
- while (!done)
- [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
+ CFAbsoluteTime end = CFAbsoluteTimeGetCurrent() + timeout;
+ while (!done && CFAbsoluteTimeGetCurrent() < end)
+ [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]];
}
void TestController::platformInitializeContext()
diff --git a/WebKitTools/WebKitTestRunner/qt/TestControllerQt.cpp b/WebKitTools/WebKitTestRunner/qt/TestControllerQt.cpp
index d3aee4a..4845f71 100644
--- a/WebKitTools/WebKitTestRunner/qt/TestControllerQt.cpp
+++ b/WebKitTools/WebKitTestRunner/qt/TestControllerQt.cpp
@@ -83,8 +83,9 @@ void TestController::platformInitialize()
{
}
-void TestController::runUntil(bool& done)
+void TestController::platformRunUntil(bool& done, double)
{
+ // FIXME: Honor the timeout parameter <http://webkit.org/b/48941>.
RunUntilConditionLoop::start(done);
ASSERT(done);
}
diff --git a/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp b/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
index 9643c40..3fd853f 100644
--- a/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
+++ b/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
@@ -120,15 +120,25 @@ void TestController::initializeTestPluginDirectory()
m_testPluginDirectory.adopt(WKStringCreateWithCFString(testPluginDirectoryPath.get()));
}
-void TestController::runUntil(bool& done)
+void TestController::platformRunUntil(bool& done, double timeout)
{
+ DWORD end = ::GetTickCount() + timeout * 1000;
while (!done) {
- MSG msg;
- BOOL result = GetMessage(&msg, 0, 0, 0);
- if (result == -1)
+ DWORD now = ::GetTickCount();
+ if (now > end)
+ return;
+
+ DWORD result = ::MsgWaitForMultipleObjectsEx(0, 0, end - now, QS_ALLINPUT, 0);
+ if (result == WAIT_TIMEOUT)
return;
- TranslateMessage(&msg);
- DispatchMessage(&msg);
+
+ ASSERT(result == WAIT_OBJECT_0);
+ // There are messages in the queue. Process them.
+ MSG msg;
+ while (::PeekMessageW(&msg, 0, 0, 0, PM_REMOVE)) {
+ ::TranslateMessage(&msg);
+ ::DispatchMessageW(&msg);
+ }
}
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list