about summary refs log tree commit diff
path: root/tests/common.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'tests/common.sh.in')
-rw-r--r--tests/common.sh.in13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/common.sh.in b/tests/common.sh.in
index eb9798a27b45..756c20c9d9d6 100644
--- a/tests/common.sh.in
+++ b/tests/common.sh.in
@@ -2,7 +2,7 @@ set -e
 
 datadir="@datadir@"
 
-export TEST_ROOT=$(pwd)/test-tmp
+export TEST_ROOT=${TMPDIR:-/tmp}/nix-test
 export NIX_STORE_DIR
 if ! NIX_STORE_DIR=$(readlink -f $TEST_ROOT/store 2> /dev/null); then
     # Maybe the build directory is symlinked.
@@ -17,6 +17,9 @@ export NIX_CONF_DIR=$TEST_ROOT/etc
 export NIX_MANIFESTS_DIR=$TEST_ROOT/var/nix/manifests
 export _NIX_TEST_SHARED=$TEST_ROOT/shared
 export NIX_REMOTE=$NIX_REMOTE_
+export TEST_HOME=$TEST_ROOT/test-home
+export HOME=$TEST_HOME
+mkdir -p $TEST_HOME
 
 export PATH=@bindir@:$PATH
 
@@ -54,14 +57,14 @@ clearStore() {
     rm -f "$NIX_STATE_DIR"/gcroots/ref
 }
 
-clearManifests() {
-    rm -f $NIX_STATE_DIR/manifests/*
-}
-
 clearCache() {
     rm -rf "$cacheDir"
 }
 
+clearCacheCache() {
+    rm -f $TEST_HOME/.cache/nix/binary-cache*
+}
+
 startDaemon() {
     # Start the daemon, wait for the socket to appear.  !!!
     # ‘nix-daemon’ should have an option to fork into the background.