summary refs log tree commit diff
path: root/tests/guix-system.sh
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-11-24 22:29:47 +0100
committerLudovic Courtès <ludo@gnu.org>2015-11-24 23:54:30 +0100
commit2d2651e7813a232e1e49e8aa0d0e267dd9dd1f18 (patch)
tree1bf0a47d3c350dfb6285fdaaf3947b923529bbae /tests/guix-system.sh
parenteb31d4b4f12d82b3cd8ab04c0e8a796322e6abbc (diff)
downloadguix-2d2651e7813a232e1e49e8aa0d0e267dd9dd1f18.tar.gz
services: dmd: Error out upon unmet dmd requirements.
* gnu/services/dmd.scm (assert-no-duplicates): Rename to...
(assert-valid-graph): ... this.
[provisions]: New variable.
[assert-satisfied-requirements]: New procedure.
Use it.
* tests/guix-system.sh: Add test with unmet dmd requirements.
Diffstat (limited to 'tests/guix-system.sh')
-rw-r--r--tests/guix-system.sh49
1 files changed, 41 insertions, 8 deletions
diff --git a/tests/guix-system.sh b/tests/guix-system.sh
index d99c9bd07b..e20bc98713 100644
--- a/tests/guix-system.sh
+++ b/tests/guix-system.sh
@@ -71,13 +71,7 @@ else
     grep "$tmpfile:9:.*[Uu]nbound variable.*GRUB-config" "$errorfile"
 fi
 
-# Reporting of duplicate service identifiers.
-
-cat > "$tmpfile" <<EOF
-(use-modules (gnu))
-(use-service-modules networking)
-
-(operating-system
+OS_BASE='
   (host-name "antelope")
   (timezone "Europe/Paris")
   (locale "en_US.UTF-8")
@@ -85,11 +79,20 @@ cat > "$tmpfile" <<EOF
   (bootloader (grub-configuration (device "/dev/sdX")))
   (file-systems (cons (file-system
                         (device "root")
-                        (title 'label)
+                        (title (string->symbol "label"))
                         (mount-point "/")
                         (type "ext4"))
                       %base-file-systems))
+'
 
+# Reporting of duplicate service identifiers.
+
+cat > "$tmpfile" <<EOF
+(use-modules (gnu))
+(use-service-modules networking)
+
+(operating-system
+  $OS_BASE
   (services (cons* (dhcp-client-service)
                    (dhcp-client-service) ;twice!
                    %base-services)))
@@ -103,6 +106,36 @@ else
     grep "service 'networking'.*more than once" "$errorfile"
 fi
 
+# Reporting unmet dmd requirements.
+
+cat > "$tmpfile" <<EOF
+(use-modules (gnu) (gnu services dmd))
+(use-service-modules networking)
+
+(define buggy-service-type
+  (dmd-service-type
+    'buggy
+    (lambda _
+      (dmd-service
+        (provision '(buggy!))
+        (requirement '(does-not-exist))
+        (start #t)))))
+
+(operating-system
+  $OS_BASE
+  (services (cons (service buggy-service-type #t)
+                  %base-services)))
+EOF
+
+if guix system build "$tmpfile" 2> "$errorfile"
+then
+    exit 1
+else
+    grep "service 'buggy!'.*'does-not-exist'.*undefined" "$errorfile"
+fi
+
+# Reporting inconsistent user accounts.
+
 make_user_config ()
 {
     cat > "$tmpfile" <<EOF