aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-11-08 13:33:25 +0100
committerLudovic Courtès <ludo@gnu.org>2017-11-08 22:36:20 +0100
commitc5a4a92f1a796e342b7db4c458f1fdb61ffc8d40 (patch)
treeb7b59ee6fc7d0153120b333c82145a830b83988a /tests
parent49483f71381ad32cdbe81b1c8ed2cc023329cc18 (diff)
downloadgnu-guix-c5a4a92f1a796e342b7db4c458f1fdb61ffc8d40.tar
gnu-guix-c5a4a92f1a796e342b7db4c458f1fdb61ffc8d40.tar.gz
gnu: Improve error reporting of the use-.*modules macros.
Suggested by Julien Lepiller and myglc2 at <https://lists.gnu.org/archive/html/guix-devel/2017-11/msg00106.html>. * gnu.scm (%try-use-modules): New procedure. (package-module-hint, service-module-hint): New procedures. (try-use-modules): New macro. (use-package-modules, use-service-modules, use-system-modules): Use it. * tests/guix-system.sh: Test it.
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-system.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/guix-system.sh b/tests/guix-system.sh
index 31ee637133..1346d8d5a8 100644
--- a/tests/guix-system.sh
+++ b/tests/guix-system.sh
@@ -68,6 +68,34 @@ else
fi
+# Reporting of module not found errors.
+
+cat > "$tmpfile" <<EOF
+;; Line 1.
+(use-modules (gnu))
+ (use-service-modules openssh)
+EOF
+
+if guix system build "$tmpfile" -n 2> "$errorfile"
+then false
+else
+ grep "$tmpfile:3:2: .*module .*openssh.*not found" "$errorfile"
+ grep "Try.*use-service-modules ssh" "$errorfile"
+fi
+
+cat > "$tmpfile" <<EOF
+;; Line 1.
+(use-modules (gnu))
+ (use-package-modules qemu)
+EOF
+
+if guix system build "$tmpfile" -n 2> "$errorfile"
+then false
+else
+ grep "$tmpfile:3:2: .*module .*qemu.*not found" "$errorfile"
+ grep "Try.*use-package-modules virtualization" "$errorfile"
+fi
+
# Reporting of unbound variables.
cat > "$tmpfile" <<EOF