Make sure output is written when test fails

This commit is contained in:
Cheng Zhao 2016-04-30 17:47:29 +09:00
parent 3dcf69eab3
commit b68a25835f

View file

@ -30,13 +30,19 @@ def main():
else: else:
atom_shell = os.path.join(SOURCE_ROOT, 'out', config, PROJECT_NAME) atom_shell = os.path.join(SOURCE_ROOT, 'out', config, PROJECT_NAME)
subprocess.check_call([atom_shell, 'spec'] + sys.argv[1:]) returncode = 0
try:
subprocess.check_call([atom_shell, 'spec'] + sys.argv[1:])
except subprocess.CalledProcessError as e:
returncode = e.returncode
if os.environ.has_key('OUTPUT_TO_FILE'): if os.environ.has_key('OUTPUT_TO_FILE'):
output_to_file = os.environ['OUTPUT_TO_FILE'] output_to_file = os.environ['OUTPUT_TO_FILE']
with open(output_to_file, 'r') as f: with open(output_to_file, 'r') as f:
print f.read() print f.read()
return returncode
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main()) sys.exit(main())