Skip to content

Fix JS engines to use NODE_JS_TEST - #25074

Merged
juj merged 8 commits into
emscripten-core:mainfrom
juj:node_js_test
Aug 27, 2025
Merged

Fix JS engines to use NODE_JS_TEST#25074
juj merged 8 commits into
emscripten-core:mainfrom
juj:node_js_test

Conversation

@juj

@juj juj commented Aug 27, 2025

Copy link
Copy Markdown
Collaborator

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.

@juj

juj commented Aug 27, 2025

Copy link
Copy Markdown
Collaborator Author

Test failures seem to be flakes.

Running this PR in http://localhost:8010/#/builders/11/builds/287 does seem to work as expected.

Comment thread tools/config.py
# EM_CONFIG stuff
if not JS_ENGINES:
JS_ENGINES = [NODE_JS]
JS_ENGINES = [NODE_JS_TEST if NODE_JS_TEST else NODE_JS]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you move these 2 lines to test/common.py after the assignment to NODE_JS_TEST (then you don't need the embedded if/else here).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

check

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

There's some kind of type analysis checker?

mypy step fails with

test/common.py:142: error: List item 0 has incompatible type "Optional[Any]"; expected "List[str]"  [list-item]
Found 1 error in 1 file (checked 130 source files)

@juj juj Aug 27, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Not sure if I did the change something wrong, though after moving the two lines, it seems the effect is as if I didn't have those lines at all, i.e. the run fails like it did before this PR altogether. (http://localhost:8010/api/v2/logs/33118/raw_inline)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Oh I see, I still need the ternary, I misunderstood the move was intended to avoid that.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

(then you don't need the embedded if/else here).

Hmm, it looks like I do, because in common.py, the check is

if not config.NODE_JS_TEST:
  config.NODE_JS_TEST = config.NODE_JS

but in emsdk case, config.NODE_JS_TEST is set, it has both. So this check doesn't do anything.

So it needs

if not config.JS_ENGINES:
  config.JS_ENGINES = [config.NODE_JS_TEST if config.NODE_JS_TEST else config.NODE_JS]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I reverted back to the original form, that helped the mypy type check, that insisted thinking that config.NODE_JS is Optional[Any] and not List[Str]

@sbc100 sbc100 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm, I'll try to move this code into test files later.

@juj
juj merged commit 1ba28a0 into emscripten-core:main Aug 27, 2025
14 of 30 checks passed
inolen pushed a commit to inolen/emscripten that referenced this pull request Feb 13, 2026
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
emscripten-core#25063 (comment)
suggests that the intent is that if NODE_JS_TEST is populated, it should
go to JS_ENGINES, so make that happen.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants