diff options
author | John Kehayias <john.kehayias@protonmail.com> | 2023-12-28 21:13:26 -0500 |
---|---|---|
committer | John Kehayias <john.kehayias@protonmail.com> | 2023-12-28 21:13:26 -0500 |
commit | 92227248a616a9555200a48b1e4f1768a462556b (patch) | |
tree | 2e5bc472b5169742a4a5ffe5971ceb8be780970f /tests/gexp.scm | |
parent | bdab356332e391e09d0feafe0fcac9c52388a07d (diff) | |
parent | 7722da6fa5422c4fec69d6c8b9536c7d6fc3d326 (diff) | |
download | guix-92227248a616a9555200a48b1e4f1768a462556b.tar guix-92227248a616a9555200a48b1e4f1768a462556b.tar.gz |
Merge branch 'master' into mesa-updates
Change-Id: I16539f64df739453a83f8dfd962e04910a7d7ff5
Diffstat (limited to 'tests/gexp.scm')
-rw-r--r-- | tests/gexp.scm | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm index 0e3c446576..001786c13c 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -393,6 +393,30 @@ (list item)) (null? (lowered-gexp-inputs lexp))))) +(test-equal "gexp references non-existent output" + "no-default-output" + (guard (c ((derivation-missing-output-error? c) + (derivation-name (derivation-error-derivation c)))) + (let* ((obj (computed-file "no-default-output" + #~(mkdir #$output:bar))) + (exp #~(symlink #$obj #$output)) + (drv (run-with-store %store (lower-gexp exp)))) + (pk 'oops! drv #f)))) + +(test-assert "gexp-input, as first-class input" + ;; Insert a <gexp-input> record in a gexp as a way to specify which output + ;; of OBJ should be used. + (let* ((obj (computed-file "foo" #~(mkdir #$output:bar))) + (exp #~(list #$(gexp-input obj "bar"))) + (drv (run-with-store %store (lower-object obj))) + (item (derivation->output-path drv "bar")) + (lexp (run-with-store %store (lower-gexp exp)))) + (and (match (lowered-gexp-inputs lexp) + ((input) + (eq? (derivation-input-derivation input) drv))) + (equal? (lowered-gexp-sexp lexp) + `(list ,item))))) + (test-assertm "with-parameters for %current-system" (mlet* %store-monad ((system -> (match (%current-system) ("aarch64-linux" "x86_64-linux") @@ -1628,6 +1652,36 @@ importing.* \\(guix config\\) from the host" read) refs))))))) +(test-assertm "references-file, non-default output" + (let* ((exp #~(begin + (mkdir #$output) + (symlink #$%bootstrap-guile #$output:extra))) + (computed (computed-file "computed" exp + #:guile %bootstrap-guile)) + (refs1 (references-file computed + #:guile %bootstrap-guile)) + ;; Wrap COMPUTE in 'gexp-input' to get the "extra" output. + (refs2 (references-file (gexp-input computed "extra") + #:guile %bootstrap-guile))) + (mlet* %store-monad ((drv0 (lower-object %bootstrap-guile)) + (drv1 (lower-object computed)) + (drv2 (lower-object refs2)) + (drv3 (lower-object refs1))) + (mbegin %store-monad + (built-derivations (list drv2 drv3)) + (mlet %store-monad ((refs ((store-lift requisites) + (list (derivation->output-path + drv1 "extra"))))) + (return + (and (lset= string=? + (call-with-input-file (derivation->output-path drv2) + read) + refs) + (lset= string=? + (call-with-input-file (derivation->output-path drv3) + read) + (list (derivation->output-path drv1)))))))))) + (test-assert "lower-object & gexp-input-error?" (guard (c ((gexp-input-error? c) (gexp-error-invalid-input c))) |