Title: [155098] trunk
Revision
155098
Author
[email protected]
Date
2013-09-04 23:34:58 -0700 (Wed, 04 Sep 2013)

Log Message

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

Source/_javascript_Core: 

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-_javascript_core-tests:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (155097 => 155098)


--- trunk/Source/_javascript_Core/ChangeLog	2013-09-05 06:32:35 UTC (rev 155097)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-09-05 06:34:58 UTC (rev 155098)
@@ -1,5 +1,19 @@
 2013-09-04  Filip Pizlo  <[email protected]>
 
+        jsc tests should have timeouts
+        https://bugs.webkit.org/show_bug.cgi?id=120725
+
+        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):
+
+2013-09-04  Filip Pizlo  <[email protected]>
+
         fast/js/dfg-* tests should wait for the concurrent JIT
         https://bugs.webkit.org/show_bug.cgi?id=120723
 

Modified: trunk/Source/_javascript_Core/jsc.cpp (155097 => 155098)


--- trunk/Source/_javascript_Core/jsc.cpp	2013-09-05 06:32:35 UTC (rev 155097)
+++ trunk/Source/_javascript_Core/jsc.cpp	2013-09-05 06:34:58 UTC (rev 155098)
@@ -518,6 +518,23 @@
 
 int jscmain(int argc, char** argv);
 
+static double s_desiredTimeout;
+static double s_timeToWake;
+
+static NO_RETURN_DUE_TO_CRASH void timeoutThreadMain(void*)
+{
+    // WTF doesn't provide for a portable sleep(), so we use the ThreadCondition, which
+    // is close enough.
+    Mutex mutex;
+    ThreadCondition condition;
+    mutex.lock();
+    while (currentTime() < s_timeToWake)
+        condition.timedWait(mutex, s_timeToWake);
+    
+    dataLog("Timed out after ", s_desiredTimeout, " seconds!\n");
+    CRASH();
+}
+
 int main(int argc, char** argv)
 {
 #if PLATFORM(IOS)
@@ -566,6 +583,17 @@
     WTF::initializeMainThread();
 #endif
     JSC::initializeThreading();
+    
+    if (char* timeoutString = getenv("JSC_timeout")) {
+        if (sscanf(timeoutString, "%lf", &s_desiredTimeout) != 1) {
+            dataLog(
+                "WARNING: timeout string is malformed, got ", timeoutString,
+                " but expected a number. Not using a timeout.\n");
+        } else {
+            s_timeToWake = currentTime() + s_desiredTimeout;
+            createThread(timeoutThreadMain, 0, "jsc Timeout Thread");
+        }
+    }
 
     // We can't use destructors in the following code because it uses Windows
     // Structured Exception Handling

Modified: trunk/Tools/ChangeLog (155097 => 155098)


--- trunk/Tools/ChangeLog	2013-09-05 06:32:35 UTC (rev 155097)
+++ trunk/Tools/ChangeLog	2013-09-05 06:34:58 UTC (rev 155098)
@@ -1,5 +1,16 @@
 2013-09-04  Filip Pizlo  <[email protected]>
 
+        jsc tests should have timeouts
+        https://bugs.webkit.org/show_bug.cgi?id=120725
+
+        Reviewed by Geoffrey Garen.
+        
+        Set the timeout to 20 seconds per test for now.
+
+        * Scripts/run-_javascript_core-tests:
+
+2013-09-04  Filip Pizlo  <[email protected]>
+
         run-_javascript_core-tests should run-fast-jsc as well
         https://bugs.webkit.org/show_bug.cgi?id=120722
 

Modified: trunk/Tools/Scripts/run-_javascript_core-tests (155097 => 155098)


--- trunk/Tools/Scripts/run-_javascript_core-tests	2013-09-05 06:32:35 UTC (rev 155097)
+++ trunk/Tools/Scripts/run-_javascript_core-tests	2013-09-05 06:34:58 UTC (rev 155098)
@@ -115,6 +115,7 @@
 
 my $productDir = jscProductDir();
 $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
+$ENV{JSC_timeout} = 20; # Set a 20 second timeout on all jsc tests.
 setPathForRunningWebKitApp(\%ENV) if isCygwin();
 
 sub testapiPath($)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to