suppress false positives in ufuzz (#4577)
This commit is contained in:
@@ -235,17 +235,26 @@ function run_code_exec(code, toplevel, timeout) {
|
|||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
var msg = ex.message.replace(/\r\n/g, "\n");
|
var msg = ex.message.replace(/\r\n/g, "\n");
|
||||||
if (/ETIMEDOUT/.test(msg)) return new Error("Script execution timed out.");
|
if (/ETIMEDOUT/.test(msg)) return new Error("Script execution timed out.");
|
||||||
var value = msg.slice(msg.indexOf("\n") + 1, msg.indexOf("\n\n-----===== UNCAUGHT EXCEPTION =====-----\n\n"));
|
var end = msg.indexOf("\n\n-----===== UNCAUGHT EXCEPTION =====-----\n\n");
|
||||||
try {
|
var details;
|
||||||
value = vm.runInNewContext("(" + value.replace(/<([1-9][0-9]*) empty items?>/g, function(match, count) {
|
if (end >= 0) {
|
||||||
|
var start = msg.indexOf("\n") + 1;
|
||||||
|
details = msg.slice(start, end).replace(/<([1-9][0-9]*) empty items?>/g, function(match, count) {
|
||||||
return new Array(+count).join();
|
return new Array(+count).join();
|
||||||
}) + ")");
|
});
|
||||||
} catch (e) {}
|
try {
|
||||||
|
details = vm.runInNewContext("(" + details + ")");
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
var match = /\n([^:\s]*Error)(?:: ([\s\S]+?))?\n( at [\s\S]+)\n$/.exec(msg);
|
var match = /\n([^:\s]*Error)(?:: ([\s\S]+?))?\n( at [\s\S]+)\n$/.exec(msg);
|
||||||
if (!match) return value;
|
if (!match) return details;
|
||||||
ex = new global[match[1]](match[2]);
|
ex = new global[match[1]](match[2]);
|
||||||
ex.stack = ex.stack.slice(0, ex.stack.indexOf(" at ")) + match[3];
|
ex.stack = ex.stack.slice(0, ex.stack.indexOf(" at ")) + match[3];
|
||||||
for (var name in value) ex[name] = value[name];
|
if (typeof details == "object") {
|
||||||
|
for (var name in details) ex[name] = details[name];
|
||||||
|
} else if (end >= 0) {
|
||||||
|
ex.details = details;
|
||||||
|
}
|
||||||
return ex;
|
return ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1761,11 +1761,10 @@ function sort_globals(code) {
|
|||||||
errorln("//-------------------------------------------------------------");
|
errorln("//-------------------------------------------------------------");
|
||||||
errorln("// !!! sort_globals() failed !!!");
|
errorln("// !!! sort_globals() failed !!!");
|
||||||
errorln("// expected Array, got:");
|
errorln("// expected Array, got:");
|
||||||
try {
|
if (!sandbox.is_error(globals)) try {
|
||||||
errorln("// " + JSON.stringify(globals));
|
globals = JSON.stringify(globals);
|
||||||
} catch (e) {
|
} catch (e) {}
|
||||||
errorln("// " + globals);
|
errorln(globals);
|
||||||
}
|
|
||||||
errorln("//");
|
errorln("//");
|
||||||
errorln(code);
|
errorln(code);
|
||||||
errorln();
|
errorln();
|
||||||
@@ -1922,6 +1921,7 @@ for (var round = 1; round <= num_iterations; round++) {
|
|||||||
println("original result:");
|
println("original result:");
|
||||||
println(orig_result[0]);
|
println(orig_result[0]);
|
||||||
println();
|
println();
|
||||||
|
// ignore v8 parser bug
|
||||||
if (is_bug_async_arrow_rest(orig_result[0])) continue;
|
if (is_bug_async_arrow_rest(orig_result[0])) continue;
|
||||||
}
|
}
|
||||||
minify_options.forEach(function(options) {
|
minify_options.forEach(function(options) {
|
||||||
@@ -1934,6 +1934,8 @@ for (var round = 1; round <= num_iterations; round++) {
|
|||||||
uglify_code = uglify_code.code;
|
uglify_code = uglify_code.code;
|
||||||
uglify_result = sandbox.run_code(uglify_code, toplevel);
|
uglify_result = sandbox.run_code(uglify_code, toplevel);
|
||||||
ok = sandbox.same_stdout(original_result, uglify_result);
|
ok = sandbox.same_stdout(original_result, uglify_result);
|
||||||
|
// ignore v8 parser bug
|
||||||
|
if (!ok && is_bug_async_arrow_rest(uglify_result)) ok = true;
|
||||||
// ignore declaration order of global variables
|
// ignore declaration order of global variables
|
||||||
if (!ok && !toplevel) {
|
if (!ok && !toplevel) {
|
||||||
ok = sandbox.same_stdout(sandbox.run_code(sort_globals(original_code)), sandbox.run_code(sort_globals(uglify_code)));
|
ok = sandbox.same_stdout(sandbox.run_code(sort_globals(original_code)), sandbox.run_code(sort_globals(uglify_code)));
|
||||||
|
|||||||
Reference in New Issue
Block a user