Skip to content

Fix test_modularize_instance when running with asan. #24408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9734,21 +9734,24 @@ def test_modularize_instance(self, args):
self.run_process([EMCC, test_file('modularize_instance.c'),
'-sMODULARIZE=instance',
'-Wno-experimental',
'-sEXPORTED_RUNTIME_METHODS=baz,addOnExit,HEAP32',
'-sEXPORTED_RUNTIME_METHODS=baz,addOnExit,HEAP32,runtimeKeepalivePush,runtimeKeepalivePop',
'-sEXPORTED_FUNCTIONS=_bar,_main,qux',
'--js-library', 'library.js',
'-o', 'modularize_instance.mjs'] + args + self.get_emcc_args())

create_file('runner.mjs', '''
import { strict as assert } from 'assert';
import init, { _foo as foo, _bar as bar, baz, qux, addOnExit, HEAP32 } from "./modularize_instance.mjs";
import init, { _foo as foo, _bar as bar, baz, qux, addOnExit, HEAP32, runtimeKeepalivePush, runtimeKeepalivePop } from "./modularize_instance.mjs";
// Keep the runtime alive for asan when EXIT_RUNTIME=1.
runtimeKeepalivePush();
await init();
foo(); // exported with EMSCRIPTEN_KEEPALIVE
bar(); // exported with EXPORTED_FUNCTIONS
baz(); // exported library function with EXPORTED_RUNTIME_METHODS
qux(); // exported library function with EXPORTED_FUNCTIONS
assert(typeof addOnExit === 'function'); // exported runtime function with EXPORTED_RUNTIME_METHODS
assert(typeof HEAP32 === 'object'); // exported runtime value by default
runtimeKeepalivePop();
''')

self.assertContained('main1\nmain2\nfoo\nbar\nbaz\n', self.run_js('runner.mjs'))
Expand Down