summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-08-11 15:06:50 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2010-08-11 15:06:50 +0200
commit809ed1768b83bc0c5392f943f4820523494e8285 (patch)
tree5f8f3b8e27e70d3ecf7190876cba9c2c7489135a /tests
parent4bf834bad6640b5670959ce0c21557bf5923bb2b (diff)
downloadrsyslog-809ed1768b83bc0c5392f943f4820523494e8285.tar.gz
rsyslog-809ed1768b83bc0c5392f943f4820523494e8285.tar.xz
rsyslog-809ed1768b83bc0c5392f943f4820523494e8285.zip
imptcp: added $InputPTCPServerAddtlFrameDelimiter directive
also improved testbench
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am6
-rwxr-xr-xtests/imptcp_addtlframedelim.sh14
-rwxr-xr-xtests/imtcp_addtlframedelim.sh14
-rw-r--r--tests/tcpflood.c14
-rw-r--r--tests/testsuites/imptcp_addtlframedelim.conf13
-rw-r--r--tests/testsuites/imtcp_addtlframedelim.conf13
6 files changed, 69 insertions, 5 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b500bc85..8b75a9f2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -9,8 +9,10 @@ TESTS = $(TESTRUNS) cfg.sh \
manytcp.sh \
manyptcp.sh \
imptcp_large.sh \
+ imptcp_addtlframedelim.sh \
imptcp_conndrop.sh \
imtcp_conndrop.sh \
+ imtcp_addtlframedelim.sh \
sndrcv.sh \
sndrcv_gzip.sh \
asynwr_simple.sh \
@@ -144,10 +146,14 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/manyptcp.conf \
imptcp_large.sh \
testsuites/imptcp_large.conf \
+ imptcp_addtlframedelim.sh \
+ testsuites/imptcp_addtlframedelim.conf \
imptcp_conndrop.sh \
testsuites/imptcp_conndrop.conf \
imtcp_conndrop.sh \
testsuites/imtcp_conndrop.conf \
+ imtcp_addtlframedelim.sh \
+ testsuites/imtcp_addtlframedelim.conf \
inputname.sh \
testsuites/inputname_imtcp.conf \
testsuites/1.inputname_imtcp_12514 \
diff --git a/tests/imptcp_addtlframedelim.sh b/tests/imptcp_addtlframedelim.sh
new file mode 100755
index 00000000..b26fc85b
--- /dev/null
+++ b/tests/imptcp_addtlframedelim.sh
@@ -0,0 +1,14 @@
+# added 2010-08-11 by Rgerhards
+#
+# This file is part of the rsyslog project, released under GPLv3
+echo ====================================================================================
+echo TEST: \[imptcp_addtlframedelim.sh\]: test imptcp additional frame delimiter
+cat rsyslog.action.1.include
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup imptcp_addtlframedelim.conf
+source $srcdir/diag.sh tcpflood -m20000 -F0 -P129
+#sleep 2 # due to large messages, we need this time for the tcp receiver to settle...
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown # and wait for it to terminate
+source $srcdir/diag.sh seq-check 0 19999
+source $srcdir/diag.sh exit
diff --git a/tests/imtcp_addtlframedelim.sh b/tests/imtcp_addtlframedelim.sh
new file mode 100755
index 00000000..8de7ca58
--- /dev/null
+++ b/tests/imtcp_addtlframedelim.sh
@@ -0,0 +1,14 @@
+# added 2010-08-11 by Rgerhards
+#
+# This file is part of the rsyslog project, released under GPLv3
+echo ====================================================================================
+echo TEST: \[imtcp_addtlframedelim.sh\]: test imtcp additional frame delimiter
+cat rsyslog.action.1.include
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup imtcp_addtlframedelim.conf
+source $srcdir/diag.sh tcpflood -m20000 -F0 -P129
+#sleep 2 # due to large messages, we need this time for the tcp receiver to settle...
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown # and wait for it to terminate
+source $srcdir/diag.sh seq-check 0 19999
+source $srcdir/diag.sh exit
diff --git a/tests/tcpflood.c b/tests/tcpflood.c
index ee43449e..f3aa4e7f 100644
--- a/tests/tcpflood.c
+++ b/tests/tcpflood.c
@@ -30,6 +30,7 @@
* (C like cycle, running out of meaningful option switches ;))
* -D randomly drop and re-establish connections. Useful for stress-testing
* the TCP receiver.
+ * -F USASCII value for frame delimiter (in octet-stuffing mode), default LF
*
* Part of the testbench for rsyslog.
*
@@ -89,6 +90,7 @@ static char *MsgToSend = NULL; /* if non-null, this is the actual message to sen
static int bBinaryFile = 0; /* is -I file binary */
static char *dataFile = NULL; /* name of data file, if NULL, generate own data */
static int numFileIterations = 1;/* how often is file data to be sent? */
+static char frameDelim = '\n'; /* default frame delimiter */
FILE *dataFP = NULL; /* file pointer for data file, if used */
static long nConnDrops = 0; /* counter: number of time connection was dropped (-D option) */
@@ -242,8 +244,8 @@ genMsg(char *buf, size_t maxBuf, int *pLenBuf)
snprintf(dynFileIDBuf, maxBuf, "%d:", rand() % dynFileIDs);
}
if(extraDataLen == 0) {
- *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:\n",
- msgPRI, dynFileIDBuf, msgNum);
+ *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%c",
+ msgPRI, dynFileIDBuf, msgNum, frameDelim);
} else {
if(bRandomizeExtraData)
edLen = ((long) rand() + extraDataLen) % extraDataLen + 1;
@@ -251,8 +253,8 @@ genMsg(char *buf, size_t maxBuf, int *pLenBuf)
edLen = extraDataLen;
memset(extraData, 'X', edLen);
extraData[edLen] = '\0';
- *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%d:%s\n",
- msgPRI, dynFileIDBuf, msgNum, edLen, extraData);
+ *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%d:%s%c",
+ msgPRI, dynFileIDBuf, msgNum, edLen, extraData, frameDelim);
}
} else {
/* use fixed message format from command line */
@@ -368,7 +370,7 @@ int main(int argc, char *argv[])
if(!isatty(1))
bShowProgress = 0;
- while((opt = getopt(argc, argv, "f:t:p:c:C:m:i:I:P:d:Dn:M:rB")) != -1) {
+ while((opt = getopt(argc, argv, "f:F:t:p:c:C:m:i:I:P:d:Dn:M:rB")) != -1) {
switch (opt) {
case 't': targetIP = optarg;
break;
@@ -399,6 +401,8 @@ int main(int argc, char *argv[])
break;
case 'f': dynFileIDs = atoi(optarg);
break;
+ case 'F': frameDelim = atoi(optarg);
+ break;
case 'M': MsgToSend = optarg;
break;
case 'I': dataFile = optarg;
diff --git a/tests/testsuites/imptcp_addtlframedelim.conf b/tests/testsuites/imptcp_addtlframedelim.conf
new file mode 100644
index 00000000..eb7ed0c4
--- /dev/null
+++ b/tests/testsuites/imptcp_addtlframedelim.conf
@@ -0,0 +1,13 @@
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imptcp/.libs/imptcp
+$MainMsgQueueTimeoutShutdown 10000
+$InputPTCPServerAddtlFrameDelimiter 0
+$InputPTCPServerRun 13514
+
+$template outfmt,"%msg:F,58:2%\n"
+$OMFileFlushOnTXEnd off
+$OMFileFlushInterval 2
+$OMFileIOBufferSize 256k
+$IncludeConfig rsyslog.action.1.include
+local0.* ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/imtcp_addtlframedelim.conf b/tests/testsuites/imtcp_addtlframedelim.conf
new file mode 100644
index 00000000..3b4759c5
--- /dev/null
+++ b/tests/testsuites/imtcp_addtlframedelim.conf
@@ -0,0 +1,13 @@
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+$MainMsgQueueTimeoutShutdown 10000
+$InputTCPServerAddtlFrameDelimiter 0
+$InputTCPServerRun 13514
+
+$template outfmt,"%msg:F,58:2%\n"
+$OMFileFlushOnTXEnd off
+$OMFileFlushInterval 2
+$OMFileIOBufferSize 256k
+$IncludeConfig rsyslog.action.1.include
+local0.* ./rsyslog.out.log;outfmt