@@ -1244,7 +1244,9 @@ def test_exceptions_allowed(self):
1244
1244
self .set_setting ('INLINING_LIMIT' , 50 )
1245
1245
1246
1246
self .do_core_test ('test_exceptions_allowed.cpp' )
1247
- size = len (open ('test_exceptions_allowed.js' ).read ())
1247
+ size = os .path .getsize ('test_exceptions_allowed.js' )
1248
+ if self .is_wasm ():
1249
+ size += os .path .getsize ('test_exceptions_allowed.wasm' )
1248
1250
shutil .copyfile ('test_exceptions_allowed.js' , 'orig.js' )
1249
1251
1250
1252
# check that an empty allow list works properly (as in, same as exceptions disabled)
@@ -1253,26 +1255,34 @@ def test_exceptions_allowed(self):
1253
1255
1254
1256
self .set_setting ('EXCEPTION_CATCHING_ALLOWED' , [])
1255
1257
self .do_run_from_file (src , empty_output , assert_returncode = NON_ZERO )
1256
- empty_size = len (open ('test_exceptions_allowed.js' ).read ())
1258
+ empty_size = os .path .getsize ('test_exceptions_allowed.js' )
1259
+ if self .is_wasm ():
1260
+ empty_size += os .path .getsize ('test_exceptions_allowed.wasm' )
1257
1261
shutil .copyfile ('test_exceptions_allowed.js' , 'empty.js' )
1258
1262
1259
1263
self .set_setting ('EXCEPTION_CATCHING_ALLOWED' , ['fake' ])
1260
1264
self .do_run_from_file (src , empty_output , assert_returncode = NON_ZERO )
1261
- fake_size = len (open ('test_exceptions_allowed.js' ).read ())
1265
+ fake_size = os .path .getsize ('test_exceptions_allowed.js' )
1266
+ if self .is_wasm ():
1267
+ fake_size += os .path .getsize ('test_exceptions_allowed.wasm' )
1262
1268
shutil .copyfile ('test_exceptions_allowed.js' , 'fake.js' )
1263
1269
1264
1270
self .set_setting ('DISABLE_EXCEPTION_CATCHING' )
1265
1271
self .do_run_from_file (src , empty_output , assert_returncode = NON_ZERO )
1266
- disabled_size = len (open ('test_exceptions_allowed.js' ).read ())
1272
+ disabled_size = os .path .getsize ('test_exceptions_allowed.js' )
1273
+ if self .is_wasm ():
1274
+ disabled_size += os .path .getsize ('test_exceptions_allowed.wasm' )
1267
1275
shutil .copyfile ('test_exceptions_allowed.js' , 'disabled.js' )
1268
1276
1269
- if not self .is_wasm ():
1270
- print (size , empty_size , fake_size , disabled_size )
1271
- assert empty_size == fake_size , [empty_size , fake_size ]
1272
- # big change when we disable exception catching of the function
1273
- assert size - empty_size > 0.01 * size , [empty_size , size ]
1274
- # full disable can remove a little bit more
1275
- assert empty_size >= disabled_size , [empty_size , disabled_size ]
1277
+ print ('size: %d' % size )
1278
+ print ('empty_size: %d' % empty_size )
1279
+ print ('fake_size: %d' % fake_size )
1280
+ print ('disabled_size: %d' % disabled_size )
1281
+ self .assertEqual (empty_size , fake_size )
1282
+ # big change when we disable exception catching of the function
1283
+ self .assertGreater (size - empty_size , 0.01 * size )
1284
+ # full disable can remove a little bit more
1285
+ self .assertLess (disabled_size , empty_size )
1276
1286
1277
1287
def test_exceptions_allowed_2 (self ):
1278
1288
self .set_setting ('DISABLE_EXCEPTION_CATCHING' , 2 )
0 commit comments