Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / tests / guix-build.sh
index 880a582..66bf6be 100644 (file)
@@ -1,5 +1,5 @@
 # GNU Guix --- Functional package management for GNU
-# Copyright © 2012, 2013, 2014, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2012, 2013, 2014, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 #
 # This file is part of GNU Guix.
 #
@@ -37,7 +37,7 @@ guix build hello -d |                         \
     grep -e '-hello-[0-9\.]\+\.drv$'
 
 # Passing a URI.
-GUIX_DAEMON_SOCKET="file://$NIX_STATE_DIR/daemon-socket/socket"        \
+GUIX_DAEMON_SOCKET="file://$GUIX_STATE_DIRECTORY/daemon-socket/socket" \
 guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'
 
 ( if GUIX_DAEMON_SOCKET="weird://uri"                                  \
@@ -138,6 +138,25 @@ test `guix build -d --sources=transitive foo \
       | grep -e 'foo\.tar\.gz' -e 'bar\.tar\.gz' -e 'bar\.dat' \
       | wc -l` -eq 3
 
+
+# Unbound variables.
+cat > "$module_dir/foo.scm"<<EOF
+(define-module (foo)
+  #:use-module (guix tests)
+  #:use-module (guix build-system trivial))
+
+(define-public foo
+  (dummy-package "package-with-something-wrong"
+    (build-system trivial-build-system)
+    (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 2> "$module_dir/err" || true
+grep "unbound" "$module_dir/err"                    # actual error
+grep "forget.*(gnu packages base)" "$module_dir/err" # hint
+rm -f "$module_dir"/*
+
 # Should all return valid log files.
 drv="`guix build -d -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'`"
 out="`guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'`"
@@ -184,7 +203,7 @@ test "`guix build superseded -d`" = "`guix build bar -d`"
 
 # Parsing package names and versions.
 guix build -n time             # PASS
-guix build -n time@1.7         # PASS, version found
+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
@@ -202,6 +221,10 @@ guix build -e "(begin
 guix build -e '#~(mkdir #$output)' -d
 guix build -e '#~(mkdir #$output)' -d | grep 'gexp\.drv'
 
+# Same with a file-like object.
+guix build -e '(computed-file "foo" #~(mkdir #$output))' -d
+guix build -e '(computed-file "foo" #~(mkdir #$output))' -d | grep 'foo\.drv'
+
 # Building from a package file.
 cat > "$module_dir/package.scm"<<EOF
 (use-modules (gnu))