diff options
author | Daniel Wirtz <dcode@dcode.io> | 2018-01-17 18:25:49 +0100 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2018-01-17 09:25:49 -0800 |
commit | 01b23987405d8d7b2f13e40ef906169163ac2a5f (patch) | |
tree | 7b76946e0392eb65ad773cbb6524ad0fdbddde38 /scripts/test | |
parent | 3d8358f8e10a01869ef59189539ab1d17d52cb10 (diff) | |
download | binaryen-01b23987405d8d7b2f13e40ef906169163ac2a5f.tar.gz binaryen-01b23987405d8d7b2f13e40ef906169163ac2a5f.tar.bz2 binaryen-01b23987405d8d7b2f13e40ef906169163ac2a5f.zip |
Add optimize, shrink level and debug info options to C/JS (#1357)
* Add optimize, shrink level and debug info options to C/JS
* Add instantiate functionality for creating additional unique instances of the API
* Use a workaround when running tests in node
Tests misuse a module as a script by concatenating, so instead of catching this case in the library, catch it there
* Update sieve test
Seems optimized output changed due to running with optimize levels 2/1 now
* Use the options with all pass runners
* Update relooper-fuzz C-API test
* Share defaults between tools and the C-API
* Add a test for optimize levels
* Unify node test support in check.by and auto_update_tests.py
* Also add getters for optimize levels and test them
* Also test debugInfo
* Add debug info to C tests that used it as well
* Fix missing NODEJS import in auto_update_tests
* Detect node.js version (WASM support)
* Update hello-world JS test (now also runs with node)
* feature-test WebAssembly in node instead
* Document that these options apply globally, and where
* Make sure hello-world.js output doesn't differ between mozjs/node
Diffstat (limited to 'scripts/test')
-rwxr-xr-x | scripts/test/support.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/test/support.py b/scripts/test/support.py index 9d70abb7f..02d2bbfef 100755 --- a/scripts/test/support.py +++ b/scripts/test/support.py @@ -165,3 +165,17 @@ def run_command(cmd, expected_status=0, stderr=None, raise Exception(('run_command unexpected stderr', "expected '%s', actual '%s'" % (expected_err, err))) return out + + +def node_has_webassembly(cmd): + cmd = [cmd, '-e', 'process.stdout.write(typeof WebAssembly)'] + return run_command(cmd) == 'object' + + +def node_test_glue(): + # running concatenated files (a.js) in node interferes with module loading + # because the concatenated file expects a 'var Binaryen' but binaryen.js + # assigned to module.exports. this is correct behavior but tests then need + # a workaround: + return ('if (typeof module === "object" && typeof exports === "object")\n' + ' Binaryen = module.exports;\n') |