|
|
5808e7 |
From afcfb65ce7514bf32e59e0b9d212ae18d023a4b5 Mon Sep 17 00:00:00 2001
|
|
|
5808e7 |
From: Benjamin Robin <dev@benjarobin.fr>
|
|
|
5808e7 |
Date: Sat, 9 May 2020 12:01:07 +0200
|
|
|
5808e7 |
Subject: [PATCH] test: Stricter test case for #15654 (Add more checks)
|
|
|
5808e7 |
|
|
|
5808e7 |
Check:
|
|
|
5808e7 |
- There is only 3 messages logged with type stdout
|
|
|
5808e7 |
- Check all messages logged does not have new line: LINE_BREAK=eof
|
|
|
5808e7 |
- Check that the 3 messages are logged from a different PID
|
|
|
5808e7 |
- Check the 3 MESSAGE= content
|
|
|
5808e7 |
(cherry picked from commit d38b3b74dbde2d65b23e5963354c3db96acd3420)
|
|
|
5808e7 |
|
|
|
5808e7 |
Related: #2029426
|
|
|
5808e7 |
---
|
|
|
5808e7 |
test/TEST-04-JOURNAL/test-journal.sh | 4 ++++
|
|
|
5808e7 |
1 file changed, 4 insertions(+)
|
|
|
5808e7 |
|
|
|
5808e7 |
diff --git a/test/TEST-04-JOURNAL/test-journal.sh b/test/TEST-04-JOURNAL/test-journal.sh
|
|
|
5808e7 |
index bdf137cd69..641259ce24 100755
|
|
|
5808e7 |
--- a/test/TEST-04-JOURNAL/test-journal.sh
|
|
|
5808e7 |
+++ b/test/TEST-04-JOURNAL/test-journal.sh
|
|
|
5808e7 |
@@ -83,6 +83,10 @@ systemd-cat -t "$ID" /bin/sh -c 'env echo -n "This will";echo;env echo -n "usual
|
|
|
5808e7 |
journalctl --sync
|
|
|
5808e7 |
journalctl -b -o cat -t "$ID" >/output
|
|
|
5808e7 |
cmp /expected /output
|
|
|
5808e7 |
+[[ $(journalctl -b -o export -t "$ID" --output-fields=_TRANSPORT | grep -Pc "^_TRANSPORT=stdout$") -eq 3 ]]
|
|
|
5808e7 |
+[[ $(journalctl -b -o export -t "$ID" --output-fields=_LINE_BREAK | grep -Pc "^_LINE_BREAK=pid-change$") -eq 3 ]]
|
|
|
5808e7 |
+[[ $(journalctl -b -o export -t "$ID" --output-fields=_PID | sort -u | grep -c "^_PID=.*$") -eq 3 ]]
|
|
|
5808e7 |
+[[ $(journalctl -b -o export -t "$ID" --output-fields=MESSAGE | grep -Pc "^MESSAGE=(This will|usually fail|and be truncated)$") -eq 3 ]]
|
|
|
5808e7 |
|
|
|
5808e7 |
# Add new tests before here, the journald restarts below
|
|
|
5808e7 |
# may make tests flappy.
|