Skip to content

Commit d0465ad

Browse files
authored
[test] Simplify _test_dylink_dso_needed. NFC (#25681)
- This function is never called more then once per test - I have idea where the "5mb per module" thing came form.
1 parent 7d50e24 commit d0465ad

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

test/common.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,29 +1417,18 @@ def _test_dylink_dso_needed(self, do_run):
14171417
}
14181418
''')
14191419

1420-
# _test_dylink_dso_needed can be potentially called several times by a test.
1421-
# reset dylink-related options first.
1422-
self.clear_setting('MAIN_MODULE')
1423-
self.clear_setting('SIDE_MODULE')
1424-
1425-
# XXX in wasm each lib load currently takes 5MB; default INITIAL_MEMORY=16MB is thus not enough
1426-
if not self.has_changed_setting('INITIAL_MEMORY'):
1427-
self.set_setting('INITIAL_MEMORY', '32mb')
1428-
1429-
so = '.wasm' if self.is_wasm() else '.js'
1430-
14311420
def ccshared(src, linkto=None):
1432-
cmdv = [EMCC, src, '-o', utils.unsuffixed(src) + so, '-sSIDE_MODULE'] + self.get_cflags()
1421+
cmdv = [EMCC, src, '-o', utils.unsuffixed(src) + '.wasm', '-sSIDE_MODULE'] + self.get_cflags()
14331422
if linkto:
14341423
cmdv += linkto
14351424
self.run_process(cmdv)
14361425

14371426
ccshared('liba.cpp')
1438-
ccshared('libb.c', ['liba' + so])
1439-
ccshared('libc.c', ['liba' + so])
1427+
ccshared('libb.c', ['liba.wasm'])
1428+
ccshared('libc.c', ['liba.wasm'])
14401429

14411430
self.set_setting('MAIN_MODULE')
1442-
extra_args = ['-L.', 'libb' + so, 'libc' + so]
1431+
extra_args = ['-L.', 'libb.wasm', 'libc.wasm']
14431432
do_run(r'''
14441433
#ifdef __cplusplus
14451434
extern "C" {
@@ -1459,8 +1448,8 @@ def ccshared(src, linkto=None):
14591448
'a: loaded\na: b (prev: (null))\na: c (prev: b)\n', cflags=extra_args)
14601449

14611450
extra_args = []
1462-
for libname in ('liba', 'libb', 'libc'):
1463-
extra_args += ['--embed-file', libname + so]
1451+
for libname in ('liba.wasm', 'libb.wasm', 'libc.wasm'):
1452+
extra_args += ['--embed-file', libname]
14641453
do_run(r'''
14651454
#include <assert.h>
14661455
#include <dlfcn.h>
@@ -1471,9 +1460,9 @@ def ccshared(src, linkto=None):
14711460
void (*bfunc_ptr)(), (*cfunc_ptr)();
14721461
14731462
// FIXME for RTLD_LOCAL binding symbols to loaded lib is not currently working
1474-
bdso = dlopen("libb%(so)s", RTLD_NOW|RTLD_GLOBAL);
1463+
bdso = dlopen("libb.wasm", RTLD_NOW|RTLD_GLOBAL);
14751464
assert(bdso != NULL);
1476-
cdso = dlopen("libc%(so)s", RTLD_NOW|RTLD_GLOBAL);
1465+
cdso = dlopen("libc.wasm", RTLD_NOW|RTLD_GLOBAL);
14771466
assert(cdso != NULL);
14781467
14791468
bfunc_ptr = (void (*)())dlsym(bdso, "bfunc");

0 commit comments

Comments
 (0)