diff options
| author | Alon Zakai <alonzakai@gmail.com> | 2012-01-02 19:21:57 -0800 | 
|---|---|---|
| committer | Alon Zakai <alonzakai@gmail.com> | 2012-01-02 19:21:57 -0800 | 
| commit | f6e838357b58559ac376c7975f64b87da5a52b0a (patch) | |
| tree | 669c1c7690365bd9225f0f01a094e95bd3acd30c | |
| parent | 7b7e1b6a69b578f17ca9ab8a70fcdd023386dbb6 (diff) | |
make it easy to set whether stderr is silent or noisy in the test runner
| -rw-r--r-- | tests/runner.py | 16 | 
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/runner.py b/tests/runner.py index b0df18b3..ce31783d 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -35,6 +35,8 @@ except:  class RunnerCore(unittest.TestCase):    save_dir = os.environ.get('EM_SAVE_DIR')    save_JS = 0 +  stderr_redirect = STDOUT # This avoids cluttering the test runner output, which is stderr too, with compiler warnings etc. +                           # Change this to None to get stderr reporting, for debugging purposes    def setUp(self):      Settings.reset() @@ -143,7 +145,7 @@ class RunnerCore(unittest.TestCase):               ['-I', dirname, '-I', os.path.join(dirname, 'include')] + \               map(lambda include: '-I' + include, includes) + \               ['-c', f, '-o', f + '.o'] -      output = Popen(args, stdout=PIPE).communicate()[0] +      output = Popen(args, stdout=PIPE, stderr=self.stderr_redirect).communicate()[0]        assert os.path.exists(f + '.o'), 'Source compilation error: ' + output      os.chdir(cwd) @@ -182,7 +184,7 @@ class RunnerCore(unittest.TestCase):      return ret    def run_llvm_interpreter(self, args): -    return Popen([EXEC_LLVM] + args, stdout=PIPE, stderr=STDOUT).communicate()[0] +    return Popen([EXEC_LLVM] + args, stdout=PIPE, stderr=self.stderr_redirect).communicate()[0]    def build_native(self, filename):      Popen([CLANG, '-O2', filename, '-o', filename+'.native'], stdout=PIPE).communicate()[0] @@ -3771,7 +3773,7 @@ def process(filename):          try_delete(os.path.join(self.get_dir(), 'src.cpp.o.js'))          output = Popen([EMCC, path_from_root('tests', 'dlmalloc_test.c'), -                        '-o', os.path.join(self.get_dir(), 'src.cpp.o.js')], stdout=PIPE, stderr=PIPE).communicate() +                        '-o', os.path.join(self.get_dir(), 'src.cpp.o.js')], stdout=PIPE, stderr=self.stderr_redirect).communicate()          #print output          self.do_run('x', '*1,0*', ['200', '1'], no_build=True) @@ -4160,7 +4162,7 @@ def process(filename):      # Autodebug the code      def do_autodebug(self, filename): -      output = Popen(['python', AUTODEBUGGER, filename+'.o.ll', filename+'.o.ll.ll'], stdout=PIPE, stderr=STDOUT).communicate()[0] +      output = Popen(['python', AUTODEBUGGER, filename+'.o.ll', filename+'.o.ll.ll'], stdout=PIPE, stderr=self.stderr_redirect).communicate()[0]        assert 'Success.' in output, output        self.prep_ll_run(filename, filename+'.o.ll.ll', force_recompile=True) # rebuild .bc # TODO: use code in do_autodebug_post for this @@ -4172,7 +4174,7 @@ def process(filename):          return True        print 'Autodebugging during post time'        delattr(self, 'post') -      output = Popen(['python', AUTODEBUGGER, filename+'.o.ll', filename+'.o.ll.ll'], stdout=PIPE, stderr=STDOUT).communicate()[0] +      output = Popen(['python', AUTODEBUGGER, filename+'.o.ll', filename+'.o.ll.ll'], stdout=PIPE, stderr=self.stderr_redirect).communicate()[0]        assert 'Success.' in output, output        shutil.copyfile(filename + '.o.ll.ll', filename + '.o.ll')        Building.llvm_as(filename) @@ -4405,7 +4407,7 @@ def process(filename):          open(header_filename, 'w').write(header)          basename = os.path.join(self.get_dir(), 'bindingtest') -        output = Popen([BINDINGS_GENERATOR, basename, header_filename], stdout=PIPE, stderr=STDOUT).communicate()[0] +        output = Popen([BINDINGS_GENERATOR, basename, header_filename], stdout=PIPE, stderr=self.stderr_redirect).communicate()[0]          #print output          assert 'Traceback' not in output, 'Failure in binding generation: ' + output @@ -5428,7 +5430,7 @@ elif 'benchmark' in str(sys.argv):        try_delete(final_filename)        output = Popen([EMCC, filename, '-O3', '-s', 'USE_TYPED_ARRAYS=1', '-s', 'QUANTUM_SIZE=1',                        '-s', 'TOTAL_MEMORY=100*1024*1024', '-s', 'FAST_MEMORY=10*1024*1024', -                      '-o', final_filename] + emcc_args, stdout=PIPE, stderr=PIPE).communicate() +                      '-o', final_filename] + emcc_args, stdout=PIPE, stderr=self.stderr_redirect).communicate()        assert os.path.exists(final_filename), 'Failed to compile file: ' + '\n'.join(output)        # Run JS  | 
