Skip to content

Commit b3ffbcd

Browse files
authored
Enable wasm simd testing under recent versions of node. NFC (#18839)
1 parent 0933960 commit b3ffbcd

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ jobs:
591591
other.test_node_emscripten_num_logical_cores
592592
core2.test_pthread_create
593593
core2.test_i64_invoke_bigint
594+
core2.test_sse2
594595
core2.test_source_map
595596
core2.test_exceptions_wasm
596597
core2.test_pthread_unhandledrejection"
@@ -630,6 +631,7 @@ jobs:
630631
EMTEST_SKIP_V8: "1"
631632
EMTEST_SKIP_EH: "1"
632633
EMTEST_SKIP_WASM64: "1"
634+
EMTEST_SKIP_SIMD: "1"
633635
steps:
634636
- checkout
635637
- run:
@@ -701,6 +703,7 @@ jobs:
701703
EMTEST_SKIP_V8: "1"
702704
EMTEST_SKIP_EH: "1"
703705
EMTEST_SKIP_WASM64: "1"
706+
EMTEST_SKIP_SIMD: "1"
704707
EMCC_SKIP_SANITY_CHECK: "1"
705708
steps:
706709
- run:

test/common.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,23 @@ def require_wasm64(self):
491491
else:
492492
self.fail('either d8 or node >= 16 required to run wasm64 tests. Use EMTEST_SKIP_WASM64 to skip')
493493

494+
def require_simd(self):
495+
if config.NODE_JS and config.NODE_JS in self.js_engines:
496+
version = shared.check_node_version()
497+
if version >= (16, 0, 0):
498+
self.js_engines = [config.NODE_JS]
499+
return
500+
501+
if config.V8_ENGINE and config.V8_ENGINE in self.js_engines:
502+
self.emcc_args.append('-sENVIRONMENT=shell')
503+
self.js_engines = [config.V8_ENGINE]
504+
return
505+
506+
if 'EMTEST_SKIP_SIMD' in os.environ:
507+
self.skipTest('test requires node >= 16 or d8 (and EMTEST_SKIP_SIMD is set)')
508+
else:
509+
self.fail('either d8 or node >= 16 required to run wasm64 tests. Use EMTEST_SKIP_SIMD to skip')
510+
494511
def require_wasm_eh(self):
495512
if config.NODE_JS and config.NODE_JS in self.js_engines:
496513
version = shared.check_node_version()

test/test_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
def wasm_simd(f):
4040
@wraps(f)
4141
def decorated(self, *args, **kwargs):
42-
self.require_v8()
42+
self.require_simd()
4343
if self.get_setting('MEMORY64') == 2:
4444
self.skipTest('https://github.com/WebAssembly/binaryen/issues/4638')
4545
if not self.is_wasm():

tools/shared.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ def shlex_quote(arg):
9494
# Switch to shlex.join once we can depend on python 3.8:
9595
# https://docs.python.org/3/library/shlex.html#shlex.join
9696
def shlex_join(cmd):
97+
if type(cmd) is str:
98+
return cmd
9799
return ' '.join(shlex_quote(x) for x in cmd)
98100

99101

0 commit comments

Comments
 (0)