Skip to content

Commit 90d76db

Browse files
authored
Remove non-determinsim tolerance from code size tests. NFC (#19348)
1 parent 59eb365 commit 90d76db

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

test/test_other.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7812,6 +7812,7 @@ def check_expected_size_in_file(self, desc, filename, size):
78127812
print(' seen %s size: %d (expected: %d) (delta: %d), ratio to expected: %f' % (desc, size, expected_size, delta, ratio))
78137813
self.assertLess(ratio, size_slack)
78147814

7815+
@crossplatform
78157816
def test_unoptimized_code_size(self):
78167817
# We don't care too about unoptimized code size but we would like to keep it
78177818
# under control to a certain extent. This test allows us to track major
@@ -10014,6 +10015,7 @@ def test(args, closure, opt):
1001410015
'math': ('math', False),
1001510016
'hello_wasm_worker': ('hello_wasm_worker', False, True),
1001610017
})
10018+
@crossplatform
1001710019
def test_minimal_runtime_code_size(self, test_name, js, compare_js_output=False):
1001810020
smallest_code_size_args = ['-sMINIMAL_RUNTIME=2',
1001910021
'-sENVIRONMENT=web',
@@ -10144,28 +10146,6 @@ def get_file_gzipped_size(f):
1014410146
print('size of ' + f + ' == ' + str(size) + ', expected ' + str(expected_size) + ', delta=' + str(size - expected_size) + print_percent(size, expected_size))
1014510147
print('size of ' + f_gz + ' == ' + str(size_gz) + ', expected ' + str(expected_size_gz) + ', delta=' + str(size_gz - expected_size_gz) + print_percent(size_gz, expected_size_gz))
1014610148

10147-
# Hack: Generated .mem initializer files have different sizes on different
10148-
# platforms (Windows gives x, CircleCI Linux gives x-17 bytes, my home
10149-
# Linux gives x+2 bytes..). Likewise asm.js files seem to be affected by
10150-
# the LLVM IR text names, which lead to asm.js names, which leads to
10151-
# difference code size, which leads to different relooper choices,
10152-
# as a result leading to slightly different total code sizes.
10153-
# Also as of July 16, 2020, wasm2js files have different sizes on
10154-
# different platforms (Windows and MacOS improved to give a slightly
10155-
# better thing than Linux does, which didn't change; this just
10156-
# started to happen on CI, not in response to a code update, so it
10157-
# may have been present all along but just noticed now; it only
10158-
# happens in wasm2js, so it may be platform-nondeterminism in closure
10159-
# compiler).
10160-
# TODO: identify what is causing this. meanwhile allow some amount of slop
10161-
if not common.EMTEST_REBASELINE:
10162-
if js:
10163-
slop = 30
10164-
else:
10165-
slop = 20
10166-
if size <= expected_size + slop and size >= expected_size - slop:
10167-
size = expected_size
10168-
1016910149
# N.B. even though the test code above prints out gzip compressed sizes, regression testing is done against uncompressed sizes
1017010150
# this is because optimizing for compressed sizes can be unpredictable and sometimes counterproductive
1017110151
total_output_size += size

0 commit comments

Comments
 (0)