Skip to content

Commit d69c187

Browse files
committed
Cleanup test_async_compile. NFC
1 parent aef8142 commit d69c187

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

test/browser/test_async_compile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ int main() {
1414
int result = EM_ASM_INT({
1515
return Module.sawAsyncCompilation | 0;
1616
});
17+
printf("sawAsyncCompilation => %d\n", result);
1718
return result;
1819
}
1920

test/test_browser.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4469,7 +4469,16 @@ def test_in_flight_memfile_request(self, args, expected):
44694469
# should happen when there is a mem init file (-O2+)
44704470
self.btest('in_flight_memfile_request.c', expected=expected)
44714471

4472-
def test_async_compile(self):
4472+
@parameterized({
4473+
'': ([], 1),
4474+
'O1': (['-O1'], 1),
4475+
'O2': (['-O2'], 1),
4476+
'O3': (['-O3'], 1),
4477+
# force it on
4478+
'force': (['-sWASM_ASYNC_COMPILATION'], 1),
4479+
'off': (['-sWASM_ASYNC_COMPILATION=0'], 0),
4480+
})
4481+
def test_async_compile(self, opts, returncode):
44734482
# notice when we use async compilation
44744483
script = '''
44754484
<script>
@@ -4478,11 +4487,13 @@ def test_async_compile(self):
44784487
var real_wasm_instantiateStreaming = WebAssembly.instantiateStreaming;
44794488
if (typeof real_wasm_instantiateStreaming === 'function') {
44804489
WebAssembly.instantiateStreaming = (a, b) => {
4490+
console.log('instantiateStreaming called');
44814491
Module.sawAsyncCompilation = true;
44824492
return real_wasm_instantiateStreaming(a, b);
44834493
};
44844494
} else {
44854495
WebAssembly.instantiate = (a, b) => {
4496+
console.log('instantiate called');
44864497
Module.sawAsyncCompilation = true;
44874498
return real_wasm_instantiate(a, b);
44884499
};
@@ -4497,21 +4508,9 @@ def test_async_compile(self):
44974508
'''
44984509
shell_with_script('shell.html', 'shell.html', script)
44994510
common_args = ['--shell-file', 'shell.html']
4500-
for opts, returncode in [
4501-
([], 1),
4502-
(['-O1'], 1),
4503-
(['-O2'], 1),
4504-
(['-O3'], 1),
4505-
# force it on
4506-
(['-sWASM_ASYNC_COMPILATION'], 1),
4507-
# force it off. note that we use -O3 here to make the binary small enough
4508-
# for chrome to allow compiling it synchronously
4509-
(['-O3', '-sWASM_ASYNC_COMPILATION=0'], 0),
4510-
]:
4511-
print(opts, returncode)
4512-
self.btest_exit('test_async_compile.c', assert_returncode=returncode, args=common_args + opts)
4511+
self.btest_exit('test_async_compile.c', assert_returncode=returncode, args=common_args + opts)
45134512
# Ensure that compilation still works and is async without instantiateStreaming available
4514-
no_streaming = ' <script> WebAssembly.instantiateStreaming = undefined;</script>'
4513+
no_streaming = '<script>WebAssembly.instantiateStreaming = undefined;</script>'
45154514
shell_with_script('shell.html', 'shell.html', no_streaming + script)
45164515
self.btest_exit('test_async_compile.c', assert_returncode=1, args=common_args)
45174516

0 commit comments

Comments
 (0)