aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-xtests/runner.py52
1 files changed, 29 insertions, 23 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 62a85085..4afdaa99 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -266,6 +266,13 @@ 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 '--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)
+
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
stderr = os.path.join(self.get_dir(), 'stderr')
@@ -8911,11 +8918,11 @@ TT = %s
exec('o1 = make_run("o1", compiler=CLANG, emcc_args=["-O1", "-s", "SAFE_HEAP=1"])')
# Make one run with -O2, but without closure (we enable closure in specific tests, otherwise on everything it is too slow)
- exec('o2 = make_run("o2", compiler=CLANG, emcc_args=["-O2"])')
+ exec('o2 = make_run("o2", compiler=CLANG, emcc_args=["-O2", "-s", "JS_CHUNK_SIZE=1024"])')
# asm.js
exec('asm2 = make_run("asm2", compiler=CLANG, emcc_args=["-O2", "-s", "ASM_JS=1"])')
- exec('asm2g = make_run("asm2g", compiler=CLANG, emcc_args=["-O2", "-s", "ASM_JS=1", "-g", "-s", "ASSERTIONS=1"])')
+ exec('asm2g = make_run("asm2g", compiler=CLANG, emcc_args=["-O2", "-s", "ASM_JS=1", "-g", "-s", "ASSERTIONS=1", "--memory-init-file", "0"])')
# Make custom runs with various options
for compiler, quantum, embetter, typed_arrays, llvm_opts in [
@@ -9018,20 +9025,23 @@ Options that are modified or new in %s include:
# emcc [..] -o [path] ==> should work with absolute paths
try:
- os.mkdir('a_dir')
- os.chdir('a_dir')
- os.mkdir('b_dir')
for path in [os.path.abspath(os.path.join('..', 'file1.js')), os.path.join('b_dir', 'file2.js')]:
+ print path
self.clear(in_curr=True)
+ os.chdir(self.get_dir())
+ if not os.path.exists('a_dir'): os.mkdir('a_dir')
+ os.chdir('a_dir')
+ if not os.path.exists('b_dir'): os.mkdir('b_dir')
output = Popen([PYTHON, compiler, path_from_root('tests', 'hello_world.ll'), '-o', path], stdout=PIPE, stderr=PIPE).communicate()
+ print output
assert os.path.exists(path), path + ' does not exist; ' + '\n'.join(output)
- self.assertContained('hello, world!', run_js(path))
+ last = os.getcwd()
+ os.chdir(os.path.dirname(path))
+ self.assertContained('hello, world!', run_js(os.path.basename(path)))
+ os.chdir(last)
finally:
os.chdir(self.get_dir())
- try:
- shutil.rmtree('a_dir')
- except:
- pass
+ self.clear()
# dlmalloc. dlmalloc is special in that it is the only part of libc that is (1) hard to write well, and
# very speed-sensitive. So we do not implement it in JS in library.js, instead we compile it from source
@@ -9975,7 +9985,8 @@ f.close()
if no_initial_run:
# Calling main later should still work, filesystem etc. must be set up.
- src = open(os.path.join(self.get_dir(), 'a.out.js')).read() + '\n_main();\n';
+ print 'call main later'
+ src = open(os.path.join(self.get_dir(), 'a.out.js')).read() + '\nModule.callMain();\n';
open(os.path.join(self.get_dir(), 'a.out.js'), 'w').write(src)
assert 'hello from main' in run_js(os.path.join(self.get_dir(), 'a.out.js')), 'main should print when called manually'
@@ -10094,12 +10105,14 @@ f.close()
def test_chunking(self):
if os.environ.get('EMCC_DEBUG'): return self.skip('cannot run in debug mode')
+ if os.environ.get('EMCC_CORES'): return self.skip('cannot run if cores are altered')
if multiprocessing.cpu_count() < 2: return self.skip('need multiple cores')
try:
os.environ['EMCC_DEBUG'] = '1'
+ os.environ['EMCC_CORES'] = '2'
for asm, linkable, chunks, js_chunks in [
- (0, 0, 3, 2), (0, 1, 4, 4),
- (1, 0, 3, 2), (1, 1, 4, 4)
+ (0, 0, 3, 2), (0, 1, 3, 4),
+ (1, 0, 3, 2), (1, 1, 3, 4)
]:
print asm, linkable, chunks, js_chunks
output, err = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_libcxx.cpp'), '-O1', '-s', 'LINKABLE=%d' % linkable, '-s', 'ASM_JS=%d' % asm, '-s', 'UNRESOLVED_AS_DEAD=1'] + (['-O2'] if asm else []), stdout=PIPE, stderr=PIPE).communicate()
@@ -10113,6 +10126,7 @@ f.close()
assert ok, err
finally:
del os.environ['EMCC_DEBUG']
+ del os.environ['EMCC_CORES']
def test_debuginfo(self):
if os.environ.get('EMCC_DEBUG'): return self.skip('cannot run in debug mode')
@@ -10331,11 +10345,11 @@ seeked= file.
assert (' with -O3 since EMCC_OPTIMIZE_NORMALLY defined' in err) == optimize_normally
for last in ['both.o', 'both2.o']:
- out, err = Popen([PYTHON, EMCC, self.in_dir('both.o'), '-O2', '-o', last + '.js'], stdout=PIPE, stderr=PIPE).communicate()
+ out, err = Popen([PYTHON, EMCC, self.in_dir('both.o'), '-O2', '-o', last + '.js', '--memory-init-file', '0'], stdout=PIPE, stderr=PIPE).communicate()
assert ("emcc: LLVM opts: ['-O3']" not in err) == optimize_normally
assert ' with -O3 since EMCC_OPTIMIZE_NORMALLY defined' not in err
output = run_js(last + '.js')
- assert 'yello' in output, 'code works'
+ assert 'yello' in output, 'code works ' + err
assert open('both.o.js').read() == open('both2.o.js').read()
finally:
@@ -11409,14 +11423,6 @@ elif 'browser' in str(sys.argv):
self.run_browser('something.html', 'You should see animating gears.', '/report_gl_result?true')
assert ('var GLEmulation' in open(self.in_dir('something.html')).read()) == emulation, "emulation code should be added when asked for"
- def test_glgears_bad(self):
- # Make sure that OpenGL ES is not available if typed arrays are not used
- Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_gles.c'), '-o', 'something.html',
- '-DHAVE_BUILTIN_SINCOS', '-s', 'GL_TESTING=1',
- '-s', 'USE_TYPED_ARRAYS=0',
- '--shell-file', path_from_root('tests', 'hello_world_gles_shell.html')]).communicate()
- self.run_browser('something.html', 'You should not see animating gears.', '/report_gl_result?false')
-
def test_glgears_deriv(self):
self.reftest(path_from_root('tests', 'gears.png'))
Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_gles_deriv.c'), '-o', 'something.html', '-s', 'GL_TESTING=1',