aboutsummaryrefslogtreecommitdiff
path: root/test/ufuzz/index.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-02-08 12:17:14 +0000
committerGitHub <noreply@github.com>2021-02-08 20:17:14 +0800
commitaedc1e7fc9cab772734d559e149c0b4f70454321 (patch)
treec7f80daf67a11012bd94d71c6adee9761c6fe089 /test/ufuzz/index.js
parent353f654038381bc96a7cb770013e0b52b10694e6 (diff)
downloadtracifyjs-aedc1e7fc9cab772734d559e149c0b4f70454321.tar.gz
tracifyjs-aedc1e7fc9cab772734d559e149c0b4f70454321.zip
improve false positive detection in `ufuzz` (#4626)
Diffstat (limited to 'test/ufuzz/index.js')
-rw-r--r--test/ufuzz/index.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js
index 58228bdb..cfe35afd 100644
--- a/test/ufuzz/index.js
+++ b/test/ufuzz/index.js
@@ -2070,27 +2070,28 @@ for (var round = 1; round <= num_iterations; round++) {
original_code = createTopLevelCode();
var orig_result = [ sandbox.run_code(original_code), sandbox.run_code(original_code, true) ];
- errored = typeof orig_result[0] != "string";
- if (errored) {
+ if (orig_result.some(function(result, toplevel) {
+ if (typeof result == "string") return;
println();
println();
println("//=============================================================");
- println("// original code");
- try_beautify(original_code, false, orig_result[0], println);
+ println("// original code" + (toplevel ? " (toplevel)" : ""));
+ try_beautify(original_code, toplevel, result, println);
println();
println();
println("original result:");
- println(orig_result[0]);
+ println(result);
println();
// ignore v8 parser bug
- if (is_bug_async_arrow_rest(orig_result[0])) continue;
- }
+ return is_bug_async_arrow_rest(result);
+ })) continue;
minify_options.forEach(function(options) {
var o = JSON.parse(options);
var toplevel = sandbox.has_toplevel(o);
o.validate = true;
uglify_code = UglifyJS.minify(original_code, o);
original_result = orig_result[toplevel ? 1 : 0];
+ errored = typeof original_result != "string";
if (!uglify_code.error) {
uglify_code = uglify_code.code;
uglify_result = sandbox.run_code(uglify_code, toplevel);