summary refs log tree commit diff
path: root/tests/packages.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-10-06 01:24:46 +0200
committerLudovic Courtès <ludo@gnu.org>2012-10-07 22:24:59 +0200
commit14da91e2f0de4c8a7e1f3b706cc5d961030ff190 (patch)
treea48c033a6b5e74aa195471423f9881874b2622b0 /tests/packages.scm
parent81c7948d9acd3e203e5fd7185dbead33c11d4a92 (diff)
downloadguix-14da91e2f0de4c8a7e1f3b706cc5d961030ff190.tar.gz
tests: Use bootstrap and Nixpkgs inputs to be less costly.
* tests/builders.scm (%bootstrap-inputs, %bootstrap-guile): New
  variables.
  ("gnu-build"): Use them, by setting `#:implicit-inputs? #f' and `#:guile'.

* tests/packages.scm (%bootstrap-inputs, %bootstrap-guile): New
  variables.
  ("trivial"): Pass `#:guile %bootstrap-guile'.
  ("GNU Hello"): Use `package-with-explicit-inputs' to use
  %BOOTSTRAP-GUILE and %BOOTSTRAP-INPUTS.
Diffstat (limited to 'tests/packages.scm')
-rw-r--r--tests/packages.scm31
1 files changed, 23 insertions, 8 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index 20f586e449..1319bf8634 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -35,6 +35,18 @@
 (define %store
   (false-if-exception (open-connection)))
 
+(define %bootstrap-inputs
+  ;; Derivations taken from Nixpkgs, so that the initial tests don't
+  ;; take forever.
+  (and (file-exists? (%nixpkgs-directory))
+       `(("make" ,(nixpkgs-derivation "gnumake"))
+         ("diffutils" ,(nixpkgs-derivation "diffutils"))
+         ,@(@@ (distro packages base) %bootstrap-inputs))))
+
+(define %bootstrap-guile
+  (@@ (distro packages base) %bootstrap-guile))
+
+
 (test-begin "packages")
 
 (define-syntax-rule (dummy-package name* extra-fields ...)
@@ -70,7 +82,8 @@
               (build-system trivial-build-system)
               (source #f)
               (arguments
-               '(#:builder
+               `(#:guile ,%bootstrap-guile
+                 #:builder
                  (begin
                    (mkdir %output)
                    (call-with-output-file (string-append %output "/test")
@@ -83,13 +96,15 @@
                    (call-with-input-file (string-append p "/test") read))))))
 
 (test-assert "GNU Hello"
-  (and (package? hello)
-       (or (location? (package-location hello))
-           (not (package-location hello)))
-       (let* ((drv (package-derivation %store hello))
-              (out (derivation-path->output-path drv)))
-         (and (build-derivations %store (list drv))
-              (file-exists? (string-append out "/bin/hello"))))))
+  (let ((hello (package-with-explicit-inputs hello %bootstrap-inputs
+                                             #:guile %bootstrap-guile)))
+    (and (package? hello)
+         (or (location? (package-location hello))
+             (not (package-location hello)))
+         (let* ((drv (package-derivation %store hello))
+                (out (derivation-path->output-path drv)))
+           (and (build-derivations %store (list drv))
+                (file-exists? (string-append out "/bin/hello")))))))
 
 (test-assert "find-packages-by-name"
   (match (find-packages-by-name "hello")