summaryrefslogtreecommitdiffstats
path: root/tests/imfile-endregex-timeout-none.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-endregex-timeout-none.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 'tests/imfile-endregex-timeout-none.sh')
-rwxr-xr-xtests/imfile-endregex-timeout-none.sh54
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/imfile-endregex-timeout-none.sh b/tests/imfile-endregex-timeout-none.sh
new file mode 100755
index 0000000..7554c27
--- /dev/null
+++ b/tests/imfile-endregex-timeout-none.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+# This is part of the rsyslog testbench, licensed under ASL 2.0
+echo ======================================================================
+echo [imfile-endregex-timeout-none.sh]
+. ${srcdir:=.}/diag.sh init
+. $srcdir/diag.sh check-inotify
+mkdir "$RSYSLOG_DYNNAME.work"
+generate_conf
+add_conf '
+global(workDirectory="./'"$RSYSLOG_DYNNAME"'.work")
+module(load="../plugins/imfile/.libs/imfile")
+input(type="imfile"
+ File="./'$RSYSLOG_DYNNAME'.input"
+ Tag="file:"
+ PersistStateInterval="1"
+ startmsg.regex="^[^ ]")
+template(name="outfmt" type="list") {
+ constant(value="HEADER ")
+ property(name="msg" format="json")
+ constant(value="\n")
+}
+if $msg contains "msgnum:" then
+ action(
+ type="omfile"
+ file=`echo $RSYSLOG_OUT_LOG`
+ template="outfmt"
+ )
+'
+startup
+
+# we need to sleep a bit between writes to give imfile a chance
+# to pick up the data (IN MULTIPLE ITERATIONS!)
+echo 'msgnum:0
+ msgnum:1' > $RSYSLOG_DYNNAME.input
+./msleep 5000 # wait 5 seconds - this shall cause a timeout
+echo ' msgnum:2
+ msgnum:3' >> $RSYSLOG_DYNNAME.input
+# the next line terminates our test. It is NOT written to the output file,
+# as imfile waits whether or not there is a follow-up line that it needs
+# to combine.
+echo 'END OF TEST' >> $RSYSLOG_DYNNAME.input
+./msleep 200
+
+shutdown_when_empty # shut down rsyslogd when done processing messages
+wait_shutdown # we need to wait until rsyslogd is finished!
+
+printf 'HEADER msgnum:0\\\\n msgnum:1\\\\n msgnum:2\\\\n msgnum:3\n' | cmp - $RSYSLOG_OUT_LOG
+if [ ! $? -eq 0 ]; then
+ echo "invalid multiline message generated, $RSYSLOG_OUT_LOG is:"
+ cat $RSYSLOG_OUT_LOG
+ exit 1
+fi;
+
+exit_test