summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-07-26 22:54:40 +0200
committerLudovic Courtès <ludo@gnu.org>2014-07-26 22:57:00 +0200
commit462f5ccade9fd1372e2a7d1e854cd6324ebb4105 (patch)
tree6f804a79074238627c20e307d8569b5f450e0d9b /tests
parent4ca0b4101d2d15fc41c0a875f09553ded27091bd (diff)
downloadguix-462f5ccade9fd1372e2a7d1e854cd6324ebb4105.tar.gz
profiles: Add 'package->manifest-entry'.
Suggested by Alex Kost <alezost@gmail.com>.

* guix/scripts/package.scm (options->installable)[package->manifest-entry]:
  Move to (guix profiles).
  [package->manifest-entry*]: New procedure.
  Use it.
* guix/profiles.scm (package->manifest-entry): New procedure.
* tests/profiles.scm (guile-for-build): New variable.
  Call '%guile-for-build'.
  ("profile-derivation"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/profiles.scm27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/profiles.scm b/tests/profiles.scm
index e6fcaad7cf..d405f6453e 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -18,11 +18,25 @@
 
 (define-module (test-profiles)
   #:use-module (guix profiles)
+  #:use-module (guix store)
+  #:use-module (guix monads)
+  #:use-module (guix packages)
+  #:use-module (guix derivations)
+  #:use-module (gnu packages bootstrap)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-64))
 
 ;; Test the (guix profile) module.
 
+(define %store
+  (open-connection))
+
+(define guile-for-build
+  (package-derivation %store %bootstrap-guile))
+
+;; Make it the default.
+(%guile-for-build guile-for-build)
+
 
 ;; Example manifest entries.
 
@@ -87,6 +101,19 @@
             (null? (manifest-entries m3))
             (null? (manifest-entries m4)))))))
 
+(test-assert "profile-derivation"
+  (run-with-store %store
+    (mlet* %store-monad
+        ((entry ->   (package->manifest-entry %bootstrap-guile))
+         (guile      (package->derivation %bootstrap-guile))
+         (drv        (profile-derivation (manifest (list entry))))
+         (profile -> (derivation->output-path drv))
+         (bindir ->  (string-append profile "/bin"))
+         (_          (built-derivations (list drv))))
+      (return (and (file-exists? (string-append bindir "/guile"))
+                   (string=? (dirname (readlink bindir))
+                             (derivation->output-path guile)))))))
+
 (test-end "profiles")