diff tests/run-tests.py @ 35066:57d56f603f70

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
author Kyle Lippincott <spectral@google.com>
date Wed, 15 Nov 2017 17:54:27 -0800
parents d600bda4a3e1
children 4fb489a998c9
line wrap: on
line diff
--- 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: