diff options
| author | Eric Bavier <bavier@posteo.net> | 2023-04-20 00:11:27 -0500 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2023-04-21 16:16:38 +0200 |
| commit | 37dd69b44511dc73eb04bdebe8d82c9a0386338e (patch) | |
| tree | d20ecc2b15659ed2345f00beb39170a5365a7051 /tests/guix-hash.sh | |
| parent | a09c7da8f8d8e732f969cf0a09aaa78f87032ab1 (diff) | |
tests: Fix checks for expected failures.
Addresses <https://issues.guix.gnu.org/62406>.
With 'set -e', a return status inverted with '!' does not cause the shell to
exit immediately. Instead use '&& false' to indicate an expected failure.
* tests/guix-archive.sh, tests/guix-build-branch.sh, tests/guix-build.sh,
tests/guix-daemon.sh, tests/guix-download.sh,
tests/guix-environment-container.sh, tests/guix-environment.sh,
tests/guix-gc.sh, tests/guix-git-authenticate.sh, tests/guix-graph.sh,
tests/guix-hash.sh, tests/guix-home.sh, tests/guix-pack-relocatable.sh,
tests/guix-pack.sh, tests/guix-package-aliases.sh, tests/guix-package-net.sh,
tests/guix-package.sh, tests/guix-refresh.sh, tests/guix-shell.sh,
tests/guix-style.sh, tests/guix-system.sh: Replace uses of '! ...' with
'... && false' or `test ! ...` as appropriate.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'tests/guix-hash.sh')
| -rw-r--r-- | tests/guix-hash.sh | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/guix-hash.sh b/tests/guix-hash.sh index 8b03c7985da..e260396fd81 100644 --- a/tests/guix-hash.sh +++ b/tests/guix-hash.sh | |||
| @@ -38,12 +38,12 @@ test `guix hash -H sha1 -f base64 /dev/null` = "2jmj7l5rSw0yVb/vlWAYkK/YBwk=" | |||
| 38 | test "`guix hash /dev/null "$abs_top_srcdir/README"`" = "`guix hash /dev/null ; guix hash "$abs_top_srcdir/README"`" | 38 | test "`guix hash /dev/null "$abs_top_srcdir/README"`" = "`guix hash /dev/null ; guix hash "$abs_top_srcdir/README"`" |
| 39 | 39 | ||
| 40 | # Zero files. | 40 | # Zero files. |
| 41 | ! guix hash | 41 | guix hash && false |
| 42 | 42 | ||
| 43 | # idem as `cat /dev/null | git hash-object --stdin` | 43 | # idem as `cat /dev/null | git hash-object --stdin` |
| 44 | test `guix hash -S git -H sha1 -f hex /dev/null` = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 | 44 | test `guix hash -S git -H sha1 -f hex /dev/null` = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 |
| 45 | 45 | ||
| 46 | ! guix hash -H abcd1234 /dev/null | 46 | guix hash -H abcd1234 /dev/null && false |
| 47 | 47 | ||
| 48 | mkdir "$tmpdir" | 48 | mkdir "$tmpdir" |
| 49 | echo -n executable > "$tmpdir/exe" | 49 | echo -n executable > "$tmpdir/exe" |
| @@ -61,11 +61,11 @@ test `guix hash -r "$tmpdir" 2>/dev/null` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslin | |||
| 61 | test `guix hash -r "$tmpdir" -H sha512 2>/dev/null` = 301ra58c2vahczzxiyfin41mpyb0ljh4dh9zn3ijvwviaw1j40sfzw5skh9x945da88n3785ggifzig7acd6k72h0mpsc20m1f66m9n | 61 | test `guix hash -r "$tmpdir" -H sha512 2>/dev/null` = 301ra58c2vahczzxiyfin41mpyb0ljh4dh9zn3ijvwviaw1j40sfzw5skh9x945da88n3785ggifzig7acd6k72h0mpsc20m1f66m9n |
| 62 | 62 | ||
| 63 | # Without '-r', this should fail. | 63 | # Without '-r', this should fail. |
| 64 | ! guix hash "$tmpdir" | 64 | guix hash "$tmpdir" && false |
| 65 | 65 | ||
| 66 | # This should fail because /dev/null is a character device, which | 66 | # This should fail because /dev/null is a character device, which |
| 67 | # the archive format doesn't support. | 67 | # the archive format doesn't support. |
| 68 | ! guix hash -S nar /dev/null | 68 | guix hash -S nar /dev/null && false |
| 69 | 69 | ||
| 70 | # Adding a .git directory | 70 | # Adding a .git directory |
| 71 | mkdir "$tmpdir/.git" | 71 | mkdir "$tmpdir/.git" |
| @@ -80,5 +80,6 @@ test `guix hash -S nar $tmpdir -x` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppi | |||
| 80 | test `guix hash -S git $tmpdir -x` = 1m9yxz99g7askm88h6hzyv4g2bfv57rp5wvwp3iq5ypsplq1xkkk | 80 | test `guix hash -S git $tmpdir -x` = 1m9yxz99g7askm88h6hzyv4g2bfv57rp5wvwp3iq5ypsplq1xkkk |
| 81 | 81 | ||
| 82 | # Without '-r', this should fail. | 82 | # Without '-r', this should fail. |
| 83 | ! guix hash "$tmpdir" | 83 | guix hash "$tmpdir" && false |
| 84 | 84 | ||
| 85 | exit 0 | ||
