Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: autotest.py

Issue 11039026: Use a subprocess wrapper that will throw if a command returns a non-zero result code (Closed)
Patch Set: Created July 4, 2013, 7:18 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « abp_rewrite.py ('k') | utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: autotest.py
===================================================================
--- a/autotest.py
+++ b/autotest.py
@@ -1,16 +1,16 @@
#!/usr/bin/env python
# coding: utf-8
# This Source Code is subject to the terms of the Mozilla Public License
# version 2.0 (the "License"). You can obtain a copy of the License at
# http://mozilla.org/MPL/2.0/.
-import sys, os, subprocess, re, difflib, utils
+import sys, os, re, difflib, utils
def run_tests():
application = utils.ensureJSShell()
env = {
'LD_LIBRARY_PATH': os.path.relpath(os.path.dirname(application)),
}
baseDir = os.path.dirname(utils.__file__)
@@ -30,17 +30,17 @@ def run_tests():
elif match and match.group(1).lower() == 'arguments':
arguments = match.group(2).split(' ')
handle.close()
if arguments == None:
continue
command = [application, os.path.join(baseDir, 'jshydra.js'), file] + arguments
- out = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env).communicate()[0].replace('\r', '')
+ out = utils.run(command, utils.STREAMS_STDOUT, env=env).replace('\r', '')
expected = open(file + '.expected', 'r').read().replace('\r', '')
if out == expected:
print '%s passed' % name
else:
print '%s failed! Log:' % name
for line in difflib.unified_diff(expected.split('\n'), out.split('\n'), fromfile=file + '.expected', tofile=file + '.output'):
print line
print
« no previous file with comments | « abp_rewrite.py ('k') | utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld