2005-02-01 00:01:55 +02:00
|
|
|
storeExpr1=$($TOP/src/nix-instantiate/nix-instantiate gc-concurrent.nix)
|
|
|
|
outPath1=$($TOP/src/nix-store/nix-store -q $storeExpr1)
|
|
|
|
|
|
|
|
storeExpr2=$($TOP/src/nix-instantiate/nix-instantiate gc-concurrent2.nix)
|
|
|
|
outPath2=$($TOP/src/nix-store/nix-store -q $storeExpr2)
|
2005-01-28 22:36:46 +02:00
|
|
|
|
2005-02-01 19:50:48 +02:00
|
|
|
ln -s $storeExpr2 "$NIX_STATE_DIR"/gcroots/foo2
|
2005-02-01 00:23:49 +02:00
|
|
|
|
2005-02-01 00:01:55 +02:00
|
|
|
# Start build #1 in the background. It starts immediately.
|
|
|
|
$TOP/src/nix-store/nix-store -rvv "$storeExpr1" &
|
|
|
|
pid1=$!
|
2005-01-28 22:36:46 +02:00
|
|
|
|
2005-02-01 00:01:55 +02:00
|
|
|
# Start build #2 in the background after 3 seconds.
|
|
|
|
(sleep 3 && $TOP/src/nix-store/nix-store -rvv "$storeExpr2") &
|
|
|
|
pid2=$!
|
2005-01-28 22:36:46 +02:00
|
|
|
|
2005-02-01 00:01:55 +02:00
|
|
|
# Run the garbage collector while the build is running. Note: the GC
|
|
|
|
# sleeps for *another* 2 seconds after acquiring the GC lock. This
|
|
|
|
# checks whether build #1
|
2005-01-28 22:36:46 +02:00
|
|
|
sleep 2
|
2005-02-01 00:01:55 +02:00
|
|
|
NIX_DEBUG_GC_WAIT=1 $NIX_BIN_DIR/nix-collect-garbage -vvvvv
|
|
|
|
|
|
|
|
# Wait for build #1/#2 to finish.
|
|
|
|
echo waiting for pid $pid1 to finish...
|
|
|
|
wait $pid1
|
|
|
|
echo waiting for pid $pid2 to finish...
|
|
|
|
wait $pid2
|
2005-01-28 22:36:46 +02:00
|
|
|
|
2005-02-01 00:01:55 +02:00
|
|
|
# Check that the root of build #1 and its dependencies haven't been
|
|
|
|
# deleted.
|
|
|
|
cat $outPath1/foobar
|
|
|
|
cat $outPath1/input-2/bar
|
2005-01-28 22:36:46 +02:00
|
|
|
|
2005-02-01 00:23:49 +02:00
|
|
|
# Build #2 should have failed because its derivation got garbage collected.
|
2005-02-01 00:01:55 +02:00
|
|
|
cat $outPath2/foobar
|