1 # GNU Guix --- Functional package management for GNU
2 # Copyright © 2013, 2015 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 # For some operations, passing extra arguments is an error.
29 for option
in "" "-C 500M" "--verify" "--optimize"
31 if guix gc
$option whatever
; then false
; else true
; fi
34 # Check the references of a .drv.
35 drv
="`guix build guile-bootstrap -d`"
36 out
="`guix build guile-bootstrap`"
37 test -f "$drv" && test -d "$out"
39 guix gc
--references "$drv" |
grep -e -bash
40 guix gc
--references "$out"
41 guix gc
--references "$out/bin/guile"
43 if guix gc
--references /dev
/null
;
44 then false
; else true
; fi
46 # Add then reclaim a .drv file.
47 drv
="`guix build idutils -d`"
50 guix gc
--list-dead |
grep "$drv"
51 guix gc
--delete "$drv"
54 # Add a .drv, register it as a root.
55 drv
="`guix build --root=guix-gc-root lsh -d`"
56 test -f "$drv" && test -L guix-gc-root
58 guix gc
--list-live |
grep "$drv"
59 if guix gc
--delete "$drv";
60 then false
; else true
; fi
63 guix gc
--list-dead |
grep "$drv"
64 guix gc
--delete "$drv"
67 # Try a random collection.
70 # Check trivial error cases.
71 if guix gc
--delete /dev
/null
;
72 then false
; else true
; fi
75 out
="`guix build guile-bootstrap`"
78 guix gc
--delete "$out"
82 out
="`guix build guile-bootstrap`"
85 guix gc
--delete "$out/"
89 out
="`guix build guile-bootstrap`"
92 guix gc
--delete "$out/bin/guile"