Skip to content

Commit

Permalink
Add some slack to test_extern_prepost. NFC (#23127)
Browse files Browse the repository at this point in the history
This test started failing on the macOS roller.

The js size on this test on my machine is 5006 which is very close the
limit of 100 * 50 that this test was checking against.

The main change here is to reduce the limit to from 5k (100 * 50) to
2.5k (50 * 50).
  • Loading branch information
sbc100 authored Dec 11, 2024
1 parent 82182e6 commit f36fcb8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -2868,16 +2868,18 @@ def test_extern_prepost(self):
# code, so they are the very first and last things, and they are not
# minified.
js = read_file('a.out.js')
pre = js.index('// I am an external pre.')
post = js.index('// I am an external post.')
js_size = len(js)
print('js_size', js_size)
pre_offset = js.index('// I am an external pre.')
post_offset = js.index('// I am an external post.')
# ignore some slack - newlines and other things. we just care about the
# big picture here
SLACK = 50
self.assertLess(pre, post)
self.assertLess(pre, SLACK)
self.assertGreater(post, len(js) - SLACK)
self.assertLess(pre_offset, post_offset)
self.assertLess(pre_offset, SLACK)
self.assertGreater(post_offset, js_size - SLACK)
# make sure the slack is tiny compared to the whole program
self.assertGreater(len(js), 100 * SLACK)
self.assertGreater(js_size, 50 * SLACK)

@parameterized({
'minifyGlobals': (['minifyGlobals'],),
Expand Down

0 comments on commit f36fcb8

Please sign in to comment.