⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 280619 in webkit


Ignore:
Timestamp:
Aug 3, 2021, 3:23:44 PM (5 years ago)
Author:
jer.noble@apple.com
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:
Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r280618 r280619  
     12021-08-03  Jer Noble  <jer.noble@apple.com>
     2
     3        WebKitTestRunner should dump current results in the case of a timeout
     4        https://bugs.webkit.org/show_bug.cgi?id=228706
     5        <rdar://79154019>
     6
     7        Reviewed by Jonathan Bedard.
     8
     9        When WKTR encounters a timeout, it current prints a "PID UNRESPONSIVE" and "FAIL: timed out" message,
     10        but the WebContent process may not actually be unresponsive; it may just be waiting for an event
     11        which hasn't fired, or a condition to become true. In these cases, it would be very helpful to see
     12        the results of the test so far, so as to diagnose what is keeping the test from running to completion.
     13
     14        When, in the WKTR process, TestInvocation's "waitToDumpWatchdogTimer" fires, first try sending a message
     15        to the InjectedBundle, requesting it to "ForceImmediateCompletion". Only if this message fails to be
     16        acted upon will WKTR print the "PID UNRESPONSIVE" message.
     17
     18        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
     19        (WTR::InjectedBundle::didReceiveMessageToPage):
     20        * WebKitTestRunner/TestInvocation.cpp:
     21        (WTR::TestInvocation::TestInvocation):
     22        (WTR::TestInvocation::waitToDumpWatchdogTimerFired):
     23        (WTR::TestInvocation::initializeWaitForPostDumpWatchdogTimerIfNeeded):
     24        (WTR::TestInvocation::invalidateWaitForPostDumpWatchdogTimer):
     25        (WTR::TestInvocation::waitForPostDumpWatchdogTimerFired):
     26        (WTR::TestInvocation::done):
     27        * WebKitTestRunner/TestInvocation.h:
     28
    1292021-08-03  Jonathan Bedard  <jbedard@apple.com>
    230
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp

    r280288 r280619  
    487487    }
    488488
     489    if (WKStringIsEqualToUTF8CString(messageName, "ForceImmediateCompletion")) {
     490        m_testRunner->forceImmediateCompletion();
     491        return;
     492    }
     493
    489494    postPageMessage("Error", "Unknown");
    490495}
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r280288 r280619  
    8181    , m_url(url)
    8282    , m_waitToDumpWatchdogTimer(RunLoop::main(), this, &TestInvocation::waitToDumpWatchdogTimerFired)
     83    , m_waitForPostDumpWatchdogTimer(RunLoop::main(), this, &TestInvocation::waitForPostDumpWatchdogTimerFired)
    8384{
    8485    m_urlString = toWTFString(adoptWK(WKURLCopyString(m_url.get())).get());
     
    16361637{
    16371638    invalidateWaitToDumpWatchdogTimer();
     1639   
     1640    outputText("FAIL: Timed out waiting for notifyDone to be called\n\n");
     1641
     1642    postPageMessage("ForceImmediateCompletion");
     1643
     1644    initializeWaitForPostDumpWatchdogTimerIfNeeded();
     1645}
     1646
     1647void TestInvocation::initializeWaitForPostDumpWatchdogTimerIfNeeded()
     1648{
     1649    if (m_waitForPostDumpWatchdogTimer.isActive())
     1650        return;
     1651
     1652    m_waitForPostDumpWatchdogTimer.startOneShot(shortTimeout());
     1653}
     1654
     1655void TestInvocation::invalidateWaitForPostDumpWatchdogTimer()
     1656{
     1657    m_waitForPostDumpWatchdogTimer.stop();
     1658}
     1659
     1660void TestInvocation::waitForPostDumpWatchdogTimerFired()
     1661{
     1662    invalidateWaitForPostDumpWatchdogTimer();
    16381663
    16391664#if PLATFORM(COCOA)
     
    16421667    outputText(buffer);
    16431668#endif
    1644     outputText("FAIL: Timed out waiting for notifyDone to be called\n\n");
    16451669    done();
    16461670}
     
    16571681    m_gotFinalMessage = true;
    16581682    invalidateWaitToDumpWatchdogTimer();
     1683    invalidateWaitForPostDumpWatchdogTimer();
    16591684    RunLoop::main().dispatch([] {
    16601685        TestController::singleton().notifyDone();
  • trunk/Tools/WebKitTestRunner/TestInvocation.h

    r279750 r280619  
    115115    void invalidateWaitToDumpWatchdogTimer();
    116116
     117    void waitForPostDumpWatchdogTimerFired();
     118    void initializeWaitForPostDumpWatchdogTimerIfNeeded();
     119    void invalidateWaitForPostDumpWatchdogTimer();
     120   
    117121    void done();
    118122    void setWaitUntilDone(bool);
     
    146150    String m_urlString;
    147151    RunLoop::Timer<TestInvocation> m_waitToDumpWatchdogTimer;
     152    RunLoop::Timer<TestInvocation> m_waitForPostDumpWatchdogTimer;
    148153
    149154    std::string m_expectedPixelHash;
Note: See TracChangeset for help on using the changeset viewer.