summaryrefslogtreecommitdiff
path: root/tests/guix-build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/guix-build.sh')
-rw-r--r--tests/guix-build.sh60
1 files changed, 46 insertions, 14 deletions
diff --git a/tests/guix-build.sh b/tests/guix-build.sh
index 6c08857358..4a58ea1476 100644
--- a/tests/guix-build.sh
+++ b/tests/guix-build.sh
@@ -24,8 +24,7 @@
guix build --version
# Should fail.
-if guix build -e +;
-then false; else true; fi
+! guix build -e +
# Source-less packages are accepted; they just return nothing.
guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S
@@ -178,7 +177,7 @@ cat > "$module_dir/foo.scm" <<EOF
(inputs (quasiquote (("sed" ,sed)))))) ;unbound variable
EOF
-if guix build package-with-something-wrong -n; then false; else true; fi
+! guix build package-with-something-wrong -n
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
@@ -199,6 +198,33 @@ grep "forget.*(guix build-system gnu)" "$module_dir/err" # hint
rm -f "$module_dir"/*
+# Unbound variable: don't suggest modules that do not export the variable.
+cat > "$module_dir/aa-private.scm" <<EOF
+(define-module (aa-private))
+(define make-thing #f)
+(set! make-thing make-thing) ;don't inline
+EOF
+
+cat > "$module_dir/bb-public.scm" <<EOF
+(define-module (bb-public) #:export (make-thing))
+(define make-thing identity)
+EOF
+
+cat > "$module_dir/cc-user.scm" <<EOF
+;; Make those module available in the global name space.
+(load-from-path "aa-private.scm")
+(load-from-path "bb-public.scm")
+
+(define-module (cc-user))
+(make-thing 42)
+EOF
+! guix build -f "$module_dir/cc-user.scm" -n 2> "$module_dir/err"
+cat "$module_dir/err"
+grep "make-thing.*unbound" "$module_dir/err" # actual error
+grep "forget.*(bb-public)" "$module_dir/err" # hint
+
+rm -f "$module_dir"/*
+
# Wrong 'define-module' clause reported by 'warn-about-load-error'.
cat > "$module_dir/foo.scm" <<EOF
(define-module (something foo)
@@ -222,7 +248,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.
-if guix build hello-0.0.1 -n; then false; else true; fi
+! guix build hello-0.0.1 -n
# Keep a symlink to the result, registered as a root.
result="t-result-$$"
@@ -231,8 +257,7 @@ guix build -r "$result" \
test -x "$result/bin/guile"
# Should fail, because $result already exists.
-if guix build -r "$result" -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'
-then false; else true; fi
+! guix build -r "$result" -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'
rm -f "$result"
@@ -259,8 +284,18 @@ drv1=`guix build guile -d`
drv2=`guix build guile --with-input=gimp=ruby -d`
test "$drv1" = "$drv2"
-if guix build guile --with-input=libunistring=something-really-silly
-then false; else true; fi
+# See <https://bugs.gnu.org/42156>.
+drv1=`guix build glib -d`
+drv2=`guix build glib -d --with-input=libreoffice=inkscape`
+test "$drv1" = "$drv2"
+
+# Rewriting implicit inputs.
+drv1=`guix build hello -d`
+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
# Deprecated/superseded packages.
test "`guix build superseded -d`" = "`guix build bar -d`"
@@ -268,10 +303,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
-if guix build -n time@3.2; # FAIL, version not found
-then false; else true; fi
-if guix build -n something-that-will-never-exist; # FAIL
-then false; else true; fi
+! guix build -n time@3.2 # FAIL, version not found
+! guix build -n something-that-will-never-exist # FAIL
# Invoking a monadic procedure.
guix build -e "(begin
@@ -343,5 +376,4 @@ export GUIX_BUILD_OPTIONS
guix build emacs
GUIX_BUILD_OPTIONS="--something-completely-crazy"
-if guix build emacs;
-then false; else true; fi
+! guix build emacs