D1433: run-tests: fix TESTDIR if testdescs are absolute paths

spectral (Kyle Lippincott) phabricator at mercurial-scm.org
Thu Nov 16 04:41:52 UTC 2017


spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Commit https://phab.mercurial-scm.org/rHGa18eef03d879b179c69744ff3568615402542938 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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1433

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2356,9 +2356,12 @@
         # 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 and pathname[0].startswith(b'/'):
+                osenvironb[b'TESTDIR'] = pathname
+            else:
+                if pathname and not osenvironb[b'TESTDIR'].endswith(b'/'):
+                    osenvironb[b'TESTDIR'] += b'/'
+                osenvironb[b'TESTDIR'] += pathname
         if self.options.outputdir:
             self._outputdir = canonpath(_bytespath(self.options.outputdir))
         else:



To: spectral, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list