aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-08-26 15:48:02 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-03 14:41:29 -0700
commit8bf0623459ac62303f0c06206d944f15e6a3afdd (patch)
tree5dea9f5176628bd36b76620e07b537f58c123222 /tests
parent2079eb527ca3e25b0f5dfebd867cbc3efa9b6382 (diff)
refactor test_dlfcn_qsort
Diffstat (limited to 'tests')
-rw-r--r--tests/test_core.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index ed026e6f..c6b1a69e 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -5616,7 +5616,6 @@ The current type of b is: 9
if not self.can_dlfcn(): return
self.prep_dlfcn_lib()
-
lib_src = '''
#include <cstdio>
@@ -5635,7 +5634,6 @@ The current type of b is: 9
shutil.move(filename + '.o.js', os.path.join(dirname, 'liblib.so'))
self.prep_dlfcn_main()
-
src = '''
#include <cstdio>
#include <dlfcn.h>
@@ -5666,15 +5664,13 @@ def process(filename):
post_build=add_pre_run_and_checks)
def test_dlfcn_qsort(self):
- if self.emcc_args is None: return self.skip('requires emcc')
- if Settings.ASM_JS: return self.skip('TODO: dlopen in asm')
-
- Settings.LINKABLE = 1
- Settings.NAMED_GLOBALS = 1
+ if not self.can_dlfcn(): return
if Settings.USE_TYPED_ARRAYS == 2:
Settings.CORRECT_SIGNS = 1 # Needed for unsafe optimizations
+ self.prep_dlfcn_lib()
+ Settings.EXPORTED_FUNCTIONS = ['_get_cmp']
lib_src = '''
int lib_cmp(const void* left, const void* right) {
const int* a = (const int*) left;
@@ -5692,11 +5688,11 @@ def process(filename):
'''
dirname = self.get_dir()
filename = os.path.join(dirname, 'liblib.cpp')
- Settings.BUILD_AS_SHARED_LIB = 1
- Settings.EXPORTED_FUNCTIONS = ['_get_cmp']
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', '_malloc']
src = '''
#include <stdio.h>
#include <stdlib.h>
@@ -5747,8 +5743,6 @@ def process(filename):
return 0;
}
'''
- Settings.BUILD_AS_SHARED_LIB = 0
- Settings.EXPORTED_FUNCTIONS = ['_main']
add_pre_run_and_checks = '''
def process(filename):
src = open(filename, 'r').read().replace(