Better error output when cmd is not found

stl_dim
Marius Kintel 2010-08-28 15:16:03 +02:00
parent 22b74585d8
commit f2323c78b3
1 changed files with 16 additions and 12 deletions

View File

@ -64,19 +64,23 @@ def run_test(testname, cmd, args):
if not os.path.exists(outputdir): os.makedirs(outputdir)
outputname = actualfilename
outfile = open(outputname, "wb")
proc = subprocess.Popen([cmd] + args, stdout=outfile, stderr=subprocess.PIPE)
errtext = proc.communicate()[1]
if errtext != None and len(errtext) > 0:
print >> sys.stderr, "Error output: " + errtext
outfile.close()
if proc.returncode != 0:
print >> sys.stderr, "Error: %s failed with return code %d" % (cmdname, proc.returncode)
return False
if not options.generate:
if not compare_text(expectedfilename, actualfilename):
execute_and_redirect("diff", [expectedfilename, actualfilename], sys.stderr)
try:
proc = subprocess.Popen([cmd] + args, stdout=outfile, stderr=subprocess.PIPE)
errtext = proc.communicate()[1]
if errtext != None and len(errtext) > 0:
print >> sys.stderr, "Error output: " + errtext
outfile.close()
if proc.returncode != 0:
print >> sys.stderr, "Error: %s failed with return code %d" % (cmdname, proc.returncode)
return False
if not options.generate:
if not compare_text(expectedfilename, actualfilename):
execute_and_redirect("diff", [expectedfilename, actualfilename], sys.stderr)
return False
except OSError, err:
print >> sys.stderr, "Error: %s \"%s\"" % (err.strerror, cmd)
return True
class Options: