[PATCH v2] run-tests: outputdir also has to be changed if $TESTDIR is not $PWD
matthieu.laneuville at octobus.net
matthieu.laneuville at octobus.net
Sun Nov 19 09:12:48 UTC 2017
# HG changeset patch
# User Matthieu Laneuville <matthieu.laneuville at octobus.net>
# Date 1510989120 -32400
# Sat Nov 18 16:12:00 2017 +0900
# Node ID 5c8ac4355da919423a59ab3d6d0145c8f3f54975
# Parent 57d56f603f7062d9c5a0f6d9c4bf39e1a26c5388
# EXP-Topic hg122b
run-tests: outputdir also has to be changed if $TESTDIR is not $PWD
Following a18eef03d879, running run-tests.py from outside tests/ would lead to
the creation of .testtimes and test-*.t.err in $PWD instead of $TESTDIR. This
patch fixes that and updates the relevant test.
diff -r 57d56f603f70 -r 5c8ac4355da9 tests/run-tests.py
--- a/tests/run-tests.py Wed Nov 15 17:54:27 2017 -0800
+++ b/tests/run-tests.py Sat Nov 18 16:12:00 2017 +0900
@@ -2363,6 +2363,8 @@ class TestRunner(object):
self._outputdir = canonpath(_bytespath(self.options.outputdir))
else:
self._outputdir = self._testdir
+ if testdescs and pathname:
+ self._outputdir = os.path.join(self._outputdir, pathname)
if 'PYTHONHASHSEED' not in os.environ:
# use a random python hash seed all the time
diff -r 57d56f603f70 -r 5c8ac4355da9 tests/test-run-tests.t
--- a/tests/test-run-tests.t Wed Nov 15 17:54:27 2017 -0800
+++ b/tests/test-run-tests.t Sat Nov 18 16:12:00 2017 +0900
@@ -1281,6 +1281,7 @@ support for automatically discovering te
support for running run-tests.py from another directory
$ mkdir tmp && cd tmp
+
$ cat > useful-file.sh << EOF
> important command
> EOF
@@ -1290,10 +1291,27 @@ support for running run-tests.py from an
> important command
> EOF
+ $ cat > test-folder-fail.t << EOF
+ > $ cat \$TESTDIR/useful-file.sh
+ > important commando
+ > EOF
+
$ cd ..
- $ $PYTHON $TESTDIR/run-tests.py tmp/test-folder.t
- .
- # Ran 1 tests, 0 skipped, 0 failed.
+ $ $PYTHON $TESTDIR/run-tests.py tmp/test-*.t
+
+ --- $TESTTMP/anothertests/tmp/test-folder-fail.t
+ +++ $TESTTMP/anothertests/tmp/test-folder-fail.t.err
+ @@ -1,2 +1,2 @@
+ $ cat $TESTDIR/useful-file.sh
+ - important commando
+ + important command
+
+ ERROR: test-folder-fail.t output changed
+ !.
+ Failed test-folder-fail.t: output changed
+ # Ran 2 tests, 0 skipped, 1 failed.
+ python hash seed: * (glob)
+ [1]
support for bisecting failed tests automatically
$ hg init bisect
More information about the Mercurial-devel
mailing list