run-tests: write .err files earlier
Earlier refactoring of run-tests.py accidentally broke --interactive
and external diff generation by not having .err files written before
they are consulted. This patch fixes that.
--- a/tests/run-tests.py Tue May 27 19:10:22 2014 -0700
+++ b/tests/run-tests.py Tue May 27 19:21:12 2014 -0700
@@ -530,6 +530,14 @@
elif ret is False:
raise WarnTest('no result code from test')
elif out != self._refout:
+ # Diff generation may rely on written .err file.
+ if (ret != 0 or out != self._refout) and not self._skipped \
+ and not self._debug:
+ f = open(self.errpath, 'wb')
+ for line in out:
+ f.write(line)
+ f.close()
+
# The result object handles diff calculation for us.
self._result.addOutputMismatch(self, ret, out, self._refout)
@@ -538,13 +546,6 @@
else:
msg = 'output changed'
- if (ret != 0 or out != self._refout) and not self._skipped \
- and not self._debug:
- f = open(self.errpath, 'wb')
- for line in out:
- f.write(line)
- f.close()
-
self.fail(msg)
elif ret:
self.fail(describe(ret))