summaryrefslogtreecommitdiff
path: root/scripts/test
Commit message (Collapse)AuthorAgeFilesLines
...
* [Refactoring] Cleanup asm2wasm. Use JS instead ASM prefix where possible. ↵Max Graey2021-09-011-2/+0
| | | | NFC (#4090)
* Run spec test all at once after binary transform (#3817)Abbas Mashayekh2021-04-202-2/+1
| | | | | | | | | | | | | | | | | | #3792 added support for module linking and (register command to wasm-shell, but forgot about three problems: - Splitting spec tests prevents linking test modules together. - Registered modules may still be used in assertions or an invoke - Modules may re-export imported objects This PR appends transformed modules after binary checks to a spec.wast file, plus assertion tests and register commands. Then runs wasm-shell on the whole file. It also keeps both the module name and its registered name available in wasm-shell for use in shell commands and linked modules. Furthermore, it correctly finds the module where an object is defined even if it is imported and re-exported several times. The updated version of imports.wast spec test is enabled to verify the fixes.
* Regenerate lld tests (#3684)Sam Clegg2021-03-121-0/+2
| | | | | | | | | | | This change as automatically generated by: $ ./scripts/test/generate_lld_tests.py $ ./auto_update_tests.py --binaryen-bin=../binaryen-out/bin lld The changes here are mostly due to: - llvm now emits names for globals and segments - emscripten now packs EM_ASM consts into a single contiguous segment
* Update V8 feature flags for the fuzzer (#3569)Heejin Ahn2021-02-181-3/+3
| | | | | | This removes feature flags that are now included in `--wasm-staging` and adds new experimental flags. Does not change the fuzzer's behavior at the moment because the fuzzer does not seem to be currently enabled for GC or typed funcref yet.
* Add feature options to wasm-dis (#3548)Abbas Mashayekh2021-02-082-2/+2
| | | | | | This will allow .fromBinary tests be executed with the desired featurs so there will be no difference between those tests and .from-wast tests. Fixes #3545
* Remove test suite's assumption of minify_check roundtripping perfectly (#3524)Alon Zakai2021-01-271-13/+2
| | | | | | | | | | | | minify_check checks that we can print and read minified wast. The test also, however, assumed that we round-trip such things perfectly. That's never been true, and only by chance did this go unnoticed until now, in #3523 The specific issue happening there is that we create a block without a name. Then we write that as text, then read it. When we read it, we give all such blocks a name (and we rely on optimizations to remove it later when possible - this avoids optimizing in the parser). The extra name looks like a bug to minify_check.
* Warn when running a pass not compatible with DWARF (#3506)Alon Zakai2021-01-261-1/+2
| | | | | | | | | | | | Previously the addDefault* methods would avoid adding opt passes that we know are incompatible with DWARF. However, that didn't handle the case of passes that are added in other ways. For example, when running Asyncify, emcc will run --flatten before, and that pass is not compatible with DWARF. This PR lets us warn on that by annotating the passes themselves. Then we use those annotation to either not run a pass at all (matching the previous behavior) or to show a warning when necessary. Fixes emscripten-core/emscripten#13288 . That is, concretely after this PR running asyncify + DWARF will show a warning to the user.
* Introduce a script for updating lit tests (#3503)Thomas Lively2021-01-211-3/+4
| | | | And demonstrate its capabilities by porting all tests of the optimize-instructions pass to use lit and FileCheck.
* When looking for node binary, search for 'node' before 'nodejs' (#3164)Sam Clegg2020-12-301-1/+1
| | | | | | | `node` is he name used by the upstream project. `nodejs` is a legacy name used on older debian/ubunru systems. Searching for `nodejs` first meant it was finding my local (old) `nodejs` package even those I have a more recent `node` in my $PATH.
* Fixed wasm-emscripten-finalize AsmConstWalker not handling 64-bit pointers ↵Wouter van Oortmerssen2020-12-142-4/+16
| | | | | (#3431) Also improved the LLD test scripts to accomodate 64-bit tests.
* [TypedFunctionReferences] Enable call_ref in fuzzer, and fix minor misc fuzz ↵Alon Zakai2020-11-251-2/+4
| | | | | | | | | | | | | | | | | | | | bugs (#3401) * Count signatures in tuple locals. * Count nested signature types (confirming @aheejin was right, that was missing). * Inlining was using the wrong type. * OptimizeInstructions should return -1 for unhandled types, not error. * The fuzzer should check for ref types as well, not just typed function references, similar to what GC does. * The fuzzer now creates a function if it has no other option for creating a constant expression of a function type, then does a ref.func of that. * Handle unreachability in call_ref binary reading. * S-expression parsing fixes in more places, and add a tiny fuzzer for it. * Switch fuzzer test to just have the metrics, and not print all the fuzz output which changes a lot. Also fix noprint handling which only worked on binaries before. * Fix Properties::getLiteral() to use the specific function type properly, and make Literal's function constructor require that, to prevent future bugs. * Turn all input types into nullable types, for now.
* Introduce lit/FileCheck tests (#3367)Thomas Lively2020-11-182-4/+5
| | | | | | | | | | | | | | | lit and FileCheck are the tools used to run the majority of tests in LLVM. Each lit test file contains the commands to be run for that test, so lit tests are much more flexible and can be more precise than our current ad hoc testing system. FileCheck reads expected test output from comments, so it allows test output to be written alongside and interspersed with test input, making tests more readable and precise than in our current system. This PR adds a new suite to check.py that runs lit tests in the test/lit directory. A few tests have been ported to demonstrate the features of the new test runner. This change is motivated by a need for greater flexibility in testing wasm-split. See #3359.
* Allow setting the path to libbinaryen.so shared library (#3025)rathann2020-11-101-0/+9
| | | | This makes it easier to install libbinaryen.so into an alternative locations. Fixes part of issue #2999 for me.
* wasm2js: Remove global dict arguments to asmFunc (#3325)Sam Clegg2020-11-051-1/+1
|
* wasm-emscripten-finalize: Remove staticBump from metadata (#3300)Sam Clegg2020-10-291-1/+0
| | | | | | Emscripten no longer needs this information as of https://github.com/emscripten-core/emscripten/pull/12643. This also removes the need to export __data_end.
* Remove remnants of spec interpreter, and excess mozjs warning (#3262)Alon Zakai2020-10-201-18/+0
| | | | | The spec interpreter is no longer used at all. Mozjs is still used optionally, but while it was crucial in the past for test coverage, it is entirely optional now and not run by default, so no need to warn.
* Fix split_wast on asserts before the first module (#3206)Alon Zakai2020-10-091-0/+6
| | | | | | | | Normally a wast file has a module and then asserts on it, but some tests have just asserts without a module. In that case, set the module to None. (This can happen if the asserts do not refer to a module, and are at the top of the wast file.)
* wasm2js: override incoming memory's grow method (#3185)Sam Clegg2020-09-301-0/+3
| | | | | | | | | | This will allow for the completely removal of `__growWasmMemory` as a followup. We currently unconditionally generate this function in `generateMemoryGrowthFunction`. See #3180
* Remove stale test output (#3157)Sam Clegg2020-09-211-0/+14
| | | | | | | | | | | | These test output files are ignored and so contain stale output that is neither checked during `check.py` not updated during `auto_update_tests.py`. There are three clases to tests here: 1. Spec tests that end in 64.wast are ignored by scripts/test/wasm2js.py 2. Spec tests that are globallyi ignoed by shared.py:SPEC_TESTS_TO_SKIP 3. hello_world.2asm.js.. I cant tell where this came remove it seems like an anomaly.
* wasm2js: Support exported tables (#3152)Sam Clegg2020-09-211-2/+2
|
* Initial implementation of "Memory64" proposal (#3130)Wouter van Oortmerssen2020-09-181-0/+3
| | | Also includes a lot of new spec tests that eventually need to go into the spec repo
* Improve testing on Windows (#3142)Wouter van Oortmerssen2020-09-171-0/+6
| | | | | | This PR contains: - Changes that enable/disable tests on Windows to allow for better local testing. - Also changes many abort() into Fatal() when it is really just exiting on error. This is because abort() generates a dialog window on Windows which is not great in automated scripts. - Improvements to CMake to better work with the project in IDEs (VS).
* Add mozjs, V8 and WABT setup script (#3053)Daniel Wirtz2020-09-141-1/+7
| | | Adds a new script `./third_party/setup.py` to conveniently install necessary dependencies for testing and fuzzing, including the SpiderMonkey JS shell (mozjs), the V8 JS shell and WABT. Other scripts now automatically pick these up when installed and fall back to look for the tools in PATH like before.
* Stay on C++14 for now (#3108)Daniel Wirtz2020-09-081-1/+1
| | | | | Switch us back to C++ standard support to 14 (for now), so we can easily upgrade again once the autoroller issues are resolved (atm the chromium roller does not have a libc++ with c++17 support).
* Upgrade to C++17 (#3103)Daniel Wirtz2020-09-061-0/+4
|
* Use fnmatch for test filtering (#3068)Thomas Lively2020-08-211-1/+2
| | | Allows for using `*` wildcards and simplifies the code!
* Test-runner can filter tests by name (#3067)Wouter van Oortmerssen2020-08-201-0/+6
|
* Harmonize auto updater with test runner: wasm-opt should update .fromBinary ↵Alon Zakai2020-08-201-0/+26
| | | | | | | outputs (#3066) It was confusing that you had to run ./auto_update_tests.py binfmt to update a test checked by ./check.py wasm-opt. Instead, make ./auto_update_tests.py wasm-opt update those, so it's symmetrical.
* Remove asm2wasm (#3042)Alon Zakai2020-08-171-149/+0
| | | | | | | Now that fastcomp has been removed from Emscripten, there is no need for the asm2wasm tool which it used to compile fastcomp's asm.js output to wasm. See emscripten-core/emscripten#11860
* Skip tests that fail on windows and enable all the rest (#3035)Alon Zakai2020-08-113-3/+21
| | | | | | | | | | | | | | This lets us run most tests at least on that platform. Add a new function for skipping those tests, skip_if_on_windows, so that it's easy to find which tests are disabled on windows for later fixing efforts. This fixes a few minor issues for windows, like comparisons should ignore \r in some cases. Rename all passes tests that use --dwarfdump to contain "dwarf" in their name, which makes it easy to skip those (and is clearer anyhow).
* Remove unneeded old binary validation in test suite (#3034)Alon Zakai2020-08-101-17/+0
| | | | | | | | This was useful back when we didn't have many VMs to test in, and we weren't confident in our binaries being valid wasm. Today we have lots of testing on VMs, and in particular, this test tends to fail when we do things like reorder SIMD opcode constants. (This doesn't fail on CI as we don't have v8 installed there, so this path is never reached, but it does happen locally.)
* Specify UTF-8 encoding instead of relying on locale default (#3009)rathann2020-07-311-1/+1
| | | | Current locale may not be UTF-8, which makes the spec/names.wast test fail. Fixes issue #3003.
* Update flags used in generate_lld_tests (#2981)Sam Clegg2020-07-241-1/+1
| | | | | | | | | | | | The `--no-gc-sections` was added as part of #2857 but is not needed and in fact changes the output of some tests. `--experimental-pic` is needed these days when building shared libraries with emscripten's abi. After these two changes I verfied that the following command generated no local changes (i.e. is a no-op): ./scripts/test/generate_lld_tests.py --binaryen-bin=$PWD/../binaryen-out/bin/ $PWD/../llvm-build/bin/ $PWD/../emscripten
* Disable nodejs warnings in test suite (#2973)rathann2020-07-221-1/+1
| | | | | | | | | | | | Fixes issue #2970 Avoids "Exception: 'run_command unexpected stderr'" when running wasm2js tests with nodejs-14.5.0+, which is due to extra warnings from that node: $ cd out/test/ $ /usr/bin/node --experimental-modules --loader /builddir/build/BUILD/binaryen-version_95/scripts/test/node-esm-loader.mjs a.2asm.mjs (node:187299) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time (Use `node --trace-warnings ...` to show where the warning was created)
* wasm2js testing improvements before bulk-memory (#2918)Alon Zakai2020-06-202-16/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Necessary preparations for a later PR that adds bulk memory support to wasm2js (splitting this out so the next PR is less big): * Fix logging of print functions in wasm2js spec tests, there was an extra space in the output (which console.log adds automatically between items). * Don't assume the output is always empty, as some tests (like bulk memory) do have expected output. * Rename test/bulk-memory.wast as it "conflicts" with test/spec/bulk-memory.wast - the problem is that we scan both places, and emit files in test/wasm2js/*, so those would collide if the names overlap. * Extend the parsing and emitting of JS for (assert.. ) lines such as (assert_return (invoke "foo" (i32.const 1)) (i32.const 2)) to also handle (invoke "foo" (i32.const 1)) (i32.const 2)) Without this, we skip (invoke ..) lines in spec tests, which normally is fine, but in bulk memory at least they have side effects we need - we must run them before the later assertions.
* Move optional metadata field so its not last (#2909)Sam Clegg2020-06-111-6/+15
| | | | To avoid the conditional trailing comma.
* Rename anyref to externref to match proposal change (#2900)Jay Phelps2020-06-101-1/+1
| | | | | | | anyref future semantics were changed to only represent opaque host values, and thus renamed to externref. [Chromium](https://bugs.chromium.org/p/v8/issues/detail?id=7748#c360) was just updated to today (not yet released). I couldn't find a Mozilla bugzilla ticket mentioning externref so I don't immediately know if they've updated yet. https://github.com/WebAssembly/reference-types/pull/87
* Add additional test for --check-stack-overflow (#2857)Sam Clegg2020-05-182-32/+35
| | | | | This test verifies that functions in the llvm input source that do stack pointer manipulation get correctly handled by `wasm-emscripten-finalize --check-stack-overflow` (StackLimitEnforcer)
* Fix binaryenjs testing (#2810)Sam Clegg2020-04-271-5/+2
| | | | | | These tests are now optional. However, if you run them and the build is not found they will now error out, in order to avoid silently failing.
* Update v8 flags (#2754)Alon Zakai2020-04-131-5/+3
|
* Add --deterministic flag to wasm2js, for fuzzing (#2757)Alon Zakai2020-04-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | In wasm2js we ignore things that trap in wasm that we can't really handle, like a load from memory out of bounds would trap in wasm, but in JS we don't want to emit a bounds check on each load. So wasm2js focuses on programs that don't trap. However, this is annoying in the fuzzer as it turns out that our behavior for places where wasm would trap was not deterministic. That is, wasm would trap, wasm2js would not trap and do behavior X, and wasm2js with optimizations would also not trap but do behavior Y != X. This produced false positives in the fuzzer (and might be annoying in manual debugging too). As a workaround, this adds a --deterministic flag to wasm2js, which tries to be deterministic about what it does for cases where wasm would trap. This handles the case of an int division by 0 which traps in wasm but without this flag could have different behavior in wasm2js with or without opts (see details in the patch).
* Remove executable bit from test scripts (#2734)Sam Clegg2020-04-094-35/+0
| | | | | | | | | | | | | | | | | | These are no all driven by only by the two top level scripts: check.py auto_update_tests.py What is more all of them were broken when run isolation due to relative import rules in python3. e.g.: ``` $ scripts/test/binaryenjs.py Traceback (most recent call last): File "scripts/test/binaryenjs.py", line 21, in <module> from . import shared ImportError: cannot import name 'shared' from '__main__' (scripts/test/binaryenjs.py) ```
* Factor out wasm_opt testing. NFC. (#2737)Sam Clegg2020-04-092-0/+232
| | | | Also, factor out auto-updating of binaryenjs testing so it lives alongside the actual test code.
* Remove references to vanilla emcc (#2731)Sam Clegg2020-04-081-26/+0
| | | | | It looks like these were only uses as part of the vanilla tests which were removed back in #2482.
* JS/Wasm BigInt support for wasm-emscripten-finalize (#2726)Alon Zakai2020-04-071-0/+2
| | | | | If wasm-emscripten-finalize is given the BigInt flag, then we will be using BigInts on the JS side, and need no legalization at all since i64s will just be BigInts.
* Avoid unnecessary fp$ in side modules (#2717)Alon Zakai2020-03-311-15/+15
| | | | | | | | | | | | | | | | Now that we update the dylink section properly, we can do the same optimization in side modules as in main ones: if the module provides a function, don't call an $fp method during startup, instead add it to the table ourselves and use the relative offset to the table base. Fix an issue when the table has no segments initially: the code just added an offset of 0, but that's not right. Instead, an a __table_base import and use that as the offset. As this is ABI-specific I did it on wasm-emscripten-finalize, leaving TableUtils to just assert on having a singleton segment. Add a test of a wasm file with a dylink section to the lld tests.
* Update node-esm-loader to work with latest node LTS (#2657)Daniel Wirtz2020-02-121-22/+29
| | | An attempt to fix the node-esm-loader related [issues](https://travis-ci.org/WebAssembly/binaryen/jobs/649056649#L22931) seen on CI currently, apparently due to CI automatically picking up a newer node LTS (12.16.0 released 2020/02/11) where the API changed.
* Convert remaining python scripts to run under python3 (#2643)Sam Clegg2020-02-113-3/+3
|
* Properly order the actual and exepcted outputs in fail() and ↵Alon Zakai2020-02-071-1/+1
| | | | fail_if_not_identical_to_file() (#2649)
* Add EH support for EffectAnalyzer (#2631)Heejin Ahn2020-02-031-4/+11
| | | | | | | | | | | | | | | | | | | | This adds EH support to `EffectAnalyzer`. Before `throw` and `rethrow` conservatively set property. Now `EffectAnalyzer` has a new property `throws` to represent an expression that can throw, and expression that can throw sets `throws` correctly. When EH is enabled, any calls can throw too, so we cannot reorder them with another expression with any side effects, meaning all calls should be treated in the same way as branches when evaluating `invalidate`. This prevents many reorderings, so this patch sets `throws` for calls only when the exception handling features is enabled. This is also why I passed `--disable-exception-handling` to `wasm2js` tests. Most of code changes outside of `EffectAnalyzer` class was made in order to pass `FeatureSet` to it. `throws` isn't always set whenever an expression contains a throwable instruction. When an throwable instruction is within an inner try, it will be caught by the corresponding inner catch, so it does not set `throws`.