summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2017-04-14 13:07:16 -0400
committerLeo Famulari <leo@famulari.name>2017-04-14 13:07:16 -0400
commitc57ce31a896f659a2e311c2ee90b9027f4a405bc (patch)
tree17d0d0238ca1db65cce1f2ac68273af0483c9e7d /tests
parentf575efa12c5df9f9879b7be0fe3593a3106a346d (diff)
parent8439c9c05eab5c98d889fb1de56bc78f62a8058f (diff)
downloadguix-c57ce31a896f659a2e311c2ee90b9027f4a405bc.tar.gz
Merge branch 'master' into staging
Diffstat (limited to 'tests')
-rw-r--r--tests/gexp.scm7
-rw-r--r--tests/packages.scm35
-rw-r--r--tests/search-paths.scm2
-rw-r--r--tests/size.scm18
4 files changed, 60 insertions, 2 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index b3f7323984..41a53ae5a4 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -946,6 +946,13 @@
                      (string=? (readlink (string-append comp "/text"))
                                text)))))))
 
+(test-assert "lower-object & gexp-input-error?"
+  (guard (c ((gexp-input-error? c)
+             (gexp-error-invalid-input c)))
+    (run-with-store %store
+      (lower-object (current-module))
+      #:guile-for-build (%guile-for-build))))
+
 (test-assert "printer"
   (string-match "^#<gexp \\(string-append .*#<package coreutils.*\
  \"/bin/uname\"\\) [[:xdigit:]]+>$"
diff --git a/tests/packages.scm b/tests/packages.scm
index aa29758830..930374dabf 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -470,6 +470,14 @@
       (package-derivation %store p)
       #f)))
 
+(let ((dummy (dummy-package "foo" (inputs `(("x" ,(current-module)))))))
+  (test-equal "&package-input-error"
+    (list dummy (current-module))
+    (guard (c ((package-input-error? c)
+               (list (package-error-package c)
+                     (package-error-invalid-input c))))
+      (package-derivation %store dummy))))
+
 (test-assert "reference to non-existent output"
   ;; See <http://bugs.gnu.org/19630>.
   (parameterize ((%graft? #f))
@@ -878,6 +886,33 @@
            (and (build-derivations %store (list drv))
                 (file-exists? (string-append out "/bin/make")))))))
 
+(test-equal "package-mapping"
+  42
+  (let* ((dep       (dummy-package "chbouib"
+                      (native-inputs `(("x" ,grep)))))
+         (p0        (dummy-package "example"
+                      (inputs `(("foo" ,coreutils)
+                                ("bar" ,grep)
+                                ("baz" ,dep)))))
+         (transform (lambda (p)
+                      (package (inherit p) (source 42))))
+         (rewrite   (package-mapping transform))
+         (p1        (rewrite p0)))
+    (and (eq? p1 (rewrite p0))
+         (eqv? 42 (package-source p1))
+         (match (package-inputs p1)
+           ((("foo" dep1) ("bar" dep2) ("baz" dep3))
+            (and (eq? dep1 (rewrite coreutils))   ;memoization
+                 (eq? dep2 (rewrite grep))
+                 (eq? dep3 (rewrite dep))
+                 (eqv? 42
+                       (package-source dep1) (package-source dep2)
+                       (package-source dep3))
+                 (match (package-native-inputs dep3)
+                   ((("x" dep))
+                    (and (eq? dep (rewrite grep))
+                         (package-source dep))))))))))
+
 (test-assert "package-input-rewriting"
   (let* ((dep     (dummy-package "chbouib"
                     (native-inputs `(("x" ,grep)))))
diff --git a/tests/search-paths.scm b/tests/search-paths.scm
index 2a4c18dd76..8dad424415 100644
--- a/tests/search-paths.scm
+++ b/tests/search-paths.scm
@@ -29,7 +29,7 @@
 
 (test-equal "evaluate-search-paths, separator is #f"
   (string-append %top-srcdir
-                 "/gnu/packages/bootstrap/armhf-linux")
+                 "/gnu/packages/bootstrap/aarch64-linux")
 
   ;; The following search path spec should evaluate to a single item: the
   ;; first directory that matches the "-linux$" pattern in
diff --git a/tests/size.scm b/tests/size.scm
index 068ebc1d68..575b1abfdd 100644
--- a/tests/size.scm
+++ b/tests/size.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -86,6 +86,22 @@
                                     (profile-self-size profile3)
                                     (profile-self-size profile4))))))))))))
 
+(test-assertm "store-profile with multiple items"
+  (mlet* %store-monad ((file1 (gexp->derivation "file1"
+                                                #~(symlink #$%bootstrap-guile
+                                                           #$output)))
+                       (file2 (text-file* "file2"
+                                          "the file => " file1)))
+    (mbegin %store-monad
+      (built-derivations (list file2))
+      (mlet %store-monad ((profiles  (store-profile
+                                      (list (derivation->output-path file2)
+                                            (derivation->output-path file1))))
+                          (reference (store-profile
+                                      (list (derivation->output-path file2)))))
+        (return (and (= (length profiles) 4)
+                     (lset= equal? profiles reference)))))))
+
 (test-end "size")
 
 ;;; Local Variables: