@@ -9081,18 +9081,24 @@ def run_codesize_test(self, filename, args=[], expected_exists=[], expected_not_
9081
9081
for not_exists in expected_not_exists:
9082
9082
self.assertNotIn(not_exists, sent)
9083
9083
9084
- # measure the wasm size without the name section
9085
- building.strip('a.out.wasm', 'a.out.nodebug.wasm', sections=['name'])
9086
- wasm_size = os.path.getsize('a.out.nodebug.wasm')
9087
- size_file = expected_basename + '.size'
9088
9084
js_size = os.path.getsize('a.out.js')
9089
9085
gz_size = get_file_gzipped_size('a.out.js')
9090
9086
js_size_file = expected_basename + '.jssize'
9091
9087
gz_size_file = expected_basename + '.gzsize'
9092
- self.check_expected_size_in_file('wasm', size_file, wasm_size)
9093
9088
self.check_expected_size_in_file('js', js_size_file, js_size)
9094
9089
self.check_expected_size_in_file('gz', gz_size_file, gz_size)
9095
9090
9091
+ if '-sSINGLE_FILE' in args:
9092
+ # No wasm file in the final output so we skip the rest of the
9093
+ # testing
9094
+ return
9095
+
9096
+ # measure the wasm size without the name section
9097
+ building.strip('a.out.wasm', 'a.out.nodebug.wasm', sections=['name'])
9098
+ wasm_size = os.path.getsize('a.out.nodebug.wasm')
9099
+ size_file = expected_basename + '.size'
9100
+ self.check_expected_size_in_file('wasm', size_file, wasm_size)
9101
+
9096
9102
imports, exports, funcs = self.parse_wasm('a.out.wasm')
9097
9103
# Deminify the imports/export lists, if minification occured
9098
9104
if os.path.exists('minify.map'):
@@ -9189,14 +9195,14 @@ def test_codesize_cxx(self, *args):
9189
9195
'Os': (['-Os'], [], []),
9190
9196
'Oz': (['-Oz'], [], []),
9191
9197
# finally, check what happens when we export nothing. wasm should be almost empty
9192
- 'export_nothing':
9193
- (['-Os', '-sEXPORTED_FUNCTIONS=[]'], [], []), # noqa
9198
+ 'export_nothing': (['-Os', '-sEXPORTED_FUNCTIONS=[]'], [], []),
9194
9199
# we don't metadce with linkable code! other modules may want stuff
9195
9200
# TODO(sbc): Investivate why the number of exports is order of magnitude
9196
9201
# larger for wasm backend.
9197
- 'dylink': (['-O3', '-sMAIN_MODULE=2'], [], []), # noqa
9202
+ 'dylink': (['-O3', '-sMAIN_MODULE=2'], [], []),
9198
9203
# WasmFS should not be fully linked into a hello world program.
9199
- 'wasmfs': (['-O3', '-sWASMFS'], [], []), # noqa
9204
+ 'wasmfs': (['-O3', '-sWASMFS'], [], []),
9205
+ 'single_file': (['-O3', '-sSINGLE_FILE'], [], []), # noqa
9200
9206
})
9201
9207
def test_codesize_hello(self, *args):
9202
9208
self.run_codesize_test('hello_world.c', *args)
0 commit comments