summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/fuzz_opt.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py
index 58751a72e..2346e2ee7 100644
--- a/scripts/fuzz_opt.py
+++ b/scripts/fuzz_opt.py
@@ -26,8 +26,9 @@ from test.shared import options
# parameters
+NANS = True
-FUZZ_OPTS = ['--mvp-features'] # may want to add '--no-fuzz-nans' for cross-VM testing
+FUZZ_OPTS = ['--mvp-features']
INPUT_SIZE_LIMIT = 250 * 1024
@@ -134,9 +135,11 @@ def run_vms(prefix):
if len(results) == 0:
results = [0]
- first = results[0]
- for i in range(len(results)):
- compare(first, results[i], 'comparing between vms at ' + str(i))
+ # NaNs are a source of nondeterminism between VMs; don't compare them
+ if not NANS:
+ first = results[0]
+ for i in range(len(results)):
+ compare(first, results[i], 'comparing between vms at ' + str(i))
return results
@@ -170,6 +173,12 @@ def test_one(infile, opts):
run([in_bin('wasm-opt'), 'a.wasm', '-o', 'c.wasm'] + opts)
assert open('b.wasm').read() == open('c.wasm').read(), 'output must be deterministic'
+ os.environ['OLD'] = '1'
+ run([in_bin('wasm-opt'), 'a.wasm', '-o', 'b.wasm', '-O'])
+ del os.environ['OLD']
+ run([in_bin('wasm-opt'), 'a.wasm', '-o', 'c.wasm', '--ssa', '-O'])
+ assert os.path.getsize('b.wasm') >= os.path.getsize('c.wasm')
+
return bytes
@@ -241,6 +250,9 @@ def get_multiple_opt_choices():
# main
+if not NANS:
+ FUZZ_OPTS += ['--no-fuzz-nans']
+
if __name__ == '__main__':
print('checking infinite random inputs')
random.seed(time.time() * os.getpid())