forked from systemd/systemd
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test case for issue user journal corruption
For issue systemd#24150 and systemd#31222.
- Loading branch information
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
# SPDX-License-Identifier: LGPL-2.1-or-later | ||
set -eux | ||
set -o pipefail | ||
|
||
journalctl --rotate --vacuum-files=1 | ||
# Nuke all archived journals, so we start with a clean slate | ||
rm -f "/var/log/journal/$(</etc/machine-id)/system@*.journal" | ||
rm -f "/var/log/journal/$(</etc/machine-id)/user-*@*.journal" | ||
journalctl --header | grep path | ||
|
||
# Make sure the user instance is active when we rotate journals | ||
systemd-run --unit user-sleep.service --user -M testuser@ sleep infinity | ||
|
||
for _ in {0..10}; do | ||
journalctl --rotate | ||
journalctl --sync | ||
SYSTEMD_LOG_LEVEL=debug journalctl -n1 -q | ||
(! journalctl -n0 -q |& grep corrupted) | ||
done | ||
|
||
systemctl stop --user -M testuser@ user-sleep.service |