summaryrefslogtreecommitdiffstats
path: root/tests/imtcp-listen-port-file-2.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/imtcp-listen-port-file-2.sh')
-rwxr-xr-xtests/imtcp-listen-port-file-2.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/imtcp-listen-port-file-2.sh b/tests/imtcp-listen-port-file-2.sh
new file mode 100755
index 0000000..1508536
--- /dev/null
+++ b/tests/imtcp-listen-port-file-2.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+# This test checks if more than one port file names work correctly for
+# imtcp. See also:
+# https://github.com/rsyslog/rsyslog/issues/3817
+# added 2019-08-14 by Rgerhards
+# This file is part of the rsyslog project, released under ASL 2.0
+. ${srcdir:=.}/diag.sh init
+generate_conf
+add_conf '
+template(name="outfmt" type="string" string="%msg:F,58:2%\n")
+module(load="../plugins/imtcp/.libs/imtcp")
+input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.rcvr_port"
+ ruleset="rs1")
+input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.rcvr_port2"
+ ruleset="rs2")
+
+ruleset(name="rs1") {
+ action(type="omfile" file="'$RSYSLOG_DYNNAME.1.log'" template="outfmt")
+}
+
+ruleset(name="rs2") {
+ action(type="omfile" file="'$RSYSLOG_DYNNAME.2.log'" template="outfmt")
+}
+'
+startup
+assign_file_content RCVR_PORT "$RSYSLOG_DYNNAME.rcvr_port"
+assign_file_content RCVR_PORT2 "$RSYSLOG_DYNNAME.rcvr_port2"
+./tcpflood -p $RCVR_PORT -m10
+./tcpflood -p $RCVR_PORT2 -m10 -i10
+shutdown_when_empty
+wait_shutdown
+printf 'checking receiver 1\n'
+export SEQ_CHECK_FILE="$RSYSLOG_DYNNAME.1.log"
+seq_check 0 9
+printf 'checking receiver 2\n'
+export SEQ_CHECK_FILE="$RSYSLOG_DYNNAME.2.log"
+seq_check 10 19
+exit_test