check-available-binaries: Use 'substitutable-paths'.
[guix.git] / tests / guix-gc.sh
blobc1eb66cef53b3e435e9ade4320e3a69a4b6d0061
1 # GNU Guix --- Functional package management for GNU
2 # Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
4 # This file is part of GNU Guix.
6 # GNU Guix is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or (at
9 # your option) any later version.
11 # GNU Guix is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 # Test the `guix gc' command-line utility.
23 guix gc --version
25 trap "rm -f guix-gc-root" EXIT
26 rm -f guix-gc-root
28 # Check the references of a .drv.
29 drv="`guix build guile-bootstrap -d`"
30 out="`guix build guile-bootstrap`"
31 test -f "$drv" && test -d "$out"
33 guix gc --references "$drv" | grep -e -bash
34 guix gc --references "$out"
35 guix gc --references "$out/bin/guile"
37 if guix gc --references /dev/null;
38 then false; else true; fi
40 # Add then reclaim a .drv file.
41 drv="`guix build idutils -d`"
42 test -f "$drv"
44 guix gc --list-dead | grep "$drv"
45 guix gc --delete "$drv"
46 ! test -f "$drv"
48 # Add a .drv, register it as a root.
49 drv="`guix build --root=guix-gc-root lsh -d`"
50 test -f "$drv" && test -L guix-gc-root
52 guix gc --list-live | grep "$drv"
53 if guix gc --delete "$drv";
54 then false; else true; fi
56 rm guix-gc-root
57 guix gc --list-dead | grep "$drv"
58 guix gc --delete "$drv"
59 ! test -f "$drv"
61 # Try a random collection.
62 guix gc -C 1KiB
64 # Check trivial error cases.
65 if guix gc --delete /dev/null;
66 then false; else true; fi
68 # Bug #19757
69 out="`guix build guile-bootstrap`"
70 test -d "$out"
72 guix gc --delete "$out"
74 ! test -d "$out"
76 out="`guix build guile-bootstrap`"
77 test -d "$out"
79 guix gc --delete "$out/"
81 ! test -d "$out"
83 out="`guix build guile-bootstrap`"
84 test -d "$out"
86 guix gc --delete "$out/bin/guile"