mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 09:21:26 +03:00
bff653e397
This test fails before previous commit, and passes with it.
71 lines
1.8 KiB
Bash
Executable File
71 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -x
|
|
set -e
|
|
set -o pipefail
|
|
|
|
# Test stdout stream
|
|
|
|
# Skip empty lines
|
|
ID=$(journalctl --new-id128 | sed -n 2p)
|
|
>/expected
|
|
printf $'\n\n\n' | systemd-cat -t "$ID" --level-prefix false
|
|
journalctl --sync
|
|
journalctl -b -o cat -t "$ID" >/output
|
|
cmp /expected /output
|
|
|
|
ID=$(journalctl --new-id128 | sed -n 2p)
|
|
>/expected
|
|
printf $'<5>\n<6>\n<7>\n' | systemd-cat -t "$ID" --level-prefix true
|
|
journalctl --sync
|
|
journalctl -b -o cat -t "$ID" >/output
|
|
cmp /expected /output
|
|
|
|
# Remove trailing spaces
|
|
ID=$(journalctl --new-id128 | sed -n 2p)
|
|
printf "Trailing spaces\n">/expected
|
|
printf $'<5>Trailing spaces \t \n' | systemd-cat -t "$ID" --level-prefix true
|
|
journalctl --sync
|
|
journalctl -b -o cat -t "$ID" >/output
|
|
cmp /expected /output
|
|
|
|
ID=$(journalctl --new-id128 | sed -n 2p)
|
|
printf "Trailing spaces\n">/expected
|
|
printf $'Trailing spaces \t \n' | systemd-cat -t "$ID" --level-prefix false
|
|
journalctl --sync
|
|
journalctl -b -o cat -t "$ID" >/output
|
|
cmp /expected /output
|
|
|
|
# Don't remove leading spaces
|
|
ID=$(journalctl --new-id128 | sed -n 2p)
|
|
printf $' \t Leading spaces\n'>/expected
|
|
printf $'<5> \t Leading spaces\n' | systemd-cat -t "$ID" --level-prefix true
|
|
journalctl --sync
|
|
journalctl -b -o cat -t "$ID" >/output
|
|
cmp /expected /output
|
|
|
|
ID=$(journalctl --new-id128 | sed -n 2p)
|
|
printf $' \t Leading spaces\n'>/expected
|
|
printf $' \t Leading spaces\n' | systemd-cat -t "$ID" --level-prefix false
|
|
journalctl --sync
|
|
journalctl -b -o cat -t "$ID" >/output
|
|
cmp /expected /output
|
|
|
|
# Don't lose streams on restart
|
|
systemctl start forever-print-hola
|
|
sleep 3
|
|
systemctl restart systemd-journald
|
|
sleep 3
|
|
systemctl stop forever-print-hola
|
|
[[ ! -f "/i-lose-my-logs" ]]
|
|
|
|
# https://github.com/systemd/systemd/issues/4408
|
|
rm -f /i-lose-my-logs
|
|
systemctl start forever-print-hola
|
|
sleep 3
|
|
systemctl kill --signal=SIGKILL systemd-journald
|
|
sleep 3
|
|
[[ ! -f "/i-lose-my-logs" ]]
|
|
|
|
touch /testok
|