diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-02-21 10:10:49 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-02-21 10:10:49 -0800 |
commit | 025dea98e497bc2c3e9167850c4ecae9a65785cf (patch) | |
tree | 9505cb685b74966d9378d151fff1b092cd6398b6 /tests/test_core.py | |
parent | 09a848a0771550c95df8b3566efdfde5e80803a9 (diff) |
turn fastcomp on by default, disabling can be done with EMCC_FAST_COMPILER=0 in the env
Diffstat (limited to 'tests/test_core.py')
-rw-r--r-- | tests/test_core.py | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/tests/test_core.py b/tests/test_core.py index b96cbc36..f155d446 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -529,17 +529,6 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co finally: os.environ['EMSCRIPT_MAX_CHUNK_SIZE'] = old_chunk_size - assert 'asm1' in test_modes - if self.run_name == 'asm1' and not os.environ.get('EMCC_FAST_COMPILER'): - assert Settings.RELOOP - generated = open('src.cpp.o.js').read() - main = generated[generated.find('function _main'):] - main = main[:main.find('\n}')] - num_vars = 0 - for v in re.findall('var [^;]+;', main): - num_vars += v.count(',') + 1 - assert num_vars == 10, 'no variable elimination should have been run, but seeing %d' % num_vars - def test_unaligned(self): if Settings.QUANTUM_SIZE == 1: return self.skip('No meaning to unaligned addresses in q1') @@ -951,7 +940,7 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co for named in (0, 1): print named - if os.environ.get('EMCC_FAST_COMPILER') == '1' and named: continue # no named globals in fastcomp + if os.environ.get('EMCC_FAST_COMPILER') != '0' and named: continue # no named globals in fastcomp Settings.NAMED_GLOBALS = named self.do_run_from_file(src, output, ['wowie', 'too', '74']) @@ -1138,7 +1127,7 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co self.do_run_from_file(src, output) def test_longjmp_repeat(self): - if os.environ.get('EMCC_FAST_COMPILER') != '1': Settings.MAX_SETJMPS = 1 # todo: do this more strict thing in fastcomp too + if os.environ.get('EMCC_FAST_COMPILER') == '0': Settings.MAX_SETJMPS = 1 # todo: do this more strict thing in fastcomp too test_path = path_from_root('tests', 'core', 'test_longjmp_repeat') src, output = (test_path + s for s in ('.in', '.out')) self.do_run_from_file(src, output) @@ -1162,7 +1151,7 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co self.do_run_from_file(src, output) def test_setjmp_many(self): - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp: make MAX_SETJMPS take effect') + if os.environ.get('EMCC_FAST_COMPILER') != '0': return self.skip('todo in fastcomp: make MAX_SETJMPS take effect') src = r''' #include <stdio.h> @@ -1930,7 +1919,7 @@ def process(filename): def test_inlinejs(self): if not self.is_le32(): return self.skip('le32 needed for inline js') - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('fastcomp only supports EM_ASM') + if os.environ.get('EMCC_FAST_COMPILER') != '0': return self.skip('fastcomp only supports EM_ASM') test_path = path_from_root('tests', 'core', 'test_inlinejs') src, output = (test_path + s for s in ('.in', '.out')) @@ -1943,7 +1932,7 @@ def process(filename): def test_inlinejs2(self): if not self.is_le32(): return self.skip('le32 needed for inline js') - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('fastcomp only supports EM_ASM') + if os.environ.get('EMCC_FAST_COMPILER') != '0': return self.skip('fastcomp only supports EM_ASM') test_path = path_from_root('tests', 'core', 'test_inlinejs2') src, output = (test_path + s for s in ('.in', '.out')) @@ -2749,7 +2738,7 @@ The current type of b is: 9 self.do_run(main, 'supp: 54,2\nmain: 56\nsupp see: 543\nmain see: 76\nok.') def can_dlfcn(self): - if os.environ.get('EMCC_FAST_COMPILER') == '1': + if os.environ.get('EMCC_FAST_COMPILER') != '0': self.skip('todo in fastcomp') return False @@ -3171,7 +3160,7 @@ def process(filename): def test_dlfcn_self(self): if Settings.USE_TYPED_ARRAYS == 1: return self.skip('Does not work with USE_TYPED_ARRAYS=1') - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp') + if os.environ.get('EMCC_FAST_COMPILER') != '0': return self.skip('todo in fastcomp') Settings.DLOPEN_SUPPORT = 1 def post(filename): @@ -4673,7 +4662,7 @@ return malloc(size); main = main[:main.find('\n}')] assert main.count('\n') <= 7, ('must not emit too many postSets: %d' % main.count('\n')) + ' : ' + main - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('fastcomp always aliases pointers') + if os.environ.get('EMCC_FAST_COMPILER') != '0': return self.skip('fastcomp always aliases pointers') assert 'asm2g' in test_modes if self.run_name == 'asm2g': @@ -4721,7 +4710,7 @@ return malloc(size); self.do_run_from_file(src, output) def test_gcc_unmangler(self): - if os.environ.get('EMCC_FAST_COMPILER') != '1': Settings.NAMED_GLOBALS = 1 # test coverage for this; fastcomp never names globals + if os.environ.get('EMCC_FAST_COMPILER') == '0': Settings.NAMED_GLOBALS = 1 # test coverage for this; fastcomp never names globals Building.COMPILER_TEST_OPTS += ['-I' + path_from_root('third_party'), '-Wno-warn-absolute-paths'] @@ -4892,7 +4881,7 @@ def process(filename): test() assert 'asm2g' in test_modes - if self.run_name == 'asm2g' and not use_cmake and os.environ.get('EMCC_FAST_COMPILER') != '1': + if self.run_name == 'asm2g' and not use_cmake and os.environ.get('EMCC_FAST_COMPILER') == '0': # Test forced alignment print >> sys.stderr, 'testing FORCE_ALIGNED_MEMORY' old = open('src.cpp.o.js').read() @@ -5125,7 +5114,7 @@ def process(filename): for name in glob.glob(path_from_root('tests', 'cases', '*.ll')): shortname = name.replace('.ll', '') if '' not in shortname: continue - if os.environ.get('EMCC_FAST_COMPILER') == '1' and os.path.basename(shortname) in [ + if os.environ.get('EMCC_FAST_COMPILER') != '0' and os.path.basename(shortname) in [ 'structparam', 'extendedprecision', 'issue_39', 'emptystruct', 'phinonexist', 'quotedlabel', 'oob_ta2', 'phientryimplicit', 'phiself', 'invokebitcast', 'funcptr', # invalid ir 'structphiparam', 'callwithstructural_ta2', 'callwithstructural64_ta2', 'structinparam', # pnacl limitations in ExpandStructRegs '2xi40', # pnacl limitations in ExpandGetElementPtr @@ -5141,7 +5130,7 @@ def process(filename): if '_le32' in shortname and not self.is_le32(): print self.skip('case "%s" not relevant for non-le32 target' % shortname) continue - if '_fastcomp' in shortname and not os.environ.get('EMCC_FAST_COMPILER') == '1': + if '_fastcomp' in shortname and not os.environ.get('EMCC_FAST_COMPILER') != '0': print self.skip('case "%s" not relevant for non-fastcomp' % shortname) continue self.emcc_args = emcc_args @@ -5180,7 +5169,7 @@ def process(filename): for name in glob.glob(path_from_root('tests', 'fuzz', '*.c')) + glob.glob(path_from_root('tests', 'fuzz', '*.cpp')): #if os.path.basename(name) != '4.c': continue if 'newfail' in name: continue - if os.path.basename(name) == '18.cpp' and not os.environ.get('EMCC_FAST_COMPILER') == '1': continue # works only in fastcomp + if os.path.basename(name) == '18.cpp' and not os.environ.get('EMCC_FAST_COMPILER') != '0': continue # works only in fastcomp print name self.do_run(open(path_from_root('tests', 'fuzz', name)).read(), @@ -5420,7 +5409,7 @@ def process(filename): def test_asm_pgo(self): if not Settings.ASM_JS: return self.skip('this is a test for PGO for asm (NB: not *in* asm)') - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp') + if os.environ.get('EMCC_FAST_COMPILER') != '0': return self.skip('todo in fastcomp') src = open(path_from_root('tests', 'hello_libcxx.cpp')).read() output = 'hello, world!' @@ -5540,7 +5529,7 @@ def process(filename): def test_embind(self): if self.emcc_args is None: return self.skip('requires emcc') - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp') + if os.environ.get('EMCC_FAST_COMPILER') != '0': return self.skip('todo in fastcomp') Building.COMPILER_TEST_OPTS += ['--bind'] src = r''' @@ -5563,7 +5552,7 @@ def process(filename): def test_embind_2(self): if self.emcc_args is None: return self.skip('requires emcc') - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp') + if os.environ.get('EMCC_FAST_COMPILER') != '0': return self.skip('todo in fastcomp') Building.COMPILER_TEST_OPTS += ['--bind', '--post-js', 'post.js'] open('post.js', 'w').write(''' Module.print('lerp ' + Module.lerp(1, 2, 0.66) + '.'); @@ -6397,7 +6386,7 @@ def process(filename): def test_minmax(self): if self.emcc_args == None: return self.skip('needs emcc') - if os.environ.get('EMCC_FAST_COMPILER') != '1': return self.skip('this test will not pass in the old compiler') + if os.environ.get('EMCC_FAST_COMPILER') == '0': return self.skip('this test will not pass in the old compiler') self.do_run(open(path_from_root('tests', 'test_minmax.c')).read(), 'NAN != NAN\nSuccess!') def test_locale(self): @@ -6488,7 +6477,7 @@ def make_run(fullname, name=-1, compiler=-1, embetter=0, quantum_size=0, return TT # Make one run with the defaults -default = make_run("default", compiler=CLANG, emcc_args=[] if os.environ.get('EMCC_FAST_COMPILER') != '1' else ['-s', 'ASM_JS=1']) +default = make_run("default", compiler=CLANG, emcc_args=[] if os.environ.get('EMCC_FAST_COMPILER') == '0' else ['-s', 'ASM_JS=1']) # Make one run with -O1, with safe heap o1 = make_run("o1", compiler=CLANG, emcc_args=["-O1", "-s", "ASM_JS=0", "-s", "SAFE_HEAP=1"]) @@ -6501,7 +6490,7 @@ asm1 = make_run("asm1", compiler=CLANG, emcc_args=["-O1"]) asm2 = make_run("asm2", compiler=CLANG, emcc_args=["-O2"]) asm3 = make_run("asm3", compiler=CLANG, emcc_args=["-O3"]) asm2f = make_run("asm2f", compiler=CLANG, emcc_args=["-O2", "-s", "PRECISE_F32=1"]) -if os.environ.get('EMCC_FAST_COMPILER') == '1': +if os.environ.get('EMCC_FAST_COMPILER') != '0': asm2g = make_run("asm2g", compiler=CLANG, emcc_args=["-O2", "-g", "-s", "ASSERTIONS=1", "--memory-init-file", "1", "-s", "SAFE_HEAP=1"]) else: asm2g = make_run("asm2g", compiler=CLANG, emcc_args=["-O2", "-g", "-s", "ASSERTIONS=1", "--memory-init-file", "1", "-s", "CHECK_HEAP_ALIGN=1"]) |