Changeset 177870 in webkit


Ignore:
Timestamp:
Jan 2, 2015 2:49:44 PM (9 years ago)
Author:
ap@apple.com
Message:

Simplify WebKitTestRunner timeout tracking
https://bugs.webkit.org/show_bug.cgi?id=140036

Reviewed by Darin Adler.

The code for configuring timeouts was mostly dead, because run-webkit-tests never
passes the --timeout option to WebKitTestRunner.

  • WebKitTestRunner/Options.h:
  • WebKitTestRunner/Options.cpp:

(WTR::Options::Options):
(WTR::OptionsHandler::OptionsHandler):
(WTR::handleOptionTimeout): Deleted.
Removed support for --timeout. Timeouts are passed for each test individually,
and defaults are good enough for the rare cases where WebKitTestRunner is run
manually without run-webkit-tests.

  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::TestController):
(WTR::TestController::initialize):
(WTR::TestController::resetStateToConsistentValues):
(WTR::TestController::reattachPageToWebProcess):
(WTR::TestController::runUntil):

  • WebKitTestRunner/TestController.h:

Simplified runUntil by passing the actual timeout, not an enum.
Increased short timeout for ASan enabled builds, as WebProcess launching takes
quite a while.

  • WebKitTestRunner/TestInvocation.cpp:

(WTR::TestInvocation::invoke): Removed dead code that handled a timeout from NoTimeout.

  • WebKitTestRunner/efl/TestControllerEfl.cpp:

(WTR::TestController::platformRunUntil):

  • WebKitTestRunner/gtk/TestControllerGtk.cpp:

(WTR::TestController::platformRunUntil):
Build fixes.

