From 88c7adc5a177b37adc6122d91a495a73256e00da Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Tue, 10 Dec 2024 15:39:12 -0800 Subject: [PATCH] Add some slack to test_extern_prepost. NFC 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). --- test/test_other.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/test_other.py b/test/test_other.py index f3e6b7ee59b9a..b034bbea1f75b 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -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'],),