aboutsummaryrefslogtreecommitdiff
path: root/test/ufuzz/index.js
diff options
context:
space:
mode:
authorkzc <kzc@users.noreply.github.com>2020-02-05 21:50:59 -0500
committerGitHub <noreply@github.com>2020-02-06 02:50:59 +0000
commitb0040ba6540232687204d125eff021adf11c4efa (patch)
treee11d708d5a194fb8a498ef9934f4c2e16bcb0007 /test/ufuzz/index.js
parentc93ca6ee5386f824e60bea6563d249c13854f171 (diff)
downloadtracifyjs-b0040ba6540232687204d125eff021adf11c4efa.tar.gz
tracifyjs-b0040ba6540232687204d125eff021adf11c4efa.zip
implement CLI `--reduce-test` and reduce tests in ufuzz (#3705)
Diffstat (limited to 'test/ufuzz/index.js')
-rw-r--r--test/ufuzz/index.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js
index 36224667..7032fc3c 100644
--- a/test/ufuzz/index.js
+++ b/test/ufuzz/index.js
@@ -10,6 +10,7 @@ require("../../tools/exit");
var UglifyJS = require("../..");
var randomBytes = require("crypto").randomBytes;
var sandbox = require("../sandbox");
+var reduce_test = require("../reduce");
var MAX_GENERATED_TOPLEVELS_PER_RUN = 1;
var MAX_GENERATION_RECURSION_DEPTH = 12;
@@ -1051,6 +1052,7 @@ function log_rename(options) {
}
function log(options) {
+ var options_copy = JSON.parse(options);
options = JSON.parse(options);
if (!ok) errorln("\n\n\n\n\n\n!!!!!!!!!!\n\n\n");
errorln("//=============================================================");
@@ -1069,6 +1071,18 @@ function log(options) {
errorln(original_result);
errorln("uglified result:");
errorln(uglify_result);
+ errorln("//-------------------------------------------------------------");
+ var reduced = reduce_test(original_code, options_copy, {
+ verbose: false,
+ }).code;
+ if (reduced) {
+ errorln();
+ errorln("// reduced test case (output will differ)");
+ errorln();
+ errorln(reduced);
+ errorln();
+ errorln("//-------------------------------------------------------------");
+ }
} else {
errorln("// !!! uglify failed !!!");
errorln(uglify_code);