5808e7
From e019afeefb396ea42d03f4c3f9713e262aff6450 Mon Sep 17 00:00:00 2001
5808e7
From: Benjamin Robin <dev@benjarobin.fr>
5808e7
Date: Wed, 6 May 2020 23:28:02 +0200
5808e7
Subject: [PATCH] test: Add a test case for #15654
5808e7
5808e7
(cherry picked from commit c11d8fd1dab3bc3f0abbc861ba5eb34518cec1da)
5808e7
5808e7
Related: #2029426
5808e7
---
5808e7
 test/TEST-04-JOURNAL/test-journal.sh | 11 +++++++++++
5808e7
 1 file changed, 11 insertions(+)
5808e7
5808e7
diff --git a/test/TEST-04-JOURNAL/test-journal.sh b/test/TEST-04-JOURNAL/test-journal.sh
5808e7
index a3db1a7472..bdf137cd69 100755
5808e7
--- a/test/TEST-04-JOURNAL/test-journal.sh
5808e7
+++ b/test/TEST-04-JOURNAL/test-journal.sh
5808e7
@@ -76,6 +76,17 @@ journalctl -b -o export -t "$ID" --output-fields=_PID | grep '^_PID=' >/output
5808e7
 grep -q "^_PID=$PID" /output
5808e7
 grep -vq "^_PID=$PID" /output
5808e7
 
5808e7
+# https://github.com/systemd/systemd/issues/15654
5808e7
+ID=$(journalctl --new-id128 | sed -n 2p)
5808e7
+printf "This will\nusually fail\nand be truncated\n">/expected
5808e7
+systemd-cat -t "$ID" /bin/sh -c 'env echo -n "This will";echo;env echo -n "usually fail";echo;env echo -n "and be truncated";echo;'
5808e7
+journalctl --sync
5808e7
+journalctl -b -o cat -t "$ID" >/output
5808e7
+cmp /expected /output
5808e7
+
5808e7
+# Add new tests before here, the journald restarts below
5808e7
+# may make tests flappy.
5808e7
+
5808e7
 # Don't lose streams on restart
5808e7
 systemctl start forever-print-hola
5808e7
 sleep 3