civodul pushed a commit to branch wip-syslogd
in repository shepherd.
commit b4606b31b424465a341ccf7f526cbc8acd923c6e
Author: Ludovic Courtès <[email protected]>
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 | 46 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 45 insertions(+), 1 deletion(-)
diff --git a/.guix/manifest.scm b/.guix/manifest.scm
index 460e3ae..54d1d6c 100644
--- a/.guix/manifest.scm
+++ b/.guix/manifest.scm
@@ -24,6 +24,7 @@
#:select (virtual-machine
virtualized-operating-system))
((gnu services) #:select (modify-services))
+ ((gnu services base) #:select (syslog-service-type))
(gnu services shepherd)
(gnu tests)
(gnu tests base)
@@ -80,6 +81,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 +120,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 +166,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))