aboutsummaryrefslogtreecommitdiff
path: root/tests/gc.sh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-01-27 17:48:50 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-01-27 17:48:50 +0000
commite5c16c95829f4f14763ba1f66f6e26f5f1792b29 (patch)
tree801594a055a1c762a93b4b1ef3406148594b4eff /tests/gc.sh
parent8a3eef22e38136513370f0dfb3cf7866ec2abaa3 (diff)
* Add missing substitutes files to dist.
* Add a garbage collector test.
Diffstat (limited to 'tests/gc.sh')
-rw-r--r--tests/gc.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/gc.sh b/tests/gc.sh
new file mode 100644
index 000000000..9aeda43e7
--- /dev/null
+++ b/tests/gc.sh
@@ -0,0 +1,14 @@
+storeExpr=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
+outPath=$($TOP/src/nix-store/nix-store -rvv "$storeExpr")
+
+# Set a GC root.
+ln -s $outPath "$NIX_LOCALSTATE_DIR"/nix/gcroots/foo
+
+$NIX_BIN_DIR/nix-collect-garbage
+
+# Check that the root and its dependencies haven't been deleted.
+cat $outPath/foobar
+cat $outPath/input-2/bar
+
+# Check that the derivation has been GC'd.
+if cat $storeExpr > /dev/null; then false; fi