Ignore:
Timestamp:
Sep 4, 2013, 11:34:58 PM (12 years ago)
Author:
[email protected]
Message:

jsc tests should have timeouts
https://bugs.webkit.org/show_bug.cgi?id=120725

Source/JavaScriptCore:

Reviewed by Geoffrey Garen.

Add the timeout logic directly to 'jsc' because that's easier to do than
writing shell/perl code for it.

  • jsc.cpp:

(timeoutThreadMain):
(main):

Tools:

Reviewed by Geoffrey Garen.

Set the timeout to 20 seconds per test for now.

  • Scripts/run-javascriptcore-tests:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jsc.cpp

    r155090 r155098  
    519519int jscmain(int argc, char** argv);
    520520
     521static double s_desiredTimeout;
     522static double s_timeToWake;
     523
     524static NO_RETURN_DUE_TO_CRASH void timeoutThreadMain(void*)
     525{
     526    // WTF doesn't provide for a portable sleep(), so we use the ThreadCondition, which
     527    // is close enough.
     528    Mutex mutex;
     529    ThreadCondition condition;
     530    mutex.lock();
     531    while (currentTime() < s_timeToWake)
     532        condition.timedWait(mutex, s_timeToWake);
     533   
     534    dataLog("Timed out after ", s_desiredTimeout, " seconds!\n");
     535    CRASH();
     536}
     537
    521538int main(int argc, char** argv)
    522539{
     
    567584#endif
    568585    JSC::initializeThreading();
     586   
     587    if (char* timeoutString = getenv("JSC_timeout")) {
     588        if (sscanf(timeoutString, "%lf", &s_desiredTimeout) != 1) {
     589            dataLog(
     590                "WARNING: timeout string is malformed, got ", timeoutString,
     591                " but expected a number. Not using a timeout.\n");
     592        } else {
     593            s_timeToWake = currentTime() + s_desiredTimeout;
     594            createThread(timeoutThreadMain, 0, "jsc Timeout Thread");
     595        }
     596    }
    569597
    570598    // We can't use destructors in the following code because it uses Windows
Note: See TracChangeset for help on using the changeset viewer.