run-tests: fix TESTDIR if testdescs are absolute paths
authorKyle Lippincott <spectral@google.com>
Wed, 15 Nov 2017 17:54:27 -0800
changeset 35066 57d56f603f70
parent 35065 a1de4ffaa7a8
child 35067 929858db4d22
run-tests: fix TESTDIR if testdescs are absolute paths Commit a18eef03d879 made TESTDIR be the location of the arguments that were passed to run-tests.py instead of just PWD. It assumed that these tests were specified using relative paths, so if pwd was /tmp/foo, and the first argument was /tmp/baz, it would set TESTDIR to /tmp/foo//tmp/baz. Differential Revision: https://phab.mercurial-scm.org/D1433
tests/run-tests.py
--- a/tests/run-tests.py	Thu Nov 16 22:21:03 2017 +0800
+++ b/tests/run-tests.py	Wed Nov 15 17:54:27 2017 -0800
@@ -2356,9 +2356,9 @@
         # assume all tests in same folder for now
         if testdescs:
             pathname = os.path.dirname(testdescs[0]['path'])
-            if pathname and not osenvironb[b'TESTDIR'].endswith(b'/'):
-                osenvironb[b'TESTDIR'] += b'/'
-            osenvironb[b'TESTDIR'] += pathname
+            if pathname:
+                osenvironb[b'TESTDIR'] = os.path.join(osenvironb[b'TESTDIR'],
+                                                      pathname)
         if self.options.outputdir:
             self._outputdir = canonpath(_bytespath(self.options.outputdir))
         else: