From 78e2cf064131fc155b9529e383c95ca6a225a6a7 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 22 Nov 2015 14:39:21 +0200 Subject: More logging for compiler sanity testing. --- compilers.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/compilers.py b/compilers.py index 7ca602f..f211760 100644 --- a/compilers.py +++ b/compilers.py @@ -294,8 +294,17 @@ class CCompiler(Compiler): extra_flags = ['-c'] else: extra_flags = [] - pc = subprocess.Popen(self.exelist + extra_flags + [source_name, '-o', binary_name]) - pc.wait() + cmdlist = self.exelist + extra_flags + [source_name, '-o', binary_name] + pc = subprocess.Popen(cmdlist, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (stdo, stde) = pc.communicate() + stdo = stdo.decode() + stde = stde.decode() + mlog.debug('Sanity check compiler command line:', ' '.join(cmdlist)) + mlog.debug('Sanity check compile stdout:') + mlog.debug(stdo) + mlog.debug('-----\nSanity check compile stderr:') + mlog.debug(stde) + mlog.debug('-----') if pc.returncode != 0: raise EnvironmentException('Compiler %s can not compile programs.' % self.name_string()) if self.is_cross: @@ -544,7 +553,17 @@ class CPPCompiler(CCompiler): ofile = open(source_name, 'w') ofile.write('class breakCCompiler;int main(int argc, char **argv) { return 0; }\n') ofile.close() - pc = subprocess.Popen(self.exelist + [source_name, '-o', binary_name]) + cmdlist = self.exelist + [source_name, '-o', binary_name] + pc = subprocess.Popen(cmdlist, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (stdo, stde) = pc.communicate() + stdo = stdo.decode() + stde = stde.decode() + mlog.debug('Sanity check compiler command line:', ' '.join(cmdlist)) + mlog.debug('Sanity check compile stdout:') + mlog.debug(stdo) + mlog.debug('-----\nSanity check compile stderr:') + mlog.debug(stde) + mlog.debug('-----') pc.wait() if pc.returncode != 0: raise EnvironmentException('Compiler %s can not compile programs.' % self.name_string()) -- cgit v1.1