Skip to content

Commit 1ba28a0

Browse files
authored
Fix JS engines to use NODE_JS_TEST (#25074)
Emsdk generates ``` import os emsdk_path = os.path.dirname(os.getenv('EM_CONFIG')).replace('\\', '/') LLVM_ROOT = emsdk_path + '/llvm/git/build_main_64/bin' NODE_JS = emsdk_path + '/node/22.16.0_64bit/bin/node' EMSCRIPTEN_ROOT = emsdk_path + '/emscripten/main' BINARYEN_ROOT = emsdk_path + '/binaryen/main_64bit_binaryen' NODE_JS_TEST = ['qemu-s390x', '-L', '/usr/s390x-linux-gnu/', emsdk_path + '/node-big-endian-crosscompile/22.16.0_64bit/bin/node'] ``` when activating regular and big endian node. This results in a non-working Emscripten installation that complains about NODE_JS not found. Comment at #25063 (comment) suggests that the intent is that if NODE_JS_TEST is populated, it should go to JS_ENGINES, so make that happen.
1 parent 084dba8 commit 1ba28a0

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

test/test_core.py

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10041,26 +10041,18 @@ def setUp(self):
1004110041
minimal0 = make_run('minimal0', cflags=['-g'], settings={'MINIMAL_RUNTIME': 1})
1004210042
llvmlibc = make_run('llvmlibc', cflags=['-lllvmlibc'])
1004310043

10044-
# To run the big endian test suite on a little endian Linux host:
10044+
# To run the big endian test suite (supported by emsdk on a little endian Linux host only):
1004510045
# 1. sudo apt install -y qemu-user libc6-s390x-cross libstdc++6-s390x-cross
10046-
# 2. wget https://nodejs.org/dist/v22.16.0/node-v22.16.0-linux-s390x.tar.xz
10047-
# 3. tar xJf node-v22.14.0-linux-s390x.tar.xz
10048-
# 4. run a little endian emsdk install, e.g. `emsdk install sdk-main-64bit`
10049-
# 5. activate little endian emsdk install, e.g. `emsdk activate sdk-main-64bit`
10050-
# 6. modify the generated emsdk install: edit file .emscripten under emsdk/ root directory, and change the line
10051-
# NODE_JS = emsdk_path + '/node/22.16.0_64bit/bin/node'
10052-
# to point to big endian node:
10053-
# NODE_JS = ['qemu-s390x', '-L', '/usr/s390x-linux-gnu/', '/home/user/node-v22.16.0-linux-s390x/bin/node']
10054-
# 7. enter emsdk environment in current terminal with `source ./emsdk_env.sh`
10055-
# 8. modify EMSDK_NODE environment variable to also point to the big endian node:
10056-
# export EMSDK_NODE="qemu-s390x -L /usr/s390x-linux-gnu/ /home/user/node-v22.16.0-linux-s390x/bin/node"
10057-
# 9. run some tests in big endian mode: in Emscripten root directory, run
10058-
# `test/runner bigendian` to run all tests, or a single test with
10059-
# `test/runner bigendian.test_jslib_i64_params`
10060-
10061-
# The above test scheme has a small quirk that it will also use the Big Endian version of node.js for internal
10062-
# Emscripten compilation. At a quick test, this actually worked, so maybe this would be fine for this test harness.
10063-
# Alternatively, we would want to find a way to separate compiler node from runtime node somehow in the harness.
10046+
# 2. install emsdk with big-endian node: `git clone https://github.com/emscripten-core/emsdk.git`
10047+
# and `./emsdk install sdk-main-64bit node-big-endian-crosscompile-22.16.0-64bit`
10048+
# 3. activate emsdk tools: `./emsdk activate sdk-main-64bit node-big-endian-crosscompile-22.16.0-64bit`
10049+
# 4. enter emsdk environment in current terminal with `source ./emsdk_env.sh`
10050+
# 5. run some tests in big endian mode: `cd emscripten/main` to enter Emscripten root directory, and run
10051+
# `test/runner bigendian0` to run all tests, or a single test with
10052+
# `test/runner bigendian0.test_jslib_i64_params`
10053+
10054+
# This setup will still use the native x64 Node.js in Emscripten internal use to compile code, but
10055+
# runs all unit tests via qemu on the s390x big endian version of Node.js.
1006410056
bigendian0 = make_run('bigendian0', cflags=['-O0'], settings={'SUPPORT_BIG_ENDIAN': 1})
1006510057

1006610058
# TestCoreBase is just a shape for the specific subclasses, we don't test it itself

tools/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def normalize_config_settings():
6464

6565
# EM_CONFIG stuff
6666
if not JS_ENGINES:
67-
JS_ENGINES = [NODE_JS]
67+
JS_ENGINES = [NODE_JS_TEST if NODE_JS_TEST else NODE_JS]
6868

6969
SPIDERMONKEY_ENGINE = fix_js_engine(SPIDERMONKEY_ENGINE, listify(SPIDERMONKEY_ENGINE))
7070
NODE_JS = fix_js_engine(NODE_JS, listify(NODE_JS))

0 commit comments

Comments
 (0)