gnu: Adjust tests for ‘shepherd-system-log-service-type’.

This is a followup to 8492a3c896.

* gnu/services/virtualization.scm (%minimal-vm-syslog-config): Remove.
(%system-log-message-destination): New variable.
(%virtual-build-machine-operating-system): Use it, and modify
‘shepherd-system-log-service-type’ instead of ‘syslog-service-type’.
* gnu/tests/base.scm (%avahi-os): Likewise.
* gnu/tests/install.scm (%syslog-conf): Remove.
(operating-system-with-console-syslog): Modify
‘shepherd-system-log-service-type’ instead of ‘syslog-service-type’.
* gnu/tests/nfs.scm (%nfs-os, run-nfs-full-test): Likewise.
* gnu/tests/reconfigure.scm (run-kexec-test): Likewise.

Change-Id: I142d34ad27594a538f5b75daf087e48c690171b8
This commit is contained in:
Ludovic Courtès 2025-03-10 00:21:26 +01:00
parent ac26813108
commit d0510dcd82
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
5 changed files with 63 additions and 67 deletions

View file

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Ryan Moe <ryan.moe@gmail.com>
;;; Copyright © 2018, 2020-2024 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2018, 2020-2025 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2020, 2021, 2023, 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2021 Timotej Lazar <timotej.lazar@araneo.si>
;;; Copyright © 2022 Oleg Pykhalov <go.wigust@gmail.com>
@ -1289,17 +1289,20 @@ that will be listening to receive secret keys on ADDRESS."
(_ #f))
(virtual-build-machine-port-forwardings config)))
(define %minimal-vm-syslog-config
;; Minimal syslog configuration for a VM.
(plain-file "vm-syslog.conf" "\
# Log most messages to the console, which goes to the serial
# output, allowing the host to log it.
*.info;auth.notice;authpriv.none -/dev/console
# The rest.
*.=debug -/var/log/debug
authpriv.*;auth.info /var/log/secure
"))
(define %system-log-message-destination
;; Shepherd system log message destination procedure. Log most messages to
;; the console, which goes to the serial output, allowing the host to log
;; it.
#~(lambda (message)
(cond ((= (system-log-priority debug)
(system-log-message-priority message))
'("/var/log/debug"))
((member (system-log-message-facility message)
(list (system-log-facility authorization)
(system-log-facility authorization/private)))
'("/var/log/secure"))
(else
'("/dev/console")))))
(define %virtual-build-machine-operating-system
(operating-system
@ -1349,10 +1352,10 @@ authpriv.*;auth.info /var/log/secure
(inherit config)
(authorize-key? #f)
(use-substitutes? #f)))
(syslog-service-type config =>
(syslog-configuration
(config-file
%minimal-vm-syslog-config)))
(shepherd-system-log-service-type
config =>
(system-log-configuration
(message-destination %system-log-message-destination)))
(delete mingetty-service-type)
(delete console-font-service-type))))))

View file

@ -984,14 +984,12 @@ non-ASCII names from /tmp.")
(inherit config)
(debug-level 3)
(log-file "/dev/console")))
(syslog-service-type config
=>
(syslog-configuration
(inherit config)
(config-file
(plain-file
"syslog.conf"
"*.* /dev/console\n")))))))))
(shepherd-system-log-service-type
config
=>
(system-log-configuration
(inherit config)
(message-destination #~(const '("/dev/console"))))))))))
(define (run-nss-mdns-test)
;; Test resolution of '.local' names via libc. Start the marionette service

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016-2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016-2023, 2025 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017, 2019, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2020 Danny Milosavljevic <dannym@scratchpost.org>
@ -52,6 +52,7 @@
#:use-module (gnu packages xorg)
#:use-module (gnu services desktop)
#:use-module (gnu services networking)
#:use-module (gnu services shepherd)
#:use-module (gnu services xorg)
#:use-module (guix store)
#:use-module (guix monads)
@ -1783,27 +1784,25 @@ build (current-guix) and then store a couple of full system images.")
;;; Installation through the graphical interface.
;;;
(define %syslog-conf
;; Syslog configuration that dumps to /dev/console, so we can see the
;; installer's messages during the test.
(computed-file "syslog.conf"
#~(begin
(copy-file #$%default-syslog.conf #$output)
(chmod #$output #o644)
(let ((port (open-file #$output "a")))
(display "\n*.info /dev/console\n" port)
#t))))
(define (operating-system-with-console-syslog os)
"Return OS with a syslog service that writes to /dev/console."
(operating-system
(inherit os)
(services (modify-services (operating-system-user-services os)
(syslog-service-type config
=>
(syslog-configuration
(inherit config)
(config-file %syslog-conf)))))))
(services
(modify-services (operating-system-user-services os)
(shepherd-system-log-service-type
config
=>
(system-log-configuration
(inherit config)
(message-destination
#~(lambda (message)
(let ((destinations ((default-message-destination-procedure)
message)))
(if (<= (system-log-message-priority message)
(system-log-priority info))
(cons "/dev/console" destinations)
destinations))))))))))
(define %root-password "foo")

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016, 2017, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016-2017, 2020-2021, 2025 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 John Darrington <jmd@gnu.org>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
@ -33,6 +33,7 @@
#:use-module (gnu services base)
#:use-module (gnu services nfs)
#:use-module (gnu services networking)
#:use-module (gnu services shepherd)
#:use-module (gnu packages admin)
#:use-module (gnu packages onc-rpc)
#:use-module (gnu packages nfs)
@ -170,14 +171,12 @@
(services
;; Enable debugging output.
(modify-services (operating-system-user-services os)
(syslog-service-type config
=>
(syslog-configuration
(inherit config)
(config-file
(plain-file
"syslog.conf"
"*.* /dev/console\n")))))))))
(shepherd-system-log-service-type
config
=>
(system-log-configuration
(inherit config)
(message-destination #~(const '("/dev/console"))))))))))
(define (run-nfs-server-test)
"Run a test of an OS running a service of NFS-SERVICE-TYPE."
@ -287,14 +286,12 @@ directories can be mounted.")
"*(rw,insecure,no_subtree_check,\
crossmnt,fsid=root,no_root_squash,insecure,async)")))))
(modify-services (operating-system-user-services os)
(syslog-service-type config
=>
(syslog-configuration
(inherit config)
(config-file
(plain-file
"syslog.conf"
"*.* /dev/console\n"))))))))
(shepherd-system-log-service-type
config
=>
(system-log-configuration
(inherit config)
(message-destination #~(const '("/dev/console")))))))))
#:requirements '(nscd)
#:imported-modules '((gnu services herd)
(guix combinators)))))

View file

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Jakob L. Kreuze <zerodaysfordays@sdf.org>
;;; Copyright © 2024 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2024-2025 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -190,13 +190,12 @@ Shepherd (PID 1) by unloading obsolete services and loading new services."
(operating-system
(inherit %simple-os)
(services (modify-services %base-services
(syslog-service-type
config => (syslog-configuration
(inherit config)
(config-file
(plain-file
"syslog.conf"
"*.* /dev/console\n")))))))
(shepherd-system-log-service-type
config
=>
(system-log-configuration
(inherit config)
(message-destination #~(const '("/dev/console"))))))))
#:imported-modules '((gnu services herd)
(guix combinators))))