improve resilience against spurious time-outs (#4252)
authorAlex Lam S.L <alexlamsl@gmail.com>
Fri, 30 Oct 2020 03:06:48 +0000 (03:06 +0000)
committerGitHub <noreply@github.com>
Fri, 30 Oct 2020 03:06:48 +0000 (11:06 +0800)
test/reduce.js
test/ufuzz/index.js

index ec1fb0b..ab742af 100644 (file)
@@ -593,7 +593,7 @@ function is_error(result) {
 }
 
 function is_timed_out(result) {
-    return is_error(result) && /timed out/.test(result);
+    return is_error(result) && /timed out/.test(result.message);
 }
 
 function is_statement(node) {
index 5f6a3de..1ebc655 100644 (file)
@@ -1369,7 +1369,12 @@ for (var round = 1; round <= num_iterations; round++) {
                 }
             }
             // ignore difference in error message caused by Temporal Dead Zone
-            if (!ok && errored) ok = uglify_result.name == "ReferenceError" && original_result.name == "ReferenceError";
+            if (!ok && errored && uglify_result.name == "ReferenceError" && original_result.name == "ReferenceError") ok = true;
+            // ignore spurious time-outs
+            if (!ok && errored && /timed out/.test(original_result.message) && !/timed out/.test(uglify_result.message)) {
+                if (!orig_result[toplevel ? 3 : 2]) orig_result[toplevel ? 3 : 2] = sandbox.run_code(original_code, toplevel, 10000);
+                ok = sandbox.same_stdout(orig_result[toplevel ? 3 : 2], uglify_result);
+            }
             // ignore difference in error message caused by `in`
             // ignore difference in depth of termination caused by infinite recursion
             if (!ok) {