summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-system.sh9
-rw-r--r--tests/pack.scm79
-rw-r--r--tests/store.scm4
-rw-r--r--tests/zlib.scm11
4 files changed, 100 insertions, 3 deletions
diff --git a/tests/guix-system.sh b/tests/guix-system.sh
index 77d4e28999..de6db0928c 100644
--- a/tests/guix-system.sh
+++ b/tests/guix-system.sh
@@ -76,7 +76,14 @@ EOF
 if guix system build "$tmpfile" -n 2> "$errorfile"
 then false
 else
-    grep "$tmpfile:9:.*[Uu]nbound variable.*GRUB-config" "$errorfile"
+    if test "`guile -c '(display (effective-version))'`" = 2.2
+    then
+	# FIXME: With Guile 2.2.0 the error is reported on line 4.
+	# See <http://bugs.gnu.org/26107>.
+	grep "$tmpfile:[49]:.*[Uu]nbound variable.*GRUB-config" "$errorfile"
+    else
+	grep "$tmpfile:9:.*[Uu]nbound variable.*GRUB-config" "$errorfile"
+    fi
 fi
 
 OS_BASE='
diff --git a/tests/pack.scm b/tests/pack.scm
new file mode 100644
index 0000000000..de9ef8e6ab
--- /dev/null
+++ b/tests/pack.scm
@@ -0,0 +1,79 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (test-pack)
+  #:use-module (guix scripts pack)
+  #:use-module (guix store)
+  #:use-module (guix derivations)
+  #:use-module (guix profiles)
+  #:use-module (guix monads)
+  #:use-module (guix grafts)
+  #:use-module (guix tests)
+  #:use-module (guix gexp)
+  #:use-module (gnu packages bootstrap)
+  #:use-module (srfi srfi-64))
+
+(define %store
+  (open-connection-for-tests))
+
+;; Globally disable grafts because they can trigger early builds.
+(%graft? #f)
+
+(define-syntax-rule (test-assertm name exp)
+  (test-assert name
+    (run-with-store %store exp
+                    #:guile-for-build (%guile-for-build))))
+
+(define %gzip-compressor
+  ;; Compressor that uses the bootstrap 'gzip'.
+  ((@ (guix scripts pack) compressor) "gzip"
+   %bootstrap-coreutils&co "gz" '("gzip" "-6n")))
+
+(define %tar-bootstrap %bootstrap-coreutils&co)
+
+
+(test-begin "pack")
+
+(test-assertm "self-contained-tarball"
+  (mlet* %store-monad
+      ((profile (profile-derivation (packages->manifest
+                                     (list %bootstrap-guile))
+                                    #:hooks '()
+                                    #:locales? #f))
+       (tarball (self-contained-tarball "pack" profile
+                                        #:symlinks '(("/bin/Guile"
+                                                      -> "bin/guile"))
+                                        #:compressor %gzip-compressor
+                                        #:tar %tar-bootstrap))
+       (check   (gexp->derivation
+                 "check-tarball"
+                 #~(let ((guile (string-append "." #$profile "/bin")))
+                     (setenv "PATH"
+                             (string-append #$%tar-bootstrap "/bin"))
+                     (system* "tar" "xvf" #$tarball)
+                     (mkdir #$output)
+                     (exit
+                      (and (file-exists? (string-append guile "/guile"))
+                           (string=? (string-append #$%bootstrap-guile "/bin")
+                                     (readlink guile))
+                           (string=? (string-append (string-drop guile 1)
+                                                    "/guile")
+                                     (readlink "bin/Guile"))))))))
+    (built-derivations (list check))))
+
+(test-end)
diff --git a/tests/store.scm b/tests/store.scm
index 64d3553f25..c0ebe7b941 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -383,7 +383,9 @@
                      (package-derivation %store %bootstrap-guile))))
             (guard (c ((nix-protocol-error? c) #t))
               (build-derivations %store (list d))))))))
-   "garbage: ?lambda: λ"))
+   (cond-expand
+     (guile-2.0 "garbage: ?lambda: λ")
+     (else      "garbage: �lambda: λ"))))
 
 (test-assert "log-file, derivation"
   (let* ((b (add-text-to-store %store "build" "echo $foo > $out" '()))
diff --git a/tests/zlib.scm b/tests/zlib.scm
index 5455240a71..f71609b7c5 100644
--- a/tests/zlib.scm
+++ b/tests/zlib.scm
@@ -57,7 +57,16 @@
               (match (waitpid pid)
                 ((_ . status)
                  (and (zero? status)
-                      (port-closed? parent)
+
+                      ;; PORT itself isn't closed but its underlying file
+                      ;; descriptor must have been closed by 'gzclose'.
+                      (catch 'system-error
+                        (lambda ()
+                          (seek (fileno parent) 0 SEEK_CUR)
+                          #f)
+                        (lambda args
+                          (= EBADF (system-error-errno args))))
+
                       (bytevector=? received data))))))))))))
 
 (test-end)