Title: [208925] trunk
Revision
208925
Author
[email protected]
Date
2016-11-19 09:39:25 -0800 (Sat, 19 Nov 2016)

Log Message

Add --timeoutMultiplier option to allow some tests more time to run.
https://bugs.webkit.org/show_bug.cgi?id=164951

Reviewed by Yusuke Suzuki.

JSTests:

Extended the timeout for these tests by 50% more because they run quite slow on
low-end machines.

* stress/op_div-ConstVar.js:
* stress/op_div-VarConst.js:
* stress/op_div-VarVar.js:

Source/_javascript_Core:

* jsc.cpp:
(timeoutThreadMain):
- Modified to factor in a timeout multiplier that can adjust the timeout duration.
(startTimeoutThreadIfNeeded):
- Moved the code that starts the timeout thread here from main() so that we can
call it after command line args have been parsed instead.
(main):
- Deleted old timeout thread starting code.
(CommandLine::parseArguments):
- Added parsing of the --timeoutMultiplier option.
(jscmain):
- Start the timeout thread if needed after we've parsed the command line args.

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (208924 => 208925)


--- trunk/JSTests/ChangeLog	2016-11-19 08:08:03 UTC (rev 208924)
+++ trunk/JSTests/ChangeLog	2016-11-19 17:39:25 UTC (rev 208925)
@@ -1,3 +1,17 @@
+2016-11-19  Mark Lam  <[email protected]>
+
+        Add --timeoutMultiplier option to allow some tests more time to run.
+        https://bugs.webkit.org/show_bug.cgi?id=164951
+
+        Reviewed by Yusuke Suzuki.
+
+        Extended the timeout for these tests by 50% more because they run quite slow on
+        low-end machines.
+
+        * stress/op_div-ConstVar.js:
+        * stress/op_div-VarConst.js:
+        * stress/op_div-VarVar.js:
+
 2016-11-18  Yusuke Suzuki  <[email protected]>
 
         REGRESSION(r208867): JSC test failure: ChakraCore.yaml/ChakraCore/test/strict/05.arguments_sm.js.default

Modified: trunk/JSTests/stress/op_div-ConstVar.js (208924 => 208925)


--- trunk/JSTests/stress/op_div-ConstVar.js	2016-11-19 08:08:03 UTC (rev 208924)
+++ trunk/JSTests/stress/op_div-ConstVar.js	2016-11-19 17:39:25 UTC (rev 208925)
@@ -1,4 +1,4 @@
-//@ runFTLNoCJIT
+//@ runFTLNoCJIT("--timeoutMultiplier=1.5")
 
 // If all goes well, this test module will terminate silently. If not, it will print
 // errors. See binary-op-test.js for debugging options if needed.

Modified: trunk/JSTests/stress/op_div-VarConst.js (208924 => 208925)


--- trunk/JSTests/stress/op_div-VarConst.js	2016-11-19 08:08:03 UTC (rev 208924)
+++ trunk/JSTests/stress/op_div-VarConst.js	2016-11-19 17:39:25 UTC (rev 208925)
@@ -1,4 +1,4 @@
-//@ runFTLNoCJIT
+//@ runFTLNoCJIT("--timeoutMultiplier=1.5")
 
 // If all goes well, this test module will terminate silently. If not, it will print
 // errors. See binary-op-test.js for debugging options if needed.

Modified: trunk/JSTests/stress/op_div-VarVar.js (208924 => 208925)


--- trunk/JSTests/stress/op_div-VarVar.js	2016-11-19 08:08:03 UTC (rev 208924)
+++ trunk/JSTests/stress/op_div-VarVar.js	2016-11-19 17:39:25 UTC (rev 208925)
@@ -1,4 +1,4 @@
-//@ runFTLNoCJIT
+//@ runFTLNoCJIT("--timeoutMultiplier=1.5")
 
 // If all goes well, this test module will terminate silently. If not, it will print
 // errors. See binary-op-test.js for debugging options if needed.

Modified: trunk/Source/_javascript_Core/ChangeLog (208924 => 208925)


