aboutsummaryrefslogtreecommitdiff
path: root/tests/guix-hash.sh
blob: 23df01d417c7a524d70e496fa4a3c44d9c325921 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# GNU Guix --- Functional package management for GNU
# Copyright © 2013, 2014 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 hash' command-line utility.
#

guix hash --version

tmpdir="guix-hash-$$"
trap 'rm -rf "$tmpdir"' EXIT

test `guix hash /dev/null` = 0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73
test `guix hash -f nix-base32 /dev/null` = 0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73
test `guix hash -f hex /dev/null` = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
test `guix hash -f base32 /dev/null` = 4oymiquy7qobjgx36tejs35zeqt24qpemsnzgtfeswmrw6csxbkq

mkdir "$tmpdir"
echo -n executable > "$tmpdir/exe"
chmod +x "$tmpdir/exe"
( cd "$tmpdir" ; ln -s exe symlink )
mkdir "$tmpdir/subdir"

test `guix hash -r "$tmpdir"` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p

# Without '-r', this should fail.
if guix hash "$tmpdir"
then false; else true; fi

# This should fail because /dev/null is a character device, which
# the archive format doesn't support.
if guix hash -r /dev/null
then false; else true; fi
>2021-02-15gnu: knot: Update to 3.0.4....Tobias Geerinckx-Rice 2021-02-15gnu: nsd: Update to 4.3.5....Tobias Geerinckx-Rice 2021-01-28gnu: dnsmasq: Update to 2.84....Vincent Legoll 2021-01-26gnu: bind: Edit synopsis & description....Tobias Geerinckx-Rice 2021-01-21gnu: dnsmasq: Update to 2.83 [security fixes]....Pierre Langlois 2021-01-21gnu: bind: Update to 9.16.11....Tobias Geerinckx-Rice 2020-12-22gnu: yadifa: Update to 2.4.1....Tobias Geerinckx-Rice 2020-12-21gnu: unbound: Update to 1.13.0....Vincent Legoll 2020-12-17gnu: knot: Update to 3.0.3....Tobias Geerinckx-Rice 2020-12-16gnu: bind: Update to 9.16.10....Tobias Geerinckx-Rice 2020-12-11gnu: knot-resolver: Update to 5.2.1....Simon South