summary refs log tree commit diff
path: root/tests/gexp.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-11-13 17:43:29 +0100
committerLudovic Courtès <ludo@gnu.org>2023-12-22 00:31:40 +0100
commit11a454f9dae84cc00b977d164dae764454ecb11d (patch)
treee08670e170f6fa5042791bc1a4eacfc24bd11c60 /tests/gexp.scm
parentd9190abbd20f15ea5b55abdd51e1376f05055850 (diff)
downloadguix-11a454f9dae84cc00b977d164dae764454ecb11d.tar.gz
gexp: #:references-graphs accepts and honors <gexp-input> records.
* guix/gexp.scm (lower-reference-graphs)[tuple->gexp-input]: Add
‘gexp-input?’ case.
(gexp->derivation): Update docstring.
* doc/guix.texi (G-Expressions): Adjust accordingly.
* tests/gexp.scm ("references-file, non-default output"): New test.

Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Change-Id: I595cb75da0867ab8ab44552887dc06ed1d23315e
Diffstat (limited to 'tests/gexp.scm')
-rw-r--r--tests/gexp.scm30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 871e5f7abb..001786c13c 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -1652,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)))