Title: [280619] trunk/Tools
- Revision
- 280619
- Author
- [email protected]
- Date
- 2021-08-03 15:23:44 -0700 (Tue, 03 Aug 2021)
Log Message
WebKitTestRunner should dump current results in the case of a timeout
https://bugs.webkit.org/show_bug.cgi?id=228706
<rdar://79154019>
Reviewed by Jonathan Bedard.
When WKTR encounters a timeout, it current prints a "PID UNRESPONSIVE" and "FAIL: timed out" message,
but the WebContent process may not actually be unresponsive; it may just be waiting for an event
which hasn't fired, or a condition to become true. In these cases, it would be very helpful to see
the results of the test so far, so as to diagnose what is keeping the test from running to completion.
When, in the WKTR process, TestInvocation's "waitToDumpWatchdogTimer" fires, first try sending a message
to the InjectedBundle, requesting it to "ForceImmediateCompletion". Only if this message fails to be
acted upon will WKTR print the "PID UNRESPONSIVE" message.
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::TestInvocation):
(WTR::TestInvocation::waitToDumpWatchdogTimerFired):
(WTR::TestInvocation::initializeWaitForPostDumpWatchdogTimerIfNeeded):
(WTR::TestInvocation::invalidateWaitForPostDumpWatchdogTimer):
(WTR::TestInvocation::waitForPostDumpWatchdogTimerFired):
(WTR::TestInvocation::done):
* WebKitTestRunner/TestInvocation.h:
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (280618 => 280619)
--- trunk/Tools/ChangeLog 2021-08-03 22:17:14 UTC (rev 280618)
+++ trunk/Tools/ChangeLog 2021-08-03 22:23:44 UTC (rev 280619)
@@ -1,3 +1,31 @@
+2021-08-03 Jer Noble <[email protected]>
+
+ WebKitTestRunner should dump current results in the case of a timeout
+ https://bugs.webkit.org/show_bug.cgi?id=228706
+ <rdar://79154019>
+
+ Reviewed by Jonathan Bedard.
+
+ When WKTR encounters a timeout, it current prints a "PID UNRESPONSIVE" and "FAIL: timed out" message,
+ but the WebContent process may not actually be unresponsive; it may just be waiting for an event
+ which hasn't fired, or a condition to become true. In these cases, it would be very helpful to see
+ the results of the test so far, so as to diagnose what is keeping the test from running to completion.
+
+ When, in the WKTR process, TestInvocation's "waitToDumpWatchdogTimer" fires, first try sending a message
+ to the InjectedBundle, requesting it to "ForceImmediateCompletion". Only if this message fails to be
+ acted upon will WKTR print the "PID UNRESPONSIVE" message.
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::didReceiveMessageToPage):
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::TestInvocation):
+ (WTR::TestInvocation::waitToDumpWatchdogTimerFired):
+ (WTR::TestInvocation::initializeWaitForPostDumpWatchdogTimerIfNeeded):
+ (WTR::TestInvocation::invalidateWaitForPostDumpWatchdogTimer):
+ (WTR::TestInvocation::waitForPostDumpWatchdogTimerFired):
+ (WTR::TestInvocation::done):
+ * WebKitTestRunner/TestInvocation.h:
+
2021-08-03 Jonathan Bedard <[email protected]>
[webkitpy] Narrow set of terminated simulator processes
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (280618 => 280619)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2021-08-03 22:17:14 UTC (rev 280618)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2021-08-03 22:23:44 UTC (rev 280619)
@@ -486,6 +486,11 @@
return;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "ForceImmediateCompletion")) {
+ m_testRunner->forceImmediateCompletion();
+ return;
+ }
+
postPageMessage("Error", "Unknown");
}
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (280618 => 280619)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2021-08-03 22:17:14 UTC (rev 280618)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2021-08-03 22:23:44 UTC (rev 280619)
@@ -80,6 +80,7 @@
: m_options(options)
, m_url(url)
, m_waitToDumpWatchdogTimer(RunLoop::main(), this, &TestInvocation::waitToDumpWatchdogTimerFired)
+ , m_waitForPostDumpWatchdogTimer(RunLoop::main(), this, &TestInvocation::waitForPostDumpWatchdogTimerFired)
{
m_urlString = toWTFString(adoptWK(WKURLCopyString(m_url.get())).get());
@@ -1635,13 +1636,36 @@
void TestInvocation::waitToDumpWatchdogTimerFired()
{
invalidateWaitToDumpWatchdogTimer();
+
+ outputText("FAIL: Timed out waiting for notifyDone to be called\n\n");
+ postPageMessage("ForceImmediateCompletion");
+
+ initializeWaitForPostDumpWatchdogTimerIfNeeded();
+}
+
+void TestInvocation::initializeWaitForPostDumpWatchdogTimerIfNeeded()
+{
+ if (m_waitForPostDumpWatchdogTimer.isActive())
+ return;
+
+ m_waitForPostDumpWatchdogTimer.startOneShot(shortTimeout());
+}
+
+void TestInvocation::invalidateWaitForPostDumpWatchdogTimer()
+{
+ m_waitForPostDumpWatchdogTimer.stop();
+}
+
+void TestInvocation::waitForPostDumpWatchdogTimerFired()
+{
+ invalidateWaitForPostDumpWatchdogTimer();
+
#if PLATFORM(COCOA)
char buffer[1024];
snprintf(buffer, sizeof(buffer), "#PID UNRESPONSIVE - %s (pid %d)\n", getprogname(), getpid());
outputText(buffer);
#endif
- outputText("FAIL: Timed out waiting for notifyDone to be called\n\n");
done();
}
@@ -1656,6 +1680,7 @@
{
m_gotFinalMessage = true;
invalidateWaitToDumpWatchdogTimer();
+ invalidateWaitForPostDumpWatchdogTimer();
RunLoop::main().dispatch([] {
TestController::singleton().notifyDone();
});
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.h (280618 => 280619)
--- trunk/Tools/WebKitTestRunner/TestInvocation.h 2021-08-03 22:17:14 UTC (rev 280618)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.h 2021-08-03 22:23:44 UTC (rev 280619)
@@ -114,6 +114,10 @@
void initializeWaitToDumpWatchdogTimerIfNeeded();
void invalidateWaitToDumpWatchdogTimer();
+ void waitForPostDumpWatchdogTimerFired();
+ void initializeWaitForPostDumpWatchdogTimerIfNeeded();
+ void invalidateWaitForPostDumpWatchdogTimer();
+
void done();
void setWaitUntilDone(bool);
@@ -145,6 +149,7 @@
WKRetainPtr<WKURLRef> m_url;
String m_urlString;
RunLoop::Timer<TestInvocation> m_waitToDumpWatchdogTimer;
+ RunLoop::Timer<TestInvocation> m_waitForPostDumpWatchdogTimer;
std::string m_expectedPixelHash;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes