aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/runner.py')
-rw-r--r--tests/runner.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 84b358fd..04856b8b 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -120,7 +120,7 @@ class RunnerCore(unittest.TestCase):
self.do_llvm_dis(filename)
# Build JavaScript code from source code
- def build(self, src, dirname, filename, output_processor=None, main_file=None, additional_files=[], libraries=[], includes=[], build_ll_hook=None):
+ def build(self, src, dirname, filename, output_processor=None, main_file=None, additional_files=[], libraries=[], includes=[], build_ll_hook=None, extra_emscripten_args=[]):
# Copy over necessary files for compiling the source
if main_file is None:
f = open(filename, 'w')
@@ -169,9 +169,9 @@ class RunnerCore(unittest.TestCase):
# Finalize
self.prep_ll_test(filename, filename + '.o', build_ll_hook=build_ll_hook)
- self.do_emscripten(filename, output_processor)
+ self.do_emscripten(filename, output_processor, extra_args=extra_emscripten_args)
- def do_emscripten(self, filename, output_processor=None, append_ext=True):
+ def do_emscripten(self, filename, output_processor=None, append_ext=True, extra_args=[]):
# Run Emscripten
exported_settings = {}
for setting in ['QUANTUM_SIZE', 'RELOOP', 'OPTIMIZE', 'ASSERTIONS', 'USE_TYPED_ARRAYS', 'SAFE_HEAP', 'CHECK_OVERFLOWS', 'CORRECT_OVERFLOWS', 'CORRECT_SIGNS', 'CHECK_SIGNS', 'CORRECT_OVERFLOWS_LINES', 'CORRECT_SIGNS_LINES', 'CORRECT_ROUNDINGS', 'CORRECT_ROUNDINGS_LINES', 'INVOKE_RUN', 'SAFE_HEAP_LINES', 'INIT_STACK', 'AUTO_OPTIMIZE', 'EXPORTED_FUNCTIONS', 'EXPORTED_GLOBALS', 'BUILD_AS_SHARED_LIB', 'INCLUDE_FULL_LIBRARY']:
@@ -181,7 +181,7 @@ class RunnerCore(unittest.TestCase):
except:
pass
settings = ['%s=%s' % (k, json.dumps(v)) for k, v in exported_settings.items()]
- compiler_output = timeout_run(Popen([EMSCRIPTEN, filename + ('.o.ll' if append_ext else ''), '-o', filename + '.o.js', '-s'] + settings, stdout=PIPE, stderr=STDOUT), TIMEOUT, 'Compiling')
+ compiler_output = timeout_run(Popen([EMSCRIPTEN, filename + ('.o.ll' if append_ext else ''), '-o', filename + '.o.js', '-s'] + settings + extra_args, stdout=PIPE, stderr=STDOUT), TIMEOUT, 'Compiling')
# Detect compilation crashes and errors
if compiler_output is not None and 'Traceback' in compiler_output and 'in test_' in compiler_output: print compiler_output; assert 0
@@ -234,7 +234,7 @@ if 'benchmark' not in sys.argv:
class T(RunnerCore): # Short name, to make it more fun to use manually on the commandline
## Does a complete test - builds, runs, checks output, etc.
- def do_test(self, src, expected_output=None, args=[], output_nicerizer=None, output_processor=None, no_build=False, main_file=None, additional_files=[], js_engines=None, post_build=None, basename='src.cpp', libraries=[], includes=[], force_c=False, build_ll_hook=None):
+ def do_test(self, src, expected_output=None, args=[], output_nicerizer=None, output_processor=None, no_build=False, main_file=None, additional_files=[], js_engines=None, post_build=None, basename='src.cpp', libraries=[], includes=[], force_c=False, build_ll_hook=None, extra_emscripten_args=[]):
#print 'Running test:', inspect.stack()[1][3].replace('test_', ''), '[%s,%s,%s]' % (COMPILER.split(os.sep)[-1], 'llvm-optimizations' if LLVM_OPTS else '', 'reloop&optimize' if RELOOP else '')
if force_c or (main_file is not None and main_file[-2:]) == '.c':
basename = 'src.c'
@@ -245,7 +245,7 @@ if 'benchmark' not in sys.argv:
filename = os.path.join(dirname, basename)
if not no_build:
self.build(src, dirname, filename, main_file=main_file, additional_files=additional_files, libraries=libraries, includes=includes,
- build_ll_hook=build_ll_hook)
+ build_ll_hook=build_ll_hook, extra_emscripten_args=extra_emscripten_args)
if post_build is not None:
post_build(filename + '.o.js')
@@ -2683,6 +2683,10 @@ if 'benchmark' not in sys.argv:
shutil.copy(filename + '.o.js', os.path.join(self.get_dir(), 'src.cpp.o.js'))
self.do_test(None, 'test\n', no_build=True)
+ def test_dlmalloc_linked(self):
+ src = open(path_from_root('tests', 'dlmalloc_test.c'), 'r').read()
+ self.do_test(src, '*1,0*', ['200', '1'], extra_emscripten_args=['-m'])
+
def test_linespecific(self):
global COMPILER_TEST_OPTS; COMPILER_TEST_OPTS = ['-g']