run-test: restore the -i prompt by write .err before checking if it exists
authorPierre-Yves David <pierre-yves.david@fb.com>
Sat, 17 May 2014 00:37:06 -0700
changeset 21386 3b0c522f04aa
parent 21385 28414e5ac9ec
child 21387 82f8d4e95c87
run-test: restore the -i prompt by write .err before checking if it exists The `--interactive` flag workis by overwriting the original test file by its `.err` version. So we need to write it before calling `self.fail`. Otherwise the `.err` file does not exists and `--interactive` is ignored. We can move that block code around because it is dedicated to write changed output and we moves it in the try-except dedicated to handling changed output. Note that the flog is still badly broken after this change. But at least it crash instead of being ignored.
tests/run-tests.py
--- a/tests/run-tests.py	Sun Apr 20 11:04:25 2014 -0700
+++ b/tests/run-tests.py	Sat May 17 00:37:06 2014 -0700
@@ -473,18 +473,18 @@
             else:
                 msg += 'output changed'
 
+            if (ret != 0 or out != self._refout) and not skipped \
+                and not options.debug:
+                f = open(self._errpath, 'wb')
+                for line in out:
+                    f.write(line)
+            f.close()
             res = self.fail(msg, ret)
         elif ret:
             res = self.fail(describe(ret), ret)
         else:
             res = self.success()
 
-        if (ret != 0 or out != self._refout) and not skipped \
-            and not options.debug:
-            f = open(self._errpath, 'wb')
-            for line in out:
-                f.write(line)
-            f.close()
 
         vlog("# Ret was:", ret)