summaryrefslogtreecommitdiff
path: root/scripts/test
Commit message (Collapse)AuthorAgeFilesLines
* 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`.
* Reland "Fix renaming in FixInvokeFunctionNamesWalker (#2513)" (#2622)Sam Clegg2020-01-242-10/+13
| | | | | This reverts commit 132daae1e9154782bb1afa5df80dfe7ea35f0369. This change is the same as before but the fix in #2619 should now make it safe.
* DWARF: Function location tracking (#2592)Alon Zakai2020-01-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Track the beginning and end of each function, both when reading and writing. We track expressions and functions separately, instead of having a single big map of (oldAddr) => (newAddr) because of the potentially ambiguous case of the final expression in a function: it's end might be identical in offset to the end of the function. So we have two different things that map to the same offset. However, if the context is "the end of the function" then the updated address is the new end of the function, even if the function ends with a different instruction now, as the old last instruction might have moved or been optimized out. Concretely, we have getNewExprAddr and getNewFuncAddr, so we can ask to update the location of either an expression or a function, and use that contextual information. This checks for the DIE tag in order to know what we are looking for. To be safe, if we hit an unknown tag, we halt, so that we don't silently miss things. As the test updates show, the new things we can do thanks to this PR are to update compile unit and subprogram low_pc locations. Note btw that in the first test (dwarfdump_roundtrip_dwarfdump.bin.txt) we change 5 to 0: that is correct since that test does not write out DWARF (it intentionally has no -g), so we do not track binary locations while writing, and so we have nothing to update to (the other tests show actual updating). Also fix the order in the python test runner code to show a diff of expected to encountered, and not the reverse, which confused me.
* Align binaryen.js with the npm package (#2551)Daniel Wirtz2020-01-143-18/+38
| | | | | Binaryen.js now uses binaryen (was Binaryen) as its global name to align with the npm package. Also fixes issues with emitting and testing both the JS and Wasm builds.
* Revert "Reland "Fix renaming in FixInvokeFunctionNamesWalker (#2513)" ↵Sam Clegg2020-01-072-13/+10
| | | | | (#2542)" (#2576) This reverts commit f62e171c38bea14302f9b79f7941a248ea704425.
* Reland "Fix renaming in FixInvokeFunctionNamesWalker (#2513)" (#2542)Sam Clegg2019-12-202-10/+13
| | | | | | | | | | | | | | | | * Reland "Fix renaming in FixInvokeFunctionNamesWalker (#2513)" In the previous iteration of this change we were not calling `renameFunctions` for each of the functions we removed. The problem manifested itself when we rename the imported function to `emscripten_longjmp_jmpbuf` to `emscripten_longjmp`. In this case the import of `emscripten_longjmp` already exists so we remove the import of `emscripten_longjmp_jmpbuf` but we were not correclty calling renameFunctions to handle the rename of all the uses. Add an additional test case to cover the failures that we saw on the emscripten tree.
* Compile Binaryen to WebAssembly (#2503)Daniel Wirtz2019-12-191-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR enables compiling Binaryen to WebAssembly when building binaryen.js. Since WebAssembly is best compiled and instantiated asynchronously in browsers, it also adds a new mechanism to tell if respectively when the module is ready by means of one of the following: // Using a promise const binaryen = require("binaryen"); binaryen.ready.then(() => { ... use normally ... }); // Using await const binaryen = require("binaryen"); (async () => { await binaryen.ready; ... use normally ... })(); // Where top-level await is available const binaryen = await require("binaryen").ready; ... use normally ... One can also tell if Binaryen is already ready (for example when assuming it in follow-up code) by: if (/* we already know that */ binaryen.isReady) { ... use normally ... } else { throw Error("Binaryen is supposed to be ready here but isn't"); } The JS test cases have been updated accordingly by wrapping everything in a test function and invoking it once ready. Documentation will have to be updated as well to cover this of course. New file size is about 2.5mb, even though the Wasm becomes inlined into the JS file which makes distribution across different environments a lot easier. Also makes building binaryen (to either js or wasm) emit binaryen.js, and not binaryen_js.js etc. Supersedes and thus fixes #1381 With .ready it also fixes #2452
* Revert "Fix renaming in FixInvokeFunctionNamesWalker (#2513)" (#2541)Sam Clegg2019-12-192-13/+10
| | | This reverts commit f0a2e2c75c7bb3008f10b6edbb8dc4cfd27b7d28.
* Fix renaming in FixInvokeFunctionNamesWalker (#2513)Sam Clegg2019-12-172-10/+13
| | | | | | | | | | | | | This fixes https://github.com/emscripten-core/emscripten/issues/9950. The issue only shows up when debug names are not present so most of the changes in CL come from disabling debug names in the lld tests. We want to make sure that wasm-emscripten-finalize runs fine without debug names so I think it makes most sense to test in this mode. The actual bugfix is in wasm-emscripten.cpp as part of the FixInvokeFunctionNamesWalker. The problem was the name of the function rather than is import name was being added to importRenames. This means that when debug names were present (and the two names were the same) we didn't see the bug.
* Support stack overflow checks in standalone mode (#2525)Alon Zakai2019-12-121-7/+7
| | | | | | | | | In normal mode we call a JS import, but we can't import from JS in standalone mode. Instead, just trap in that case with an unreachable. (The error reporting is not as good in this case, but at least it catches all errors and halts, and the emitted wasm is valid for standalone mode.) Helps emscripten-core/emscripten#10019
* Rename a couple of files that were missing in #2518 (#2521)Sam Clegg2019-12-101-1/+1
|
* Look for bin/binaryen_js.js directly, instead of expecting us to copy it. ↵Alon Zakai2019-12-101-1/+3
| | | | (#2508)
* Use wat over wast for text format filenames (#2518)Sam Clegg2019-12-081-15/+15
|
* Regenerate lld test inputs (#2502)Sam Clegg2019-12-051-2/+3
|
* Update spec test suite (#2484)Heejin Ahn2019-11-293-8/+80
| | | | | | | | | | | | | 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.
* Use package name in imports (NFC) (#2462)Heejin Ahn2019-11-225-107/+103
| | | | | Don't directly import names from shared.py and support.py, and use prefixes instead. Also this reorders imports based on PEP recommendation.
* Fix syntax errors from #2457 (#2460)Heejin Ahn2019-11-201-1/+1
|
* Simplify test scripts (NFC) (#2457)Heejin Ahn2019-11-204-47/+45
| | | | | | | | 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-252-3/+3
| | | | | | renamed (#2382) Fixes https://github.com/WebAssembly/binaryen/issues/2180
* Upgrade the build container for linux releases (#2405)Alex Crichton2019-10-252-3/+3
| | | | | | | | This is a continued effort to try and track down #2273 which came up again and is still present in the current release binaries. Issues like crystal-lang/crystal#4276 may indicate that C++ exceptions are just somewhat broken with static linking when using alpine, but I've at least locally been able to verify that upgrading the container produces working binaries which previously segfaulted on some wasm files.
* Add --out-dir to allow setting the test output dir. (#2389)Alon Zakai2019-10-171-4/+11
| | | This allows fuzzing in parallel invocations.
* Add a --standalone-wasm flag to wasm-emscripten-finalize (#2333)Alon Zakai2019-09-181-0/+2
| | | The flag indicates that we want to run the wasm by itself, without JS support. In that case we don't emit JS dynCalls etc., and we also emit a wasi _start if there is a main, i.e., we try to use the current conventions in the wasm-only space.
* [wasm2js] Fix memory.size (#2330)Alon Zakai2019-09-051-2/+2
| | | | | | | We emitted the __wasm_memory_size function only when memory growth was enabled, but it can be used without that too. In theory we could only emit it if either memory growth or memory.size is used, but I think we can expect JS minifiers to do that later. Also fix a test suite bug - the check/auto_update script didn't run all the wasm2js tests when you run it with argument wasm2js (it used that as the list of tests, instead of the list of files, which confused me here for a while...).