From 2ee8959623f4b2889bad1fb3916ce982732c2ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Wed, 27 Aug 2025 22:36:14 +0300 Subject: [PATCH 1/7] Fix JS engines to use NODE_JS_TEST --- tools/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config.py b/tools/config.py index dcb80045d2ed2..acfa0bb3843b0 100644 --- a/tools/config.py +++ b/tools/config.py @@ -64,7 +64,7 @@ def normalize_config_settings(): # EM_CONFIG stuff if not JS_ENGINES: - JS_ENGINES = [NODE_JS] + JS_ENGINES = [NODE_JS_TEST if NODE_JS_TEST else NODE_JS] SPIDERMONKEY_ENGINE = fix_js_engine(SPIDERMONKEY_ENGINE, listify(SPIDERMONKEY_ENGINE)) NODE_JS = fix_js_engine(NODE_JS, listify(NODE_JS)) From d04c4c971351a2fa693c4d7e329275614a0b3a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Wed, 27 Aug 2025 23:29:10 +0300 Subject: [PATCH 2/7] Update instructions to access qemu node --- test/test_core.py | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/test/test_core.py b/test/test_core.py index beb9c903aa521..dfb4c1762507d 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -10041,26 +10041,17 @@ def setUp(self): minimal0 = make_run('minimal0', cflags=['-g'], settings={'MINIMAL_RUNTIME': 1}) llvmlibc = make_run('llvmlibc', cflags=['-lllvmlibc']) -# To run the big endian test suite on a little endian Linux host: +# To run the big endian test suite (supported by emsdk on a little endian Linux host only): # 1. sudo apt install -y qemu-user libc6-s390x-cross libstdc++6-s390x-cross -# 2. wget https://nodejs.org/dist/v22.16.0/node-v22.16.0-linux-s390x.tar.xz -# 3. tar xJf node-v22.14.0-linux-s390x.tar.xz -# 4. run a little endian emsdk install, e.g. `emsdk install sdk-main-64bit` -# 5. activate little endian emsdk install, e.g. `emsdk activate sdk-main-64bit` -# 6. modify the generated emsdk install: edit file .emscripten under emsdk/ root directory, and change the line -# NODE_JS = emsdk_path + '/node/22.16.0_64bit/bin/node' -# to point to big endian node: -# NODE_JS = ['qemu-s390x', '-L', '/usr/s390x-linux-gnu/', '/home/user/node-v22.16.0-linux-s390x/bin/node'] -# 7. enter emsdk environment in current terminal with `source ./emsdk_env.sh` -# 8. modify EMSDK_NODE environment variable to also point to the big endian node: -# export EMSDK_NODE="qemu-s390x -L /usr/s390x-linux-gnu/ /home/user/node-v22.16.0-linux-s390x/bin/node" -# 9. run some tests in big endian mode: in Emscripten root directory, run -# `test/runner bigendian` to run all tests, or a single test with -# `test/runner bigendian.test_jslib_i64_params` - -# The above test scheme has a small quirk that it will also use the Big Endian version of node.js for internal -# Emscripten compilation. At a quick test, this actually worked, so maybe this would be fine for this test harness. -# Alternatively, we would want to find a way to separate compiler node from runtime node somehow in the harness. +# 2. install emsdk with big-endian node: `./emsdk install sdk-main-64bit node-big-endian-crosscompile-22.16.0-64bit` +# 3. activate emsdk tools: `./emsdk activate sdk-main-64bit node-big-endian-crosscompile-22.16.0-64bit` +# 4. enter emsdk environment in current terminal with `source ./emsdk_env.sh` +# 5. run some tests in big endian mode: in Emscripten root directory, run +# `test/runner bigendian0` to run all tests, or a single test with +# `test/runner bigendian0.test_jslib_i64_params` + +# This setup will still use the native x64 Node.js in Emscripten internal use to compile code, but +# runs all unit tests via qemu on the s390x big endian version of Node.js. bigendian0 = make_run('bigendian0', cflags=['-O0'], settings={'SUPPORT_BIG_ENDIAN': 1}) # TestCoreBase is just a shape for the specific subclasses, we don't test it itself From 74fcadebb52809856b8649d66012b1fab45b6f0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Wed, 27 Aug 2025 23:30:51 +0300 Subject: [PATCH 3/7] dir --- test/test_core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_core.py b/test/test_core.py index dfb4c1762507d..80b29ba488479 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -10046,7 +10046,7 @@ def setUp(self): # 2. install emsdk with big-endian node: `./emsdk install sdk-main-64bit node-big-endian-crosscompile-22.16.0-64bit` # 3. activate emsdk tools: `./emsdk activate sdk-main-64bit node-big-endian-crosscompile-22.16.0-64bit` # 4. enter emsdk environment in current terminal with `source ./emsdk_env.sh` -# 5. run some tests in big endian mode: in Emscripten root directory, run +# 5. run some tests in big endian mode: `cd emscripten/main` to enter Emscripten root directory, and run # `test/runner bigendian0` to run all tests, or a single test with # `test/runner bigendian0.test_jslib_i64_params` From 5681b22a906b6b33b6be83d4ad508982dfbec1ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Wed, 27 Aug 2025 23:38:23 +0300 Subject: [PATCH 4/7] Update instructions --- test/test_core.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_core.py b/test/test_core.py index 80b29ba488479..2dd030198f360 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -10043,7 +10043,8 @@ def setUp(self): # To run the big endian test suite (supported by emsdk on a little endian Linux host only): # 1. sudo apt install -y qemu-user libc6-s390x-cross libstdc++6-s390x-cross -# 2. install emsdk with big-endian node: `./emsdk install sdk-main-64bit node-big-endian-crosscompile-22.16.0-64bit` +# 2. install emsdk with big-endian node: `git clone https://github.com/emscripten-core/emsdk.git` +# and `./emsdk install sdk-main-64bit node-big-endian-crosscompile-22.16.0-64bit` # 3. activate emsdk tools: `./emsdk activate sdk-main-64bit node-big-endian-crosscompile-22.16.0-64bit` # 4. enter emsdk environment in current terminal with `source ./emsdk_env.sh` # 5. run some tests in big endian mode: `cd emscripten/main` to enter Emscripten root directory, and run From 455143f40b0d4560d8aebd7b6f4e2b65f88dddf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Thu, 28 Aug 2025 00:30:50 +0300 Subject: [PATCH 5/7] Review --- test/common.py | 3 +++ tools/config.py | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/test/common.py b/test/common.py index eb2913d5d1ef7..cd894a2ef8afe 100644 --- a/test/common.py +++ b/test/common.py @@ -138,6 +138,9 @@ def configure(data_dir): if not config.NODE_JS_TEST: config.NODE_JS_TEST = config.NODE_JS +if not config.JS_ENGINES: + config.JS_ENGINES = [config.NODE_JS] + requires_network = unittest.skipIf(os.getenv('EMTEST_SKIP_NETWORK_TESTS'), 'This test requires network access') diff --git a/tools/config.py b/tools/config.py index acfa0bb3843b0..6ce8ccd77c6a9 100644 --- a/tools/config.py +++ b/tools/config.py @@ -62,10 +62,6 @@ def normalize_config_settings(): global CACHE, PORTS, LLVM_ADD_VERSION, CLANG_ADD_VERSION, CLOSURE_COMPILER global NODE_JS, NODE_JS_TEST, V8_ENGINE, JS_ENGINES, SPIDERMONKEY_ENGINE, WASM_ENGINES - # EM_CONFIG stuff - if not JS_ENGINES: - JS_ENGINES = [NODE_JS_TEST if NODE_JS_TEST else NODE_JS] - SPIDERMONKEY_ENGINE = fix_js_engine(SPIDERMONKEY_ENGINE, listify(SPIDERMONKEY_ENGINE)) NODE_JS = fix_js_engine(NODE_JS, listify(NODE_JS)) NODE_JS_TEST = fix_js_engine(NODE_JS_TEST, listify(NODE_JS_TEST)) From 5b8bb5b869308a373f6978074f346815f3fa3415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Thu, 28 Aug 2025 00:53:53 +0300 Subject: [PATCH 6/7] Restore ternary --- test/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/common.py b/test/common.py index cd894a2ef8afe..1b580a9bd4bc7 100644 --- a/test/common.py +++ b/test/common.py @@ -139,7 +139,7 @@ def configure(data_dir): config.NODE_JS_TEST = config.NODE_JS if not config.JS_ENGINES: - config.JS_ENGINES = [config.NODE_JS] + config.JS_ENGINES = [config.NODE_JS_TEST if config.NODE_JS_TEST else config.NODE_JS] requires_network = unittest.skipIf(os.getenv('EMTEST_SKIP_NETWORK_TESTS'), 'This test requires network access') From 5e2e4497705b74495829cdf2183ef824b490b057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Thu, 28 Aug 2025 01:02:45 +0300 Subject: [PATCH 7/7] Restore to original form --- test/common.py | 3 --- tools/config.py | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/common.py b/test/common.py index 1b580a9bd4bc7..eb2913d5d1ef7 100644 --- a/test/common.py +++ b/test/common.py @@ -138,9 +138,6 @@ def configure(data_dir): if not config.NODE_JS_TEST: config.NODE_JS_TEST = config.NODE_JS -if not config.JS_ENGINES: - config.JS_ENGINES = [config.NODE_JS_TEST if config.NODE_JS_TEST else config.NODE_JS] - requires_network = unittest.skipIf(os.getenv('EMTEST_SKIP_NETWORK_TESTS'), 'This test requires network access') diff --git a/tools/config.py b/tools/config.py index 6ce8ccd77c6a9..acfa0bb3843b0 100644 --- a/tools/config.py +++ b/tools/config.py @@ -62,6 +62,10 @@ def normalize_config_settings(): global CACHE, PORTS, LLVM_ADD_VERSION, CLANG_ADD_VERSION, CLOSURE_COMPILER global NODE_JS, NODE_JS_TEST, V8_ENGINE, JS_ENGINES, SPIDERMONKEY_ENGINE, WASM_ENGINES + # EM_CONFIG stuff + if not JS_ENGINES: + JS_ENGINES = [NODE_JS_TEST if NODE_JS_TEST else NODE_JS] + SPIDERMONKEY_ENGINE = fix_js_engine(SPIDERMONKEY_ENGINE, listify(SPIDERMONKEY_ENGINE)) NODE_JS = fix_js_engine(NODE_JS, listify(NODE_JS)) NODE_JS_TEST = fix_js_engine(NODE_JS_TEST, listify(NODE_JS_TEST))