@@ -10703,27 +10703,33 @@ def test_emscripten_license(self, expect_license, args):
10703
10703
# unminified exported name exactly once. (need to contain the export name once for unminified
10704
10704
# access from calling code, and should not have the unminified name exist more than once, that
10705
10705
# would be wasteful for size)
10706
- def test_function_exports_are_small(self):
10707
- def test(args, closure, opt):
10708
- extra_args = args + opt + closure
10709
- print(extra_args)
10710
- args = [EMCC, test_file('long_function_name_in_export.c'), '-o', 'a.html', '-sENVIRONMENT=web', '-sDECLARE_ASM_MODULE_EXPORTS=0', '-Werror'] + extra_args
10711
- self.run_process(args)
10706
+ @parameterized({
10707
+ '': ([],),
10708
+ 'closure': (['--closure=1'],),
10709
+ })
10710
+ @parameterized({
10711
+ 'O2': (['-O2'],),
10712
+ 'O3': (['-O3'],),
10713
+ 'Os': (['-Os'],),
10714
+ })
10715
+ @parameterized({
10716
+ 'sync': (['-sWASM_ASYNC_COMPILATION=0'],),
10717
+ 'wasm2js': (['-sWASM=0', '-Wno-closure'],),
10718
+ })
10719
+ def test_function_exports_are_small(self, args, opt, closure):
10720
+ extra_args = args + opt + closure
10721
+ args = [EMCC, test_file('long_function_name_in_export.c'), '-o', 'a.html', '-sENVIRONMENT=web', '-sDECLARE_ASM_MODULE_EXPORTS=0', '-Werror'] + extra_args
10722
+ self.run_process(args)
10712
10723
10713
- output = read_file('a.js')
10714
- delete_file('a.js')
10715
- self.assertNotContained('_thisIsAFunctionExportedFromAsmJsOrWasmWithVeryLongFunction', output)
10716
-
10717
- # TODO: Add stricter testing when Wasm side is also optimized: (currently Wasm does still need
10718
- # to reference exports multiple times)
10719
- if '-sWASM=0' in args:
10720
- num_times_export_is_referenced = output.count('thisIsAFunctionExportedFromAsmJsOrWasmWithVeryLongFunction')
10721
- self.assertEqual(num_times_export_is_referenced, 1)
10722
-
10723
- for closure in [[], ['--closure=1']]:
10724
- for opt in [['-O2'], ['-O3'], ['-Os']]:
10725
- test(['-sWASM=0', '-Wno-closure'], closure, opt)
10726
- test(['-sWASM_ASYNC_COMPILATION=0'], closure, opt)
10724
+ output = read_file('a.js')
10725
+ delete_file('a.js')
10726
+ self.assertNotContained('_thisIsAFunctionExportedFromAsmJsOrWasmWithVeryLongFunction', output)
10727
+
10728
+ # TODO: Add stricter testing when Wasm side is also optimized: (currently Wasm does still need
10729
+ # to reference exports multiple times)
10730
+ if '-sWASM=0' in args:
10731
+ num_times_export_is_referenced = output.count('thisIsAFunctionExportedFromAsmJsOrWasmWithVeryLongFunction')
10732
+ self.assertEqual(num_times_export_is_referenced, 1)
10727
10733
10728
10734
@parameterized({
10729
10735
'hello_world_wasm': ('hello_world', False, True),
0 commit comments