summary refs log tree commit diff
path: root/tests/graph.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2019-03-23 23:16:55 +0100
committerMarius Bakke <mbakke@fastmail.com>2019-03-23 23:16:55 +0100
commit8c14f7f8a7ab0722bf4c9f92fd28ae85514d564f (patch)
treeadc5d29e9c2dcda5befa0ca81f1af8df23294947 /tests/graph.scm
parent2f33a7321e5e37d37f57c229c8079cb4ffd10834 (diff)
parent3374e9207f5244c20402a3c5513fe562140fef47 (diff)
downloadguix-8c14f7f8a7ab0722bf4c9f92fd28ae85514d564f.tar.gz
Merge branch 'staging' into core-updates
Diffstat (limited to 'tests/graph.scm')
-rw-r--r--tests/graph.scm28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/graph.scm b/tests/graph.scm
index 2a0f675717..b7732ec709 100644
--- a/tests/graph.scm
+++ b/tests/graph.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -191,6 +191,32 @@ edges."
                                 (string=? target (derivation-file-name g)))))
                         edges)))))))))
 
+(test-assert "reverse bag DAG"
+  (let-values (((dune bap ocaml-base)
+                (values (specification->package "dune")
+                        (specification->package "bap")
+                        (specification->package "ocaml-base")))
+               ((backend nodes+edges) (make-recording-backend)))
+    (run-with-store %store
+      (export-graph (list dune) 'port
+                    #:node-type %reverse-bag-node-type
+                    #:backend backend))
+
+    (run-with-store %store
+      (mlet %store-monad ((dune-drv       (package->derivation dune))
+                          (bap-drv        (package->derivation bap))
+                          (ocaml-base-drv (package->derivation ocaml-base)))
+        ;; OCAML-BASE uses 'dune-build-system' so DUNE is a direct dependency.
+        ;; BAP is much higher in the stack but it should be there.
+        (let-values (((nodes edges) (nodes+edges)))
+          (return
+           (and (member `(,(derivation-file-name bap-drv)
+                          ,(package-full-name bap))
+                        nodes)
+                (->bool (member (map derivation-file-name
+                                     (list dune-drv ocaml-base-drv))
+                                edges)))))))))
+
 (test-assert "derivation DAG"
   (let-values (((backend nodes+edges) (make-recording-backend)))
     (run-with-store %store