Skip to content

Commit

Permalink
More logging for compiler sanity testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed Nov 22, 2015
1 parent 134468d commit 78e2cf0
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,17 @@ def sanity_check(self, work_dir):
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:
Expand Down Expand Up @@ -544,7 +553,17 @@ def sanity_check(self, work_dir):
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())
Expand Down

0 comments on commit 78e2cf0

Please sign in to comment.