3535from common import create_file, parameterized, NON_ZERO, node_pthreads, TEST_ROOT, test_file
3636from common import compiler_for, EMBUILDER, requires_v8, requires_node, requires_wasm64, requires_node_canary
3737from 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
3939from common import also_with_minimal_runtime, also_with_wasm_bigint, also_with_wasm64, flaky
4040from common import EMTEST_BUILD_VERBOSE, PYTHON, WEBIDL_BINDER
4141from common import requires_network
@@ -9091,39 +9091,41 @@ def test_standalone_system_headers(self):
90919091
90929092 @is_slow_test
90939093 @parameterized({
9094- '': (False ,),
9095- 'wasm2js ': (True ,),
9094+ '': (True ,),
9095+ 'disabled ': (False ,),
90969096 })
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 ):
91019101 # skip unhelpful option combinations
91029102 if closure_enabled and debug_enabled:
91039103 continue
91049104
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()
91089106
91099107 if single_file_enabled:
91109108 expect_wasm = False
91119109 cmd += ['-sSINGLE_FILE']
9110+ else:
9111+ expect_wasm = self.is_wasm()
9112+
91129113 if debug_enabled:
91139114 cmd += ['-g']
91149115 if closure_enabled:
9115- cmd += ['--closure=1']
9116- if wasm2js:
9117- cmd += ['-sWASM=0']
9116+ cmd += ['--closure=1', '-Wno-closure']
91189117
91199118 self.clear()
91209119
91219120 def do_test(cmd):
91229121 print(' '.join(cmd))
91239122 self.run_process(cmd)
91249123 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')
91279129 self.assertContained('hello, world!', self.run_js('a.out.js'))
91289130
91299131 do_test(cmd)
@@ -9132,7 +9134,7 @@ def do_test(cmd):
91329134
91339135 if debug_enabled:
91349136 separate_dwarf_cmd = cmd + ['-gseparate-dwarf']
9135- if wasm2js :
9137+ if self.is_wasm2js() :
91369138 self.expect_fail(separate_dwarf_cmd)
91379139 else:
91389140 do_test(separate_dwarf_cmd)
0 commit comments