diff options
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-x | tests/runner.py | 65 |
1 files changed, 43 insertions, 22 deletions
diff --git a/tests/runner.py b/tests/runner.py index c5c2f998..e7b4e6ad 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -185,7 +185,7 @@ process(sys.argv[1]) ''') transform.close() transform_args = ['--js-transform', "python %s" % transform_filename] - Building.emcc(filename + '.o.ll', Settings.serialize() + self.emcc_args + transform_args, filename + '.o.js') + Building.emcc(filename + '.o.ll', Settings.serialize() + self.emcc_args + transform_args + Building.COMPILER_TEST_OPTS, filename + '.o.js') run_post(post2) # Build JavaScript code from source code @@ -306,14 +306,14 @@ process(sys.argv[1]) os.makedirs(ret) return ret - def get_library(self, name, generated_libs, configure=['sh', './configure'], configure_args=[], make=['make'], make_args=['-j', '2'], cache=True, env_init={}): + def get_library(self, name, generated_libs, configure=['sh', './configure'], configure_args=[], make=['make'], make_args=['-j', '2'], cache=True, env_init={}, cache_name_extra=''): build_dir = self.get_build_dir() output_dir = self.get_dir() - cache_name = name + '|' + Building.COMPILER + cache_name = name + cache_name_extra if self.library_cache is not None: if cache and self.library_cache.get(cache_name): - print >> sys.stderr, '<load build from cache> ', + print >> sys.stderr, '<load %s from cache> ' % cache_name, generated_libs = [] for basename, contents in self.library_cache[cache_name]: bc_file = os.path.join(build_dir, basename) @@ -323,7 +323,7 @@ process(sys.argv[1]) generated_libs.append(bc_file) return generated_libs - print >> sys.stderr, '<building and saving into cache> ', + print >> sys.stderr, '<building and saving %s into cache> ' % cache_name, return Building.build_library(name, build_dir, output_dir, generated_libs, configure, configure_args, make, make_args, self.library_cache, cache_name, copy_project=True, env_init=env_init) @@ -1123,16 +1123,22 @@ c5,de,15,8a self.do_run(open(path_from_root('tests', 'cube2md5.cpp')).read(), open(path_from_root('tests', 'cube2md5.ok')).read()) def test_cube2hash(self): - # A good test of i64 math - if Settings.USE_TYPED_ARRAYS != 2: return self.skip('requires ta2 C-style memory aliasing') - self.do_run('', 'Usage: hashstring <seed>', - libraries=self.get_library('cube2hash', ['cube2hash.bc'], configure=None), - includes=[path_from_root('tests', 'cube2hash')]) - - for text, output in [('fleefl', '892BDB6FD3F62E863D63DA55851700FDE3ACF30204798CE9'), - ('fleefl2', 'AA2CC5F96FC9D540CA24FDAF1F71E2942753DB83E8A81B61'), - ('64bitisslow', '64D8470573635EC354FEE7B7F87C566FCAF1EFB491041670')]: - self.do_run('', 'hash value: ' + output, [text], no_build=True) + try: + old_chunk_size = os.environ.get('EMSCRIPT_MAX_CHUNK_SIZE') or '' + os.environ['EMSCRIPT_MAX_CHUNK_SIZE'] = '1' # test splitting out each function to a chunk in emscripten.py (21 functions here) + + # A good test of i64 math + if Settings.USE_TYPED_ARRAYS != 2: return self.skip('requires ta2 C-style memory aliasing') + self.do_run('', 'Usage: hashstring <seed>', + libraries=self.get_library('cube2hash', ['cube2hash.bc'], configure=None), + includes=[path_from_root('tests', 'cube2hash')]) + + for text, output in [('fleefl', '892BDB6FD3F62E863D63DA55851700FDE3ACF30204798CE9'), + ('fleefl2', 'AA2CC5F96FC9D540CA24FDAF1F71E2942753DB83E8A81B61'), + ('64bitisslow', '64D8470573635EC354FEE7B7F87C566FCAF1EFB491041670')]: + self.do_run('', 'hash value: ' + output, [text], no_build=True) + finally: + os.environ['EMSCRIPT_MAX_CHUNK_SIZE'] = old_chunk_size def test_unaligned(self): if Settings.QUANTUM_SIZE == 1: return self.skip('No meaning to unaligned addresses in q1') @@ -5748,8 +5754,8 @@ void*:16 def get_freetype(self): Settings.INIT_STACK = 1 # TODO: Investigate why this is necessary - - return self.get_library('freetype', os.path.join('objs', '.libs', 'libfreetype.a')) + return self.get_library('freetype', + os.path.join('objs', '.libs', 'libfreetype.a')) def test_freetype(self): if Settings.QUANTUM_SIZE == 1: return self.skip('TODO: Figure out and try to fix') @@ -6002,17 +6008,23 @@ def process(filename): do_test() - # some test coverage for EMCC_DEBUG + # some test coverage for EMCC_DEBUG 1 and 2 if self.emcc_args and '-O2' in self.emcc_args and 'EMCC_DEBUG' not in os.environ: shutil.copyfile('src.c.o.js', 'release.js') try: os.environ['EMCC_DEBUG'] = '1' + print '2' + do_test() + shutil.copyfile('src.c.o.js', 'debug1.js') + os.environ['EMCC_DEBUG'] = '2' + print '3' do_test() + shutil.copyfile('src.c.o.js', 'debug2.js') finally: del os.environ['EMCC_DEBUG'] - shutil.copyfile('src.c.o.js', 'debug.js') - self.assertIdentical(open('release.js').read().replace('\n\n', '\n').replace('\n\n', '\n'), open('debug.js').read().replace('\n\n', '\n').replace('\n\n', '\n')) # EMCC_DEBUG=1 mode must not generate different code! - print >> sys.stderr, 'debug check passed too' + for debug in [1,2]: + self.assertIdentical(open('release.js').read().replace('\n\n', '\n').replace('\n\n', '\n'), open('debug%d.js' % debug).read().replace('\n\n', '\n').replace('\n\n', '\n')) # EMCC_DEBUG=1 mode must not generate different code! + print >> sys.stderr, 'debug check %d passed too' % debug else: print >> sys.stderr, 'not doing debug check' @@ -6713,6 +6725,8 @@ def process(filename): assert 'Too many corrections' in str(e), str(e) def test_debug(self): + if '-g' not in Building.COMPILER_TEST_OPTS: Building.COMPILER_TEST_OPTS.append('-g') + src = ''' #include <stdio.h> #include <assert.h> @@ -6743,6 +6757,7 @@ def process(filename): assert 'Assertion failed' in str(e), str(e) def test_linespecific(self): + if '-g' not in Building.COMPILER_TEST_OPTS: Building.COMPILER_TEST_OPTS.append('-g') if self.emcc_args: self.emcc_args += ['--llvm-opts', '0'] # llvm full opts make the expected failures here not happen Settings.CHECK_SIGNS = 0 @@ -6899,6 +6914,7 @@ def process(filename): Settings.CORRECT_SIGNS = 0 def test_pgo(self): + if '-g' not in Building.COMPILER_TEST_OPTS: Building.COMPILER_TEST_OPTS.append('-g') Settings.PGO = Settings.CHECK_OVERFLOWS = Settings.CORRECT_OVERFLOWS = Settings.CHECK_SIGNS = Settings.CORRECT_SIGNS = 1 src = ''' @@ -6927,6 +6943,7 @@ def process(filename): assert 'UnSign|src.cpp:13 : 6 hits, %17 failures' in output, 'no indication of Sign corrections: ' + output return output + print >>sys.stderr, '1' self.do_run(src, '*186854335,63*\n', output_nicerizer=check) Settings.PGO = Settings.CHECK_OVERFLOWS = Settings.CORRECT_OVERFLOWS = Settings.CHECK_SIGNS = Settings.CORRECT_SIGNS = 0 @@ -6940,10 +6957,12 @@ def process(filename): Settings.CORRECT_OVERFLOWS = 2 Settings.CORRECT_OVERFLOWS_LINES = pgo_data['overflows_lines'] + print >>sys.stderr, '2' self.do_run(src, '*186854335,63*\n') # Sanity check: Without PGO, we will fail + print >>sys.stderr, '3' try: self.do_run(src, '*186854335,63*\n') except: @@ -7101,6 +7120,8 @@ class %s(T): if self.emcc_args is not None: Settings.load(self.emcc_args) Building.LLVM_OPTS = 0 + if '-O2' in self.emcc_args: + Building.COMPILER_TEST_OPTS = [] # remove -g in -O2 tests, for more coverage return llvm_opts = %d # 1 is yes, 2 is yes and unsafe @@ -10056,7 +10077,7 @@ fi try_delete('a.out.js') basebc_name = os.path.join(TEMP_DIR, 'emscripten_temp', 'emcc-0-basebc.bc') - dcebc_name = os.path.join(TEMP_DIR, 'emscripten_temp', 'emcc-1-dce.bc') + dcebc_name = os.path.join(TEMP_DIR, 'emscripten_temp', 'emcc-1-linktime.bc') # Building a file that *does* need dlmalloc *should* trigger cache generation, but only the first time for filename, libname in [('hello_malloc.cpp', 'dlmalloc'), ('hello_libcxx.cpp', 'libcxx')]: |