run-tests: write .err files earlier
authorGregory Szorc <gregory.szorc@gmail.com>
Tue, 27 May 2014 19:21:12 -0700
changeset 21614 609a642dff61
parent 21613 b3213b9fafed
child 21616 0a8e7f81e8ae
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.
tests/run-tests.py
--- 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))