Fix run_tests.py to print all output from tests (if any)
This commit is contained in:
13
run_tests.py
13
run_tests.py
@@ -75,11 +75,14 @@ fnull = open(os.devnull, 'w')
|
|||||||
|
|
||||||
# run the commands in cmd_list
|
# run the commands in cmd_list
|
||||||
def run_cmds(cmd_list, filename, expect_failure):
|
def run_cmds(cmd_list, filename, expect_failure):
|
||||||
|
output = ""
|
||||||
for cmd in cmd_list:
|
for cmd in cmd_list:
|
||||||
sp = subprocess.Popen(shlex.split(cmd), stdin=None,
|
sp = subprocess.Popen(shlex.split(cmd), stdin=None,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
output = sp.communicate()[0]
|
out = sp.communicate()
|
||||||
|
output += out[0]
|
||||||
|
output += out[1]
|
||||||
failed = (sp.returncode != 0)
|
failed = (sp.returncode != 0)
|
||||||
if failed:
|
if failed:
|
||||||
break
|
break
|
||||||
@@ -87,9 +90,11 @@ def run_cmds(cmd_list, filename, expect_failure):
|
|||||||
surprise = ((expect_failure and not failed) or
|
surprise = ((expect_failure and not failed) or
|
||||||
(not expect_failure and failed))
|
(not expect_failure and failed))
|
||||||
if surprise == True:
|
if surprise == True:
|
||||||
print "Test %s %s " % \
|
print "Test %s %s (return code %d) " % \
|
||||||
(filename, "unexpectedly passed" if expect_failure else "failed")
|
(filename, "unexpectedly passed" if expect_failure else "failed",
|
||||||
print "Output %s" % output
|
sp.returncode)
|
||||||
|
if output != "":
|
||||||
|
print "%s" % output
|
||||||
return surprise
|
return surprise
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user