summaryrefslogtreecommitdiff
path: root/test/passes/emit-js-wrapper=a.js.wast.js
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-04-15 15:06:08 -0700
committerGitHub <noreply@github.com>2020-04-15 15:06:08 -0700
commit598b3dffae13a9fc823257d668972c3b4890b2d4 (patch)
treed46f3fa1d641017798077e73875eda5915609269 /test/passes/emit-js-wrapper=a.js.wast.js
parente04d25e2e6cab2df0dfda5e4a206714a202313bc (diff)
downloadbinaryen-598b3dffae13a9fc823257d668972c3b4890b2d4.tar.gz
binaryen-598b3dffae13a9fc823257d668972c3b4890b2d4.tar.bz2
binaryen-598b3dffae13a9fc823257d668972c3b4890b2d4.zip
Enable cross-VM fuzzing + related improvements to fuzz_opt.py (#2762)
The main benefit here is comparing VMs, instead of just comparing each VM to itself after opts. Comparing VMs is a little tricky since there is room for nondeterminism with how results are printed and other annoying things, which is why that didn't work well earlier. With this PR I can run 10's of thousands of iterations without finding any issues between v8 and the binaryen interpreter. That's after fixing the various issues over the last few days as found by this: #2760 #2757 #2750 #2752 Aside from that main benefit I ended up adding more improvements to make it practical to do all that testing: Randomize global fuzz settings like whether we allow NaNs and out-of-bounds memory accesses. (This was necessary here since we have to disable cross-VM comparisons if NaNs are enabled.) Better logging of statistics like how many times each handler was run. Remove redundant FuzzExecImmediately handler (looks like after past refactorings it was no longer adding any value). Deterministic testcase handling: if you run e.g. fuzz_opt.py 42 it will run one testcase and exactly the same one. If you run without an argument it will run forever until it fails, and if it fails, it prints out that ID so that you can easily reproduce it (I guess, on the same binaryen + same python, not sure how python's deterministic RNG changes between versions and builds). Upgrade to Python 3.
Diffstat (limited to 'test/passes/emit-js-wrapper=a.js.wast.js')
-rw-r--r--test/passes/emit-js-wrapper=a.js.wast.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/passes/emit-js-wrapper=a.js.wast.js b/test/passes/emit-js-wrapper=a.js.wast.js
index 2e127d189..60f2449b0 100644
--- a/test/passes/emit-js-wrapper=a.js.wast.js
+++ b/test/passes/emit-js-wrapper=a.js.wast.js
@@ -21,13 +21,13 @@ if (typeof process === 'object' && typeof require === 'function' /* node.js dete
}
}
function literal(x, type) {
- var ret = type + '.const ';
+ var ret = '';
switch (type) {
case 'i32': ret += (x | 0); break;
case 'f32':
case 'f64': {
if (x == 0 && (1 / x) < 0) ret += '-';
- ret += x;
+ ret += Number(x).toString();
break;
}
default: throw 'what?';
@@ -48,36 +48,36 @@ var instance = new WebAssembly.Instance(new WebAssembly.Module(binary), {
});
if (instance.exports.hangLimitInitializer) instance.exports.hangLimitInitializer();
try {
- console.log('[fuzz-exec] calling $add');
- console.log('[fuzz-exec] note result: $add => ' + literal(instance.exports.add(0, 0), 'i32'));
+ console.log('[fuzz-exec] calling add');
+ console.log('[fuzz-exec] note result: add => ' + literal(instance.exports.add(0, 0), 'i32'));
} catch (e) {
console.log('exception!' /* + e */);
}
if (instance.exports.hangLimitInitializer) instance.exports.hangLimitInitializer();
try {
- console.log('[fuzz-exec] calling $no_return');
+ console.log('[fuzz-exec] calling no_return');
instance.exports.no_return(0);
} catch (e) {
console.log('exception!' /* + e */);
}
if (instance.exports.hangLimitInitializer) instance.exports.hangLimitInitializer();
try {
- console.log('[fuzz-exec] calling $types');
+ console.log('[fuzz-exec] calling types');
instance.exports.types(0, 0, 0, 0, 0);
} catch (e) {
console.log('exception!' /* + e */);
}
if (instance.exports.hangLimitInitializer) instance.exports.hangLimitInitializer();
try {
- console.log('[fuzz-exec] calling $types2');
+ console.log('[fuzz-exec] calling types2');
instance.exports.types2(0, 0, 0);
} catch (e) {
console.log('exception!' /* + e */);
}
if (instance.exports.hangLimitInitializer) instance.exports.hangLimitInitializer();
try {
- console.log('[fuzz-exec] calling $types3');
- console.log('[fuzz-exec] note result: $types3 => ' + literal(instance.exports.types3(0, 0, 0), 'i32'));
+ console.log('[fuzz-exec] calling types3');
+ console.log('[fuzz-exec] note result: types3 => ' + literal(instance.exports.types3(0, 0, 0), 'i32'));
} catch (e) {
console.log('exception!' /* + e */);
}