Skip to content

Commit 9ecca00

Browse files
authored
Add is_slow_test test decorator and EMTEST_SKIP_SLOW env var (#7642)
List of slow tests based on Jacob's list. I only included tests that take more than 20 seconds. Future work: - Warn if test marked as slow runs in <10 seconds. - Warn if test not marked as slow runs in >30 seconds.
1 parent 969259a commit 9ecca00

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

tests/runner.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ def path_from_root(*pathelems):
9191
# to force testing on all js engines, good to find js engine bugs
9292
EMTEST_ALL_ENGINES = os.getenv('EMTEST_ALL_ENGINES')
9393

94+
EMTEST_SKIP_SLOW = os.getenv('EMTEST_SKIP_SLOW')
95+
9496

9597
# checks if browser testing is enabled
9698
def has_browser():
@@ -118,6 +120,15 @@ def decorated(self):
118120
return decorated
119121

120122

123+
def is_slow_test(func):
124+
def decorated(self, *args, **kwargs):
125+
if EMTEST_SKIP_SLOW:
126+
return self.skipTest('skipping slow tests')
127+
return func(self, *args, **kwargs)
128+
129+
return decorated
130+
131+
121132
def no_wasm_backend(note=''):
122133
def decorated(f):
123134
return skip_if(f, 'is_wasm_backend', note)

tests/test_core.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from tools.shared import NODE_JS, V8_ENGINE, JS_ENGINES, SPIDERMONKEY_ENGINE, PYTHON, EMCC, EMAR, CLANG, WINDOWS, AUTODEBUGGER
2424
from tools import jsrun, shared
2525
from runner import RunnerCore, path_from_root, core_test_modes, get_bullet_library, get_freetype_library, get_poppler_library
26-
from runner import skip_if, no_wasm_backend, needs_dlfcn, no_windows, env_modify, with_env_modify
26+
from runner import skip_if, no_wasm_backend, needs_dlfcn, no_windows, env_modify, with_env_modify, is_slow_test
2727

2828
# decorators for limiting which modes a test can run in
2929

@@ -1878,6 +1878,7 @@ def test_bigswitch(self):
18781878
''', args=['34962', '26214', '35040', str(0xbf4)])
18791879

18801880
@no_emterpreter
1881+
@is_slow_test
18811882
def test_biggerswitch(self):
18821883
num_cases = 20000
18831884
switch_case = run_process([PYTHON, path_from_root('tests', 'gen_large_switchcase.py'), str(num_cases)], stdout=PIPE, stderr=PIPE).stdout
@@ -4831,6 +4832,7 @@ def test_fs_base(self):
48314832
self.do_run(src, expected)
48324833

48334834
@also_with_noderawfs
4835+
@is_slow_test
48344836
def test_fs_nodefs_rw(self, js_engines=[NODE_JS]):
48354837
self.set_setting('SYSCALL_DEBUG', 1)
48364838
src = open(path_from_root('tests', 'fs', 'test_nodefs_rw.c'), 'r').read()
@@ -5823,6 +5825,7 @@ def test_lua(self):
58235825
output_nicerizer=lambda string, err: (string + err).replace('\n\n', '\n').replace('\n\n', '\n'))
58245826

58255827
@no_windows('./configure scripts dont to run on windows.')
5828+
@is_slow_test
58265829
def test_freetype(self):
58275830
assert 'asm2g' in core_test_modes
58285831
if self.run_name == 'asm2g':
@@ -5895,6 +5898,7 @@ def test_sqlite(self):
58955898
includes=[path_from_root('tests', 'sqlite')],
58965899
force_c=True)
58975900

5901+
@is_slow_test
58985902
def test_zlib(self):
58995903
self.maybe_closure()
59005904

@@ -5916,6 +5920,7 @@ def test_zlib(self):
59165920
includes=[path_from_root('tests', 'zlib'), os.path.join(self.get_dir(), 'building', 'zlib')],
59175921
force_c=True)
59185922

5923+
@is_slow_test
59195924
def test_the_bullet(self): # Called thus so it runs late in the alphabetical cycle... it is long
59205925
self.set_setting('DEAD_FUNCTIONS', ['__ZSt9terminatev'])
59215926

@@ -5986,6 +5991,7 @@ def test():
59865991
# Make sure that DFE ends up eliminating more than 200 functions (if we can view source)
59875992
assert (num_original_funcs - self.count_funcs('src.cpp.o.js')) > 200
59885993

5994+
@is_slow_test
59895995
def test_openjpeg(self):
59905996
# remove -g, so we have one test without it by default
59915997
Building.COMPILER_TEST_OPTS = [x for x in Building.COMPILER_TEST_OPTS if x != '-g']
@@ -6104,6 +6110,7 @@ def test_lifetime(self):
61046110
# They are only valid enough for us to read for test purposes, not for llvm-as
61056111
# to process.
61066112
@no_wasm_backend("uses bitcode compiled with asmjs, and we don't have unified triples")
6113+
@is_slow_test
61076114
def test_cases(self):
61086115
if Building.LLVM_OPTS:
61096116
self.skipTest("Our code is not exactly 'normal' llvm assembly")
@@ -6208,6 +6215,7 @@ def test_cases(self):
62086215
generated = open('src.cpp.o.js').read() # noqa
62096216
exec(open(src_checker).read())
62106217

6218+
@is_slow_test
62116219
def test_fuzz(self):
62126220
Building.COMPILER_TEST_OPTS += ['-I' + path_from_root('tests', 'fuzz', 'include'), '-w']
62136221
# some of these tests - 2.c', '9.c', '19.c', '21.c', '20.cpp' - div or rem i32 by 0, which traps in wasm

0 commit comments

Comments
 (0)