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.
25 trap "rm -f guix-gc-root" EXIT
28 # Add then reclaim a .drv file.
29 drv
="`guix build idutils -d`"
32 guix gc
--list-dead |
grep "$drv"
33 guix gc
--delete "$drv"
36 # Add a .drv, register it as a root.
37 drv
="`guix build --root=guix-gc-root lsh -d`"
38 test -f "$drv" && test -L guix-gc-root
40 guix gc
--list-live |
grep "$drv"
41 if guix gc
--delete "$drv";
42 then false
; else true
; fi
45 guix gc
--list-dead |
grep "$drv"
46 guix gc
--delete "$drv"
49 # Try a random collection.
52 # Check trivial error cases.
53 if guix gc
--delete /dev
/null
;
54 then false
; else true
; fi