aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-12-12 17:03:18 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-12-12 17:03:18 +0000
commit0008b0006db59ea8fccfe041cf8d87f05abb427d (patch)
tree70adf7ea0596a5128c7e2f50fbed2fdae5510cea /tests
parentac36c6cd44e8f46573ce3df0749d2f062fa35f3b (diff)
* Simplify deleting .lock files in /nix/store: just don't delete them
if they belong a path that's currently being built. This gets rid of some Cygwin-specific code.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/gc-concurrent.sh20
2 files changed, 19 insertions, 3 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c65f68584..ab6ac426a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -7,7 +7,7 @@ dependencies.sh gc.sh nix-push.sh nix-pull.in logging.sh nix-build.sh install-pa
locking.sh: locking.nix
parallel.sh: parallel.nix
build-hook.sh: build-hook.nix
-gc-concurrent.sh: gc-concurrent.nix gc-concurrent2.nix
+gc-concurrent.sh: gc-concurrent.nix gc-concurrent2.nix simple.nix
user-envs.sh: user-envs.nix
fixed.sh: fixed.nix
gc-runtime.sh: gc-runtime.nix
diff --git a/tests/gc-concurrent.sh b/tests/gc-concurrent.sh
index 6cf652078..fbc949720 100644
--- a/tests/gc-concurrent.sh
+++ b/tests/gc-concurrent.sh
@@ -8,8 +8,15 @@ outPath1=$($nixstore -q $drvPath1)
drvPath2=$($nixinstantiate gc-concurrent2.nix)
outPath2=$($nixstore -q $drvPath2)
-rm -f "$NIX_STATE_DIR"/gcroots/foo
+drvPath3=$($nixinstantiate simple.nix)
+outPath3=$($nixstore -r $drvPath3)
+
+! test -e $outPath3.lock
+touch $outPath3.lock
+
+rm -f "$NIX_STATE_DIR"/gcroots/foo*
ln -s $drvPath2 "$NIX_STATE_DIR"/gcroots/foo
+ln -s $outPath3 "$NIX_STATE_DIR"/gcroots/foo2
# Start build #1 in the background. It starts immediately.
$nixstore -rvv "$drvPath1" &
@@ -39,4 +46,13 @@ cat $outPath1/input-2/bar
# derivation is a GC root.
cat $outPath2/foobar
-rm "$NIX_STATE_DIR"/gcroots/foo
+rm -f "$NIX_STATE_DIR"/gcroots/foo*
+
+# The collector should have deleted lock files for paths that have
+# been built previously.
+! test -e $outPath3.lock
+
+# If we run the collector now, it should delete outPath1/2.
+$NIX_BIN_DIR/nix-collect-garbage -vvvvv
+! test -e $outPath1
+! test -e $outPath2