]>
Commit | Line | Data |
---|---|---|
1c36b4a7 EV |
1 | #!/bin/bash |
2 | ||
3 | set -x | |
4 | set -e | |
5 | set -o pipefail | |
6 | ||
7 | # Test stdout stream | |
8 | ||
9 | # Skip empty lines | |
10 | ID=$(journalctl --new-id128 | sed -n 2p) | |
11 | >/expected | |
12 | printf $'\n\n\n' | systemd-cat -t "$ID" --level-prefix false | |
e8e5a6e2 | 13 | journalctl --sync |
1c36b4a7 EV |
14 | journalctl -b -o cat -t "$ID" >/output |
15 | cmp /expected /output | |
16 | ||
17 | ID=$(journalctl --new-id128 | sed -n 2p) | |
18 | >/expected | |
19 | printf $'<5>\n<6>\n<7>\n' | systemd-cat -t "$ID" --level-prefix true | |
e8e5a6e2 | 20 | journalctl --sync |
1c36b4a7 EV |
21 | journalctl -b -o cat -t "$ID" >/output |
22 | cmp /expected /output | |
23 | ||
45d39b4f EV |
24 | # Remove trailing spaces |
25 | ID=$(journalctl --new-id128 | sed -n 2p) | |
26 | printf "Trailing spaces\n">/expected | |
27 | printf $'<5>Trailing spaces \t \n' | systemd-cat -t "$ID" --level-prefix true | |
e8e5a6e2 | 28 | journalctl --sync |
45d39b4f EV |
29 | journalctl -b -o cat -t "$ID" >/output |
30 | cmp /expected /output | |
31 | ||
32 | ID=$(journalctl --new-id128 | sed -n 2p) | |
33 | printf "Trailing spaces\n">/expected | |
34 | printf $'Trailing spaces \t \n' | systemd-cat -t "$ID" --level-prefix false | |
e8e5a6e2 | 35 | journalctl --sync |
45d39b4f EV |
36 | journalctl -b -o cat -t "$ID" >/output |
37 | cmp /expected /output | |
38 | ||
39 | # Don't remove leading spaces | |
40 | ID=$(journalctl --new-id128 | sed -n 2p) | |
41 | printf $' \t Leading spaces\n'>/expected | |
42 | printf $'<5> \t Leading spaces\n' | systemd-cat -t "$ID" --level-prefix true | |
e8e5a6e2 | 43 | journalctl --sync |
45d39b4f EV |
44 | journalctl -b -o cat -t "$ID" >/output |
45 | cmp /expected /output | |
46 | ||
47 | ID=$(journalctl --new-id128 | sed -n 2p) | |
48 | printf $' \t Leading spaces\n'>/expected | |
49 | printf $' \t Leading spaces\n' | systemd-cat -t "$ID" --level-prefix false | |
e8e5a6e2 | 50 | journalctl --sync |
45d39b4f EV |
51 | journalctl -b -o cat -t "$ID" >/output |
52 | cmp /expected /output | |
53 | ||
3889613e EV |
54 | # Don't lose streams on restart |
55 | systemctl start forever-print-hola | |
56 | sleep 3 | |
57 | systemctl restart systemd-journald | |
58 | sleep 3 | |
59 | systemctl stop forever-print-hola | |
60 | [[ ! -f "/i-lose-my-logs" ]] | |
61 | ||
1c36b4a7 EV |
62 | touch /testok |
63 | exit 0 |