aboutsummaryrefslogtreecommitdiff
path: root/tests/test_core.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-01-26 16:47:00 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-01-26 16:47:00 -0800
commite7d23dbbc9fec07c9ecc25c5621c5c285b4e9101 (patch)
treedabdbe89da378b952f02aed9131765a5bfe5f1cd /tests/test_core.py
parent842680032b7ee76b9b177cc3491b67a1e6f5a95d (diff)
do not include library i64 stuff in side modules, it is in the parent; fixes #2060
Diffstat (limited to 'tests/test_core.py')
-rw-r--r--tests/test_core.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index 99c69459..97cba68f 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -2809,6 +2809,46 @@ def process(filename):
self.do_run(src, 'Constructing main object.\nConstructing lib object.\n',
post_build=self.dlfcn_post_build)
+ def test_dlfcn_i64(self):
+ if not self.can_dlfcn(): return
+ if not Settings.ASM_JS: return self.skip('TODO')
+
+ self.prep_dlfcn_lib()
+ Settings.EXPORTED_FUNCTIONS = ['_foo']
+ lib_src = '''
+ int foo(int x) {
+ return (long long)x / (long long)1234;
+ }
+ '''
+ dirname = self.get_dir()
+ filename = os.path.join(dirname, 'liblib.c')
+ self.build(lib_src, dirname, filename)
+ shutil.move(filename + '.o.js', os.path.join(dirname, 'liblib.so'))
+
+ self.prep_dlfcn_main()
+ Settings.EXPORTED_FUNCTIONS = ['_main']
+ src = r'''
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <dlfcn.h>
+
+ typedef int (*intfunc)(int);
+
+ void *p;
+
+ int main() {
+ p = malloc(1024);
+ void *lib_handle = dlopen("liblib.so", 0);
+ printf("load %p\n", lib_handle);
+ intfunc x = (intfunc)dlsym(lib_handle, "foo");
+ printf("foo func %p\n", x);
+ if (p == 0) return 1;
+ printf("|%d|\n", x(81234567));
+ return 0;
+ }
+ '''
+ self.do_run(src, '|65830|', post_build=self.dlfcn_post_build)
+
def test_dlfcn_qsort(self):
if not self.can_dlfcn(): return