Skip to content

Commit 9d0b063

Browse files
committed
Wasm tests can now be run without --polyglot and --js.webassembly options.
1 parent 6e75fc6 commit 9d0b063

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

graal-nodejs/mx.graal-nodejs/mx_graal_nodejs.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ def _graal_nodejs_post_gate_runner(args, tasks):
7171
npm(['--scripts-prepend-node-path=auto', 'test'] + commonArgs + testArgs, cwd=unitTestDir)
7272
if mx.suite('wasm', fatalIfMissing=False):
7373
npm(['--scripts-prepend-node-path=auto', 'run', 'testwasm'] + commonArgs + testArgs, cwd=unitTestDir)
74-
# test that WebAssembly can be enabled using env. variables
75-
_setEnvVar('NODE_OPTIONS', '--polyglot')
76-
_setEnvVar('NODE_POLYGLOT_OPTIONS', '--js.webassembly --experimental-options')
7774
node(commonArgs + ['-e', 'console.log(WebAssembly)'])
7875
# check that fetch API is available when WebAssembly is available
7976
node(commonArgs + ['-e', 'FormData'])
@@ -88,8 +85,17 @@ def _graal_nodejs_post_gate_runner(args, tasks):
8885
]
8986
for test in wasm_tests:
9087
node(commonArgs + [join(_suite.dir, 'test', 'parallel', test)])
91-
_setEnvVar('NODE_OPTIONS', '')
88+
89+
# test that WebAssembly can be disabled using env. variables
90+
_setEnvVar('NODE_POLYGLOT_OPTIONS', '--js.webassembly=false --experimental-options')
91+
out = mx.OutputCapture()
92+
node(commonArgs + ['-p', 'try { WebAssembly; } catch (e) { e.toString(); }'], out=out)
93+
assert out.data.strip() == "ReferenceError: WebAssembly is not defined", out.data
9294
_setEnvVar('NODE_POLYGLOT_OPTIONS', '')
95+
else:
96+
out = mx.OutputCapture()
97+
node(commonArgs + ['-p', 'try { WebAssembly; } catch (e) { e.toString(); }'], out=out)
98+
assert out.data.strip() == "ReferenceError: WebAssembly is not defined", out.data
9399

94100
mx_gate.make_test_report(jsonResultsFile, task=t.title)
95101
finally:

graal-nodejs/test/graal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
"scripts": {
1111
"install": "node-gyp rebuild",
1212
"test": "node --expose-gc index.js",
13-
"testwasm": "node --experimental-options --polyglot --js.webassembly=true --expose-gc index.js"
13+
"testwasm": "node --experimental-options --js.webassembly=true --expose-gc index.js"
1414
}
1515
}

0 commit comments

Comments
 (0)