gnu: r-wgcna: Move to (gnu packages bioconductor).
[jackhill/guix/guix.git] / tests / guix-graph.sh
index 1ec9970..ccb4933 100644 (file)
@@ -1,5 +1,6 @@
 # GNU Guix --- Functional package management for GNU
-# Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2015, 2016, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
 #
 # This file is part of GNU Guix.
 #
 # Test the 'guix graph' command-line utility.
 #
 
-tmpfile1="t-guix-graph1-$$"
-tmpfile2="t-guix-graph2-$$"
+module_dir="t-guix-graph-$$"
+mkdir "$module_dir"
+trap "rm -rf $module_dir" EXIT
+
+tmpfile1="$module_dir/t-guix-graph1-$$"
+tmpfile2="$module_dir/t-guix-graph2-$$"
 trap 'rm -f "$tmpfile1" "$tmpfile2"' EXIT
 
+
+cat > "$module_dir/foo.scm"<<EOF
+(define-module (foo)
+  #:use-module (guix packages)
+  #:use-module (gnu packages base))
+
+(define-public dummy
+  (package (inherit hello)
+    (name "dummy")
+    (version "42")
+    (synopsis "dummy package")
+    (description "dummy package. Only used for testing purposes.")))
+EOF
+
+
 guix graph --version
 
 for package in guile-bootstrap coreutils python
@@ -53,3 +73,26 @@ cmp "$tmpfile1" "$tmpfile2"
 guix graph -t derivation coreutils > "$tmpfile1"
 guix graph -t derivation `guix build -d coreutils` > "$tmpfile2"
 cmp "$tmpfile1" "$tmpfile2"
+
+# Try package transformation options.
+guix graph git | grep 'label = "openssl'
+guix graph git --with-input=openssl=libressl | grep 'label = "libressl'
+if guix graph git --with-input=openssl=libressl | grep 'label = "openssl'
+then false; else true; fi
+
+# Try --load-path
+guix graph -L $module_dir dummy | grep 'label = "dummy'
+
+# Displaying shortest paths (or lack thereof).
+if guix graph --path emacs vim; then false; else true; fi
+
+path="\
+emacs
+gnutls
+guile
+libffi"
+test "`guix graph --path emacs libffi | cut -d '@' -f1`" = "$path"
+
+# At the derivation level, there's a direct path because libffi is propagated
+# via gtk+.
+test "`guix graph --path -t derivation emacs libffi | wc -l`" -ge 2