diff options
author | Heejin Ahn <aheejin@gmail.com> | 2020-05-11 16:13:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-11 16:13:17 -0700 |
commit | a5a355747146d7725db7253478a028286dece715 (patch) | |
tree | 3a701aa81400a809fabd9c3a30bedb54f1205bde | |
parent | 655fd6b5cd1e3dd7441139cfca95a905004d2209 (diff) | |
download | binaryen-a5a355747146d7725db7253478a028286dece715.tar.gz binaryen-a5a355747146d7725db7253478a028286dece715.tar.bz2 binaryen-a5a355747146d7725db7253478a028286dece715.zip |
Generate wasm-reduce scripts when given a seed too (#2843)
Currently the fuzzer only generate a script for wasm-reduce only when it
first discovers a case and doesn't do that when a seed is given. But
when you get a bug report with a seed or you want to reproduce the
situation, is still helpful if the fuzzer generates a reduce script for
you.
-rwxr-xr-x | scripts/fuzz_opt.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py index aaf7f0ce9..51ca64694 100755 --- a/scripts/fuzz_opt.py +++ b/scripts/fuzz_opt.py @@ -806,7 +806,13 @@ if __name__ == '__main__': print(arg) if given_seed is not None: given_seed_passed = False - else: + + # We want to generate a template reducer script only when there is + # no given wasm file. That we have a given wasm file means we are no + # longer working on the original test case but modified one, which + # is likely to be called within wasm-reduce script itself, so + # original.wasm and reduce.sh should not be overwritten. + if not given_wasm: # show some useful info about filing a bug and reducing the # testcase (to make reduction simple, save "original.wasm" on # the side, so that we can autoreduce using the name "a.wasm" @@ -884,13 +890,16 @@ After reduction, the reduced file will be in %(working_wasm)s 'reduce_sh': os.path.abspath('reduce.sh')}) break if given_seed is not None: - if given_seed_passed: - print('(finished running seed %d without error)' % given_seed) - else: - print('(finished running seed %d, see error above)' % given_seed) - sys.exit(1) break print('\nInvocations so far:') for testcase_handler in testcase_handlers: print(' ', testcase_handler.__class__.__name__ + ':', testcase_handler.count_runs()) + + if given_seed is not None: + if given_seed_passed: + print('(finished running seed %d without error)' % given_seed) + sys.exit(0) + else: + print('(finished running seed %d, see error above)' % given_seed) + sys.exit(1) |