def test_exceptions_white_list(self):
    self.set_setting('DISABLE_EXCEPTION_CATCHING', 2)
    if (not self.is_wasm_backend()):
        self.set_setting('EXCEPTION_CATCHING_WHITELIST', ['__Z12somefunctionv'])
    else:
        self.set_setting('EXCEPTION_CATCHING_WHITELIST', ['_Z12somefunctionv'])
    self.set_setting('INLINING_LIMIT', 50)
    test_path = path_from_root('tests', 'core', 'test_exceptions_white_list')
    (src, output) = ((test_path + s) for s in ('.cpp', '.out'))
    self.do_run_from_file(src, output)
    size = len(open('src.cpp.o.js').read())
    shutil.copyfile('src.cpp.o.js', 'orig.js')
    empty_output = path_from_root('tests', 'core', 'test_exceptions_white_list_empty.out')
    self.set_setting('EXCEPTION_CATCHING_WHITELIST', [])
    self.do_run_from_file(src, empty_output, assert_returncode=None)
    empty_size = len(open('src.cpp.o.js').read())
    shutil.copyfile('src.cpp.o.js', 'empty.js')
    self.set_setting('EXCEPTION_CATCHING_WHITELIST', ['fake'])
    self.do_run_from_file(src, empty_output, assert_returncode=None)
    fake_size = len(open('src.cpp.o.js').read())
    shutil.copyfile('src.cpp.o.js', 'fake.js')
    self.set_setting('DISABLE_EXCEPTION_CATCHING', 1)
    self.do_run_from_file(src, empty_output, assert_returncode=None)
    disabled_size = len(open('src.cpp.o.js').read())
    shutil.copyfile('src.cpp.o.js', 'disabled.js')
    if (not self.is_wasm()):
        print(size, empty_size, fake_size, disabled_size)
        assert (empty_size == fake_size), [empty_size, fake_size]
        assert ((size - empty_size) > (0.01 * size)), [empty_size, size]
        assert (empty_size >= disabled_size), [empty_size, disabled_size]
def test_exceptions_white_list(self):
    self.set_setting('DISABLE_EXCEPTION_CATCHING', 2)
    if (not self.is_wasm_backend()):
        self.set_setting('EXCEPTION_CATCHING_WHITELIST', ['__Z12somefunctionv'])
    else:
        self.set_setting('EXCEPTION_CATCHING_WHITELIST', ['_Z12somefunctionv'])
    self.set_setting('INLINING_LIMIT', 50)
    test_path = path_from_root('tests', 'core', 'test_exceptions_white_list')
    (src, output) = ((test_path + s) for s in ('.cpp', '.out'))
    self.do_run_from_file(src, output)
    size = len(open('src.cpp.o.js').read())
    shutil.copyfile('src.cpp.o.js', 'orig.js')
    empty_output = path_from_root('tests', 'core', 'test_exceptions_white_list_empty.out')
    self.set_setting('EXCEPTION_CATCHING_WHITELIST', [])
    self.do_run_from_file(src, empty_output, assert_returncode=None)
    empty_size = len(open('src.cpp.o.js').read())
    shutil.copyfile('src.cpp.o.js', 'empty.js')
    self.set_setting('EXCEPTION_CATCHING_WHITELIST', ['fake'])
    self.do_run_from_file(src, empty_output, assert_returncode=None)
    fake_size = len(open('src.cpp.o.js').read())
    shutil.copyfile('src.cpp.o.js', 'fake.js')
    self.set_setting('DISABLE_EXCEPTION_CATCHING', 1)
    self.do_run_from_file(src, empty_output, assert_returncode=None)
    disabled_size = len(open('src.cpp.o.js').read())
    shutil.copyfile('src.cpp.o.js', 'disabled.js')
    if (not self.is_wasm()):
        print(size, empty_size, fake_size, disabled_size)
        assert (empty_size == fake_size), [empty_size, fake_size]
        assert ((size - empty_size) > (0.01 * size)), [empty_size, size]
        assert (empty_size >= disabled_size), [empty_size, disabled_size]