summaryrefslogtreecommitdiff
path: root/scripts/fuzz_opt.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/fuzz_opt.py')
-rwxr-xr-xscripts/fuzz_opt.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py
index b3310cad0..7efb2043a 100755
--- a/scripts/fuzz_opt.py
+++ b/scripts/fuzz_opt.py
@@ -15,6 +15,7 @@ BINARYEN_CORES=1 BINARYEN_PASS_DEBUG=1 afl-fuzz -i afl-testcases/ -o afl-finding
script covers different options being passed)
'''
+import contextlib
import os
import difflib
import math
@@ -87,6 +88,17 @@ def randomize_pass_debug():
print('randomized pass debug:', os.environ.get('BINARYEN_PASS_DEBUG', ''))
+@contextlib.contextmanager
+def no_pass_debug():
+ old_env = os.environ.copy()
+ if os.environ.get('BINARYEN_PASS_DEBUG'):
+ del os.environ['BINARYEN_PASS_DEBUG']
+ try:
+ yield
+ finally:
+ os.environ.update(old_env)
+
+
def randomize_feature_opts():
global FEATURE_OPTS
FEATURE_OPTS = CONSTANT_FEATURE_OPTS[:]
@@ -380,7 +392,11 @@ class CompareVMs(TestCaseHandler):
compile_cmd += ['-Os']
else:
compile_cmd += ['-Oz']
- run(compile_cmd)
+ # avoid pass-debug on the emcc invocation itself (which runs
+ # binaryen to optimize the wasm), as the wasm here can be very
+ # large and it isn't what we are focused on testing here
+ with no_pass_debug():
+ run(compile_cmd)
return run_vm(['d8', 'a.out.js'])
def can_run(self):