summaryrefslogtreecommitdiff
path: root/auto_update_tests.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-08-11 10:53:21 -0700
committerGitHub <noreply@github.com>2017-08-11 10:53:21 -0700
commit4216894b22e5891e83851d2af42080293e6089e4 (patch)
treee4fdcdd5becaf80dcaf924bd20e01f107b05b388 /auto_update_tests.py
parent5295929fd239ea8a760cd2c3f65510da9972c33c (diff)
downloadbinaryen-4216894b22e5891e83851d2af42080293e6089e4.tar.gz
binaryen-4216894b22e5891e83851d2af42080293e6089e4.tar.bz2
binaryen-4216894b22e5891e83851d2af42080293e6089e4.zip
New fuzzer (#1126)
This adds a new method of fuzzing, "translate to fuzz" which means we consider the input to be a stream of data that we translate into a valid wasm module. It's sort of like a random seed for a process that creates a random wasm module. By using the input that way, we can explore the space of valid wasm modules quickly, and it makes afl-fuzz integration easy. Also adds a "fuzz binary" option which is similar to "fuzz execution". It makes wasm-opt not only execute the code before and after opts, but also write to binary and read from it, helping to fuzz the binary format.
Diffstat (limited to 'auto_update_tests.py')
-rwxr-xr-xauto_update_tests.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/auto_update_tests.py b/auto_update_tests.py
index 7aab8ea4e..fd5999cad 100755
--- a/auto_update_tests.py
+++ b/auto_update_tests.py
@@ -45,7 +45,6 @@ for asm in sorted(os.listdir('test')):
cmd += ['--source-map', os.path.join('test', wasm + '.map'), '-o', 'a.wasm']
run_command(cmd)
-
for dot_s_dir in ['dot_s', 'llvm_autogenerated']:
for s in sorted(os.listdir(os.path.join('test', dot_s_dir))):
if not s.endswith('.s'): continue
@@ -102,6 +101,14 @@ for t in sorted(os.listdir(os.path.join('test', 'passes'))):
cmd = WASM_OPT + opts + ['split.wast', '--print']
actual += run_command(cmd)
with open(os.path.join('test', 'passes', passname + ('.bin' if binary else '') + '.txt'), 'w') as o: o.write(actual)
+ if 'emit-js-wrapper' in t:
+ with open('a.js') as i:
+ with open(t + '.js', 'w') as o:
+ o.write(i.read())
+ if 'emit-spec-wrapper' in t:
+ with open('a.wat') as i:
+ with open(t + '.wat', 'w') as o:
+ o.write(i.read())
print '\n[ checking wasm-opt -o notation... ]\n'