Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/browser/test_small_js_flags.js.size
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4369
10 changes: 10 additions & 0 deletions test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1537,6 +1537,16 @@ def assertBinaryEqual(self, file1, file2):
self.assertEqual(read_binary(file1),
read_binary(file2))

def check_expected_size_in_file(self, desc, filename, size):
if EMTEST_REBASELINE:
create_file(filename, f'{size}\n', absolute=True)
size_slack = 0.05
expected_size = int(read_file(filename).strip())
delta = size - expected_size
ratio = abs(delta) / float(expected_size)
print(' seen %s size: %d (expected: %d) (delta: %d), ratio to expected: %f' % (desc, size, expected_size, delta, ratio))
self.assertLess(ratio, size_slack)

library_cache: Dict[str, Tuple[str, object]] = {}

def get_build_dir(self):
Expand Down
4 changes: 3 additions & 1 deletion test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4204,7 +4204,9 @@ def test_small_js_flags(self):
print('size:', size)
# Note that this size includes test harness additions (for reporting the result, etc.).
if not self.is_wasm64() and not self.is_2gb():
self.assertLess(abs(size - 4477), 100)
self.check_expected_size_in_file('js',
test_file('browser/test_small_js_flags.js.size'),
size)

# Tests that it is possible to initialize and render WebGL content in a
# pthread by using OffscreenCanvas.
Expand Down
10 changes: 0 additions & 10 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -8712,16 +8712,6 @@ def build(args):
# adding --metrics should not affect code size
self.assertEqual(base_size, os.path.getsize('a.out.wasm'))

def check_expected_size_in_file(self, desc, filename, size):
if common.EMTEST_REBASELINE:
create_file(filename, f'{size}\n', absolute=True)
size_slack = 0.05
expected_size = int(read_file(filename).strip())
delta = size - expected_size
ratio = abs(delta) / float(expected_size)
print(' seen %s size: %d (expected: %d) (delta: %d), ratio to expected: %f' % (desc, size, expected_size, delta, ratio))
self.assertLess(ratio, size_slack)

@crossplatform
def test_unoptimized_code_size(self):
# We don't care too about unoptimized code size but we would like to keep it
Expand Down
Loading