Skip to content

Commit 55a9c76

Browse files
authored
Triage and enable all possible wasm backend tests (#9040)
I went through all the tests marked as no_wasm_backend. A fair bit now work! Those are enabled here. I clarified some comments on the non-working ones, and filed issues for the small number that seem like they should pass, or at least are in need of looking into, and linked them. Some tiny test fixes were needed in some cases. I also fixed a tiny bug in llvm_opt for the wasm backend, which it turns out is only used in the one place in one test.
1 parent a16640f commit 55a9c76

File tree

4 files changed

+49
-61
lines changed

4 files changed

+49
-61
lines changed

tests/test_browser.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ def test_sdl1(self):
144144
# Deliberately named as test_zzz_* to make this test the last one
145145
# as this test may take the focus away from the main test window
146146
# by opening a new window and possibly not closing it.
147-
@no_wasm_backend('wasm source maps')
148147
def test_zzz_html_source_map(self):
149148
if not has_browser():
150149
self.skipTest('need a browser')
@@ -174,9 +173,9 @@ def test_zzz_html_source_map(self):
174173
# sourceContent when the maps are relative paths
175174
try_delete(html_file)
176175
try_delete(html_file + '.map')
177-
self.compile_btest(['src.cpp', '-o', 'src.html', '-g4', '-s', 'WASM=0'])
176+
self.compile_btest(['src.cpp', '-o', 'src.html', '-g4'])
178177
self.assertExists(html_file)
179-
self.assertExists(html_file + '.map')
178+
self.assertExists('src.wasm.map')
180179
webbrowser.open_new('file://' + html_file)
181180
print('''
182181
If manually bisecting:
@@ -187,10 +186,9 @@ def test_zzz_html_source_map(self):
187186

188187
@no_wasm_backend('wasm source maps')
189188
def test_emscripten_log(self):
190-
# TODO: wasm support for source maps
189+
# TODO: wasm support for source maps. emscripten_loadSourceMap looks at $HTML.map but it should be $NAME.wasm.map.
191190
src = 'src.cpp'
192191
create_test_file(src, self.with_report_result(open(path_from_root('tests', 'emscripten_log', 'emscripten_log.cpp')).read()))
193-
194192
self.compile_btest([src, '--pre-js', path_from_root('src', 'emscripten-source-map.min.js'), '-g', '-o', 'page.html', '-s', 'DEMANGLE_SUPPORT=1', '-s', 'WASM=0'])
195193
self.run_browser('page.html', None, '/report_result?1')
196194

@@ -2194,9 +2192,10 @@ def test_openal_error(self):
21942192
def test_openal_capture_sanity(self):
21952193
self.btest('openal_capture_sanity.c', expected='0')
21962194

2197-
@no_wasm_backend('dynamic linking')
21982195
def test_runtimelink(self):
21992196
for wasm in [0, 1]:
2197+
if not wasm and self.is_wasm_backend():
2198+
continue
22002199
print(wasm)
22012200
main, supp = self.setup_runtimelink_test()
22022201
create_test_file('supp.cpp', supp)
@@ -2395,7 +2394,6 @@ def test_module(self):
23952394
self.compile_btest([path_from_root('tests', 'browser_module.cpp'), '-o', 'module.js', '-O2', '-s', 'SIDE_MODULE=1', '-s', 'DLOPEN_SUPPORT=1', '-s', 'EXPORTED_FUNCTIONS=["_one", "_two"]'])
23962395
self.btest('browser_main.cpp', args=['-O2', '-s', 'MAIN_MODULE=1', '-s', 'DLOPEN_SUPPORT=1', '-s', 'EXPORT_ALL=1'], expected='8')
23972396

2398-
@no_wasm_backend('dynamic linking')
23992397
def test_preload_module(self):
24002398
create_test_file('library.c', r'''
24012399
#include <stdio.h>
@@ -3415,7 +3413,6 @@ def test_webidl(self):
34153413
print(opts)
34163414
self.btest(os.path.join('webidl', 'test.cpp'), '1', args=['--post-js', 'glue.js', '-I.', '-DBROWSER'] + opts)
34173415

3418-
@no_wasm_backend('dynamic linking')
34193416
@requires_sync_compilation
34203417
def test_dynamic_link(self):
34213418
create_test_file('pre.js', '''
@@ -3529,7 +3526,6 @@ def do_run(src, expected_output):
35293526

35303527
super(browser, self)._test_dylink_dso_needed(do_run)
35313528

3532-
@no_wasm_backend('dynamic linking')
35333529
@requires_graphics_hardware
35343530
@requires_sync_compilation
35353531
def test_dynamic_link_glemu(self):

tests/test_core.py

+7-13
Original file line numberDiff line numberDiff line change
@@ -1981,13 +1981,11 @@ def test_biggerswitch(self):
19811981
59899: 598995989959899
19821982
Success!''')
19831983

1984-
@no_wasm_backend('no implementation of computed gotos')
19851984
def test_indirectbr(self):
19861985
self.emcc_args = [x for x in self.emcc_args if x != '-g']
19871986

19881987
self.do_run_in_out_file_test('tests', 'core', 'test_indirectbr')
19891988

1990-
@no_wasm_backend('no implementation of computed gotos')
19911989
def test_indirectbr_many(self):
19921990
self.do_run_in_out_file_test('tests', 'core', 'test_indirectbr_many')
19931991

@@ -2316,7 +2314,7 @@ def test_flexarray_struct(self):
23162314
def test_bsearch(self):
23172315
self.do_run_in_out_file_test('tests', 'core', 'test_bsearch')
23182316

2319-
@no_wasm_backend("wasm backend has no support for fastcomp's -emscripten-assertions flag")
2317+
@no_wasm_backend("https://github.com/emscripten-core/emscripten/issues/9039")
23202318
def test_stack_overflow(self):
23212319
self.set_setting('ASSERTIONS', 1)
23222320
self.do_run(open(path_from_root('tests', 'core', 'stack_overflow.cpp')).read(), 'Stack overflow!')
@@ -3717,7 +3715,6 @@ def test():
37173715
self.assertNotContained("trying to dynamically load symbol '__ZN5ClassC2EPKc' (from 'liblib.so') that already exists", full)
37183716

37193717
@needs_dlfcn
3720-
@no_wasm_backend('some kind of issue with dylink and i64')
37213718
def test_dylink_i64(self):
37223719
self.dylink_test(r'''
37233720
#include <stdio.h>
@@ -3749,7 +3746,6 @@ def test_dylink_i64(self):
37493746
''', 'other says 175a1ddee82b8c31.')
37503747

37513748
@needs_dlfcn
3752-
@no_wasm_backend('some kind of issue with dylink and i64')
37533749
def test_dylink_i64_b(self):
37543750
self.dylink_test(r'''
37553751
#include <stdio.h>
@@ -4031,7 +4027,6 @@ def test_dylink_iostream(self):
40314027
''', expected=['hello from main and hello from side\n'])
40324028

40334029
@needs_dlfcn
4034-
@no_wasm_backend('current fails in __dynamic_cast')
40354030
def test_dylink_dynamic_cast(self): # issue 3465
40364031
self.dylink_test(header=r'''
40374032
class Base {
@@ -4113,7 +4108,7 @@ def test_dylink_raii_exceptions(self):
41134108
''', expected=['special 2.182810 3.141590 42\ndestroy\nfrom side: 1337.\n'])
41144109

41154110
@needs_dlfcn
4116-
@no_wasm_backend('wasm backend resolved symbols greedily on startup')
4111+
@no_wasm_backend('wasm backend resolves symbols greedily on startup')
41174112
def test_dylink_hyper_dupe(self):
41184113
self.set_setting('TOTAL_MEMORY', 64 * 1024 * 1024)
41194114
if not self.has_changed_setting('ASSERTIONS'):
@@ -4187,7 +4182,7 @@ def test_dylink_hyper_dupe(self):
41874182
self.assertContained("warning: symbol '_sideg' from '%s' already exists" % libname, full)
41884183

41894184
@needs_dlfcn
4190-
@no_wasm_backend('not implemented yet')
4185+
@no_wasm_backend('possible https://github.com/emscripten-core/emscripten/issues/9038')
41914186
def test_dylink_dso_needed(self):
41924187
def do_run(src, expected_output):
41934188
self.do_run(src + 'int main() { return _main(); }', expected_output)
@@ -6538,7 +6533,6 @@ def test_demangle_stacks(self):
65386533
self.do_run_in_out_file_test('tests', 'core', 'test_demangle_stacks_noassert')
65396534

65406535
@no_emterpreter
6541-
@no_wasm_backend('lld does not generate symbol maps')
65426536
def test_demangle_stacks_symbol_map(self):
65436537
self.set_setting('DEMANGLE_SUPPORT', 1)
65446538
if '-O' in str(self.emcc_args) and '-O0' not in self.emcc_args and '-O1' not in self.emcc_args and '-g' not in self.emcc_args:
@@ -6552,7 +6546,8 @@ def test_demangle_stacks_symbol_map(self):
65526546
for line in symbols:
65536547
if ':' not in line:
65546548
continue
6555-
short, full = line.split(':')
6549+
# split by the first ':' (wasm backend demangling may include more :'s later on)
6550+
short, full = line.split(':', 1)
65566551
if 'Aborter' in full:
65576552
short_aborter = short
65586553
full_aborter = full
@@ -7274,8 +7269,7 @@ def test_async(self, emterpretify=False):
72747269
''')
72757270
self.do_run(src, 'first\nsecond\n6.4')
72767271

7277-
@no_wasm_backend('EMTERPRETIFY causes JSOptimizer to run, which is '
7278-
'unsupported with Wasm backend')
7272+
@no_wasm_backend('EMTERPRETIFY')
72797273
def test_async_emterpretify(self):
72807274
self.test_async(emterpretify=True)
72817275

@@ -7584,7 +7578,7 @@ def test_fs_dict(self):
75847578
self.do_run('int main() { return 0; }', 'object\nobject\nobject')
75857579

75867580
@sync
7587-
@no_wasm_backend("wasm backend has no support for fastcomp's -emscripten-assertions flag")
7581+
@no_wasm_backend("https://github.com/emscripten-core/emscripten/issues/9039")
75887582
def test_stack_overflow_check(self):
75897583
args = self.emcc_args + ['-s', 'TOTAL_STACK=1048576']
75907584

0 commit comments

Comments
 (0)