Skip to content

Commit

Permalink
Expand on the closure GC test
Browse files Browse the repository at this point in the history
Currently failing
  • Loading branch information
Théophane Hufschmitt committed Feb 29, 2024
1 parent 275f654 commit a3b08e1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/functional/build-delete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,18 @@ if isDaemonNewer "2.12pre0"; then
fi

nix_store_delete_best_effort() {
clearStore
nix build -f multiple-outputs.nix a --out-link $TEST_ROOT/a
a_second=$(realpath $TEST_ROOT/a-second)
a_first=$(realpath $TEST_ROOT/a-first)
rm $TEST_ROOT/a-second
p=$(nix build -f multiple-outputs.nix use-a --no-link --print-out-paths)

# Check that nix store delete --recursive is best-effort (doesn't fail when some paths in the closure are alive)
nix store delete --recursive "$p"
! stat "$p"
[[ -e "$a_first" ]] || fail "a.first is a gc root, shouldn't have been deleted"
expect 1 [[ -e "$a_second" ]] || fail "a.second is not a gc root and is part of use-a's closure, it should have been deleted"
expect 1 [[ -e "$p" ]] || fail "use-a should have been deleted"
}

nix_store_delete_best_effort

0 comments on commit a3b08e1

Please sign in to comment.