Skip to content

Commit 5312576

Browse files
authored
tests: Add @requires_ninja decorator. NFC (#17110)
Also rename the existing `require_node` and `require_v8` decorators. See #17101
1 parent 597502b commit 5312576

File tree

5 files changed

+56
-46
lines changed

5 files changed

+56
-46
lines changed

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ commands:
156156
- emsdk-env
157157
- npm-install
158158
- pip-install
159+
- run: apt-get install ninja-build
159160
run-tests:
160161
description: "Runs emscripten tests"
161162
parameters:
@@ -509,6 +510,7 @@ jobs:
509510
HOMEBREW_NO_AUTO_UPDATE: "1"
510511
command: |
511512
brew list cmake || brew install cmake
513+
brew list ninja || brew install ninja
512514
brew list python3 || brew install python3
513515
brew list pkg-config || brew install pkg-config
514516
- checkout

tests/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def decorated(self, *args, **kwargs):
178178
return decorated
179179

180180

181-
def require_node(func):
181+
def requires_node(func):
182182
assert callable(func)
183183

184184
def decorated(self, *args, **kwargs):
@@ -188,7 +188,7 @@ def decorated(self, *args, **kwargs):
188188
return decorated
189189

190190

191-
def require_v8(func):
191+
def requires_v8(func):
192192
assert callable(func)
193193

194194
def decorated(self, *args, **kwargs):

tests/test_browser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
from common import BrowserCore, RunnerCore, path_from_root, has_browser, EMTEST_BROWSER, Reporting
2424
from common import create_file, parameterized, ensure_dir, disabled, test_file, WEBIDL_BINDER
25-
from common import read_file, require_v8, also_with_minimal_runtime
25+
from common import read_file, requires_v8, also_with_minimal_runtime
2626
from tools import shared
2727
from tools import ports
2828
from tools.shared import EMCC, WINDOWS, FILE_PACKAGER, PIPE
@@ -5262,7 +5262,7 @@ def test_wasm_worker_semaphore_try_acquire(self):
52625262
self.btest(test_file('wasm_worker/semaphore_try_acquire.c'), expected='0', args=['-sWASM_WORKERS'])
52635263

52645264
@no_firefox('no 4GB support yet')
5265-
@require_v8
5265+
@requires_v8
52665266
def test_zzz_zzz_4gb(self):
52675267
# TODO Convert to an actual browser test when it reaches stable.
52685268
# For now, keep this in browser as this suite runs serially, which
@@ -5328,7 +5328,7 @@ def test_zzz_zzz_emmalloc_memgrowth(self, *args):
53285328
self.btest(test_file('browser/emmalloc_memgrowth.cpp'), expected='0', args=['-sMALLOC=emmalloc', '-sALLOW_MEMORY_GROWTH=1', '-sABORTING_MALLOC=0', '-sASSERTIONS=2', '-sMINIMAL_RUNTIME=1', '-sMAXIMUM_MEMORY=4GB'])
53295329

53305330
@no_firefox('no 4GB support yet')
5331-
@require_v8
5331+
@requires_v8
53325332
def test_zzz_zzz_2gb_fail(self):
53335333
# TODO Convert to an actual browser test when it reaches stable.
53345334
# For now, keep this in browser as this suite runs serially, which
@@ -5342,7 +5342,7 @@ def test_zzz_zzz_2gb_fail(self):
53425342
self.do_run_in_out_file_test('browser', 'test_2GB_fail.cpp')
53435343

53445344
@no_firefox('no 4GB support yet')
5345-
@require_v8
5345+
@requires_v8
53465346
def test_zzz_zzz_4gb_fail(self):
53475347
# TODO Convert to an actual browser test when it reaches stable.
53485348
# For now, keep this in browser as this suite runs serially, which

tests/test_core.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from common import RunnerCore, path_from_root, requires_native_clang, test_file, create_file
2828
from common import skip_if, needs_dylink, no_windows, no_mac, is_slow_test, parameterized
2929
from common import env_modify, with_env_modify, disabled, node_pthreads, also_with_wasm_bigint
30-
from common import read_file, read_binary, require_v8, require_node
30+
from common import read_file, read_binary, requires_v8, requires_node
3131
from common import NON_ZERO, WEBIDL_BINDER, EMBUILDER
3232
import clang_native
3333

@@ -562,7 +562,7 @@ def test_i64_varargs(self):
562562

563563
@no_wasm2js('wasm_bigint')
564564
@no_wasm64('MEMORY64 does not yet support exceptions')
565-
@require_node
565+
@requires_node
566566
def test_i64_invoke_bigint(self):
567567
self.set_setting('WASM_BIGINT')
568568
self.emcc_args += ['-fexceptions']
@@ -5790,7 +5790,7 @@ def test_fs_base(self):
57905790

57915791
@also_with_noderawfs
57925792
@is_slow_test
5793-
@require_node
5793+
@requires_node
57945794
def test_fs_nodefs_rw(self):
57955795
# TODO(sbc): This test exposes in issue in the way we run closure compiler and
57965796
# causes it to generate non-ES5 output.
@@ -5803,31 +5803,31 @@ def test_fs_nodefs_rw(self):
58035803
self.do_runf(test_file('fs/test_nodefs_rw.c'), 'success')
58045804

58055805
@also_with_noderawfs
5806-
@require_node
5806+
@requires_node
58075807
def test_fs_nodefs_cloexec(self):
58085808
self.emcc_args += ['-lnodefs.js']
58095809
self.do_runf(test_file('fs/test_nodefs_cloexec.c'), 'success')
58105810

5811-
@require_node
5811+
@requires_node
58125812
def test_fs_nodefs_home(self):
58135813
self.set_setting('FORCE_FILESYSTEM')
58145814
self.emcc_args += ['-lnodefs.js']
58155815
self.do_runf(test_file('fs/test_nodefs_home.c'), 'success')
58165816

5817-
@require_node
5817+
@requires_node
58185818
def test_fs_nodefs_nofollow(self):
58195819
self.emcc_args += ['-lnodefs.js']
58205820
self.do_runf(test_file('fs/test_nodefs_nofollow.c'), 'success')
58215821

5822-
@require_node
5822+
@requires_node
58235823
def test_fs_nodefs_readdir(self):
58245824
# externally setup an existing folder structure: existing/a
58255825
os.makedirs(os.path.join(self.working_dir, 'existing', 'a'))
58265826
self.emcc_args += ['-lnodefs.js']
58275827
self.do_runf(test_file('fs/test_nodefs_readdir.c'), 'success')
58285828

58295829
@no_windows('no symlink support on windows')
5830-
@require_node
5830+
@requires_node
58315831
def test_fs_noderawfs_nofollow(self):
58325832
self.set_setting('NODERAWFS')
58335833
create_file('filename', 'foo')
@@ -5929,7 +5929,7 @@ def test_signals(self):
59295929
self.do_core_test(test_file('test_signals.c'))
59305930

59315931
@no_windows('https://github.com/emscripten-core/emscripten/issues/8882')
5932-
@require_node
5932+
@requires_node
59335933
def test_unistd_access(self):
59345934
self.uses_es6 = True
59355935
orig_compiler_opts = self.emcc_args.copy()
@@ -5985,7 +5985,7 @@ def test_unistd_truncate(self, fs):
59855985

59865986
@no_windows("Windows throws EPERM rather than EACCES or EINVAL")
59875987
@unittest.skipIf(WINDOWS or os.geteuid() == 0, "Root access invalidates this test by being able to write on readonly files")
5988-
@require_node
5988+
@requires_node
59895989
def test_unistd_truncate_noderawfs(self):
59905990
self.uses_es6 = True
59915991
self.set_setting('NODERAWFS')
@@ -6064,7 +6064,7 @@ def test_unistd_links(self, args, nodefs):
60646064
self.do_run_in_out_file_test('unistd/links.c')
60656065

60666066
@no_windows('Skipping NODEFS test, since it would require administrative privileges.')
6067-
@require_node
6067+
@requires_node
60686068
def test_unistd_symlink_on_nodefs(self):
60696069
# Also, other detected discrepancies if you do end up running this test on NODEFS:
60706070
# test expects /, but Windows gives \ as path slashes.
@@ -6351,7 +6351,7 @@ def test_whets(self):
63516351
self.do_runf(test_file('whets.cpp'), 'Single Precision C Whetstone Benchmark')
63526352

63536353
# node is slower, and fail on 64-bit
6354-
@require_v8
6354+
@requires_v8
63556355
@no_asan('depends on the specifics of memory size, which for asan we are forced to increase')
63566356
@no_lsan('depends on the specifics of memory size, which for lsan we are forced to increase')
63576357
def test_dlmalloc_inline(self):
@@ -6363,7 +6363,7 @@ def test_dlmalloc_inline(self):
63636363
self.do_run('src.js', '*400,0*', args=['400', '400'], force_c=True, no_build=True)
63646364

63656365
# node is slower, and fail on 64-bit
6366-
@require_v8
6366+
@requires_v8
63676367
@no_asan('depends on the specifics of memory size, which for asan we are forced to increase')
63686368
@no_lsan('depends on the specifics of memory size, which for lsan we are forced to increase')
63696369
@no_wasmfs('wasmfs does some malloc/free during startup, fragmenting the heap, leading to differences later')
@@ -7984,7 +7984,7 @@ def test_async_hello(self):
79847984

79857985
self.do_runf('main.c', 'HelloWorld!99')
79867986

7987-
@require_v8
7987+
@requires_v8
79887988
@no_memory64('TODO: asyncify for wasm64')
79897989
def test_async_hello_v8(self):
79907990
self.test_async_hello()
@@ -9382,7 +9382,7 @@ def test_em_async_js(self):
93829382
self.maybe_closure()
93839383
self.do_core_test('test_em_async_js.c')
93849384

9385-
@require_v8
9385+
@requires_v8
93869386
@no_wasm2js('wasm2js does not support reference types')
93879387
def test_externref(self):
93889388
self.run_process([EMCC, '-c', test_file('core/test_externref.s'), '-o', 'asm.o'] + self.get_emcc_args(ldflags=False))

0 commit comments

Comments
 (0)