Skip to content
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
35 changes: 11 additions & 24 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8587,32 +8587,19 @@ def test_memprof_requirements(self):
# This test checks for the global variables required to run the memory
# profiler. It would fail if these variables were made no longer global
# or if their identifiers were changed.
create_file('main.c', '''
int check_memprof_requirements();

int main() {
return check_memprof_requirements();
}
''')
create_file('lib.js', '''
addToLibrary({
check_memprof_requirements: () => {
if (typeof _emscripten_stack_get_base === 'function' &&
typeof _emscripten_stack_get_end === 'function' &&
typeof _emscripten_stack_get_current === 'function' &&
typeof Module['___heap_base'] === 'number' &&
Module['___heap_base'] > 0) {
out('able to run memprof');
return 0;
} else {
out('missing the required variables to run memprof');
return 1;
}
create_file('pre.js', '''
Module = {
onRuntimeInitialized: () => {
assert(typeof _emscripten_stack_get_base === 'function');
assert(typeof _emscripten_stack_get_end === 'function');
assert(typeof _emscripten_stack_get_current === 'function');
assert(typeof Module['___heap_base'] === 'number');
assert(Module['___heap_base'] > 0);
out('able to run memprof');
}
});
};
''')
self.cflags += ['--memoryprofiler', '--js-library', 'lib.js']
self.do_runf('main.c', 'able to run memprof')
self.do_runf('hello_world.c', 'able to run memprof', cflags=['--memoryprofiler', '--pre-js=pre.js'])

@no_wasmfs('depends on MEMFS which WASMFS does not have')
def test_fs_dict(self):
Expand Down