diff options
Diffstat (limited to 'check.py')
-rwxr-xr-x | check.py | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -248,8 +248,9 @@ def run_wasm_metadce_tests(): fail_if_not_identical_to_file(stdout, expected + '.stdout') def run_wasm_reduce_tests(): - print '\n[ checking wasm-reduce ]\n' + print '\n[ checking wasm-reduce testcases]\n' + # fixed testcases test_dir = os.path.join(options.binaryen_test, 'reduce') for t in os.listdir(test_dir): if t.endswith('.wast'): @@ -257,12 +258,23 @@ def run_wasm_reduce_tests(): t = os.path.join(test_dir, t) # convert to wasm run_command(WASM_AS + [t, '-o', 'a.wasm']) - print run_command(WASM_REDUCE + ['a.wasm', '--command=%s b.wasm --fuzz-exec' % WASM_OPT[0], '-t', 'b.wasm', '-w', 'c.wasm']) + run_command(WASM_REDUCE + ['a.wasm', '--command=%s b.wasm --fuzz-exec' % WASM_OPT[0], '-t', 'b.wasm', '-w', 'c.wasm']) expected = t + '.txt' run_command(WASM_DIS + ['c.wasm', '-o', 'a.wast']) with open('a.wast') as seen: fail_if_not_identical_to_file(seen.read(), expected) + # run on a nontrivial fuzz testcase, for general coverage + # this is very slow in ThreadSanitizer, so avoid it there + if 'fsanitize=thread' not in str(os.environ): + print '\n[ checking wasm-reduce fuzz testcase ]\n' + + run_command(WASM_OPT + [os.path.join(options.binaryen_test, 'unreachable-import_wasm-only.asm.js'), '-ttf', '-Os', '-o', 'a.wasm']) + before = os.stat('a.wasm').st_size + run_command(WASM_REDUCE + ['a.wasm', '--command=%s b.wasm --fuzz-exec' % WASM_OPT[0], '-t', 'b.wasm', '-w', 'c.wasm']) + after = os.stat('c.wasm').st_size + assert after < 0.333 * before, [before, after] + def run_spec_tests(): print '\n[ checking wasm-shell spec testcases... ]\n' |