From e7848266dae240abe64aba1b1086ba8025ae50ad Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Tue, 15 Jun 2021 15:34:41 +0900 Subject: [PATCH] test: add a testcase for issue #19895 --- test/test-functions | 1 + test/units/testsuite-04.sh | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/test/test-functions b/test/test-functions index aada33611c..f9f9d6a9e6 100644 --- a/test/test-functions +++ b/test/test-functions @@ -104,6 +104,7 @@ fi BASICTOOLS=( awk + base64 basename bash busybox diff --git a/test/units/testsuite-04.sh b/test/units/testsuite-04.sh index 7a17e08611..4f009b4c45 100755 --- a/test/units/testsuite-04.sh +++ b/test/units/testsuite-04.sh @@ -2,6 +2,21 @@ set -eux set -o pipefail +# Limit the maximum journal size +trap "journalctl --rotate --vacuum-size=16M" EXIT + +# Rotation/flush test, see https://github.com/systemd/systemd/issues/19895 +journalctl --relinquish-var +for i in {0..50}; do + dd if=/dev/urandom bs=1M count=1 | base64 | systemd-cat +done +journalctl --rotate +journalctl --flush +journalctl --sync + +# Reset the ratelimit buckets for the subsequent tests below. +systemctl restart systemd-journald + # Test stdout stream # Skip empty lines