Skip to content

Commit bcde837

Browse files
committed
Remove node canary test decorators. NFC
All these features actually work on the official node 24 these days.
1 parent 8695d28 commit bcde837

File tree

5 files changed

+36
-41
lines changed

5 files changed

+36
-41
lines changed

.circleci/config.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -524,15 +524,15 @@ jobs:
524524
test-core0:
525525
executor: focal
526526
environment:
527-
EMTEST_SKIP_NODE_CANARY: "1"
527+
EMTEST_SKIP_NODE24: "1"
528528
steps:
529529
- run-tests-linux:
530530
test_targets: "core0"
531531
test-core2:
532532
executor: focal
533533
environment:
534534
EMTEST_BROWSER: "node"
535-
EMTEST_SKIP_NODE_CANARY: "1"
535+
EMTEST_SKIP_NODE24: "1"
536536
steps:
537537
- run-tests-linux:
538538
# also run a few asan tests. Run these with frozen_cache disabled
@@ -577,7 +577,7 @@ jobs:
577577
test-core3:
578578
executor: focal
579579
environment:
580-
EMTEST_SKIP_NODE_CANARY: "1"
580+
EMTEST_SKIP_NODE24: "1"
581581
steps:
582582
- run-tests-linux:
583583
frozen_cache: false
@@ -656,7 +656,7 @@ jobs:
656656
test-modularize-instance:
657657
executor: focal
658658
environment:
659-
EMTEST_SKIP_NODE_CANARY: "1"
659+
EMTEST_SKIP_NODE24: "1"
660660
steps:
661661
- run-tests-linux:
662662
test_targets: "instance"
@@ -677,7 +677,7 @@ jobs:
677677
- upload-test-results
678678
test-wasm2js1:
679679
environment:
680-
EMTEST_SKIP_NODE_CANARY: "1"
680+
EMTEST_SKIP_NODE24: "1"
681681
executor: focal
682682
steps:
683683
- run-tests-linux:
@@ -920,7 +920,7 @@ jobs:
920920
test-other:
921921
executor: focal
922922
environment:
923-
EMTEST_SKIP_NODE_CANARY: "1"
923+
EMTEST_SKIP_NODE24: "1"
924924
EMTEST_SKIP_RUST: "1"
925925
EMTEST_SKIP_WASM64: "1"
926926
EMTEST_SKIP_NEW_CMAKE: "1"
@@ -997,7 +997,7 @@ jobs:
997997
executor: focal
998998
environment:
999999
EMTEST_LACKS_WEBGPU: "1"
1000-
EMTEST_SKIP_NODE_CANARY: "1"
1000+
EMTEST_SKIP_NODE24: "1"
10011001
steps:
10021002
- run-tests-chrome:
10031003
title: "browser64_4gb"
@@ -1069,7 +1069,7 @@ jobs:
10691069
EMTEST_SKIP_WASM64: "1"
10701070
EMTEST_SKIP_SCONS: "1"
10711071
EMTEST_SKIP_RUST: "1"
1072-
EMTEST_SKIP_NODE_CANARY: "1"
1072+
EMTEST_SKIP_NODE24: "1"
10731073
EMTEST_BROWSER: "0"
10741074
steps:
10751075
- checkout

test/common.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,19 @@ def decorated(self, *args, **kwargs):
263263
return decorated
264264

265265

266-
def requires_node_canary(func):
267-
assert callable(func)
266+
def requires_node_version(major):
267+
assert not callable(major)
268268

269-
@wraps(func)
270-
def decorated(self, *args, **kwargs):
271-
self.require_node_canary()
272-
return func(self, *args, **kwargs)
269+
def decorator(f):
270+
assert callable(f)
273271

274-
return decorated
272+
@wraps(f)
273+
def decorated(self, *args, **kwargs):
274+
self.require_node_version(major)
275+
return f(self, *args, **kwargs)
276+
return decorated
277+
278+
return decorator
275279