--- trunk/Source/_javascript_Core/ChangeLog	2016-11-19 08:08:03 UTC (rev 208924)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-11-19 17:39:25 UTC (rev 208925)
@@ -1,5 +1,25 @@
 2016-11-19  Mark Lam  <[email protected]>
 
+        Add --timeoutMultiplier option to allow some tests more time to run.
+        https://bugs.webkit.org/show_bug.cgi?id=164951
+
+        Reviewed by Yusuke Suzuki.
+
+        * jsc.cpp:
+        (timeoutThreadMain):
+        - Modified to factor in a timeout multiplier that can adjust the timeout duration.
+        (startTimeoutThreadIfNeeded):
+        - Moved the code that starts the timeout thread here from main() so that we can
+        call it after command line args have been parsed instead.
+        (main):
+        - Deleted old timeout thread starting code.
+        (CommandLine::parseArguments):
+        - Added parsing of the --timeoutMultiplier option.
+        (jscmain):
+        - Start the timeout thread if needed after we've parsed the command line args.
+
+2016-11-19  Mark Lam  <[email protected]>
+
         Fix missing exception checks in JSC inspector files.
         https://bugs.webkit.org/show_bug.cgi?id=164959
 

Modified: trunk/Source/_javascript_Core/jsc.cpp (208924 => 208925)


--- trunk/Source/_javascript_Core/jsc.cpp	2016-11-19 08:08:03 UTC (rev 208924)
+++ trunk/Source/_javascript_Core/jsc.cpp	2016-11-19 17:39:25 UTC (rev 208925)
@@ -2598,16 +2598,27 @@
 int jscmain(int argc, char** argv);
 
 static double s_desiredTimeout;
+static double s_timeoutMultiplier = 1.0;
 
 static NO_RETURN_DUE_TO_CRASH void timeoutThreadMain(void*)
 {
-    auto timeout = std::chrono::microseconds(static_cast<std::chrono::microseconds::rep>(s_desiredTimeout * 1000000));
-    std::this_thread::sleep_for(timeout);
-    
-    dataLog("Timed out after ", s_desiredTimeout, " seconds!\n");
+    Seconds timeoutDuration(s_desiredTimeout * s_timeoutMultiplier);
+    sleep(timeoutDuration);
+    dataLog("Timed out after ", timeoutDuration, " seconds!\n");
     CRASH();
 }
 
+static void startTimeoutThreadIfNeeded()
+{
+    if (char* timeoutString = getenv("JSCTEST_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
+            createThread(timeoutThreadMain, 0, "jsc Timeout Thread");
+    }
+}
+
 int main(int argc, char** argv)
 {
 #if PLATFORM(IOS) && CPU(ARM_THUMB2)
@@ -2650,15 +2661,6 @@
     // have a chance to parse options.
     WTF::initializeThreading();
 
-    if (char* timeoutString = getenv("JSCTEST_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
-            createThread(timeoutThreadMain, 0, "jsc Timeout Thread");
-    }
-
 #if PLATFORM(IOS)
     Options::crashIfCantAllocateJITMemory() = true;
 #endif
@@ -3010,6 +3012,15 @@
             continue;
         }
 
+        static const char* timeoutMultiplierOptStr = "--timeoutMultiplier=";
+        static const unsigned timeoutMultiplierOptStrLength = strlen(timeoutMultiplierOptStr);
+        if (!strncmp(arg, timeoutMultiplierOptStr, timeoutMultiplierOptStrLength)) {
+            const char* valueStr = &arg[timeoutMultiplierOptStrLength];
+            if (sscanf(valueStr, "%lf", &s_timeoutMultiplier) != 1)
+                dataLog("WARNING: --timeoutMultiplier=", valueStr, " is invalid. Expects a numeric ratio.\n");
+            continue;
+        }
+
         if (!strcmp(arg, "--test262-async")) {
             test262AsyncTest = true;
             continue;
@@ -3136,6 +3147,7 @@
     // Initialize JSC before getting VM.
     WTF::initializeMainThread();
     JSC::initializeThreading();
+    startTimeoutThreadIfNeeded();
 
     VM* vm = &VM::create(LargeHeap).leakRef();
     int result;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to