Commit 1a31aadd authored by Stefan Behnel's avatar Stefan Behnel

Make it easier to report errors from srctree tests by adding the last output...

Make it easier to report errors from srctree tests by adding the last output to the reported AssertionError.
parent ddaaa7b8
...@@ -1946,13 +1946,15 @@ class EndToEndTest(unittest.TestCase): ...@@ -1946,13 +1946,15 @@ class EndToEndTest(unittest.TestCase):
cmd.append(command) cmd.append(command)
out.append(_out) out.append(_out)
err.append(_err) err.append(_err)
if res == 0 and b'REFNANNY: ' in _out: if res == 0 and b'REFNANNY: ' in _out:
res = -1 res = -1
if res != 0: if res != 0:
for c, o, e in zip(cmd, out, err): for c, o, e in zip(cmd, out, err):
sys.stderr.write("%s\n%s\n%s\n\n" % ( sys.stderr.write("%s\n%s\n%s\n\n" % (
c, self._try_decode(o), self._try_decode(e))) c, self._try_decode(o), self._try_decode(e)))
self.assertEqual(0, res, "non-zero exit status") self.assertEqual(0, res, "non-zero exit status, last output was:\n%r\n-- stdout:%s\n-- stderr:%s\n" % (
' '.join(command), self._try_decode(out[-1]), self._try_decode(err[-1])))
self.success = True self.success = True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment