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 e1718fa991944b89107b8eff20820cb93aa714a8..a37b6aad5b056bb01f7887d4d3a4100bdb089e75 100755 (executable)
@@ -21,7 +21,17 @@ if [ $# != 0 ]; then
        set TESTSCRIPTS="$*"
 fi
 
        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)
 
 case "$DGIT_TESTS_PROGRESSIVE" in
 ''|n)