naccyde / rpms / systemd

Forked from rpms/systemd 11 months ago
Clone
55853a
From 0d93b2275f5c93148f509de28cefcf3b7cabc0c7 Mon Sep 17 00:00:00 2001
55853a
From: Evgeny Vereshchagin <evvers@ya.ru>
55853a
Date: Wed, 30 Dec 2015 03:33:43 +0000
55853a
Subject: [PATCH] tests: add regression test for `systemctl restart
55853a
 systemd-journald`
55853a
55853a
See https://github.com/systemd/systemd/issues/2236
55853a
55853a
(cherry picked from commit 3889613ec6bc54b9e02955f62b9d5c5b571c3d4b)
55853a
(cherry picked from commit 4dc893c03fe9c56a3d3070fb8583f5584014aa49)
55853a
(cherry picked from commit 5c1904dbd1bd3301ce797d2764571b3e3669bec2)
55853a
Related: #1798162
55853a
---
55853a
 test/TEST-04-JOURNAL/test-journal.sh | 8 ++++++++
55853a
 test/TEST-04-JOURNAL/test.sh         | 9 +++++++++
55853a
 2 files changed, 17 insertions(+)
55853a
55853a
diff --git a/test/TEST-04-JOURNAL/test-journal.sh b/test/TEST-04-JOURNAL/test-journal.sh
55853a
index c75f396ceb..701b0cf724 100755
55853a
--- a/test/TEST-04-JOURNAL/test-journal.sh
55853a
+++ b/test/TEST-04-JOURNAL/test-journal.sh
55853a
@@ -14,5 +14,13 @@ journalctl --flush
55853a
 journalctl -b -o cat -t "$ID" >/output
55853a
 cmp /expected /output
55853a
 
55853a
+# Don't lose streams on restart
55853a
+systemctl start forever-print-hola
55853a
+sleep 3
55853a
+systemctl restart systemd-journald
55853a
+sleep 3
55853a
+systemctl stop forever-print-hola
55853a
+[[ ! -f "/i-lose-my-logs" ]]
55853a
+
55853a
 touch /testok
55853a
 exit 0
55853a
diff --git a/test/TEST-04-JOURNAL/test.sh b/test/TEST-04-JOURNAL/test.sh
55853a
index e37cb7d412..6aea67ba4e 100755
55853a
--- a/test/TEST-04-JOURNAL/test.sh
55853a
+++ b/test/TEST-04-JOURNAL/test.sh
55853a
@@ -55,6 +55,15 @@ After=multi-user.target
55853a
 [Service]
55853a
 ExecStart=/test-journal.sh
55853a
 Type=oneshot
55853a
+EOF
55853a
+
55853a
+        cat >$initdir/etc/systemd/system/forever-print-hola.service <
55853a
+[Unit]
55853a
+Description=ForeverPrintHola service
55853a
+
55853a
+[Service]
55853a
+Type=simple
55853a
+ExecStart=/bin/sh -x -c 'while :; do printf "Hola\n" || touch /i-lose-my-logs; sleep 1; done'
55853a
 EOF
55853a
 
55853a
         cp test-journal.sh $initdir/