aboutsummaryrefslogtreecommitdiff
# GNU Guix --- Functional package management for GNU
# Copyright © 2013, 2015, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of GNU Guix.
#
# GNU Guix is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Guix is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

#
# Test the `guix gc' command-line utility.
#

guix gc --version

trap "rm -f guix-gc-root" EXIT
rm -f guix-gc-root

# Below we are using 'drv' and 'out' to contain store file names.  If 'drv'
# and 'out' are environment variables, 'list-runtime-roots' will "see" them
# and thus prevent $drv and $out from being garbage-collected.  Using 'unset'
# allows us to make sure these are truly local shell variables and not
# environments variables.
unset drv
unset out

# For some operations, passing extra arguments is an error.
for option in "" "-C 500M" "--verify" "--optimize" "--list-roots"
do
    guix gc $option whatever && false
done

# This should fail.
guix gc --verify=foo && false

# Check the references of a .drv.
drv="`guix build guile-bootstrap -d`"
out="`guix build guile-bootstrap`"
test -f "$drv" && test -d "$out"

guix gc --references "$drv" | grep -e -bash
guix gc --references "$out"
guix gc --references "$out/bin/guile"

guix gc --references /dev/null && false

# Check derivers.
guix gc --derivers "$out" | grep "$drv"

# Add then reclaim a .drv file.
drv="`guix build idutils -d`"
test -f "$drv"

guix gc --list-dead | grep "$drv"
guix gc --delete "$drv"
test ! -f "$drv"

# Add a .drv, register it as a root.
drv="`guix build --root=guix-gc-root lsh -d`"
test -f "$drv" && test -L guix-gc-root

guix gc --list-roots | grep "$PWD/guix-gc-root"

guix gc --list-live | grep "$drv"
guix gc --delete "$drv" && false

rm guix-gc-root
guix gc --list-dead | grep "$drv"
guix gc --delete "$drv"
test ! -f "$drv"

# Try a random collection.
guix gc -C 1KiB

# Check trivial error cases.
guix gc --delete /dev/null && false

# Bug #19757
out="`guix build guile-bootstrap`"
test -d "$out"

guix gc --delete "$out"

test ! -d "$out"

out="`guix build guile-bootstrap`"
test -d "$out"

guix gc --delete "$out/"

test ! -d "$out"

out="`guix build guile-bootstrap`"
test -d "$out"

guix gc --delete "$out/bin/guile"
cense....Brett Gilio 2019-12-23gnu: python-sphinxcontrib-svg2pdfconverter: Reflow description....Brett Gilio 2019-12-23gnu: python-sphinxcontrib-svg2pdfconverter: Fix home-page....Brett Gilio 2019-12-23gnu: python-sphinxcontrib-svg2pdfconverter: Update to 1.0.1....Brett Gilio 2019-12-23gnu: python-sphinxcontrib-programoutput: Fix home-page....Brett Gilio 2019-12-23gnu: python-sphinxcontrib-programoutput: Update to 0.15....Brett Gilio 2019-12-23gnu: python-sphinxcontrib-jsmath: Fix license....Brett Gilio 2019-12-23gnu: python-sphinx-copybutton: Update to 0.2.6....Brett Gilio 2019-12-23gnu: python-sphinx: Fix license....Brett Gilio 2019-12-23gnu: python-sphinx: Use HTTP URI....Brett Gilio 2019-12-23gnu: python-sphinx: Alphabetize inputs....Brett Gilio 2019-12-23gnu: python-sphinx: Update to 2.3.1....Brett Gilio 2019-12-15gnu: Add python-sphinx-intl...Alexandros Theodotou 2019-11-15Merge branch 'master' into stagingMarius Bakke 2019-11-13gnu: python-sphinx-gallery: Don't use unstable tarball....Efraim Flashner 2019-11-11gnu: Add python-breathe....宋文武 2019-10-12gnu: python-sphinx: Update to 2.2.0....Marius Bakke 2019-09-23gnu: python-sphinxcontrib-htmlhelp: Fix typo....Vagrant Cascadian 2019-09-13gnu: Add python-sphinx-copybutton....Ricardo Wurmus 2019-06-20gnu: python-sphinx: Update to 2.1.2....Marius Bakke 2019-06-20Merge branch 'master' into stagingMarius Bakke 2019-06-20gnu: Use HTTPS for sphinx-doc.org....Marius Bakke 2019-06-18gnu: python-babel: Update to 2.7.0....Marius Bakke 2019-06-14gnu: Sphinx: Update to 2.1.1....Marius Bakke 2019-05-24gnu: python-sphinx: Update to 2.0.1....Marius Bakke 2019-05-24gnu: Add python-sphinxcontrib-qthelp....Marius Bakke 2019-05-24gnu: Add python-sphinxcontrib-htmlhelp....Marius Bakke 2019-05-24gnu: Add python-sphinxcontrib-jsmath....Marius Bakke 2019-05-24gnu: Add python-sphinxcontrib-devhelp....Marius Bakke 2019-05-24gnu: Add python-sphinxcontrib-applehelp....Marius Bakke 2019-05-24gnu: Add python-sphinxcontrib-serializinghtml....Marius Bakke 2019-05-24gnu: Move Sphinx and friends to (gnu packages sphinx)....Marius Bakke