summaryrefslogtreecommitdiff
path: root/tests/derivations.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-06-05 00:04:07 +0200
committerLudovic Courtès <ludo@gnu.org>2012-06-05 00:04:07 +0200
commitfb3eec8301e3f41f14a51a114cff88dc0e24cfc2 (patch)
tree815a137377bf51862636ca87b867d6f76f2ca62b /tests/derivations.scm
parentb7a7f59847154f880b69061b9f59e7acf503c121 (diff)
downloadpatches-fb3eec8301e3f41f14a51a114cff88dc0e24cfc2.tar
patches-fb3eec8301e3f41f14a51a114cff88dc0e24cfc2.tar.gz
Test the `build-derivations' operation.
* guix/derivations.scm (derivation): Return DRV as a second value. * tests/derivations.scm ("build derivation with 1 source"): New test.
Diffstat (limited to 'tests/derivations.scm')
-rw-r--r--tests/derivations.scm24
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm
index c3aba3f12b..c9b5db2311 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -20,9 +20,11 @@
(define-module (test-derivations)
#:use-module (guix derivations)
#:use-module (guix store)
+ #:use-module (srfi srfi-11)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-64)
- #:use-module (rnrs io ports))
+ #:use-module (rnrs io ports)
+ #:use-module (ice-9 rdelim))
(define %store
(false-if-exception (open-connection)))
@@ -37,7 +39,7 @@
(and (equal? b1 b2)
(equal? d1 d2))))
-(test-skip (if %store 0 1))
+(test-skip (if %store 0 2))
(test-assert "derivation with no inputs"
(let ((builder (add-text-to-store %store "my-builder.sh"
@@ -46,6 +48,24 @@
(store-path? (derivation %store "foo" "x86_64-linux" builder
'() '(("HOME" . "/homeless")) '()))))
+(test-assert "build derivation with 1 source"
+ (let*-values (((builder)
+ (add-text-to-store %store "my-builder.sh"
+ "#!/bin/sh\necho hello, world > \"$out\"\n"
+ '()))
+ ((drv-path drv)
+ (derivation %store "foo" "x86_64-linux"
+ "/bin/sh" `(,builder)
+ '(("HOME" . "/homeless"))
+ `((,builder))))
+ ((succeeded?)
+ (build-derivations %store (list drv-path))))
+ (and succeeded?
+ (let ((path (derivation-output-path
+ (assoc-ref (derivation-outputs drv) "out"))))
+ (string=? (call-with-input-file path read-line)
+ "hello, world")))))
+
(test-end)