aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-10-30 03:06:48 +0000
committerGitHub <noreply@github.com>2020-10-30 11:06:48 +0800
commitd8563caba714bc8abf22a464a2cbc0e29aeaf434 (patch)
treeb5b442b9b3fc75b32407b909ad76969ee5bbe891
parent2e0ad40fe6635f7754a3e4dcdfb3b5bff75f4ae5 (diff)
downloadtracifyjs-d8563caba714bc8abf22a464a2cbc0e29aeaf434.tar.gz
tracifyjs-d8563caba714bc8abf22a464a2cbc0e29aeaf434.zip
improve resilience against spurious time-outs (#4252)
-rw-r--r--test/reduce.js2
-rw-r--r--test/ufuzz/index.js7
2 files changed, 7 insertions, 2 deletions
diff --git a/test/reduce.js b/test/reduce.js
index ec1fb0bc..ab742af4 100644
--- a/test/reduce.js
+++ b/test/reduce.js
@@ -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) {
diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js
index 5f6a3de8..1ebc655b 100644
--- a/test/ufuzz/index.js
+++ b/test/ufuzz/index.js
@@ -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) {