about summary refs log tree commit diff
path: root/tests/gc-concurrent.sh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-01-28T20·36+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-01-28T20·36+0000
commita7668411a10c79ad40c9c18caf2570d5c9f52182 (patch)
treeeb4ea7eda7ac760e4933aba439bebb08b9ba2a71 /tests/gc-concurrent.sh
parent22cfdfa2460921a282fc924cce5fb26378b9fc9d (diff)
* Add a test to check whether concurrent garbage collection (i.e.,
  running the collector while builds are in progress) works
  correctly.  The test currently fails.

Diffstat (limited to 'tests/gc-concurrent.sh')
-rw-r--r--tests/gc-concurrent.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/gc-concurrent.sh b/tests/gc-concurrent.sh
new file mode 100644
index 000000000000..d85c609825ee
--- /dev/null
+++ b/tests/gc-concurrent.sh
@@ -0,0 +1,19 @@
+storeExpr=$($TOP/src/nix-instantiate/nix-instantiate gc-concurrent.nix)
+outPath=$($TOP/src/nix-store/nix-store -q $storeExpr)
+
+
+# Start a build in the background.
+$TOP/src/nix-store/nix-store -rvv "$storeExpr" &
+pid=$!
+
+# Run the garbage collector while the build is running.
+sleep 2
+$NIX_BIN_DIR/nix-collect-garbage
+
+# Wait for the build to finish.
+echo waiting for pid $pid to finish...
+wait $pid
+
+# Check that the root and its dependencies haven't been deleted.
+cat $outPath/foobar
+cat $outPath/input-2/bar