changeset 32717:e5680cb1414f

run-tests: write test times to output dir
author Siddharth Agarwal <sid0@fb.com>
date Wed, 07 Jun 2017 20:32:11 -0700
parents 2146f01a2577
children 232875623c27
files tests/run-tests.py tests/test-run-tests.t
diffstat 2 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Wed Jun 07 20:30:08 2017 -0700
+++ b/tests/run-tests.py	Wed Jun 07 20:32:11 2017 -0700
@@ -1866,10 +1866,10 @@
 # alphabetically, while times for each test are listed from oldest to
 # newest.
 
-def loadtimes(testdir):
+def loadtimes(outputdir):
     times = []
     try:
-        with open(os.path.join(testdir, b'.testtimes-')) as fp:
+        with open(os.path.join(outputdir, b'.testtimes-')) as fp:
             for line in fp:
                 ts = line.split()
                 times.append((ts[0], [float(t) for t in ts[1:]]))
@@ -1878,8 +1878,8 @@
             raise
     return times
 
-def savetimes(testdir, result):
-    saved = dict(loadtimes(testdir))
+def savetimes(outputdir, result):
+    saved = dict(loadtimes(outputdir))
     maxruns = 5
     skipped = set([str(t[0]) for t in result.skipped])
     for tdata in result.times:
@@ -1890,11 +1890,11 @@
             ts[:] = ts[-maxruns:]
 
     fd, tmpname = tempfile.mkstemp(prefix=b'.testtimes',
-                                   dir=testdir, text=True)
+                                   dir=outputdir, text=True)
     with os.fdopen(fd, 'w') as fp:
         for name, ts in sorted(saved.items()):
             fp.write('%s %s\n' % (name, ' '.join(['%.3f' % (t,) for t in ts])))
-    timepath = os.path.join(testdir, b'.testtimes')
+    timepath = os.path.join(outputdir, b'.testtimes')
     try:
         os.unlink(timepath)
     except OSError:
@@ -1966,7 +1966,7 @@
 
             self._runner._checkhglib('Tested')
 
-            savetimes(self._runner._testdir, result)
+            savetimes(self._runner._outputdir, result)
 
             if failed and self._runner.options.known_good_rev:
                 def nooutput(args):
--- a/tests/test-run-tests.t	Wed Jun 07 20:30:08 2017 -0700
+++ b/tests/test-run-tests.t	Wed Jun 07 20:32:11 2017 -0700
@@ -199,6 +199,7 @@
   $ ls -a output
   .
   ..
+  .testtimes
   test-failure-unicode.t.err
   test-failure.t.err