Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable wasm simd testing under recent versions of node. NFC #18839

Merged
merged 1 commit into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ jobs:
other.test_node_emscripten_num_logical_cores
core2.test_pthread_create
core2.test_i64_invoke_bigint
core2.test_sse2
core2.test_source_map
core2.test_exceptions_wasm
core2.test_pthread_unhandledrejection"
Expand Down Expand Up @@ -630,6 +631,7 @@ jobs:
EMTEST_SKIP_V8: "1"
EMTEST_SKIP_EH: "1"
EMTEST_SKIP_WASM64: "1"
EMTEST_SKIP_SIMD: "1"
steps:
- checkout
- run:
Expand Down Expand Up @@ -701,6 +703,7 @@ jobs:
EMTEST_SKIP_V8: "1"
EMTEST_SKIP_EH: "1"
EMTEST_SKIP_WASM64: "1"
EMTEST_SKIP_SIMD: "1"
EMCC_SKIP_SANITY_CHECK: "1"
steps:
- run:
Expand Down
17 changes: 17 additions & 0 deletions test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,23 @@ def require_wasm64(self):
else:
self.fail('either d8 or node >= 16 required to run wasm64 tests. Use EMTEST_SKIP_WASM64 to skip')

def require_simd(self):
if config.NODE_JS and config.NODE_JS in self.js_engines:
version = shared.check_node_version()
if version >= (16, 0, 0):
self.js_engines = [config.NODE_JS]
return

if config.V8_ENGINE and config.V8_ENGINE in self.js_engines:
self.emcc_args.append('-sENVIRONMENT=shell')
self.js_engines = [config.V8_ENGINE]
return

if 'EMTEST_SKIP_SIMD' in os.environ:
self.skipTest('test requires node >= 16 or d8 (and EMTEST_SKIP_SIMD is set)')
else:
self.fail('either d8 or node >= 16 required to run wasm64 tests. Use EMTEST_SKIP_SIMD to skip')

def require_wasm_eh(self):
if config.NODE_JS and config.NODE_JS in self.js_engines:
version = shared.check_node_version()
Expand Down
2 changes: 1 addition & 1 deletion test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
def wasm_simd(f):
@wraps(f)
def decorated(self, *args, **kwargs):
self.require_v8()
self.require_simd()
if self.get_setting('MEMORY64') == 2:
self.skipTest('https://github.com/WebAssembly/binaryen/issues/4638')
if not self.is_wasm():
Expand Down
2 changes: 2 additions & 0 deletions tools/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def shlex_quote(arg):
# Switch to shlex.join once we can depend on python 3.8:
# https://docs.python.org/3/library/shlex.html#shlex.join
def shlex_join(cmd):
if type(cmd) is str:
return cmd
Comment on lines +97 to +98
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only in the sense that SIMD tests are the only ones that pass strings to run_process. e.g. they do shared.run_process('thing'). I hadn't realized that was valid... but when we print the string version of the process (e.g. in --verbose mode) it was showing up as t h i n g :)

return ' '.join(shlex_quote(x) for x in cmd)


Expand Down