aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-xtests/runner.py34
1 files changed, 29 insertions, 5 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 1965cad9..2865679b 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -266,12 +266,15 @@ process(sys.argv[1])
if output_processor is not None:
output_processor(open(filename + '.o.js').read())
- if 0:# XXX TODO self.emcc_args is not None:
+ if self.emcc_args is not None:
if '--memory-init-file' in self.emcc_args:
memory_init_file = int(self.emcc_args[self.emcc_args.index('--memory-init-file')+1])
else:
memory_init_file = 1
- assert ('/* memory initializer */' in open(filename + '.o.js').read()) == (not memory_init_file)
+ if memory_init_file:
+ assert '/* memory initializer */' not in open(filename + '.o.js').read()
+ else:
+ assert 'memory initializer */' in open(filename + '.o.js').read()
def run_generated_code(self, engine, filename, args=[], check_timeout=True, output_nicerizer=None):
stdout = os.path.join(self.get_dir(), 'stdout') # use files, as PIPE can get too full and hang us
@@ -2958,6 +2961,9 @@ Exiting setjmp function, level: 0, prev_jmp: -1
'''
self.do_run(src, 'f()\n')
+ def test_dynamic_cast_b(self):
+ if self.emcc_args is None: return self.skip('need libcxxabi')
+
src = '''
#include <stdio.h>
@@ -5769,6 +5775,8 @@ Pass: 0.000012 0.000012''')
self.do_run(src, '2, , black\n2, ., #001100\n2, X, #111100');
def test_sscanf_skip(self):
+ if Settings.USE_TYPED_ARRAYS != 2: return self.skip("need ta2 for full i64")
+
src = r'''
#include <stdio.h>
@@ -7534,7 +7542,7 @@ def process(filename):
src.write(
\'\'\'
FS.createDataFile('/', 'paper.pdf', eval(Module.read('paper.pdf.js')), true, false);
- run();
+ Module.callMain(Module.arguments);
Module.print("Data: " + JSON.stringify(FS.root.contents['filename-1.ppm'].contents.map(function(x) { return unSign(x, 8) })));
\'\'\'
)
@@ -10010,7 +10018,7 @@ f.close()
self.assertNotContained('pre-run\nhello from main\npost-run\n', run_js(os.path.join(self.get_dir(), 'a.out.js')))
# noInitialRun prevents run
- for no_initial_run, run_dep in [(0, 0), (1, 0), (0, 1), (1, 1)]:
+ for no_initial_run, run_dep in [(0, 0), (1, 0), (0, 1)]:
print no_initial_run, run_dep
Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp')]).communicate()
src = 'var Module = { noInitialRun: %d };\n' % no_initial_run + open(os.path.join(self.get_dir(), 'a.out.js')).read()
@@ -12368,6 +12376,17 @@ ok.
''',
force_c=True, emcc_args=emcc_args, native_args=native_args)
+ def test_yyy_box2d(self): # Called thus so it runs late in the alphabetical cycle... it is long
+ src = open(path_from_root('tests', 'box2d', 'Benchmark.cpp'), 'r').read()
+
+ js_lib = self.get_library('box2d', [os.path.join('box2d.a')], configure=None)
+ native_lib = self.get_library('box2d_native', [os.path.join('box2d.a')], configure=None, native=True)
+
+ emcc_args = js_lib + ['-I' + path_from_root('tests', 'box2d')]
+ native_args = native_lib + ['-I' + path_from_root('tests', 'box2d')]
+
+ self.do_benchmark('box2d', src, [], 'frame averages', emcc_args=emcc_args, native_args=native_args)
+
def test_zzz_bullet(self): # Called thus so it runs late in the alphabetical cycle... it is long
src = open(path_from_root('tests', 'bullet', 'Demos', 'Benchmarks', 'BenchmarkDemo.cpp'), 'r').read() + \
open(path_from_root('tests', 'bullet', 'Demos', 'Benchmarks', 'main.cpp'), 'r').read()
@@ -12680,7 +12699,12 @@ fi
''')
Popen([PYTHON, EMCC, os.path.join(dirname, 'main.cpp'), '-o', os.path.join(dirname, 'a.out.js')]).communicate()
del os.environ['EM_CONFIG']
- self.assertContained('hello from emcc with no config file', run_js(os.path.join(dirname, 'a.out.js')))
+ old_dir = os.getcwd()
+ try:
+ os.chdir(dirname)
+ self.assertContained('hello from emcc with no config file', run_js('a.out.js'))
+ finally:
+ os.chdir(old_dir)
shutil.rmtree(dirname)
try_delete(CANONICAL_TEMP_DIR)