aboutsummaryrefslogtreecommitdiff
path: root/tests/derivations.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-06-08 21:31:01 +0200
committerLudovic Courtès <ludo@gnu.org>2012-06-08 21:31:01 +0200
commitd9085c23c4503347366e54707e80025ca4526941 (patch)
tree6b60eed165dd5f623585f69df9b77e9999b2bda8 /tests/derivations.scm
parentde4c3f26cbf25149265f779b5af08c79de47859c (diff)
downloadguix-d9085c23c4503347366e54707e80025ca4526941.tar
guix-d9085c23c4503347366e54707e80025ca4526941.tar.gz
Add `build-expression->derivation'.
* guix/derivations.scm (%guile-for-build): New parameter. (build-expression->derivation): New procedure. * tests/derivations.scm ("build-expression->derivation without inputs", "build-expression->derivation with one input"): New tests.
Diffstat (limited to 'tests/derivations.scm')
-rw-r--r--tests/derivations.scm32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm
index f2a3bb2d55..ff766cf175 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -94,6 +94,38 @@
(let ((p (derivation-path->output-path drv-path)))
(file-exists? (string-append p "/good"))))))
+(test-skip (if (%guile-for-build) 0 2))
+
+(test-assert "build-expression->derivation without inputs"
+ (let* ((builder '(begin
+ (mkdir %output)
+ (call-with-output-file (string-append %output "/test")
+ (lambda (p)
+ (display '(hello guix) p)))))
+ (drv-path (build-expression->derivation %store "goo" "x86_64-linux"
+ builder '()))
+ (succeeded? (build-derivations %store (list drv-path))))
+ (and succeeded?
+ (let ((p (derivation-path->output-path drv-path)))
+ (equal? '(hello guix)
+ (call-with-input-file (string-append p "/test") read))))))
+
+(test-assert "build-expression->derivation with one input"
+ (let* ((builder '(call-with-output-file %output
+ (lambda (p)
+ (let ((cu (assoc-ref %build-inputs "cu")))
+ (close 1)
+ (dup2 (port->fdes p) 1)
+ (execl (string-append cu "/bin/uname")
+ "uname" "-a")))))
+ (drv-path (build-expression->derivation %store "uname" "x86_64-linux"
+ builder
+ `(("cu" . ,%coreutils))))
+ (succeeded? (build-derivations %store (list drv-path))))
+ (and succeeded?
+ (let ((p (derivation-path->output-path drv-path)))
+ (string-contains (call-with-input-file p read-line) "GNU")))))
+
(test-end)