summaryrefslogtreecommitdiff
path: root/scripts/test/shared.py
Commit message (Collapse)AuthorAgeFilesLines
* Look for bin/binaryen_js.js directly, instead of expecting us to copy it. ↵Alon Zakai2019-12-101-1/+3
| | | | (#2508)
* Update spec test suite (#2484)Heejin Ahn2019-11-291-5/+60
| | | | | | | | | | | | | This updates spec test suite to that of the current up-to-date version of https://github.com/WebAssembly/spec repo. - All failing tests are added in `BLACKLIST` in shared.py with reasons. - For tests that already existed and was passing and started failing after the update, we add the new test to the blacklist and preserve the old file by renaming it to 'old_[FILENAME].wast' not to lose test coverage. When the cause of the error is fixed or the unsupported construct gets support so the new test passes, we can delete the corresponding 'old_[FILENAME].wast' file. - Adds support for `spectest.print_[type] style imports.
* Auto-update spec test outputs (#2481)Heejin Ahn2019-11-261-0/+16
| | | | | | | | This makes auto_update_tests.py update spec test outputs (ones that are printed with `spectest.print` import) and extracts spec tests blacklist into shared.py with comments for reasons why each of them fails. Also deletes if-label-scope.fail.wast.log because it does not seem to match with any of existing tests.
* Simplify test scripts (NFC) (#2457)Heejin Ahn2019-11-201-8/+16
| | | | | | | | This makes test scripts simpler by reducing loop depths and extracting repeating code into methods or variables. - `get_tests` returns a list of tests with specified extensions. This includes files with a full path rather than just file names. - Reduces loop depths by using early exits and `get_tests`.
* When renaming functions ensure the corresponding GOT.func entry is also ↵Sam Clegg2019-10-251-2/+1
| | | | | | renamed (#2382) Fixes https://github.com/WebAssembly/binaryen/issues/2180
* Add --out-dir to allow setting the test output dir. (#2389)Alon Zakai2019-10-171-4/+11
| | | This allows fuzzing in parallel invocations.
* Remove test output from source tree (#2114)Sam Clegg2019-08-211-0/+5
|
* Add initial support for anyref as an opaque type (#2294)Jay Phelps2019-08-201-2/+2
| | | | | | | | | | | | | Another round of trying to push upstream things from my fork. This PR only adds support for anyref itself as an opaque type. It does NOT implement the full [reference types proposal](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md)--so no table.get/set/grow/etc or ref.null, ref.func, etc. Figured it was easier to review and merge as we go, especially if I did something fundamentally wrong. *** I did put it under the `--enable-reference-types` flag as I imagine that even though this PR doesn't complete the full feature set, it probably is the right home. Lmk if not. I'll also be adding a few github comments to places I want to point out/question.
* Switch python indentation from 2-space to 4-space (#2299)Sam Clegg2019-08-161-276/+277
| | | | | | | | 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.
* Allow running a portion of binaryen test suite (#2286)Guanzhong Chen2019-08-071-10/+12
|
* Python3-ify check.py and auto_update_tests.py (#2270)Alon Zakai2019-07-311-48/+23
| | | | | I fixed flatten.bin.txt which seems to have just had some corrupted data, and I removed some fancy unicode from the spec comments tests, which I'm not sure it's important enough to figure out how to fix. Fixes #1691
* Use v8 to test wasm binaries are valid in test suite binary checks (#2206)Alon Zakai2019-07-031-2/+39
|
* Split binaryenjs tests out from main check.py script (#2163)Sam Clegg2019-06-061-1/+0
|
* First stage of cleeanup in source tree pollution (#2105)Sam Clegg2019-05-161-5/+4
| | | | | | | | | | | Update build-js.sh to output to `out` directory. This is district from the `bin` directory which is used by the cmake build and may or may not live in the source tree. The `out` directory currently always lives in the source tree. As a followup change I hope to additionally move all test outout into this tree. See #2104
* wasm2js: unreachability fixes (#2037)Alon Zakai2019-04-221-0/+14
| | | Also test in pass-debug mode, for better coverage.
* Reland emitting of DataCount section (#2027)Thomas Lively2019-04-181-1/+1
| | | | | | This reverts commit cb2d63586c08a3dd194d2b733ceb3f5051c081f8. The issues with feature validation were mostly resolved in #1993, and this PR finishes the job by adding feature flags to wasm-as to avoid emitting the DataCount section when bulk-memory is not enabled.
* Change default feature set to MVP (#1993)Thomas Lively2019-04-161-3/+3
| | | | | In the absence of the target features section or command line flags. When there are command line flags, it is an error if they do not exactly match the target features section, except if --detect-features has been provided. Also adds a --print-features pass to print the command line flags for all enabled options and uses it to make the feature tests more rigorous.
* Move features from passOptions to Module (#2001)Thomas Lively2019-04-121-7/+2
| | | | | This allows us to emit a (potentially modified) target features section and conditionally emit other sections such as the DataCount section based on the presence of features.
* Delete wasm-merge (#1969)Thomas Lively2019-03-291-1/+0
| | | It is not very useful.
* Discover and run unit tests from check.py (#1948)Thomas Lively2019-03-191-0/+54
| | | | | | unittest is Python's standard testing framework, so this change allows arbitrary tests to be written without introducing any new dependencies or code in check.py. A new test that was not possible to write before is also included. It is the first of many.
* Check $NODE environment variable when looking for node (#1792)Sam Clegg2018-11-301-1/+1
| | | | This allows me to run tests on a system where the default installed node is not recent enough.
* Rename `wasm2asm` to `wasm2js`, emit ESM by default (#1642)Alex Crichton2018-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * Rename the `wasm2asm` tool to `wasm2js` This commit performs a relatively simple rename of the `wasm2asm` tool to `wasm2js`. The functionality of the tool doesn't change just yet but it's intended that we'll start generating an ES module instead of just an `asm.js` function soon. * wasm2js: Support `*.wasm` input files Previously `wasm2js` only supported `*.wast` files but to make it a bit easier to use in tooling pipelines this commit adds support for reading in a `*.wasm` file directly. Determining which parser to use depends on the input filename, where the binary parser is used with `*.wasm` files and the wast parser is used for all other files. * wasm2js: Emit ESM imports/exports by default This commit alters the default behavior of `wasm2js` to emit an ESM by default, either importing items from the environment or exporting. Items like initialization of memory are also handled here.
* Stop bundling binaryen.js builds (#1609)Alon Zakai2018-07-041-0/+1
| | | | | | | Instead, we point users to the bot @dcodeIO has, see #1571 This is useful because otherwise every change to binaryen.js requires bundling a build here, which is more work for contributors (and also grows the git repo over time). We still keep a bundled build of wasm.js. We use that for testing of the interpreter currently, and emscripten depends on it. Eventually wasm2asm may replace that. In any case, wasm.js builds are required far less frequently than binaryen.js.
* Remove s2wasm (#1607)Sam Clegg2018-06-281-2/+0
| | | | s2wasm is no longer used my emscripten and as far as I know now as no other users.
* Fix check.py on windows platform (#1605)Loppin Vincent2018-06-201-1/+1
| | | | Fix some file reading & endline issues on windows platform.
* Remove testing of s2wasm via the wasm waterfall scripts (#1604)Sam Clegg2018-06-191-66/+0
| | | | The wasm waterfall is moving away from testing with s2wasm and s2wasm hopefully going to be removed soon.
* Cleanup scripts in scripts/test (#1566)Sam Clegg2018-05-251-70/+85
| | | | | | | | | | Remove executable bit and #! from scripts that don't have entry point. Add missing licence test. Move arg parsing into a function. Remove legacy --only_prepare (with underscrore) argument.
* include the filename in erroneous diff output where possible (#1452)Nathan Froyd2018-03-191-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Failing test cases often start out with: ``` incorrect output, diff: --- expected +++ actual ``` which makes it difficult to figure out where the expected output might live. That information can be derived from examining the tests, of course, but it'd be much nicer if it were provided in the diff to see straightaway. We do this by introducing a new check, one which takes a filename of expected output, which then enables us to display the failing file, e.g.: ``` incorrect output, diff: --- /home/froydnj/src/binaryen.git/test/passes/code-folding.txt +++ actual ``` which is arguably nicer. Having this new check also enables reducing some boilerplate `open(...).read()` calls in various places. There are still a few places using `fail_if_not_identical`, usually because `.strip()` is used on the expected output.
* use jsvu to get spidermonkey (#1443)Alon Zakai2018-03-161-1/+1
| | | jsvu is an easy way to get JS VMs. This uses it to get SpiderMonkey, which is then used to check asm.js validation in the wasm2asm tests.
* Fold wasm-link-metadata into wasm-emscripten-finalize (#1408)Jacob Gravelle2018-02-141-1/+0
| | | | | | | * wasm-link-metadata: Use `__data_end` symbol. * Add --global-base param to emscripten-wasm-finalize to compute staticBump properly * Let ModuleWriter write to a provided Output object
* First pass at LLD support for Emscripten (#1346)Jacob Gravelle2018-01-221-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Skeleton of a beginning of o2wasm, WIP and probably not going to be used * Get building post-cherry-pick * ast->ir, remove commented out code, include a debug module print because linking * Read linking section, print emscripten metadata json * WasmBinaryWriter emits user sections on Module * Remove debugging prints, everything that isn't needed to build metadata * Rename o2wasm to lld-metadata * lld-metadata support for outputting to file * Use tables index instead of function index for initializer functions * Add lld-emscripten tool to add emscripten-runtime functions to wasm modules (built with lld) * Handle EM_ASM in lld-emscripten * Add a list of functions to forcibly export (for initializer functions) * Disable incorrect initializer function reading * Add error printing when parsing .o files in lld-metadata * Remove ';; METADATA: ' prefix from lld-metadata, output is now standalone json * Support em_asm consts that aren't at the start of a segment * Initial test framework for lld-metadata tool * Add em_asm test * Add support for WASM_INIT_FUNCS in the linking section * Remove reloc section parsing because it's unused * lld-emscripten can read and write text * Add test harness for lld-emscripten * Export all functions for now * Add missing lld test output * Add support for reading object files differently Only difference so far is in importing mutable globals being an object file representation for symbols, but invalid wasm. * Update help strings * Update linking tests for stackAlloc fix * Rename lld-emscripten,lld-metadata to wasm-emscripten-finalize,wasm-link-metadata * Add help text to header comments * auto& instead of auto & * Extract LinkType to abi/wasm-object.h * Remove special handling for wasm object file reading, allow mutable globals * Add braces around default switch case * Fix flake8 errors * Handle generating dyncall thunks for imports as well * Use explicit bool for stackPointerGlobal * Use glob patterns for lld file iteration * Use __wasm_call_ctors for all initializer functions
* wasm-metadce tool (#1320)Alon Zakai2017-12-061-0/+1
| | | | | | | This adds a new tool for better dead code elimination. The problem this helps overcome is when the wasm module is part of something larger, like a wasm+JS combination, and therefore doing DCE in either one is not sufficient as it can't remove a cycle spanning the wasm and JS worlds. Concretely, when binaryen performs DCE by itself, it can never remove an export, because it considers those roots - but in the larger ("meta") space outside, they may actually be removable. To solve that, this tool receives a description of the outside graph (in very abstract form), including which nodes are roots. It then adds to that graph nodes from the wasm, so that we have a single graph representing the entire space (the outside + wasm + connections between them). It then performs DCE, finding what is not reachable from the roots, and cleaning it up from the wasm. It of course can't clean up things from the outside, since all it has is the abstract representation of those things in the graph, but it prints out the ids of the removable nodes, which an outside tool can use. This tool is written in as general a way as possible, hopefully it can have multiple uses. The use I have in mind is to write something in emscripten that uses this to DCE the JS+wasm combination that we emit.
* Fix wasm-reduce testing out of tree (#1284)Alon Zakai2017-11-211-0/+4
| | | | * fix wasm-reduce when out-of-tree: do not use a hardcoded bin/wasm-opt, instead add a Path namespace with utilities to get the proper path, and use BINARYEN_ROOT which our test setup code ensures
* Fix flake8 failures in scripts/ (#1239)Taiju Tsuiki2017-10-241-14/+20
| | | flake8 starts warning on bare "except:" in python scripts, and all CI job is failing for that.
* default waterfall testing to off (#1186)Alon Zakai2017-09-161-2/+2
|
* wasm-reduce tool (#1139)Alon Zakai2017-09-011-4/+13
| | | Reduce an interesting wasm to a smaller still interesting wasm. This takes an arbitrary command to run, and reduces the wasm as much as it can while keeping the behavior of that command fixed. This can be used to reduce compiler bugs in an arbitrary VM, etc.
* Move test/local-revision into test/wasm-install (#1157)Sam Clegg2017-08-301-9/+8
| | | | This means you can do `rm -rf test/wasm-install` and have it get redownloaded.
* Fix locaion of wasm-merge in auto_update_tests.py (#1151)Sam Clegg2017-08-291-2/+5
| | | | | Also, fix -l and -rpath lib directories so that it can be run out-of-tree
* Get wasm2asm building again (#1107)Thomas Lively2017-08-021-0/+1
| | | | | | | | | | | | | | | | | | * Get wasm2asm building again Updates CMakeLists.txt to have wasm2asm built by default, updates wasm2asm.h to account for recent interface changes, and restores JSPrinter functionality. * Implement splice for array values * Clean up wasm2asm testing * Print semicolons after statements in blocks * Cleanups and semicolons for condition arms * Prettify semicolon emission
* Fix path to wasm-ctor-eval binary used in test codeSam Clegg2017-06-091-0/+1
|
* --no-js-ffi opt to disable JS FFI mangling. (#984)Joel Martin2017-05-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Always use scripts.test.shared for bin paths. Update scripts/test/shared.py to add WASM_MERGE relative to build directory. Update auto_update_tests.py to use scripts.test.shared variables for all bin paths. Update check.py to use scripts.test.shared for wasm-merge path (this was missing). This allows check.py and auto_update_tests.py to be run from the source directory using built binaries in a different location. * --no-legalize-javascript-ffi disables JS FFI mangling. For JS/Web platform, calls to JS imports are wrapped to convert i64 to i32 and f32 to f64. Likewise calls from JS into exports do the inverse wrapping. This change provides an option to disable that wrapping and use the original types for the call. Includes tests test/noffi_f32.asm.js and test/noffi_i64.asm.js to make sure neither f32->f64 nor i64->i32 type mangling is happening when --no-legalize-javascript-ffi is specified. To fully disable JS FFI mangling when using emscripten, the fastcomp FFI mangling must also be disabled using the -emscripten-legalize-javascript-ffi=0 flag.
* Read/Write Abstraction (#889)Alon Zakai2017-01-261-11/+11
| | | | | * Added ModuleReader/Writer classes that support text and binary I/O * Use them in wasm-opt and asm2wasm
* Refactor check.py so that groups of tests can be split into separate … (#849)jgravelle-google2016-12-061-0/+406
* Refactor check.py so that groups of tests can be split into separate files - Move helper util functions into test/shared.py - Move scripts/support.py to test/support.py - Split s2wasm tests into its own file * Fix flake8 warnings for shared.py and s2wasm.py * Move test scripts from test/ to scripts/test/ * Replace 'from shared import *' with explicit imports