Update license headers.
[jackhill/guix/guix.git] / tests / guix-gc.sh
CommitLineData
233e7676
LC
1# GNU Guix --- Functional package management for GNU
2# Copyright © 2013 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#
20# Test the `guix-gc' command-line utility.
21#
22
23guix-gc --version
24
25trap "rm -f guix-gc-root" EXIT
26rm -f guix-gc-root
27
28# Add then reclaim a .drv file.
29drv="`guix-build idutils -d`"
30test -f "$drv"
31
32guix-gc --list-dead | grep "$drv"
33guix-gc --delete "$drv"
34! test -f "$drv"
35
36# Add a .drv, register it as a root.
37drv="`guix-build --root=guix-gc-root lsh -d`"
38test -f "$drv" && test -L guix-gc-root
39
40guix-gc --list-live | grep "$drv"
41if guix-gc --delete "$drv";
42then false; else true; fi
43
44rm guix-gc-root
45guix-gc --list-dead | grep "$drv"
46guix-gc --delete "$drv"
47! test -f "$drv"
48
49# Try a random collection.
50guix-gc -C 1KiB
51
52# Check trivial error cases.
53if guix-gc --delete /dev/null;
54then false; else true; fi