summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/build-utils.scm25
-rw-r--r--tests/gexp.scm8
-rw-r--r--tests/guix-build.sh13
-rw-r--r--tests/guix-environment.sh23
-rw-r--r--tests/guix-pack.sh15
-rw-r--r--tests/guix-package.sh17
-rw-r--r--tests/lzlib.scm2
-rw-r--r--tests/profiles.scm5
-rw-r--r--tests/publish.scm1
-rw-r--r--tests/substitute.scm6
10 files changed, 95 insertions, 20 deletions
diff --git a/tests/build-utils.scm b/tests/build-utils.scm
index 61e6c44e63..47a57a984b 100644
--- a/tests/build-utils.scm
+++ b/tests/build-utils.scm
@@ -151,11 +151,12 @@ echo hello world"))
   (test-equal "wrap-script, simple case"
     (string-append
      (format #f "\
-#!GUILE --no-auto-compile
+#!~a --no-auto-compile
 #!#; Guix wrapper
 #\\-~s
 #\\-~s
 "
+             (which "guile")
              '(begin (let ((current (getenv "GUIX_FOO")))
                        (setenv "GUIX_FOO"
                                (if current
@@ -175,11 +176,9 @@ echo hello world"))
            (lambda (port)
              (format port script-contents)))
          (chmod script-file-name #o777)
-
-         (mock ((guix build utils) which (const "GUILE"))
-               (wrap-script script-file-name
-                            `("GUIX_FOO" prefix ("/some/path"
-                                                 "/some/other/path"))))
+         (wrap-script script-file-name
+                      `("GUIX_FOO" prefix ("/some/path"
+                                           "/some/other/path")))
          (let ((str (call-with-input-file script-file-name get-string-all)))
            (with-directory-excursion directory
              (delete-file "foo"))
@@ -235,13 +234,11 @@ print('hello world')"))
          (lambda (port)
            (format port "This is not a script")))
        (chmod script-file-name #o777)
-       (catch 'srfi-34
-         (lambda ()
-           (wrap-script script-file-name
-                        #:guile "MYGUILE"
-                        `("GUIX_FOO" prefix ("/some/path"
-                                             "/some/other/path"))))
-         (lambda (type obj)
-           (wrap-error? obj)))))))
+       (guard (c ((wrap-error? c) #t))
+         (wrap-script script-file-name
+                      #:guile "MYGUILE"
+                      `("GUIX_FOO" prefix ("/some/path"
+                                           "/some/other/path")))
+         #f)))))
 
 (test-end)
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 50d0948659..84c16422c2 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -170,6 +170,14 @@
         (let ((file (local-file "../guix/base32.scm")))
           (local-file-absolute-file-name file)))))
 
+(test-equal "local-file, non-literal relative file name"
+  (canonicalize-path (search-path %load-path "guix/base32.scm"))
+  (let ((directory (dirname (search-path %load-path
+                                         "guix/build-system/gnu.scm"))))
+    (with-directory-excursion directory
+      (let ((file (local-file (string-copy "../base32.scm"))))
+        (local-file-absolute-file-name file)))))
+
 (test-assertm "local-file, #:select?"
   (mlet* %store-monad ((select? -> (lambda (file stat)
                                      (member (basename file)
diff --git a/tests/guix-build.sh b/tests/guix-build.sh
index 52feda9d3a..21b6af4395 100644
--- a/tests/guix-build.sh
+++ b/tests/guix-build.sh
@@ -36,6 +36,19 @@ guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' |	\
 guix build hello -d |				\
     grep -e '-hello-[0-9\.]\+\.drv$'
 
+# Passing a .drv.
+drv="`guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' -d`"
+out="`guix build "$drv"`"
+out2="`guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'`"
+test "$out" = "$out2"
+
+# Passing the name of a .drv that doesn't exist.  The daemon should try to
+# substitute the .drv.  Here we just look for the "cannot build missing
+# derivation" error that indicates that the daemon did try to substitute the
+# .drv.
+guix build "$NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo.drv" 2>&1 \
+    | grep "missing derivation"
+
 # Passing a URI.
 GUIX_DAEMON_SOCKET="file://$GUIX_STATE_DIRECTORY/daemon-socket/socket"	\
 guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'
diff --git a/tests/guix-environment.sh b/tests/guix-environment.sh
index fb1c1a022d..2faf38df06 100644
--- a/tests/guix-environment.sh
+++ b/tests/guix-environment.sh
@@ -84,6 +84,29 @@ echo "(use-modules (guix profiles) (gnu packages bootstrap))
 guix environment --bootstrap --manifest=$tmpdir/manifest.scm --pure \
      -- "$SHELL" -c 'test -f "$GUIX_ENVIRONMENT/bin/guile"'
 
+# Make sure '--manifest' can be specified multiple times.
+cat > "$tmpdir/manifest2.scm" <<EOF
+(use-modules (guix) (guix profiles)
+             (guix build-system trivial)
+             (gnu packages bootstrap))
+
+(packages->manifest
+ (list (package
+         (inherit %bootstrap-guile)
+         (name "eliug")
+         (build-system trivial-build-system)
+         (arguments
+          (quasiquote
+           (#:guile ,%bootstrap-guile
+            #:builder
+            (begin
+              (mkdir %output)
+              (mkdir (string-append %output "/eliug")))))))))
+EOF
+guix environment --bootstrap -m "$tmpdir/manifest.scm" \
+     -m "$tmpdir/manifest2.scm" --pure \
+     -- "$SHELL" -c 'test -f "$GUIX_ENVIRONMENT/bin/guile" && test -d "$GUIX_ENVIRONMENT/eliug"'
+
 # Make sure '-r' works as expected.
 rm -f "$gcroot"
 expected="`guix environment --bootstrap --ad-hoc guile-bootstrap \
diff --git a/tests/guix-pack.sh b/tests/guix-pack.sh
index 0feae6d1e8..7a0f3400c3 100644
--- a/tests/guix-pack.sh
+++ b/tests/guix-pack.sh
@@ -36,6 +36,10 @@ export GUIX_BUILD_OPTIONS
 test_directory="`mktemp -d`"
 trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT
 
+# Compute the derivation of a pack.
+drv="`guix pack coreutils -d --no-grafts`"
+guix gc -R "$drv" | grep "`guix build coreutils -d --no-grafts`"
+
 # Build a tarball with no compression.
 guix pack --compression=none --bootstrap guile-bootstrap
 
@@ -105,3 +109,14 @@ drv1="`guix pack -n guile 2>&1 | grep pack.*\.drv`"
 drv2="`guix pack -n --with-source=guile=$test_directory guile 2>&1 | grep pack.*\.drv`"
 test -n "$drv1"
 test "$drv1" != "$drv2"
+
+# Try '--manifest' options.
+cat > "$test_directory/manifest1.scm" <<EOF
+(specifications->manifest '("guile"))
+EOF
+cat > "$test_directory/manifest2.scm" <<EOF
+(specifications->manifest '("emacs"))
+EOF
+drv="`guix pack -nd -m "$test_directory/manifest1.scm" -m "$test_directory/manifest2.scm"`"
+guix gc -R "$drv" | grep `guix build guile -nd`
+guix gc -R "$drv" | grep `guix build emacs -nd`
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index 7ad0699380..f9fb31033e 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -394,6 +394,19 @@ guix package -I | grep guile
 test `guix package -I | wc -l` -eq 1
 guix package --rollback --bootstrap
 
+# Applying two manifests.
+cat > "$module_dir/manifest2.scm"<<EOF
+(use-modules (gnu packages bootstrap) (guix))
+(define p (package (inherit %bootstrap-guile) (name "eliug")))
+(packages->manifest (list p))
+EOF
+guix package --bootstrap \
+     -m "$module_dir/manifest.scm" -m "$module_dir/manifest2.scm"
+guix package -I | grep guile
+guix package -I | grep eliug
+test `guix package -I | wc -l` -eq 2
+guix package --rollback --bootstrap
+
 # Applying a manifest file with inferior packages.
 cat > "$module_dir/manifest.scm"<<EOF
 (use-modules (guix inferior))
@@ -455,8 +468,10 @@ guix package --list-profiles | grep '\.guix-profile'
 
 # Make sure we can properly lock a profile.
 mkdir "$module_dir"
-echo '(sleep 60)' > "$module_dir/manifest.scm"
+echo "(open-output-file \"$module_dir/ready\") (sleep 60)" \
+     > "$module_dir/manifest.scm"
 guix package -m "$module_dir/manifest.scm" -p "$module_dir/profile" &
 pid=$!
+while [ ! -f "$module_dir/ready" ] ; do sleep 0.5 ; done
 if guix install emacs -p "$module_dir/profile"; then kill $pid; false; else true; fi
 kill $pid
diff --git a/tests/lzlib.scm b/tests/lzlib.scm
index 543622bb45..d8d0e6edf8 100644
--- a/tests/lzlib.scm
+++ b/tests/lzlib.scm
@@ -108,7 +108,7 @@
 (test-assert* "Bytevector of size relative to Lzip internal buffers (1MiB+1)"
   (compress-and-decompress (random-bytevector (1+ (* 1024 1024)))))
 
-(test-assert "make-lzip-input-port/compressed"
+(test-assert* "make-lzip-input-port/compressed"
   (let* ((len        (pk 'len (+ 10 (random 4000 %seed))))
          (data       (random-bytevector len))
          (compressed (make-lzip-input-port/compressed
diff --git a/tests/profiles.scm b/tests/profiles.scm
index a4e28672b5..21c912a532 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -113,6 +113,11 @@
       (manifest-matching-entries m (list p))
       #f)))
 
+(test-equal "concatenate-manifests"
+  (manifest (list guile-2.0.9 glibc))
+  (concatenate-manifests (list (manifest (list guile-2.0.9))
+                               (manifest (list glibc)))))
+
 (test-assert "manifest-remove"
   (let* ((m0 (manifest (list guile-2.0.9 guile-2.0.9:debug)))
          (m1 (manifest-remove m0
diff --git a/tests/publish.scm b/tests/publish.scm
index 64a8ff3cae..204cfb4974 100644
--- a/tests/publish.scm
+++ b/tests/publish.scm
@@ -45,6 +45,7 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-64)
+  #:use-module (ice-9 threads)
   #:use-module (ice-9 format)
   #:use-module (ice-9 match)
   #:use-module (ice-9 rdelim))
diff --git a/tests/substitute.scm b/tests/substitute.scm
index ff2be662be..a4246aff82 100644
--- a/tests/substitute.scm
+++ b/tests/substitute.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org>
-;;; Copyright © 2014, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -169,9 +169,7 @@ a file for NARINFO."
           (cute write-file
                 (string-append narinfo-directory "/example.out") <>))
 
-        (set! (@@ (guix scripts substitute)
-                  %allow-unauthenticated-substitutes?)
-              #f))
+        (%allow-unauthenticated-substitutes? #f))
       thunk
       (lambda ()
         (when (file-exists? cache-directory)