276280

277281
# Used to mark dependencies in various tests to npm developer dependency
@@ -1012,20 +1016,6 @@ def require_node(self):
10121016
self.require_engine(nodejs)
10131017
return nodejs
10141018

1015-
def node_is_canary(self, nodejs):
1016-
return nodejs and nodejs[0] and 'canary' in nodejs[0]
1017-
1018-
def require_node_canary(self):
1019-
nodejs = self.get_nodejs()
1020-
if self.node_is_canary(nodejs):
1021-
self.require_engine(nodejs)
1022-
return
1023-
1024-
if 'EMTEST_SKIP_NODE_CANARY' in os.environ:
1025-
self.skipTest('test requires node canary and EMTEST_SKIP_NODE_CANARY is set')
1026-
else:
1027-
self.fail('node canary required to run this test. Use EMTEST_SKIP_NODE_CANARY to skip')
1028-
10291019
def require_engine(self, engine):
10301020
logger.debug(f'require_engine: {engine}')
10311021
if self.required_engine and self.required_engine != engine:
@@ -1062,6 +1052,14 @@ def try_require_node_version(self, major, minor = 0, revision = 0):
10621052
self.js_engines = [nodejs]
10631053
return True
10641054

1055+
def require_node_version(self, major):
1056+
if not self.try_require_node_version(major):
1057+
env = f'EMTEST_SKIP_NODE{major}'
1058+
if env in os.environ:
1059+
self.skipTest(f'test requires node >= {major} (and {env} is set)')
1060+
else:
1061+
self.fail(f'node >= {major} required to run wasm64 tests. Use {env} to skip')
1062+
10651063
def require_simd(self):
10661064
if self.is_browser_test():
10671065
return

test/test_browser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,9 +1643,9 @@ def test_hello_world_worker(self, file_data):
16431643
self.run_browser('main.html', '/report_result?hello from worker, and :' + ('data for w' if file_data else '') + ':')
16441644

16451645
# code should run standalone too
1646-
# To great memories >4gb we need the canary version of node
1646+
# To create memories >4gb we need a recent version of node
16471647
if self.is_4gb():
1648-
self.require_node_canary()
1648+
self.require_node_version(24)
16491649
self.assertContained('you should not see this text when in a worker!', self.run_js('worker.js'))
16501650

16511651
@no_wasmfs('https://github.com/emscripten-core/emscripten/issues/19608')

test/test_core.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from common import RunnerCore, path_from_root, requires_native_clang, test_file, create_file
2727
from common import skip_if, no_windows, no_mac, is_slow_test, parameterized, parameterize
2828
from common import env_modify, with_env_modify, disabled, flaky, node_pthreads, also_with_wasm_bigint
29-
from common import read_file, read_binary, requires_v8, requires_node, requires_dev_dependency, requires_wasm2js, requires_node_canary
29+
from common import read_file, read_binary, requires_v8, requires_node, requires_dev_dependency, requires_wasm2js
3030
from common import compiler_for, crossplatform, no_4gb, no_2gb, also_with_minimal_runtime, also_with_modularize
3131
from common import with_all_fs, also_with_nodefs, also_with_nodefs_both, also_with_noderawfs, also_with_wasmfs
3232
from common import with_all_eh_sjlj, with_all_sjlj, also_with_standalone_wasm, can_do_standalone, no_wasm64, requires_wasm_eh, requires_jspi
@@ -409,7 +409,7 @@ def should_use_closure(self):
409409
return all(f not in self.emcc_args for f in prohibited) and any(f in self.emcc_args for f in required)
410410

411411
def setup_esm_integration(self):
412-
self.require_node_canary()
412+
self.require_node_version(24)
413413
self.node_args += ['--experimental-wasm-modules', '--no-warnings']
414414
self.set_setting('WASM_ESM_INTEGRATION')
415415
self.emcc_args += ['-Wno-experimental']
@@ -8408,11 +8408,10 @@ def test_asyncify_main_module(self):
84088408
self.do_core_test('test_hello_world.c')
84098409

