From c89244842bf0b050b0e02476f31adae5bac711da Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 30 Apr 2024 14:29:14 +0200 Subject: [PATCH] test: Don't persist journal in mkosi image if we're not debugging tests If we're not debugging tests, there's no point in persisting the journal, so let's use the volatile journal storage mode in that case to avoid doing unnecessary work. We don't disable journal storage alltogether since various tests check that stuff is written to the journal. --- mkosi.conf | 1 + .../usr/lib/systemd/journald.conf.d/50-persistent.conf | 8 -------- test/integration-test-wrapper.py | 1 + 3 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 mkosi.images/system/mkosi.extra/usr/lib/systemd/journald.conf.d/50-persistent.conf diff --git a/mkosi.conf b/mkosi.conf index d6bf53ee46d..0f2705f5fcb 100644 --- a/mkosi.conf +++ b/mkosi.conf @@ -37,6 +37,7 @@ KernelCommandLine=systemd.crash_shell SYSTEMD_ENABLE_LOG_CONTEXT=yes [Host] +Credentials=journal.storage=persistent @Incremental=yes @RuntimeBuildSources=yes @QemuSmp=2 diff --git a/mkosi.images/system/mkosi.extra/usr/lib/systemd/journald.conf.d/50-persistent.conf b/mkosi.images/system/mkosi.extra/usr/lib/systemd/journald.conf.d/50-persistent.conf deleted file mode 100644 index 2f953290d36..00000000000 --- a/mkosi.images/system/mkosi.extra/usr/lib/systemd/journald.conf.d/50-persistent.conf +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later - -# We only ship /usr in the image so /var/log/journal won't exist on boot which means systemd-journald won't -# persist any logs as the default Storage= setting is "auto". We can't create /var/log/journal using tmpfiles -# as systemd-journal-flush.service runs before systemd-tmpfiles-setup.service so instead we explicitly set -# Storage= to persistent to have systemd-journald create /var/log/journal itself. -[Journal] -Storage=persistent diff --git a/test/integration-test-wrapper.py b/test/integration-test-wrapper.py index 2d2fba25ebb..1e003342df9 100755 --- a/test/integration-test-wrapper.py +++ b/test/integration-test-wrapper.py @@ -110,6 +110,7 @@ def main(): f"SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/testsuite-{args.test_number}.units:/usr/lib/systemd/tests/testdata/units:", f"systemd.unit={test_unit}", ]), + '--credential', f"journal.storage={'persistent' if sys.stderr.isatty() else 'runtime'}" , *args.mkosi_args, 'qemu', *(['-no-reboot'] if not sys.stderr.isatty() else []) -- 2.47.3