@sync
def test_add_function(self):
    self.set_setting('INVOKE_RUN', 0)
    self.set_setting('RESERVED_FUNCTION_POINTERS', 1)
    self.set_setting('EXPORTED_RUNTIME_METHODS', ['callMain'])
    src = path_from_root('tests', 'interop', 'test_add_function.cpp')
    post_js = path_from_root('tests', 'interop', 'test_add_function_post.js')
    self.emcc_args += ['--post-js', post_js]
    print('basics')
    self.do_run_in_out_file_test('tests', 'interop', 'test_add_function')
    if (('-g' not in self.emcc_args) and (not self.is_wasm_backend())):
        print('with --closure')
        old = list(self.emcc_args)
        self.emcc_args += ['--closure', '1']
        self.do_run_in_out_file_test('tests', 'interop', 'test_add_function')
        self.emcc_args = old
        print(old)
    print('with ALIASING_FUNCTION_POINTERS')
    self.set_setting('ALIASING_FUNCTION_POINTERS', 1)
    self.do_run_in_out_file_test('tests', 'interop', 'test_add_function')
    self.clear_setting('ALIASING_FUNCTION_POINTERS')
    print('with RESERVED_FUNCTION_POINTERS=0')
    self.set_setting('RESERVED_FUNCTION_POINTERS', 0)
    if self.is_wasm_backend():
        self.do_run(open(src).read(), 'Unable to grow wasm table', assert_returncode=None)
        print('- with table growth')
        self.set_setting('ALLOW_TABLE_GROWTH', 1)
        self.emcc_args += ['-DGROWTH']
        self.set_setting('ASSERTIONS', 2)
        self.do_run_in_out_file_test('tests', 'interop', 'test_add_function')
    else:
        self.do_run(open(src).read(), 'Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.', assert_returncode=None)
        self.assertNotContained('jsCall_', open('src.cpp.o.js').read())
    if ((not self.get_setting('WASM')) and (not self.is_wasm_backend())):
        print('- with function pointer emulation')
        self.set_setting('EMULATED_FUNCTION_POINTERS', 1)
        self.do_run_in_out_file_test('tests', 'interop', 'test_add_function')
@sync
def test_add_function(self):
    self.set_setting('INVOKE_RUN', 0)
    self.set_setting('RESERVED_FUNCTION_POINTERS', 1)
    self.set_setting('EXPORTED_RUNTIME_METHODS', ['callMain'])
    src = path_from_root('tests', 'interop', 'test_add_function.cpp')
    post_js = path_from_root('tests', 'interop', 'test_add_function_post.js')
    self.emcc_args += ['--post-js', post_js]
    print('basics')
    self.do_run_in_out_file_test('tests', 'interop', 'test_add_function')
    if (('-g' not in self.emcc_args) and (not self.is_wasm_backend())):
        print('with --closure')
        old = list(self.emcc_args)
        self.emcc_args += ['--closure', '1']
        self.do_run_in_out_file_test('tests', 'interop', 'test_add_function')
        self.emcc_args = old
        print(old)
    print('with ALIASING_FUNCTION_POINTERS')
    self.set_setting('ALIASING_FUNCTION_POINTERS', 1)
    self.do_run_in_out_file_test('tests', 'interop', 'test_add_function')
    self.clear_setting('ALIASING_FUNCTION_POINTERS')
    print('with RESERVED_FUNCTION_POINTERS=0')
    self.set_setting('RESERVED_FUNCTION_POINTERS', 0)
    if self.is_wasm_backend():
        self.do_run(open(src).read(), 'Unable to grow wasm table', assert_returncode=None)
        print('- with table growth')
        self.set_setting('ALLOW_TABLE_GROWTH', 1)
        self.emcc_args += ['-DGROWTH']
        self.set_setting('ASSERTIONS', 2)
        self.do_run_in_out_file_test('tests', 'interop', 'test_add_function')
    else:
        self.do_run(open(src).read(), 'Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.', assert_returncode=None)
        self.assertNotContained('jsCall_', open('src.cpp.o.js').read())
    if ((not self.get_setting('WASM')) and (not self.is_wasm_backend())):
        print('- with function pointer emulation')
        self.set_setting('EMULATED_FUNCTION_POINTERS', 1)
        self.do_run_in_out_file_test('tests', 'interop', 'test_add_function')