chiark / gitweb /
test suite: run-all: Honour DGIT_TESTS_TMPDIR
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Aug 2018 10:38:57 +0000 (11:38 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Aug 2018 10:54:41 +0000 (11:54 +0100)
If this variable is set, tests/tmp will be made a symlink to a real
subdirectory under $DGIT_TESTS_TMPDIR.  The real subdirectory will be
removed and recreated as tests/tmp would otherwise be.

I set it to
  /run/user/`id -u`/dgit-tests-tmp

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
tests/run-all

index e1718fa..a37b6aa 100755 (executable)
@@ -21,7 +21,17 @@ if [ $# != 0 ]; then
        set TESTSCRIPTS="$*"
 fi
 
-tmpdir=tests/tmp
+if [ "x$DGIT_TESTS_TMPDIR" != x ]; then
+       tmpdir="$PWD"
+       tmpdir="${tmpdir#/}"
+       tmpdir="${tmpdir//!/!#!}"
+       tmpdir="${tmpdir//\//!}"
+       tmpdir="$DGIT_TESTS_TMPDIR/$tmpdir"
+       rm -f tests/tmp
+       ln -ns -- "$tmpdir" tests/tmp
+else
+       tmpdir=tests/tmp
+fi
 
 case "$DGIT_TESTS_PROGRESSIVE" in
 ''|n)