diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-08-28 18:26:18 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-09-03 14:41:29 -0700 |
commit | 9f296c559dc6953983a884e9e93b7ac3b372a25e (patch) | |
tree | 1a2f807006811f5d407e23d7281925950092126a | |
parent | c76946b2f3cebf00a5e24c9582eb9b59f1039a6d (diff) |
update test_dlfcn_data_and_fptr
-rw-r--r-- | tests/test_core.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/test_core.py b/tests/test_core.py index 4871eef1..cf84ab42 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -5755,12 +5755,12 @@ def process(filename): post_build=add_pre_run_and_checks) def test_dlfcn_data_and_fptr(self): - if Settings.ASM_JS: return self.skip('TODO: dlopen in asm') - if Building.LLVM_OPTS: return self.skip('LLVM opts will optimize out parent_func') + if Settings.ASM_JS: return self.skip('this is not a valid case - libraries should not be able to access their parents globals willy nilly') + if not self.can_dlfcn(): return - Settings.LINKABLE = 1 - Settings.NAMED_GLOBALS = 1 + if Building.LLVM_OPTS: return self.skip('LLVM opts will optimize out parent_func') + self.prep_dlfcn_lib() lib_src = ''' #include <stdio.h> @@ -5785,21 +5785,23 @@ def process(filename): ''' dirname = self.get_dir() filename = os.path.join(dirname, 'liblib.cpp') - Settings.BUILD_AS_SHARED_LIB = 1 Settings.EXPORTED_FUNCTIONS = ['_func'] Settings.EXPORTED_GLOBALS = ['_global'] self.build(lib_src, dirname, filename) shutil.move(filename + '.o.js', os.path.join(dirname, 'liblib.so')) + self.prep_dlfcn_main() + Settings.LINKABLE = 1 src = ''' #include <stdio.h> #include <dlfcn.h> + #include <emscripten.h> typedef void (*FUNCTYPE(int, void(*)()))(); FUNCTYPE func; - void parent_func() { + void EMSCRIPTEN_KEEPALIVE parent_func() { printf("parent_func called from child\\n"); } @@ -5843,7 +5845,6 @@ def process(filename): return 0; } ''' - Settings.BUILD_AS_SHARED_LIB = 0 Settings.EXPORTED_FUNCTIONS = ['_main'] Settings.EXPORTED_GLOBALS = [] add_pre_run_and_checks = ''' |