civodul pushed a commit to branch devel
in repository shepherd.

commit a43ae3489df500f1cb53bbfe4c0223fbe90f2b48
Author: Ludovic Courtès <l...@gnu.org>
AuthorDate: Sat Jul 20 23:18:21 2024 +0200

    guix: Add system test for the built-in ‘system-log’ service.
    
    * .guix/manifest.scm (shepherd-system-log-service-type): New variable.
    (operating-system-with-built-in-system-log): New procedure.
    (system-test/syslogd): New variable.
    (system-tests): Add it.
---
 .guix/manifest.scm | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)

diff --git a/.guix/manifest.scm b/.guix/manifest.scm
index 460e3ae..1c1819a 100644
--- a/.guix/manifest.scm
+++ b/.guix/manifest.scm
@@ -24,6 +24,8 @@
               #:select (virtual-machine
                         virtualized-operating-system))
              ((gnu services) #:select (modify-services))
+             ((gnu services base) #:select (syslog-service-type))
+             (gnu services)
              (gnu services shepherd)
              (gnu tests)
              (gnu tests base)
@@ -80,6 +82,28 @@ TARGET."
         config => (shepherd-configuration
                    (shepherd shepherd)))))))
 
+(define shepherd-system-log-service-type
+  (shepherd-service-type
+   'shepherd-system-log
+   (const (shepherd-service
+           (documentation "Shepherd's built-in system log (syslogd).")
+           (provision '(system-log syslogd))
+           (modules '((shepherd service system-log)))
+           (free-form #~(system-log-service))))
+   #t
+   (description
+    "Shepherd's built-in system log (syslogd).")))
+
+(define (operating-system-with-built-in-system-log os)
+  "Return @var{os} using the Shepherd's built-in @code{system-log} service
+instead of the Inetutils-based @code{syslog-service-type}."
+  (operating-system
+    (inherit os)
+    (services
+     (cons (service shepherd-system-log-service-type)
+           (modify-services (operating-system-user-services os)
+             (delete syslog-service-type))))))
+
 (define system-test/base
   ;; "Base" system test running against the latest Shepherd.
   (system-test
@@ -97,6 +121,25 @@ TARGET."
                       #~(list #$vm)
                       name)))))
 
+(define system-test/syslogd
+  ;; "Base" system test running against the latest Shepherd.
+  (system-test
+   (name "system-test-syslogd")
+   (description "Test Guix System with the latest Shepherd and with the
+built-in system log (syslogd) service.")
+   (value
+    (let* ((os (marionette-operating-system
+                (operating-system-with-latest-shepherd
+                 (operating-system-with-built-in-system-log %simple-os))
+                #:imported-modules '((gnu services herd)
+                                     (guix combinators))))
+           (vm (virtual-machine os)))
+      ;; XXX: Add call to 'virtualized-operating-system' to get the exact same
+      ;; set of services as the OS in VM.
+      (run-basic-test (virtualized-operating-system os '())
+                      #~(list #$vm)
+                      name)))))
+
 (define system-test/root-unmount
   ;; Halt a system with the 'halt' command, and check whether its root file
   ;; system was cleanly unmounted.
@@ -124,6 +167,8 @@ TARGET."
 (define system-tests
   (manifest
    (map system-test->manifest-entry
-        (list system-test/base system-test/root-unmount))))
+        (list system-test/base
+              system-test/syslogd
+              system-test/root-unmount))))
 
 (concatenate-manifests (list native-builds cross-builds system-tests))

Reply via email to