diff options
Diffstat (limited to 'tests/runner.py')
-rw-r--r-- | tests/runner.py | 68 |
1 files changed, 30 insertions, 38 deletions
diff --git a/tests/runner.py b/tests/runner.py index 4eda8095..e24ea5b1 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -49,8 +49,8 @@ class RunnerCore(unittest.TestCase): shutil.copy(os.path.join(self.get_dir(), name), os.path.join(TEMP_DIR, self.id().replace('__main__.', '').replace('.test_', '.')+'.'+suff)) - def skip(self): - print >> sys.stderr, '<skip> ', + def skip(self, why): + print >> sys.stderr, '<skipping: %s> ' % why, def get_dir(self): dirname = TEMP_DIR + '/tmp' # tempfile.mkdtemp(dir=TEMP_DIR) @@ -95,8 +95,8 @@ class RunnerCore(unittest.TestCase): os.remove(target) except: pass - Popen([LLVM_AS, source, '-o=' + target], stdout=PIPE, stderr=STDOUT).communicate()[0] - assert os.path.exists(target), 'Could not create bc file' + output = Popen([LLVM_AS, source, '-o=' + target], stdout=PIPE, stderr=STDOUT).communicate()[0] + assert os.path.exists(target), 'Could not create bc file: ' + output def do_link(self, files, target): output = Popen([LLVM_LINK] + files + ['-o', target], stdout=PIPE, stderr=STDOUT).communicate()[0] @@ -277,7 +277,6 @@ if 'benchmark' not in str(sys.argv): # No building - just process an existing .ll file (or .bc, which we turn into .ll) def do_ll_test(self, ll_file, expected_output=None, args=[], js_engines=None, output_nicerizer=None, post_build=None, force_recompile=False, build_ll_hook=None, extra_emscripten_args=[]): - if COMPILER != LLVM_GCC: return self.skip() # We use existing .ll, so which compiler is unimportant filename = os.path.join(self.get_dir(), 'src.cpp') @@ -387,7 +386,7 @@ if 'benchmark' not in str(sys.argv): self.do_test(src, output, force_c=True) def test_bigint(self): - if USE_TYPED_ARRAYS != 0: return self.skip() # Typed arrays truncate i64. + if USE_TYPED_ARRAYS != 0: return self.skip('Typed arrays truncate i64') src = ''' #include <stdio.h> int main() @@ -1527,7 +1526,7 @@ if 'benchmark' not in str(sys.argv): self.do_test(src, '*4,3,4*\n*6,4,6*') def test_varargs(self): - if QUANTUM_SIZE == 1: return self.skip() # FIXME: Add support for this + if QUANTUM_SIZE == 1: return self.skip('FIXME: Add support for this') src = ''' #include <stdio.h> @@ -1649,7 +1648,7 @@ if 'benchmark' not in str(sys.argv): self.do_test(src, '*1,2,3,5,5,6*\n*stdin==0:0*\n*%*\n*5*\n*66.0*\n*10*\n*0*\n*-10*\n*18*\n*10*\n*0*\n*4294967286*\n*cleaned*') def test_time(self): - if USE_TYPED_ARRAYS == 2: return self.skip() # Typed arrays = 2 truncate i64s. + if USE_TYPED_ARRAYS == 2: return self.skip('Typed arrays = 2 truncate i64s') src = open(path_from_root('tests', 'time', 'src.c'), 'r').read() expected = open(path_from_root('tests', 'time', 'output.txt'), 'r').read() self.do_test(src, expected) @@ -1956,7 +1955,7 @@ if 'benchmark' not in str(sys.argv): def test_dlfcn_data_and_fptr(self): global LLVM_OPTS - if LLVM_OPTS: return self.skip() # LLVM opts will optimize out parent_func + if LLVM_OPTS: return self.skip('LLVM opts will optimize out parent_func') global BUILD_AS_SHARED_LIB, EXPORTED_FUNCTIONS, EXPORTED_GLOBALS lib_src = ''' @@ -2103,7 +2102,7 @@ if 'benchmark' not in str(sys.argv): INCLUDE_FULL_LIBRARY = 0 def test_dlfcn_varargs(self): - if QUANTUM_SIZE == 1: return self.skip() # FIXME: Add support for this + if QUANTUM_SIZE == 1: return self.skip('FIXME: Add support for this') global BUILD_AS_SHARED_LIB, EXPORTED_FUNCTIONS lib_src = r''' void print_ints(int n, ...); @@ -2200,7 +2199,7 @@ if 'benchmark' not in str(sys.argv): self.do_test(src, re.sub(r'(^|\n)\s+', r'\1', expected)) def test_strtod(self): - if USE_TYPED_ARRAYS == 2: return self.skip() # Typed arrays = 2 truncate doubles. + if USE_TYPED_ARRAYS == 2: return self.skip('Typed arrays = 2 truncate doubles') src = r''' #include <stdio.h> #include <stdlib.h> @@ -2255,13 +2254,13 @@ if 'benchmark' not in str(sys.argv): self.do_test(src, re.sub(r'\n\s+', '\n', expected)) def test_parseInt(self): - if USE_TYPED_ARRAYS != 0: return self.skip() # Typed arrays truncate i64. + if USE_TYPED_ARRAYS != 0: return self.skip('Typed arrays truncate i64') src = open(path_from_root('tests', 'parseInt', 'src.c'), 'r').read() expected = open(path_from_root('tests', 'parseInt', 'output.txt'), 'r').read() self.do_test(src, expected) def test_printf(self): - if USE_TYPED_ARRAYS != 0: return self.skip() # Typed arrays truncate i64. + if USE_TYPED_ARRAYS != 0: return self.skip('Typed arrays truncate i64') src = open(path_from_root('tests', 'printf', 'test.c'), 'r').read() expected = open(path_from_root('tests', 'printf', 'output.txt'), 'r').read() self.do_test(src, expected) @@ -2889,7 +2888,7 @@ if 'benchmark' not in str(sys.argv): def test_raytrace(self): global USE_TYPED_ARRAYS - if USE_TYPED_ARRAYS == 2: return self.skip() # relies on double values + if USE_TYPED_ARRAYS == 2: return self.skip('Relies on double values') src = open(path_from_root('tests', 'raytrace.cpp'), 'r').read() output = open(path_from_root('tests', 'raytrace.ppm'), 'r').read() @@ -2903,6 +2902,7 @@ if 'benchmark' not in str(sys.argv): self.do_test(src, j, [str(i)], lambda x: x.replace('\n', '*'), no_build=i>1) def test_dlmalloc(self): + #global DISABLE_EXCEPTIONS; DISABLE_EXCEPTIONS = 1 global CORRECT_SIGNS; CORRECT_SIGNS = 2 global CORRECT_SIGNS_LINES; CORRECT_SIGNS_LINES = ['src.cpp:' + str(i) for i in [4816, 4191, 4246, 4199, 4205, 4235, 4227]] @@ -2913,8 +2913,7 @@ if 'benchmark' not in str(sys.argv): def zzztest_gl(self): # Switch to gcc from g++ - we don't compile properly otherwise (why?) global COMPILER - if COMPILER != LLVM_GCC: return self.skip() - COMPILER = LLVM_GCC.replace('g++', 'gcc') + COMPILER = COMPILER.replace('++', '') def post(filename): src = open(filename, 'r').read().replace( @@ -2927,6 +2926,8 @@ if 'benchmark' not in str(sys.argv): self.do_test(path_from_root('tests', 'gl'), '*?*', main_file='sdl_ogl.c', post_build=post) def test_libcxx(self): + return self.skip('Fails to run llvm-as due to llvm bug 10850') + self.do_test(path_from_root('tests', 'libcxx'), 'june -> 30\nPrevious (in alphabetical order) is july\nNext (in alphabetical order) is march', main_file='main.cpp', additional_files=['hash.cpp']) @@ -3037,9 +3038,9 @@ if 'benchmark' not in str(sys.argv): return self.get_library('freetype', os.path.join('objs', '.libs', 'libfreetype.a.bc')) def test_freetype(self): - if QUANTUM_SIZE == 1: return self.skip() # TODO: Figure out and try to fix + if QUANTUM_SIZE == 1: return self.skip('TODO: Figure out and try to fix') - if LLVM_OPTS or COMPILER == CLANG: global RELOOP; RELOOP = 0 # Too slow; we do care about typed arrays and OPTIMIZE though + if LLVM_OPTS: global RELOOP; RELOOP = 0 # Too slow; we do care about typed arrays and OPTIMIZE though global CORRECT_SIGNS if CORRECT_SIGNS == 0: CORRECT_SIGNS = 1 # Not sure why, but needed @@ -3091,10 +3092,8 @@ if 'benchmark' not in str(sys.argv): global SAFE_HEAP, SAFE_HEAP_LINES, USE_TYPED_ARRAYS, LLVM_OPTS if LLVM_OPTS: SAFE_HEAP = 0 # Optimizations make it so we do not have debug info on the line we need to ignore - if COMPILER == LLVM_GCC: - global INIT_STACK; INIT_STACK = 1 # TODO: Investigate why this is necessary - if USE_TYPED_ARRAYS == 2: return self.skip() # We have slightly different rounding here for some reason. TODO: activate this + if USE_TYPED_ARRAYS == 2: return self.skip('We have slightly different rounding here for some reason. TODO: activate this') if SAFE_HEAP: # Ignore bitfield warnings @@ -3112,9 +3111,9 @@ if 'benchmark' not in str(sys.argv): js_engines=[SPIDERMONKEY_ENGINE]) # V8 issue 1407 def test_poppler(self): - if COMPILER != LLVM_GCC: return self.skip() # llvm-link failure when using clang, LLVM bug 9498 - if RELOOP or LLVM_OPTS: return self.skip() # TODO - if QUANTUM_SIZE == 1: return self.skip() # TODO: Figure out and try to fix + # llvm-link failure when using clang, LLVM bug 9498, still relevant? + if RELOOP or LLVM_OPTS: return self.skip('TODO') + if QUANTUM_SIZE == 1: return self.skip('TODO: Figure out and try to fix') global USE_TYPED_ARRAYS; USE_TYPED_ARRAYS = 0 # XXX bug - we fail with this FIXME @@ -3196,10 +3195,7 @@ if 'benchmark' not in str(sys.argv): else: CORRECT_SIGNS = 2 global CORRECT_SIGNS_LINES - if COMPILER == CLANG: - CORRECT_SIGNS_LINES = ["mqc.c:566"] - else: - CORRECT_SIGNS_LINES = ["mqc.c:566", "mqc.c:317"] + CORRECT_SIGNS_LINES = ["mqc.c:566", "mqc.c:317"] original_j2k = path_from_root('tests', 'openjpeg', 'syntensity_lobby_s.j2k') @@ -3293,7 +3289,7 @@ if 'benchmark' not in str(sys.argv): # to process. def test_cases(self): global CHECK_OVERFLOWS; CHECK_OVERFLOWS = 0 - if LLVM_OPTS: return self.skip() # Our code is not exactly 'normal' llvm assembly + if LLVM_OPTS: return self.skip("Our code is not exactly 'normal' llvm assembly") for name in glob.glob(path_from_root('tests', 'cases', '*.ll')): shortname = name.replace('.ll', '') print "Testing case '%s'..." % shortname @@ -3311,7 +3307,7 @@ if 'benchmark' not in str(sys.argv): self.prep_ll_test(filename, filename+'.o.ll.ll', force_recompile=True) # rebuild .bc def test_autodebug(self): - if LLVM_OPTS: return self.skip() # They mess us up + if LLVM_OPTS: return self.skip('LLVM opts mess us up') # Run a test that should work, generating some code self.test_structs() @@ -3321,7 +3317,6 @@ if 'benchmark' not in str(sys.argv): # Compare to each other, and to expected output self.do_ll_test(path_from_root('tests', filename+'.o.ll.ll')) - self.do_ll_test(path_from_root('tests', filename+'.o.ll.ll'), 'AD:38,10\nAD:47,7008\nAD:57,7018\n') # Test using build_ll_hook src = ''' @@ -3558,7 +3553,7 @@ Child2:9 def test_typeinfo(self): global RUNTIME_TYPE_INFO; RUNTIME_TYPE_INFO = 1 global QUANTUM_SIZE - if QUANTUM_SIZE != 4: return self.skip() + if QUANTUM_SIZE != 4: return self.skip('We assume normal sizes in the output here') src = ''' #include<stdio.h> @@ -3630,8 +3625,8 @@ Child2:9 def test_safe_heap(self): global SAFE_HEAP, SAFE_HEAP_LINES - if not SAFE_HEAP: return self.skip() - if LLVM_OPTS: return self.skip() # LLVM can optimize away the intermediate |x|... + if not SAFE_HEAP: return self.skip('We need SAFE_HEAP to test SAFE_HEAP') + if LLVM_OPTS: return self.skip('LLVM can optimize away the intermediate |x|') src = ''' #include<stdio.h> int main() { @@ -3964,12 +3959,9 @@ TT = %s for name, compiler, quantum, embetter, typed_arrays in [ ('clang', CLANG, 1, 0, 0), ('clang', CLANG, 4, 0, 0), - ('llvm_gcc', LLVM_GCC, 4, 0, 0), ('clang', CLANG, 1, 1, 1), ('clang', CLANG, 4, 1, 1), - ('llvm_gcc', LLVM_GCC, 4, 1, 1), ('clang', CLANG, 4, 1, 2), - #('llvm_gcc', LLVM_GCC, 4, 1, 2), ]: fullname = '%s_%d_%d%s%s' % ( name, llvm_opts, embetter, '' if quantum == 4 else '_q' + str(quantum), '' if typed_arrays in [0, 1] else '_t' + str(typed_arrays) @@ -4189,7 +4181,7 @@ else: if __name__ == '__main__': sys.argv = [sys.argv[0]] + ['-v'] + sys.argv[1:] # Verbose output by default - for cmd in [CLANG, LLVM_GCC, LLVM_DIS, SPIDERMONKEY_ENGINE[0], V8_ENGINE[0]]: + for cmd in [CLANG, LLVM_DIS, SPIDERMONKEY_ENGINE[0], V8_ENGINE[0]]: if not os.path.exists(cmd): print 'WARNING: Cannot find', cmd unittest.main() |