changeset 21614:609a642dff61

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.
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 27 May 2014 19:21:12 -0700
parents b3213b9fafed
children 0a8e7f81e8ae
files tests/run-tests.py
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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))