comparison tests/test-run-tests.t @ 34962:a18eef03d879

run-tests: $TESTDIR can be something else than $PWD $TESTDIR is expected to be the directory were the test lives, and is often used to reference helper functions. However, it is now set to $PWD at test invocation time, so if `run-tests.py` is called from another folder, the test will fail. The solution is to force $TESTDIR to be the base directory of the test itself, irrespective of where the runner is called from.
author Matthieu Laneuville <matthieu.laneuville@octobus.net>
date Wed, 02 Aug 2017 13:27:45 +0900
parents b63a7d839c33
children d600bda4a3e1
comparison
equal deleted inserted replaced
34961:a7e49a5b3e6f 34962:a18eef03d879
1259 > EOF 1259 > EOF
1260 $ rt nonlocal/test-is-not-here.t 1260 $ rt nonlocal/test-is-not-here.t
1261 . 1261 .
1262 # Ran 1 tests, 0 skipped, 0 failed. 1262 # Ran 1 tests, 0 skipped, 0 failed.
1263 1263
1264 support for running run-tests.py from another directory
1265 $ mkdir tmp && cd tmp
1266 $ cat > useful-file.sh << EOF
1267 > important command
1268 > EOF
1269
1270 $ cat > test-folder.t << EOF
1271 > $ cat \$TESTDIR/useful-file.sh
1272 > important command
1273 > EOF
1274
1275 $ cd ..
1276 $ $PYTHON $TESTDIR/run-tests.py tmp/test-folder.t
1277 .
1278 # Ran 1 tests, 0 skipped, 0 failed.
1279
1264 support for bisecting failed tests automatically 1280 support for bisecting failed tests automatically
1265 $ hg init bisect 1281 $ hg init bisect
1266 $ cd bisect 1282 $ cd bisect
1267 $ cat >> test-bisect.t <<EOF 1283 $ cat >> test-bisect.t <<EOF
1268 > $ echo pass 1284 > $ echo pass