dryang / rpms / systemd

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