84108410
# Test that pthread_join works correctly with asyncify.
8411-
@requires_node_canary
84128411
@node_pthreads
8412+
@requires_jspi
84138413
def test_pthread_join_and_asyncify(self):
84148414
# TODO Test with ASYNCIFY=1 https://github.com/emscripten-core/emscripten/issues/17552
8415-
self.require_jspi()
84168415
self.do_runf('core/test_pthread_join_and_asyncify.c', 'joining thread!\njoined thread!',
84178416
emcc_args=['-sJSPI',
84188417
'-sEXIT_RUNTIME=1',

test/test_other.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from common import RunnerCore, path_from_root, is_slow_test, ensure_dir, disabled, make_executable
3535
from common import env_modify, no_mac, no_windows, only_windows, requires_native_clang, with_env_modify
3636
from common import create_file, parameterized, NON_ZERO, node_pthreads, TEST_ROOT, test_file
37-
from common import compiler_for, EMBUILDER, requires_v8, requires_node, requires_wasm64, requires_node_canary, requires_dev_dependency
37+
from common import compiler_for, EMBUILDER, requires_v8, requires_node, requires_wasm64, requires_node_version, requires_dev_dependency
3838
from common import requires_wasm_eh, crossplatform, with_all_eh_sjlj, with_all_sjlj, requires_jspi
3939
from common import also_with_standalone_wasm, also_with_wasm2js, also_with_noderawfs
4040
from common import also_with_modularize, also_with_wasmfs, with_all_fs
@@ -357,7 +357,7 @@ def test_esm(self, args):
357357
self.assertContained('export default Module;', read_file('hello_world.mjs'))
358358
self.assertContained('hello, world!', self.run_js('hello_world.mjs'))
359359

360-
@requires_node_canary
360+
@requires_node_version(24)
361361
def test_esm_source_phase_imports(self):
362362
self.node_args += ['--experimental-wasm-modules', '--no-warnings']
363363
self.run_process([EMCC, '-o', 'hello_world.mjs', '-sSOURCE_PHASE_IMPORTS',
@@ -3414,7 +3414,7 @@ def test_embind_return_value_policy(self):
34143414

34153415
self.do_runf('embind/test_return_value_policy.cpp')
34163416

3417-
@requires_node_canary
3417+
@requires_node_version(24)
34183418
def test_embind_resource_management(self):
34193419
self.node_args.append('--js-explicit-resource-management')
34203420

@@ -7471,7 +7471,6 @@ def test_failing_growth_2gb(self):
74717471
self.assertContained('done', self.run_js('a.out.js'))
74727472

74737473
@requires_wasm64
7474-
@requires_node_canary
74757474
def test_failing_growth_wasm64(self):
74767475
self.require_wasm64()
74777476
create_file('test.c', r'''
@@ -15501,7 +15500,6 @@ def test_quick_exit(self):
1550115500
self.do_other_test('test_quick_exit.c')
1550215501

1550315502
@requires_wasm64
15504-
@requires_node_canary
1550515503
def test_memory64_proxies(self):
1550615504
self.run_process([EMCC, test_file('hello_world.c'),
1550715505
'-sMEMORY64=1',
@@ -16110,7 +16108,7 @@ def test_locate_file_abspath_esm(self, args):
1611016108
emcc_args=['--pre-js', 'pre.js',
1611116109
'--extern-post-js', test_file('modularize_post_js.js')] + args)
1611216110

16113-
@requires_node_canary
16111+
@requires_node_version(24)
1611416112
def test_js_base64_api(self):
1611516113
self.node_args += ['--js_base_64']
1611616114
self.do_runf('hello_world.c', 'hello, world!', emcc_args=['-sSINGLE_FILE'], output_basename='baseline')

0 commit comments

Comments
 (0)