Location:
trunk/Tools
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r177868 r177870  
     12015-01-01  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Simplify WebKitTestRunner timeout tracking
     4        https://bugs.webkit.org/show_bug.cgi?id=140036
     5
     6        Reviewed by Darin Adler.
     7
     8        The code for configuring timeouts was mostly dead, because run-webkit-tests never
     9        passes the --timeout option to WebKitTestRunner.
     10
     11        * WebKitTestRunner/Options.h:
     12        * WebKitTestRunner/Options.cpp:
     13        (WTR::Options::Options):
     14        (WTR::OptionsHandler::OptionsHandler):
     15        (WTR::handleOptionTimeout): Deleted.
     16        Removed support for --timeout. Timeouts are passed for each test individually,
     17        and defaults are good enough for the rare cases where WebKitTestRunner is run
     18        manually without run-webkit-tests.
     19
     20        * WebKitTestRunner/TestController.cpp:
     21        (WTR::TestController::TestController):
     22        (WTR::TestController::initialize):
     23        (WTR::TestController::resetStateToConsistentValues):
     24        (WTR::TestController::reattachPageToWebProcess):
     25        (WTR::TestController::runUntil):
     26        * WebKitTestRunner/TestController.h:
     27        Simplified runUntil by passing the actual timeout, not an enum.
     28        Increased short timeout for ASan enabled builds, as WebProcess launching takes
     29        quite a while.
     30
     31        * WebKitTestRunner/TestInvocation.cpp:
     32        (WTR::TestInvocation::invoke): Removed dead code that handled a timeout from NoTimeout.
     33
     34        * WebKitTestRunner/efl/TestControllerEfl.cpp:
     35        (WTR::TestController::platformRunUntil):
     36        * WebKitTestRunner/gtk/TestControllerGtk.cpp:
     37        (WTR::TestController::platformRunUntil):
     38        Build fixes.
     39
    1402015-01-02  Anders Carlsson  <andersca@apple.com>
    241
  • trunk/Tools/WebKitTestRunner/Options.cpp

    r160627 r177870  
    3232namespace WTR {
    3333
    34 Options::Options(double defaultLongTimeout, double defaultShortTimeout)
    35     : longTimeout(defaultLongTimeout)
    36     , shortTimeout(defaultShortTimeout)
    37     , useWaitToDumpWatchdogTimer(true)
     34Options::Options()
     35    : useWaitToDumpWatchdogTimer(true)
    3836    , forceNoTimeout(false)
    3937    , verbose(false)
     
    4442    , shouldUseAcceleratedDrawing(false)
    4543    , shouldUseRemoteLayerTree(false)
    46     , defaultLongTimeout(defaultLongTimeout)
    47     , defaultShortTimeout(defaultShortTimeout)
    4844{
    49 }
    50 
    51 bool handleOptionTimeout(Options& options, const char*, const char* argument)
    52 {
    53     options.longTimeout = atoi(argument);
    54     // Scale up the short timeout to match.
    55     options.shortTimeout = options.defaultShortTimeout * options.longTimeout / options.defaultLongTimeout;
    56     return true;
    5745}
    5846
     
    123111    : options(o)
    124112{
    125     optionList.append(Option("--timeout", "Sets long timeout to <param> and scales short timeout.", handleOptionTimeout, true));
    126     optionList.append(Option("--no-timeout", "Disables timeout.", handleOptionNoTimeout));
     113    optionList.append(Option("--no-timeout", "Disables waitUntilDone timeout.", handleOptionNoTimeout));
    127114    optionList.append(Option("--no-timeout-at-all", "Disables all timeouts.", handleOptionNoTimeoutAtAll));
    128115    optionList.append(Option("--verbose", "Turns on messages.", handleOptionVerbose));
  • trunk/Tools/WebKitTestRunner/Options.h

    r160627 r177870  
    3737
    3838struct Options {
    39     Options(double, double);
    40     double longTimeout;
    41     double shortTimeout;
     39    Options();
    4240    bool useWaitToDumpWatchdogTimer;
    4341    bool forceNoTimeout;
     
    5048    bool shouldUseRemoteLayerTree;
    5149    std::vector<std::string> paths;
    52     double defaultLongTimeout;
    53     double defaultShortTimeout;
    5450};
    5551
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r177774 r177870  
    7171const unsigned TestController::w3cSVGViewHeight = 360;
    7272
    73 // defaultLongTimeout + defaultShortTimeout should be less than 35,
    74 // the default timeout value of the test harness so we can detect an
    75 // unresponsive web process.
    76 // These values are only used by ports that don't have --timeout option passed to WebKitTestRunner.
    77 static const double defaultLongTimeout = 25;
    78 static const double defaultShortTimeout = 5;
    79 static const double defaultNoTimeout = -1;
     73#if defined(__has_feature)
     74#if __has_feature(address_sanitizer)
     75const double TestController::shortTimeout = 10.0;
     76#else
     77const double TestController::shortTimeout = 5.0;
     78#endif
     79#else
     80const double TestController::shortTimeout = 5.0;
     81#endif
     82
     83const double TestController::noTimeout = -1;
    8084
    8185static WKURLRef blankURL()
     
    107111    , m_state(Initial)
    108112    , m_doneResetting(false)
    109     , m_longTimeout(defaultLongTimeout)
    110     , m_shortTimeout(defaultShortTimeout)
    111     , m_noTimeout(defaultNoTimeout)
    112113    , m_useWaitToDumpWatchdogTimer(true)
    113114    , m_forceNoTimeout(false)
     
    338339    platformInitialize();
    339340
    340     Options options(defaultLongTimeout, defaultShortTimeout);
     341    Options options;
    341342    OptionsHandler optionsHandler(options);
    342343
     
    348349        exit(1);
    349350
    350     m_longTimeout = options.longTimeout;
    351     m_shortTimeout = options.shortTimeout;
    352351    m_useWaitToDumpWatchdogTimer = options.useWaitToDumpWatchdogTimer;
    353352    m_forceNoTimeout = options.forceNoTimeout;
     
    741740
    742741    WKPageLoadURL(m_mainWebView->page(), blankURL());
    743     runUntil(m_doneResetting, ShortTimeout);
     742    runUntil(m_doneResetting, shortTimeout);
    744743    return m_doneResetting;
    745744}
     
    755754    m_doneResetting = false;
    756755    WKPageLoadURL(m_mainWebView->page(), blankURL());
    757     runUntil(m_doneResetting, LongTimeout);
     756    runUntil(m_doneResetting, shortTimeout);
    758757}
    759758
     
    963962}
    964963
    965 void TestController::runUntil(bool& done, TimeoutDuration timeoutDuration)
    966 {
    967     double timeout = m_noTimeout;
    968     if (!m_forceNoTimeout) {
    969         switch (timeoutDuration) {
    970         case ShortTimeout:
    971             timeout = m_shortTimeout;
    972             break;
    973         case LongTimeout:
    974             timeout = m_longTimeout;
    975             break;
    976         case NoTimeout:
    977         default:
    978             timeout = m_noTimeout;
    979             break;
    980         }
    981     }
     964void TestController::runUntil(bool& done, double timeout)
     965{
     966    if (m_forceNoTimeout)
     967        timeout = noTimeout;
    982968
    983969    platformRunUntil(done, timeout);
  • trunk/Tools/WebKitTestRunner/TestController.h

    r177363 r177870  
    5252    static const unsigned w3cSVGViewHeight;
    5353
     54    static const double shortTimeout;
     55    static const double noTimeout;
     56
    5457    TestController(int argc, const char* argv[]);
    5558    ~TestController();
     
    6972   
    7073    // Runs the run loop until `done` is true or the timeout elapses.
    71     enum TimeoutDuration { ShortTimeout, LongTimeout, NoTimeout };
    7274    bool useWaitToDumpWatchdogTimer() { return m_useWaitToDumpWatchdogTimer; }
    73     void runUntil(bool& done, TimeoutDuration);
     75    void runUntil(bool& done, double timeoutSeconds);
    7476    void notifyDone();
    7577   
     
    224226    bool m_doneResetting;
    225227
    226     double m_longTimeout;
    227     double m_shortTimeout;
    228     double m_noTimeout;
    229228    bool m_useWaitToDumpWatchdogTimer;
    230229    bool m_forceNoTimeout;
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r177363 r177870  
    161161    WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), beginTestMessageBody.get());
    162162
    163     TestController::shared().runUntil(m_gotInitialResponse, TestController::ShortTimeout);
     163    TestController::shared().runUntil(m_gotInitialResponse, TestController::shortTimeout);
    164164    if (!m_gotInitialResponse) {
    165165        m_errorMessage = "Timed out waiting for initial response from web process\n";
     
    172172    WKPageLoadURL(TestController::shared().mainWebView()->page(), m_url.get());
    173173
    174     TestController::shared().runUntil(m_gotFinalMessage, TestController::NoTimeout);
    175 
    176     if (!m_gotFinalMessage) {
    177         m_errorMessage = "Timed out waiting for final message from web process\n";
    178         m_webProcessIsUnresponsive = true;
    179         goto end;
    180     }
     174    TestController::shared().runUntil(m_gotFinalMessage, TestController::noTimeout);
    181175    if (m_error)
    182176        goto end;
     
    255249            m_gotRepaint = false;
    256250            WKPageForceRepaint(TestController::shared().mainWebView()->page(), this, TestInvocation::forceRepaintDoneCallback);
    257             TestController::shared().runUntil(m_gotRepaint, TestController::ShortTimeout);
     251            TestController::shared().runUntil(m_gotRepaint, TestController::shortTimeout);
    258252            if (!m_gotRepaint) {
    259253                m_errorMessage = "Timed out waiting for pre-pixel dump repaint\n";
  • trunk/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp

    r168045 r177870  
    7070void TestController::platformRunUntil(bool& condition, double timeout)
    7171{
    72     if (timeout == m_noTimeout) {
     72    if (timeout <= 0) {
    7373        // Never timeout if we are debugging or not meant to timeout.
    7474        while (!condition)
  • trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp

    r176921 r177870  
    5858void TestController::platformRunUntil(bool&, double timeout)
    5959{
    60     if (timeout != m_noTimeout) {
     60    if (timeout > 0) {
    6161        timeoutSource.scheduleAfterDelay("[WTR] Test timeout source", [] {
    6262            fprintf(stderr, "FAIL: TestControllerRunLoop timed out.\n");
Note: See TracChangeset for help on using the changeset viewer.