diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -1801,6 +1801,7 @@ class TestRunner(object): fileb = _bytespath(__file__) runtestdir = os.path.abspath(os.path.dirname(fileb)) + osenvironb[b'RUNTESTDIR'] = runtestdir if PYTHON3: sepb = _bytespath(os.pathsep) else: @@ -1835,6 +1836,7 @@ class TestRunner(object): self._coveragefile = os.path.join(self._testdir, b'.coverage') vlog("# Using TESTDIR", self._testdir) + vlog("# Using RUNTESTDIR", osenvironb[b'RUNTESTDIR']) vlog("# Using HGTMP", self._hgtmp) vlog("# Using PATH", os.environ["PATH"]) vlog("# Using", IMPL_PATH, osenvironb[IMPL_PATH]) diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -583,3 +583,22 @@ Mercurial source tree. $ run-tests.py test-hghave.t . # Ran 1 tests, 0 skipped, 0 warned, 0 failed. + +test that RUNTESTDIR refers the directory, in which `run-tests.py` now +running is placed. + + $ cat > test-runtestdir.t < - $TESTDIR, in which test-run-tests.t is placed + > - \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime) + > - \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime) + > + > $ test "\$TESTDIR" = "$TESTTMP"/anothertests + > $ test "\$RUNTESTDIR" = "$TESTDIR" + > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py + > #!/usr/bin/env python + > # + > # check-code - a style and portability checker for Mercurial + > EOF + $ run-tests.py test-runtestdir.t + . + # Ran 1 tests, 0 skipped, 0 warned, 0 failed.