aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/derivations.scm22
-rw-r--r--tests/store.scm20
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm
index dbb5b584eb..c421d094a4 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -787,6 +787,28 @@
(build-derivations store (list drv))
#f)))
+(test-assert "build-derivations with specific output"
+ (with-store store
+ (let* ((content (random-text)) ;contents of the output
+ (drv (build-expression->derivation
+ store "substitute-me"
+ `(begin ,content (exit 1)) ;would fail
+ #:outputs '("out" "one" "two")
+ #:guile-for-build
+ (package-derivation store %bootstrap-guile)))
+ (out (derivation->output-path drv)))
+ (with-derivation-substitute drv content
+ (set-build-options store #:use-substitutes? #t
+ #:substitute-urls (%test-substitute-urls))
+ (and (has-substitutes? store out)
+
+ ;; Ask for nothing but the "out" output of DRV.
+ (build-derivations store `((,drv . "out")))
+
+ (valid-path? store out)
+ (equal? (pk 'x content) (pk 'y (call-with-input-file out get-string-all)))
+ )))))
+
(test-assert "build-expression->derivation and derivation-prerequisites-to-build"
(let ((drv (build-expression->derivation %store "fail" #f)))
;; The only direct dependency is (%guile-for-build) and it's already
diff --git a/tests/store.scm b/tests/store.scm
index df66feaebb..518750d26a 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -599,6 +599,26 @@
(valid-path? s o)
(equal? c (call-with-input-file o get-string-all)))))))
+(test-assert "substitute + build-things with specific output"
+ (with-store s
+ (let* ((c (random-text)) ;contents of the output
+ (d (build-expression->derivation
+ s "substitute-me" `(begin ,c (exit 1)) ;would fail
+ #:outputs '("out" "one" "two")
+ #:guile-for-build
+ (package-derivation s %bootstrap-guile (%current-system))))
+ (o (derivation->output-path d)))
+ (with-derivation-substitute d c
+ (set-build-options s #:use-substitutes? #t
+ #:substitute-urls (%test-substitute-urls))
+ (and (has-substitutes? s o)
+
+ ;; Ask for nothing but the "out" output of D.
+ (build-things s `((,(derivation-file-name d) . "out")))
+
+ (valid-path? s o)
+ (equal? c (call-with-input-file o get-string-all)))))))
+
(test-assert "substitute, corrupt output hash"
;; Tweak the substituter into installing a substitute whose hash doesn't
;; match the one announced in the narinfo. The daemon must notice this and