Skip to content

Commit 78b286e

Browse files
authored
Update test_no_legalize_js_ffi in preparation for binaryen change (#21599)
See WebAssembly/binaryen#6428
1 parent ecdca7b commit 78b286e

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

test/test_other.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8620,25 +8620,18 @@ def test_legalize_js_ffi(self):
86208620
assert not e_f32_f64, 'f32 converted to f64 in exports'
86218621
assert e_i64_i64, 'i64 converted to i64 in exports'
86228622

8623+
@disabled('https://github.com/WebAssembly/binaryen/pull/6428')
86238624
def test_no_legalize_js_ffi(self):
8624-
# test minimal JS FFI legalization for invoke and dyncalls
8625-
args = ['-sLEGALIZE_JS_FFI=0', '-sMAIN_MODULE=2', '-O3', '-sDISABLE_EXCEPTION_CATCHING=0']
8626-
delete_file('a.out.wasm')
8627-
with env_modify({'EMCC_FORCE_STDLIBS': 'libc++'}):
8628-
cmd = [EMXX, test_file('other/noffi.cpp'), '-g', '-o', 'a.out.js'] + args
8629-
print(' '.join(cmd))
8630-
self.run_process(cmd)
8631-
text = self.get_wasm_text('a.out.wasm')
8632-
# remove internal comments and extra whitespace
8633-
text = re.sub(r'\(;[^;]+;\)', '', text)
8634-
text = re.sub(r'\$var\$*.', '', text)
8635-
text = re.sub(r'param \$\d+', 'param ', text)
8636-
text = re.sub(r' +', ' ', text)
8637-
# print("text: %s" % text)
8638-
i_legalimport_i64 = re.search(r'\(import.*\$legalimport\$invoke_j.*', text)
8639-
e_legalstub_i32 = re.search(r'\(func.*\$legalstub\$dyn.*\(result i32\)', text)
8640-
assert i_legalimport_i64, 'legal import not generated for invoke call'
8641-
assert e_legalstub_i32, 'legal stub not generated for dyncall'
8625+
for legalizing in [0, 1]:
8626+
# test minimal JS FFI legalization for invoke and dyncalls
8627+
args = ['-sMAIN_MODULE=2', '-O3', '-sDISABLE_EXCEPTION_CATCHING=0', '-g']
8628+
if not legalizing:
8629+
args.append('-sLEGALIZE_JS_FFI=0')
8630+
self.run_process([EMXX, test_file('other/noffi.cpp')] + args)
8631+
text = self.get_wasm_text('a.out.wasm')
8632+
# Verify that legalization either did, or did not, occur
8633+
self.assertContainedIf('$legalimport', text, legalizing)
8634+
self.assertContainedIf('$legalstub', text, legalizing)
86428635

86438636
def test_export_aliasee(self):
86448637
# build side module

0 commit comments

Comments
 (0)