@@ -1347,6 +1347,33 @@ def test_exceptions_white_list(self):
1347
1347
test_path = path_from_root ('tests' , 'core' , 'test_exceptions_white_list' )
1348
1348
src , output = (test_path + s for s in ('.in' , '.out' ))
1349
1349
self .do_run_from_file (src , output )
1350
+ size = len (open ('src.cpp.o.js' ).read ())
1351
+ shutil .copyfile ('src.cpp.o.js' , 'orig.js' )
1352
+
1353
+ if os .environ .get ('EMCC_FAST_COMPILER' ) != '0' :
1354
+ # check that an empty whitelist works properly (as in, same as exceptions disabled)
1355
+ empty_output = path_from_root ('tests' , 'core' , 'test_exceptions_white_list_empty.out' )
1356
+
1357
+ Settings .EXCEPTION_CATCHING_WHITELIST = []
1358
+ self .do_run_from_file (src , empty_output )
1359
+ empty_size = len (open ('src.cpp.o.js' ).read ())
1360
+ shutil .copyfile ('src.cpp.o.js' , 'empty.js' )
1361
+
1362
+ Settings .EXCEPTION_CATCHING_WHITELIST = ['fake' ]
1363
+ self .do_run_from_file (src , empty_output )
1364
+ fake_size = len (open ('src.cpp.o.js' ).read ())
1365
+ shutil .copyfile ('src.cpp.o.js' , 'fake.js' )
1366
+
1367
+ Settings .DISABLE_EXCEPTION_CATCHING = 1
1368
+ self .do_run_from_file (src , empty_output )
1369
+ disabled_size = len (open ('src.cpp.o.js' ).read ())
1370
+ shutil .copyfile ('src.cpp.o.js' , 'disabled.js' )
1371
+
1372
+ assert size - empty_size > 2000 , [empty_size , size ] # big change when we disable entirely
1373
+ assert size - fake_size > 2000 , [fake_size , size ]
1374
+ assert empty_size == fake_size , [empty_size , fake_size ]
1375
+ assert empty_size - disabled_size < 100 , [empty_size , disabled_size ] # full disable removes a tiny bit more
1376
+ assert fake_size - disabled_size < 100 , [disabled_size , fake_size ]
1350
1377
1351
1378
def test_exceptions_white_list_2 (self ):
1352
1379
Settings .DISABLE_EXCEPTION_CATCHING = 2
0 commit comments