Skip to content

Commit 8b47a49

Browse files
Update test_llvm_lto
1 parent 2353665 commit 8b47a49

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/test_other.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6272,16 +6272,23 @@ def test_emterpreter_file_suggestion(self):
62726272

62736273
def test_llvm_lto(self):
62746274
sizes = {}
6275-
for lto in [0, 1, 2, 3]:
6275+
lto_levels = [0, 1, 2, 3]
6276+
for lto in lto_levels:
62766277
cmd = [PYTHON, EMCC, path_from_root('tests', 'hello_libcxx.cpp'), '-O2', '--llvm-lto', str(lto)]
62776278
print cmd
62786279
check_execute(cmd)
62796280
self.assertContained('hello, world!', run_js('a.out.js'))
62806281
sizes[lto] = os.stat('a.out.js').st_size
62816282
print sizes
6282-
assert sizes[1] < sizes[0] # lto reduces size
6283-
assert sizes[2] > sizes[0] # fake lto is aggressive at increasing code size
6284-
assert sizes[3] not in set([sizes[0], sizes[1], sizes[2]]) # mode 3 is different (deterministic builds means this tests an actual change)
6283+
6284+
# LTO sizes should be distinct
6285+
for i in lto_levels:
6286+
assert sizes[i] not in set(sizes).difference(set([sizes[i]]))
6287+
6288+
# LTO should reduce code size
6289+
# Skip mode 2 because it has historically increased code size, but not always
6290+
assert sizes[1] < sizes[0]
6291+
assert sizes[3] < sizes[0]
62856292

62866293
def test_split_memory(self): # make sure multiple split memory chunks get used
62876294
open('src.c', 'w').write(r'''

0 commit comments

Comments
 (0)