1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

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.
This commit is contained in:
Daan De Meyer 2024-04-30 14:29:14 +02:00
parent 123450e58e
commit c89244842b
3 changed files with 2 additions and 8 deletions

View File

@ -37,6 +37,7 @@ KernelCommandLine=systemd.crash_shell
SYSTEMD_ENABLE_LOG_CONTEXT=yes SYSTEMD_ENABLE_LOG_CONTEXT=yes
[Host] [Host]
Credentials=journal.storage=persistent
@Incremental=yes @Incremental=yes
@RuntimeBuildSources=yes @RuntimeBuildSources=yes
@QemuSmp=2 @QemuSmp=2

View File

@ -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

View File

@ -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_PATH=/usr/lib/systemd/tests/testdata/testsuite-{args.test_number}.units:/usr/lib/systemd/tests/testdata/units:",
f"systemd.unit={test_unit}", f"systemd.unit={test_unit}",
]), ]),
'--credential', f"journal.storage={'persistent' if sys.stderr.isatty() else 'runtime'}" ,
*args.mkosi_args, *args.mkosi_args,
'qemu', 'qemu',
*(['-no-reboot'] if not sys.stderr.isatty() else []) *(['-no-reboot'] if not sys.stderr.isatty() else [])