Skip to content

Commit 4113a59

Browse files
authored
test: remove banned_js_engines (#19625)
All the usages of this list can be replaced with `require_engine` or `require_node`.
1 parent c84f12a commit 4113a59

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

test/common.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,6 @@ def setUp(self):
684684
self.js_engines = config.JS_ENGINES.copy()
685685
self.required_engine = None
686686
self.wasm_engines = config.WASM_ENGINES.copy()
687-
self.banned_js_engines = []
688687
self.use_all_engines = EMTEST_ALL_ENGINES
689688

690689
if EMTEST_DETECT_TEMPFILE_LEAKS:
@@ -1357,15 +1356,6 @@ def ccshared(src, linkto=None):
13571356
''' % locals(),
13581357
'a: loaded\na: b (prev: (null))\na: c (prev: b)\n', emcc_args=extra_args)
13591358

1360-
def filtered_js_engines(self):
1361-
for engine in self.js_engines:
1362-
assert engine in config.JS_ENGINES, "js engine does not exist in config.JS_ENGINES"
1363-
assert type(engine) == list
1364-
for engine in self.banned_js_engines:
1365-
assert type(engine) in (list, type(None))
1366-
banned = [b[0] for b in self.banned_js_engines if b]
1367-
return [engine for engine in self.js_engines if engine and engine[0] not in banned]
1368-
13691359
def do_run(self, src, expected_output=None, force_c=False, **kwargs):
13701360
if 'no_build' in kwargs:
13711361
filename = src
@@ -1417,7 +1407,7 @@ def _build_and_run(self, filename, expected_output, args=None, output_nicerizer=
14171407
output_basename=output_basename)
14181408
self.assertExists(js_file)
14191409

1420-
engines = self.filtered_js_engines()
1410+
engines = self.js_engines.copy()
14211411
if len(engines) > 1 and not self.use_all_engines:
14221412
engines = engines[:1]
14231413
# In standalone mode, also add wasm vms as we should be able to run there too.
@@ -1428,7 +1418,7 @@ def _build_and_run(self, filename, expected_output, args=None, output_nicerizer=
14281418
logger.warning('no wasm engine was found to run the standalone part of this test')
14291419
engines += self.wasm_engines
14301420
if len(engines) == 0:
1431-
self.skipTest('No JS engine present to run this test with. Check %s and the paths therein.' % config.EM_CONFIG)
1421+
self.fail('No JS engine present to run this test with. Check %s and the paths therein.' % config.EM_CONFIG)
14321422
for engine in engines:
14331423
js_output = self.run_js(js_file, engine, args,
14341424
output_nicerizer=output_nicerizer,

test/test_core.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5599,9 +5599,8 @@ def test_files(self):
55995599
# Sadly --closure=2 is not yet free of closure warnings
56005600
# FIXME(https://github.com/emscripten-core/emscripten/issues/17080)
56015601
self.ldflags.append('-Wno-error=closure')
5602-
elif self.maybe_closure():
5603-
# closure can generate variables called 'gc', which pick up js shell stuff
5604-
self.banned_js_engines = [config.SPIDERMONKEY_ENGINE]
5602+
else:
5603+
self.maybe_closure()
56055604

56065605
self.emcc_args += ['--pre-js', 'pre.js']
56075606
self.set_setting('FORCE_FILESYSTEM')
@@ -5873,8 +5872,8 @@ def test_futimens(self):
58735872
self.do_runf(test_file('utime', 'test_futimens.c'), 'success')
58745873

58755874
@no_minimal_runtime('MINIMAL_RUNTIME does not have getValue() and setValue() (TODO add it to a JS library function to get it in)')
5875+
@requires_node # only node handles utf well
58765876
def test_utf(self):
5877-
self.banned_js_engines = [config.SPIDERMONKEY_ENGINE] # only node handles utf well
58785877
self.set_setting('EXPORTED_FUNCTIONS', ['_main', '_malloc', '_free'])
58795878
self.set_setting('EXPORTED_RUNTIME_METHODS', ['getValue', 'setValue', 'UTF8ToString', 'stringToUTF8'])
58805879
self.do_core_test('test_utf.c')
@@ -8742,9 +8741,9 @@ def test(assert_returncode=0):
87428741
assert ('require(' in js) == ('node' in self.get_setting('ENVIRONMENT')), 'we should have require() calls only if node js specified'
87438742

87448743
for engine in config.JS_ENGINES:
8745-
print(engine)
8744+
print(f'engine: {engine}')
87468745
# set us to test in just this engine
8747-
self.banned_js_engines = [e for e in config.JS_ENGINES if e != engine]
8746+
self.require_engine(engine)
87488747
# tell the compiler to build with just that engine
87498748
if engine == config.NODE_JS:
87508749
right = 'node'
@@ -8824,9 +8823,8 @@ def test_minimal_runtime_no_declare_asm_module_exports(self):
88248823
'streaming_inst': (['-sMINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION'],),
88258824
'no_export': (['-sDECLARE_ASM_MODULE_EXPORTS=0'],)
88268825
})
8826+
@requires_node # TODO: Support for non-Node.js shells under MINIMAL_RUNTIME
88278827
def test_minimal_runtime_hello_world(self, args):
8828-
# TODO: Support for non-Node.js shells has not yet been added to MINIMAL_RUNTIME
8829-
self.banned_js_engines = [config.V8_ENGINE, config.SPIDERMONKEY_ENGINE]
88308828
self.emcc_args = args
88318829
self.set_setting('MINIMAL_RUNTIME')
88328830
self.maybe_closure()

0 commit comments

Comments
 (0)