summaryrefslogtreecommitdiff
path: root/scripts/fuzz_opt.py
Commit message (Collapse)AuthorAgeFilesLines
* Add a RoundTrip pass (#2516)Alon Zakai2019-12-091-0/+1
| | | | | | This pass writes and reads the module. This shows the effects of converting to and back from the binary format, and will be useful in testing dwarf debug support (where we'll need to see that writing and reading a module preserves debug info properly).
* Use wat over wast for text format filenames (#2518)Sam Clegg2019-12-081-1/+1
|
* Use package name in imports (NFC) (#2462)Heejin Ahn2019-11-221-8/+8
| | | | | Don't directly import names from shared.py and support.py, and use prefixes instead. Also this reorders imports based on PEP recommendation.
* Improve type selection in fuzzer (#2424)Heejin Ahn2019-11-061-4/+4
| | | | | | | | | - Adds `items` function for `FeatureOptions` so we can get a vector of eligible types - Replaces hardcoded enumeration of MVP types with `getConcreteTypes`, which also adds v128 type to the list if SIMD is enabled - Removes `getType()` function; this does not seem to be used anywhere - Renames `vectorPick` with `pick` - Use the absolute path for d8 in the fuzzer
* Avoid fuzzing with multiple --flatten operations, which causes exponential ↵Alon Zakai2019-09-181-1/+6
| | | | overhead (#2345)
* Switch python indentation from 2-space to 4-space (#2299)Sam Clegg2019-08-161-394/+394
| | | | | | | | pep8 specifies 4 space indentation. The use of 2 spaces is, I believe a historical anomaly where certain large organizations such as google chose 2 over 4 and have yet to make the switch. Since there isn't too much code in binaryen today it seems reasonable to make the switch.
* Fuzz all feature flags, and fix another SignExt issue in the fuzzer (#2259)Alon Zakai2019-07-241-4/+7
|
* Finalize tail call support (#2246)Thomas Lively2019-07-231-3/+2
| | | | Adds tail call support to fuzzer and makes small changes to handle return calls in multiple utilities and passes. Makes larger changes to DAE and inlining passes to properly handle tail calls.
* Fuzzing: Emit BINARYEN_PASS_DEBUG in the autoreducer scripts - that env var ↵Alon Zakai2019-07-191-1/+2
| | | | is the one piece of global state we use (#2237)
* Auto-reduce testcases from the FuzzExec handler in the fuzzer (#2232)Alon Zakai2019-07-181-26/+126
| | | | | | | When it finds a failing testcase, it reduces the list of optimizations, and then runs wasm-reduce to reduce the wasm itself. This refactors the testcase handlers into two kinds: one returns a list of commands to run (get_commands()), and we can auto-reduce them. The others get all the parameters and do whatever they want internally, and we can't auto-reduce them yet. If it is useful, auto-reducing could be added to the other handlers (CompareVMs, Wasm2JS, etc.) by modifying them to the new form. Tested manually by breaking stuff.
* Tail call C/JS API (#2223)Thomas Lively2019-07-151-1/+2
|
* [fuzzing] Give each testcase handler a list of feature flags it requires. ↵Alon Zakai2019-07-151-3/+37
| | | | | (#2225) That way we can still test new flags on modes that do support them (e.g. FuzzExec runs on everything)
* Bysyncify => Asyncify (#2226)Alon Zakai2019-07-151-19/+19
| | | | | | | After some discussion this seems like a less confusing name: what the pass does is "asyncify" code, after all. The one downside is the name overlaps with the old emscripten "Asyncify" utility, which we'll need to clarify in the docs there. This keeps the old --bysyncify flag around for now, which is helpful for avoiding temporary breakage on CI as we move the emscripten side as well.
* Fix FuzzExec fuzzer, which forgot to run the opts (#2215) [ci skip]Alon Zakai2019-07-111-1/+1
|
* update fuzzer to use all features that pass fuzzing in all modes (which is ↵Alon Zakai2019-07-081-5/+10
| | | | currently just sign-ext...) (#2200)
* Use v8 to test wasm binaries are valid in test suite binary checks (#2206)Alon Zakai2019-07-031-13/+1
|
* Bysyncify: Fuzzing (#2192)Alon Zakai2019-07-011-17/+55
| | | | | | | | Gets fuzzing support for Bysyncify working. * Add the python to run the fuzzing on bysyncify. * Add a JS script to load and run a testcase with bysyncify support. The code has all the runtime support for sleep/resume etc., which it does on calls to imports at random in a deterministic manner. * Export memory from fuzzer so JS can access it. * Fix tiny builder bug with makeExport.
* Refactor python fuzz script (#2182)Alon Zakai2019-06-251-73/+134
| | | Create a class for handling the current fuzz testcase, and implement subclasses for the various fuzz things we do. This disentangles a lot of code.
* Add a fuzzer option to not emit code with OOB loads/indirect calls (#2113)Alon Zakai2019-05-171-2/+14
| | | | | This is useful for wasm2js, as we don't emit traps for OOB loads etc. like wasm (like we don't trap on bad float-to-int, as it's too hard in JS, and it's undefined behavior in C anyhow). It may also help general fuzzing, as those traps may make other interesting patterns less likely. Also add more wasm2js support in the fuzzer, which includes using this no-OOB option.
* wasm2js: remove unnecessary labels (#2108)Alon Zakai2019-05-151-9/+6
|
* wasm2js: optimize away unneeded load coercions (#2107)Alon Zakai2019-05-151-6/+9
|
* wasm2js: avoid non-ES5 stuff like "let" (#2041)Alon Zakai2019-04-231-10/+16
| | | Also fix the fuzzer's handling of feature flags so that wasm2js can work.
* Finish bulk memory support (#2030)Thomas Lively2019-04-221-7/+7
| | | | | | | Implement interpretation of remaining bulk memory ops, add bulk memory spec tests with light modifications, fix bugs preventing the fuzzer from running correctly with bulk memory, and fix bugs found by the fuzzer.
* wasm2js: use scratch memory properly (#2033)Alon Zakai2019-04-221-1/+1
| | | | | | | This replaces all uses of __tempMemory__, the old scratch space location, with calls to function imports for scratch memory access. This lets us then implement those in a way that does not use the same heap as main memory. This avoids possible bugs with scratch memory overwriting something, or just in general that it has observable side effects, which can confuse fuzzing etc. The intrinsics are currently implemented in the glue. We could perhaps emit them inline instead (but that might limit asm.js optimizations, so I wanted to keep our options open for now - easy to change later). Also fixes some places where we used 0 as the scratch space address.
* wasm2js2: more fuzzing improvements (#2028)Alon Zakai2019-04-181-48/+58
|
* Fuzz prep for wasm2js (#2022)Alon Zakai2019-04-171-2/+15
| | | Get fuzzing to a runnable state.
* don't compare running before and after binaryen opts on non-binaryen vms if ↵Alon Zakai2019-04-101-5/+10
| | | | nans are allowed, as they are nondetermnistic (#1996)
* Fuzz fixes (#1991)Alon Zakai2019-04-101-3/+15
| | | | | | | Get fuzzer to attempt to create almost all features. Pass v8 all the flags to allow that. Fix fuzz bugs where we read signed_ even when it was irrelevant for that type of load. Improve wasm-reduce on fuzz testcases, try to replace a node with drops of its children, not just the children themselves.
* clenaupAlon Zakai2019-03-201-6/+0
|
* don't compare vms if fuzzing nans, since they are nondeterministicAlon Zakai2019-03-111-4/+16
|
* NaN fuzzing improvements (#1913)Alon Zakai2019-02-191-5/+7
| | | | | | | | | * make DE_NAN avoid creating nan literals in the first place * add a reducer option `--denan` to not introduce nans in destructive reduction * add a `Literal::isNaN()` method * also remove the default exception logging from the fuzzer js glue, which is a source of non-useful VM differences (like nan nondeterminism) * added an option `--no-fuzz-nans` to make it easy to avoid nans when fuzzing (without hacking the source and recompiling). Background: trying to get fuzzing on jsc working despite this open issue: https://bugs.webkit.org/show_bug.cgi?id=175691
* fix printing of unreachable atomics, and add print fuzzing (#1899)Alon Zakai2019-02-061-1/+2
|
* Compare binaryen fuzz-exec to JS VMs (#1856)Alon Zakai2019-01-101-72/+76
| | | | | | | | | | | The main fuzz_opt.py script compares JS VMs, and separately runs binaryen's fuzz-exec that compares the binaryen interpreter to itself (before and after opts). This PR lets us directly compare binaryen's interpreter output to JS VMs. This found a bunch of minor things we can do better on both sides, giving more fuzz coverage. To enable this, a bunch of tiny fixes were needed: * Add --fuzz-exec-before which is like --fuzz-exec but just runs the code before opts are run, instead of before and after. * Normalize double printing (so JS and C++ print comparable things). This includes negative zero in JS, which we never printed properly til now. * Various improvements to how we print fuzz-exec logging - remove unuseful things, and normalize the others across JS and C++. * Properly legalize the wasm when --emit-js-wrapper (i.e., we will run the code from JS), and use that in the JS wrapper code.
* wasm-opt fuzz script improvements (#1851)Alon Zakai2019-01-031-19/+43
| | | | | | | * Allow fuzzing from other directories, by looking for wasm-opt relative to the script itself. * Ignore some VM debug assertions which are fuzz bugs that have already been filed. * Pick the random seed based on the process ID too, for better parallel fuzzing. * Remove commandline parsing stuff in fuzz_opt.py, which won't work with the other commandline parsing in test.shared - but we don't need it anyhow.
* Determinism fix for SSA pass (#1841)Alon Zakai2019-01-021-0/+4
| | | We iterated over a set. Instead, iterate over the relevant items in their order in the IR.
* wasm-opt fuzz script (#1682) [ci skip]Alon Zakai2018-09-191-0/+226
A small fuzz script I've been using locally. Runs wasm-opt on random inputs and random passes, looking for breakage or the passes changing something. Can also run VMs before and after the passes, and compare the VMs.