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-build.sh | |
parent | a09c7da8f8d8e732f969cf0a09aaa78f87032ab1 (diff) | |
download | guix-37dd69b44511dc73eb04bdebe8d82c9a0386338e.tar guix-37dd69b44511dc73eb04bdebe8d82c9a0386338e.tar.gz |
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-build.sh')
-rw-r--r-- | tests/guix-build.sh | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/guix-build.sh b/tests/guix-build.sh index 9cbf8fe26d..2c59177c86 100644 --- a/tests/guix-build.sh +++ b/tests/guix-build.sh @@ -25,7 +25,7 @@ guix build --version # Should fail. -! guix build -e + +guix build -e + && false # Source-less packages are accepted; they just return nothing. guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S @@ -92,7 +92,7 @@ cat > "$module_dir/foo.scm" <<EOF (use-modules (guix)) ) ;extra closing paren EOF -! guix build -f "$module_dir/foo.scm" 2> "$module_dir/stderr" +guix build -f "$module_dir/foo.scm" 2> "$module_dir/stderr" && false grep "read error" "$module_dir/stderr" rm "$module_dir/stderr" "$module_dir/foo.scm" @@ -199,7 +199,7 @@ cat > "$module_dir/foo.scm" <<EOF (inputs (quasiquote (("sed" ,sed)))))) ;unbound variable EOF -! guix build package-with-something-wrong -n +guix build package-with-something-wrong -n && false guix build package-with-something-wrong -n 2> "$module_dir/err" || true grep "unbound" "$module_dir/err" # actual error grep "forget.*(gnu packages base)" "$module_dir/err" # hint @@ -240,7 +240,7 @@ cat > "$module_dir/cc-user.scm" <<EOF (define-module (cc-user)) (make-thing 42) EOF -! guix build -f "$module_dir/cc-user.scm" -n 2> "$module_dir/err" +guix build -f "$module_dir/cc-user.scm" -n 2> "$module_dir/err" && false cat "$module_dir/err" grep "make-thing.*unbound" "$module_dir/err" # actual error grep "forget.*(bb-public)" "$module_dir/err" # hint @@ -270,7 +270,7 @@ test "`guix build --log-file guile-bootstrap`" = "$log" test "`guix build --log-file $out`" = "$log" # Should fail because the name/version combination could not be found. -! guix build hello-0.0.1 -n +guix build hello-0.0.1 -n && false # Keep a symlink to the result, registered as a root. result="t-result-$$" @@ -279,7 +279,7 @@ guix build -r "$result" \ test -x "$result/bin/guile" # Should fail, because $result already exists. -! guix build -r "$result" -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' +guix build -r "$result" -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' && false rm -f "$result" @@ -323,7 +323,7 @@ drv2=`guix build hello -d --with-input=gcc=gcc-toolchain` test "$drv1" != "$drv2" guix gc -R "$drv2" | grep `guix build -d gcc-toolchain` -! guix build guile --with-input=libunistring=something-really-silly +guix build guile --with-input=libunistring=something-really-silly && false # Deprecated/superseded packages. test "`guix build superseded -d`" = "`guix build bar -d`" @@ -331,8 +331,8 @@ test "`guix build superseded -d`" = "`guix build bar -d`" # Parsing package names and versions. guix build -n time # PASS guix build -n time@1.9 # PASS, version found -! guix build -n time@3.2 # FAIL, version not found -! guix build -n something-that-will-never-exist # FAIL +guix build -n time@3.2 && false # FAIL, version not found +guix build -n something-that-will-never-exist && false # FAIL # Invoking a monadic procedure. guix build -e "(begin @@ -404,4 +404,6 @@ export GUIX_BUILD_OPTIONS guix build emacs GUIX_BUILD_OPTIONS="--something-completely-crazy" -! guix build emacs +guix build emacs && false + +exit 0 |