Commit | Line | Data |
---|---|---|
233e7676 | 1 | # GNU Guix --- Functional package management for GNU |
3a96d7c3 | 2 | # Copyright © 2013, 2015 Ludovic Courtès <ludo@gnu.org> |
fe8ff028 | 3 | # |
233e7676 | 4 | # This file is part of GNU Guix. |
fe8ff028 | 5 | # |
233e7676 | 6 | # GNU Guix is free software; you can redistribute it and/or modify it |
fe8ff028 LC |
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. | |
10 | # | |
233e7676 | 11 | # GNU Guix is distributed in the hope that it will be useful, but |
fe8ff028 LC |
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. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public License | |
233e7676 | 17 | # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
fe8ff028 LC |
18 | |
19 | # | |
e49951eb | 20 | # Test the `guix gc' command-line utility. |
fe8ff028 LC |
21 | # |
22 | ||
e49951eb | 23 | guix gc --version |
fe8ff028 LC |
24 | |
25 | trap "rm -f guix-gc-root" EXIT | |
26 | rm -f guix-gc-root | |
27 | ||
3a96d7c3 LC |
28 | # For some operations, passing extra arguments is an error. |
29 | for option in "" "-C 500M" "--verify" "--optimize" | |
30 | do | |
31 | if guix gc $option whatever; then false; else true; fi | |
32 | done | |
33 | ||
ba8b732d LC |
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" | |
38 | ||
39 | guix gc --references "$drv" | grep -e -bash | |
40 | guix gc --references "$out" | |
41 | guix gc --references "$out/bin/guile" | |
42 | ||
43 | if guix gc --references /dev/null; | |
44 | then false; else true; fi | |
45 | ||
fe8ff028 | 46 | # Add then reclaim a .drv file. |
e49951eb | 47 | drv="`guix build idutils -d`" |
fe8ff028 LC |
48 | test -f "$drv" |
49 | ||
e49951eb MW |
50 | guix gc --list-dead | grep "$drv" |
51 | guix gc --delete "$drv" | |
fe8ff028 LC |
52 | ! test -f "$drv" |
53 | ||
54 | # Add a .drv, register it as a root. | |
e49951eb | 55 | drv="`guix build --root=guix-gc-root lsh -d`" |
fe8ff028 LC |
56 | test -f "$drv" && test -L guix-gc-root |
57 | ||
e49951eb MW |
58 | guix gc --list-live | grep "$drv" |
59 | if guix gc --delete "$drv"; | |
fe8ff028 LC |
60 | then false; else true; fi |
61 | ||
62 | rm guix-gc-root | |
e49951eb MW |
63 | guix gc --list-dead | grep "$drv" |
64 | guix gc --delete "$drv" | |
fe8ff028 LC |
65 | ! test -f "$drv" |
66 | ||
67 | # Try a random collection. | |
e49951eb | 68 | guix gc -C 1KiB |
fe8ff028 LC |
69 | |
70 | # Check trivial error cases. | |
e49951eb | 71 | if guix gc --delete /dev/null; |
fe8ff028 | 72 | then false; else true; fi |
cdb5b075 CS |
73 | |
74 | # Bug #19757 | |
75 | out="`guix build guile-bootstrap`" | |
76 | test -d "$out" | |
77 | ||
78 | guix gc --delete "$out" | |
79 | ||
80 | ! test -d "$out" | |
81 | ||
82 | out="`guix build guile-bootstrap`" | |
83 | test -d "$out" | |
84 | ||
85 | guix gc --delete "$out/" | |
86 | ||
87 | ! test -d "$out" | |
88 | ||
89 | out="`guix build guile-bootstrap`" | |
90 | test -d "$out" | |
91 | ||
92 | guix gc --delete "$out/bin/guile" |