mirror of
https://github.com/systemd/systemd.git
synced 2026-08-04 15:10:33 +00:00
TEST-07-PID: journalctl -u may not work for short living processes
Hopefully fixes #37818.
This commit is contained in:
@@ -14,9 +14,14 @@ systemd-run --wait --uid=nobody \
|
||||
assert_eq "$(cat /tmp/TEST-07-PID1.prefix-shell.flag)" "a"
|
||||
rm /tmp/TEST-07-PID1.prefix-shell.flag
|
||||
|
||||
# If the service exits too early, journald cannot find the source process of the log message.
|
||||
# Hence, we cannot use 'journalctl -u' below. Instead, let's use --since=.
|
||||
journalctl --sync
|
||||
TS="$(date '+%H:%M:%S')"
|
||||
|
||||
systemctl start prefix-shell.service
|
||||
assert_eq "$(cat /tmp/TEST-07-PID1.prefix-shell.flag)" "YAY!"
|
||||
|
||||
journalctl --sync
|
||||
journalctl -b -u prefix-shell.service --grep "with login shell .*: lvl 101"
|
||||
journalctl -b -u prefix-shell.service --grep "with normal shell"
|
||||
journalctl --since "$TS" --grep "with login shell .*: lvl 101"
|
||||
journalctl --since "$TS" --grep "with normal shell"
|
||||
|
||||
Reference in New Issue
Block a user