aboutsummaryrefslogtreecommitdiff
path: root/tests/gc.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/gc.sh')
-rw-r--r--tests/gc.sh16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/gc.sh b/tests/gc.sh
index cf0e2c32d..ad09a8b39 100644
--- a/tests/gc.sh
+++ b/tests/gc.sh
@@ -1,5 +1,7 @@
source common.sh
+clearStore
+
drvPath=$(nix-instantiate dependencies.nix)
outPath=$(nix-store -rvv "$drvPath")
@@ -16,18 +18,24 @@ if nix-store --gc --print-dead | grep -E $outPath$; then false; fi
nix-store --gc --print-dead
-inUse=$(readLink $outPath/input-2)
+inUse=$(readLink $outPath/reference-to-input-2)
if nix-store --delete $inUse; then false; fi
test -e $inUse
if nix-store --delete $outPath; then false; fi
test -e $outPath
+for i in $NIX_STORE_DIR/*; do
+ if [[ $i =~ /trash ]]; then continue; fi # compat with old daemon
+ touch $i.lock
+ touch $i.chroot
+done
+
nix-collect-garbage
# Check that the root and its dependencies haven't been deleted.
cat $outPath/foobar
-cat $outPath/input-2/bar
+cat $outPath/reference-to-input-2/bar
# Check that the derivation has been GC'd.
if test -e $drvPath; then false; fi
@@ -38,3 +46,7 @@ nix-collect-garbage
# Check that the output has been GC'd.
if test -e $outPath/foobar; then false; fi
+
+# Check that the store is empty.
+rmdir $NIX_STORE_DIR/.links
+rmdir $NIX_STORE_DIR