summaryrefslogtreecommitdiffstats
path: root/tests/imfile-basic-2GB-file.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
commitdcc721a95bef6f0d8e6d8775b8efe33e5aecd562 (patch)
tree66a2774cd0ee294d019efd71d2544c70f42b2842 /tests/imfile-basic-2GB-file.sh
parentInitial commit. (diff)
downloadrsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.tar.xz
rsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.zip
Adding upstream version 8.2402.0.upstream/8.2402.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xtests/imfile-basic-2GB-file.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/imfile-basic-2GB-file.sh b/tests/imfile-basic-2GB-file.sh
new file mode 100755
index 0000000..d6b40d1
--- /dev/null
+++ b/tests/imfile-basic-2GB-file.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+# written 2018-11-09 by Rainer Gerhards
+# this test checks that 2GiB (31 bit) file size region is handled correctly
+# it first generates a file that is 2GiB-64 bytes, processes it, and then
+# adds a couple of messages to get it over 2GiB.
+# This is part of the rsyslog testbench, licensed under ASL 2.0
+. ${srcdir:=.}/diag.sh init
+export TB_TEST_MAX_RUNTIME=3600 # test is very slow as it works on large files
+generate_conf
+add_conf '
+module(load="../plugins/imfile/.libs/imfile")
+input(type="imfile" File="./'$RSYSLOG_DYNNAME'.input" Tag="file:")
+
+$template outfmt,"%msg:F,58:2%\n"
+:msg, contains, "msgnum:" action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt")
+'
+touch $RSYSLOG_DYNNAME.input
+startup
+
+# initial file: 2GiB - 1 message (54 byte)
+./inputfilegen -s 2147483584 -d47 -M $RSYSLOG_DYNNAME.msgcnt > $RSYSLOG_DYNNAME.input
+ls -lh $RSYSLOG_DYNNAME.input
+export NUMMESSAGES="$(cat $RSYSLOG_DYNNAME.msgcnt)"
+
+wait_file_lines --delay 2500 --abort-on-oversize "$RSYSLOG_OUT_LOG" $NUMMESSAGES 3000
+
+# add one message --> exactly 2GB
+./inputfilegen -m1 -d47 -i$NUMMESSAGES>> $RSYSLOG_DYNNAME.input
+ls -lh $RSYSLOG_DYNNAME.input
+(( NUMMESSAGES++ ))
+wait_file_lines --abort-on-oversize "$RSYSLOG_OUT_LOG" $NUMMESSAGES
+
+# add one more message --> now we go over 2GB
+./inputfilegen -m1 -d47 -i$NUMMESSAGES>> $RSYSLOG_DYNNAME.input
+ls -lh $RSYSLOG_DYNNAME.input
+(( NUMMESSAGES++ ))
+wait_file_lines --abort-on-oversize "$RSYSLOG_OUT_LOG" $NUMMESSAGES
+
+# add even more messages
+./inputfilegen -m10000 -d47 -i$NUMMESSAGES>> $RSYSLOG_DYNNAME.input
+ls -lh $RSYSLOG_DYNNAME.input
+NUMMESSAGES=$(( NUMMESSAGES + 10000 ))
+wait_file_lines --abort-on-oversize "$RSYSLOG_OUT_LOG" $NUMMESSAGES
+
+shutdown_when_empty
+wait_shutdown
+seq_check 0 $(( NUMMESSAGES - 1))
+exit_test