diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2014-02-21 17:54:32 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2014-02-21 23:49:52 +0100 |
| commit | 3140f2df423d1235c3766e3478a429ac89d882ed (patch) | |
| tree | a250657c8c3682f5be9f40493d328f9c9ab83f20 /tests/guix-hash.sh | |
| parent | c1d52c71aa4fc8085a9737ad1b235ca53a854649 (diff) | |
guix hash: Add '--recursive'.
* guix/scripts/hash.scm (show-help): Add --recursive.
(%options): Likewise.
(guix-hash)[file-hash]: New procedure. Honor --recursive.
Use it.
* guix/nar.scm (write-file): Add missing field to the &nar-error
condition raised upon unsupported file type; change its message to be
more descriptive.
* tests/guix-hash.sh: Add tests with -r.
* doc/guix.texi (Invoking guix hash): Document --recursive.
Diffstat (limited to 'tests/guix-hash.sh')
| -rw-r--r-- | tests/guix-hash.sh | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/guix-hash.sh b/tests/guix-hash.sh index 53325ce1f45..23df01d417c 100644 --- a/tests/guix-hash.sh +++ b/tests/guix-hash.sh | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | # GNU Guix --- Functional package management for GNU | 1 | # GNU Guix --- Functional package management for GNU |
| 2 | # Copyright © 2013 Ludovic Courtès <ludo@gnu.org> | 2 | # Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org> |
| 3 | # | 3 | # |
| 4 | # This file is part of GNU Guix. | 4 | # This file is part of GNU Guix. |
| 5 | # | 5 | # |
| @@ -22,7 +22,27 @@ | |||
| 22 | 22 | ||
| 23 | guix hash --version | 23 | guix hash --version |
| 24 | 24 | ||
| 25 | tmpdir="guix-hash-$$" | ||
| 26 | trap 'rm -rf "$tmpdir"' EXIT | ||
| 27 | |||
| 25 | test `guix hash /dev/null` = 0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73 | 28 | test `guix hash /dev/null` = 0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73 |
| 26 | test `guix hash -f nix-base32 /dev/null` = 0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73 | 29 | test `guix hash -f nix-base32 /dev/null` = 0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73 |
| 27 | test `guix hash -f hex /dev/null` = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 | 30 | test `guix hash -f hex /dev/null` = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 |
| 28 | test `guix hash -f base32 /dev/null` = 4oymiquy7qobjgx36tejs35zeqt24qpemsnzgtfeswmrw6csxbkq | 31 | test `guix hash -f base32 /dev/null` = 4oymiquy7qobjgx36tejs35zeqt24qpemsnzgtfeswmrw6csxbkq |
| 32 | |||
| 33 | mkdir "$tmpdir" | ||
| 34 | echo -n executable > "$tmpdir/exe" | ||
| 35 | chmod +x "$tmpdir/exe" | ||
| 36 | ( cd "$tmpdir" ; ln -s exe symlink ) | ||
| 37 | mkdir "$tmpdir/subdir" | ||
| 38 | |||
| 39 | test `guix hash -r "$tmpdir"` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p | ||
| 40 | |||
| 41 | # Without '-r', this should fail. | ||
| 42 | if guix hash "$tmpdir" | ||
| 43 | then false; else true; fi | ||
| 44 | |||
| 45 | # This should fail because /dev/null is a character device, which | ||
| 46 | # the archive format doesn't support. | ||
| 47 | if guix hash -r /dev/null | ||
| 48 | then false; else true; fi | ||
