Skip to content

Catch exceptions in test wrapper#8503

Draft
sertonix wants to merge 1 commit intoWebAssembly:mainfrom
sertonix:no-fail-fast
Draft

Catch exceptions in test wrapper#8503
sertonix wants to merge 1 commit intoWebAssembly:mainfrom
sertonix:no-fail-fast

Conversation

@sertonix
Copy link
Contributor

This fixes --no-fail-fast on failure of scripts/test/wasm2js.py tests

@sertonix sertonix requested a review from a team as a code owner March 20, 2026 18:54
@sertonix sertonix requested review from aheejin and removed request for a team March 20, 2026 18:54
except Exception as e:
print(e)
shared.num_failures += 1
result = None
Copy link
Member

Choose a reason for hiding this comment

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

What is different in wasm2js tests that they need this but others do not?

If the others use fail_with_error (which is where num_failures seems to be handled), perhaps it should use it, rather than this change?

Copy link
Contributor Author

@sertonix sertonix Mar 20, 2026

Choose a reason for hiding this comment

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

There are probably better ways to do this but I don't know what they would be. Maybe it would be better I create an issue for this instead?

This is the stacktrace I get without this change:

Traceback (most recent call last):
  File "/builds/sertonix/aports/community/binaryen/src/binaryen-version_128/check.py", line 488, in <module>
    sys.exit(main())
             ^^^^^^
  File "/builds/sertonix/aports/community/binaryen/src/binaryen-version_128/check.py", line 471, in main
    TEST_SUITES[test]()
  File "/builds/sertonix/aports/community/binaryen/src/binaryen-version_128/check.py", line 422, in wrapper
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/builds/sertonix/aports/community/binaryen/src/binaryen-version_128/scripts/test/wasm2js.py", line 163, in test_wasm2js
    test_wasm2js_output()
  File "/builds/sertonix/aports/community/binaryen/src/binaryen-version_128/scripts/test/wasm2js.py", line 126, in test_wasm2js_output
    out = support.run_command(cmd, expected_err='', err_ignore='ExperimentalWarning')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builds/sertonix/aports/community/binaryen/src/binaryen-version_128/scripts/test/support.py", line 154, in run_command
    raise Exception(f"run_command `{' '.join(cmd)}` failed ({code}) {err or ''}")
Exception: run_command `/usr/bin/node --experimental-modules --no-warnings --loader /builds/sertonix/aports/community/binaryen/src/binaryen-version_128/scripts/test/node-esm-loader.mjs a.2asm.asserts.mjs` failed (1) 
node:internal/modules/run_main:107
    triggerUncaughtException(
    ^
assertion failed on line 345
(Use `node --trace-uncaught ...` to show where the exception was thrown)
Node.js v24.14.0

Copy link
Member

Choose a reason for hiding this comment

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

From the stack trace, I think this might be a general issue with support.run_command. Things like shared.fail_if_not_contained work right, handling the number of errors etc., so I would guess the best fix here is in support.run_command - perhaps adding shared.run_command which wraps around it, calling fail_with_error if it errors. That would fix not only wasm2js but all others.

@sertonix sertonix marked this pull request as draft March 20, 2026 21:50
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