Skip to content

Commit f36fcb8

Browse files
authored
Add some slack to test_extern_prepost. NFC (#23127)
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).
1 parent 82182e6 commit f36fcb8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/test_other.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2868,16 +2868,18 @@ def test_extern_prepost(self):
28682868
# code, so they are the very first and last things, and they are not
28692869
# minified.
28702870
js = read_file('a.out.js')
2871-
pre = js.index('// I am an external pre.')
2872-
post = js.index('// I am an external post.')
2871+
js_size = len(js)
2872+
print('js_size', js_size)
2873+
pre_offset = js.index('// I am an external pre.')
2874+
post_offset = js.index('// I am an external post.')
28732875
# ignore some slack - newlines and other things. we just care about the
28742876
# big picture here
28752877
SLACK = 50
2876-
self.assertLess(pre, post)
2877-
self.assertLess(pre, SLACK)
2878-
self.assertGreater(post, len(js) - SLACK)
2878+
self.assertLess(pre_offset, post_offset)
2879+
self.assertLess(pre_offset, SLACK)
2880+
self.assertGreater(post_offset, js_size - SLACK)
28792881
# make sure the slack is tiny compared to the whole program
2880-
self.assertGreater(len(js), 100 * SLACK)
2882+
self.assertGreater(js_size, 50 * SLACK)
28812883

28822884
@parameterized({
28832885
'minifyGlobals': (['minifyGlobals'],),

0 commit comments

Comments
 (0)