35
35
from common import create_file, parameterized, NON_ZERO, node_pthreads, TEST_ROOT, test_file
36
36
from common import compiler_for, EMBUILDER, requires_v8, requires_node, requires_wasm64, requires_node_canary
37
37
from common import requires_wasm_eh, crossplatform, with_both_eh_sjlj, with_both_sjlj
38
- from common import also_with_standalone_wasm, also_with_env_modify
38
+ from common import also_with_standalone_wasm, also_with_env_modify, also_with_wasm2js
39
39
from common import also_with_minimal_runtime, also_with_wasm_bigint, also_with_wasm64, flaky
40
40
from common import EMTEST_BUILD_VERBOSE, PYTHON, WEBIDL_BINDER
41
41
from common import requires_network
@@ -9091,39 +9091,41 @@ def test_standalone_system_headers(self):
9091
9091
9092
9092
@is_slow_test
9093
9093
@parameterized({
9094
- '': (False ,),
9095
- 'wasm2js ': (True ,),
9094
+ '': (True ,),
9095
+ 'disabled ': (False ,),
9096
9096
})
9097
- def test_single_file(self, wasm2js):
9098
- for (single_file_enabled,
9099
- debug_enabled,
9100
- closure_enabled) in itertools.product([True, False], repeat=3 ):
9097
+ @also_with_wasm2js
9098
+ def test_single_file(self, single_file_enabled):
9099
+ for ( debug_enabled,
9100
+ closure_enabled) in itertools.product([True, False], repeat=2 ):
9101
9101
# skip unhelpful option combinations
9102
9102
if closure_enabled and debug_enabled:
9103
9103
continue
9104
9104
9105
- expect_wasm = not wasm2js
9106
-
9107
- cmd = [EMCC, test_file('hello_world.c')]
9105
+ cmd = [EMCC, test_file('hello_world.c')] + self.get_emcc_args()
9108
9106
9109
9107
if single_file_enabled:
9110
9108
expect_wasm = False
9111
9109
cmd += ['-sSINGLE_FILE']
9110
+ else:
9111
+ expect_wasm = self.is_wasm()
9112
+
9112
9113
if debug_enabled:
9113
9114
cmd += ['-g']
9114
9115
if closure_enabled:
9115
- cmd += ['--closure=1']
9116
- if wasm2js:
9117
- cmd += ['-sWASM=0']
9116
+ cmd += ['--closure=1', '-Wno-closure']
9118
9117
9119
9118
self.clear()
9120
9119
9121
9120
def do_test(cmd):
9122
9121
print(' '.join(cmd))
9123
9122
self.run_process(cmd)
9124
9123
print(os.listdir('.'))
9125
- assert expect_wasm == os.path.exists('a.out.wasm')
9126
- assert not os.path.exists('a.out.wat')
9124
+ if expect_wasm:
9125
+ self.assertExists('a.out.wasm')
9126
+ else:
9127
+ self.assertNotExists('a.out.wasm')
9128
+ self.assertNotExists('a.out.wat')
9127
9129
self.assertContained('hello, world!', self.run_js('a.out.js'))
9128
9130
9129
9131
do_test(cmd)
@@ -9132,7 +9134,7 @@ def do_test(cmd):
9132
9134
9133
9135
if debug_enabled:
9134
9136
separate_dwarf_cmd = cmd + ['-gseparate-dwarf']
9135
- if wasm2js :
9137
+ if self.is_wasm2js() :
9136
9138
self.expect_fail(separate_dwarf_cmd)
9137
9139
else:
9138
9140
do_test(separate_dwarf_cmd)
0 commit comments