summary refs log tree commit diff
path: root/tests/gc-concurrent.sh
blob: c41475fb6ebd9cefc8d8fed4cde1fae27388637e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
storeExpr=$($TOP/src/nix-instantiate/nix-instantiate gc-concurrent.nix)
outPath=$($TOP/src/nix-store/nix-store -q $storeExpr)

ls -l test-tmp/state/temproots


# 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 -vvvvv

# 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