summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am234
-rwxr-xr-xtests/arrayqueue.sh18
-rw-r--r--tests/bad_qi/dbq.qi29
-rwxr-xr-xtests/badqi.sh16
-rwxr-xr-xtests/cfg.sh1
-rwxr-xr-xtests/da-mainmsg-q.sh33
-rwxr-xr-xtests/daqueue-persist-drvr.sh36
-rwxr-xr-xtests/daqueue-persist.sh12
-rwxr-xr-xtests/diag.sh76
-rw-r--r--tests/diagtalker.c9
-rwxr-xr-xtests/dircreate_dflt.sh20
-rwxr-xr-xtests/dircreate_off.sh20
-rwxr-xr-xtests/discard-allmark-vg.sh13
-rwxr-xr-xtests/discard-allmark.sh10
-rwxr-xr-xtests/discard-rptdmsg-vg.sh13
-rwxr-xr-xtests/discard-rptdmsg.sh10
-rwxr-xr-xtests/discard.sh17
-rwxr-xr-xtests/diskqueue-fsync.sh4
-rwxr-xr-xtests/diskqueue.sh2
-rwxr-xr-xtests/execonlyonce.sh1
-rwxr-xr-xtests/execonlywhenprevsuspended.sh13
-rwxr-xr-xtests/execonlywhenprevsuspended2.sh17
-rwxr-xr-xtests/execonlywhenprevsuspended3.sh17
-rwxr-xr-xtests/execonlywhenprevsuspended4.sh16
-rwxr-xr-xtests/failover-async.sh12
-rwxr-xr-xtests/failover-basic-vg.sh13
-rwxr-xr-xtests/failover-basic.sh12
-rwxr-xr-xtests/failover-double.sh12
-rwxr-xr-xtests/failover-no-basic-vg.sh20
-rwxr-xr-xtests/failover-no-basic.sh19
-rwxr-xr-xtests/failover-no-rptd-vg.sh20
-rwxr-xr-xtests/failover-no-rptd.sh19
-rwxr-xr-xtests/failover-rptd-vg.sh13
-rwxr-xr-xtests/failover-rptd.sh12
-rwxr-xr-xtests/fieldtest.sh2
-rwxr-xr-xtests/imfile-basic-vg.sh15
-rwxr-xr-xtests/imtcp_conndrop.sh4
-rwxr-xr-xtests/imuxsock_ccmiddle_root.sh18
-rwxr-xr-xtests/imuxsock_logger_root.sh18
-rwxr-xr-xtests/imuxsock_traillf_root.sh18
-rwxr-xr-xtests/inputname.sh2
-rwxr-xr-xtests/libdbi-asyn.sh13
-rwxr-xr-xtests/libdbi-basic-vg.sh16
-rwxr-xr-xtests/libdbi-basic.sh13
-rwxr-xr-xtests/linkedlistqueue.sh17
-rwxr-xr-xtests/manytcp-too-few-tls.sh19
-rwxr-xr-xtests/manytcp.sh1
-rwxr-xr-xtests/mysql-asyn-vg.sh14
-rwxr-xr-xtests/mysql-asyn.sh13
-rwxr-xr-xtests/mysql-basic-vg.sh14
-rwxr-xr-xtests/mysql-basic.sh13
-rw-r--r--tests/nettester.c43
-rwxr-xr-xtests/omod-if-array.sh2
-rwxr-xr-xtests/omruleset-queue.sh19
-rwxr-xr-xtests/omruleset.sh22
-rwxr-xr-xtests/parsertest.sh8
-rwxr-xr-xtests/pipe_noreader.sh29
-rwxr-xr-xtests/pmlastmsg.sh6
-rwxr-xr-xtests/proprepltest.sh2
-rwxr-xr-xtests/queue-persist-drvr.sh1
-rwxr-xr-xtests/queue-persist.sh1
-rwxr-xr-xtests/rcvr_fail_restore.sh122
-rw-r--r--tests/resultdata/imuxsock_ccmiddle.log1
-rw-r--r--tests/resultdata/imuxsock_logger.log1
-rw-r--r--tests/resultdata/imuxsock_traillf.log1
-rw-r--r--tests/rt-init.c1
-rwxr-xr-xtests/rulesetmultiqueue.sh33
-rw-r--r--tests/runtime-dummy.c3
-rwxr-xr-xtests/sndrcv_drvr.sh50
-rwxr-xr-xtests/sndrcv_drvr_noexit.sh49
-rwxr-xr-xtests/sndrcv_failover.sh21
-rwxr-xr-xtests/sndrcv_omudpspoof.sh10
-rwxr-xr-xtests/sndrcv_omudpspoof_nonstdpt.sh10
-rwxr-xr-xtests/sndrcv_udp.sh10
-rwxr-xr-xtests/sndrcv_udp_nonstdpt.sh10
-rw-r--r--tests/syslog_caller.c75
-rw-r--r--tests/syslog_inject.c28
-rwxr-xr-xtests/tabescape_dflt.sh14
-rwxr-xr-xtests/tabescape_off.sh14
-rwxr-xr-xtests/tcp-msgreduc-vg.sh16
-rw-r--r--tests/tcpflood.c615
-rw-r--r--tests/testconfgen.c72
-rw-r--r--tests/testsuites/1.tabescape_dflt3
-rw-r--r--tests/testsuites/1.tabescape_off3
-rw-r--r--tests/testsuites/4.parse14
-rw-r--r--tests/testsuites/8bit.parse12
-rw-r--r--tests/testsuites/8bit.parse_8bit_escape2
-rw-r--r--tests/testsuites/arrayqueue.conf14
-rw-r--r--tests/testsuites/badqi.conf15
-rw-r--r--tests/testsuites/da-mainmsg-q.conf21
-rw-r--r--tests/testsuites/diag-common.conf5
-rw-r--r--tests/testsuites/dircreate_dflt.conf11
-rw-r--r--tests/testsuites/dircreate_off.conf12
-rw-r--r--tests/testsuites/discard-allmark.conf15
-rw-r--r--tests/testsuites/discard-rptdmsg.conf15
-rw-r--r--tests/testsuites/discard.conf13
-rw-r--r--tests/testsuites/empty.parse13
-rw-r--r--tests/testsuites/execonlywhenprevsuspended.conf13
-rw-r--r--tests/testsuites/execonlywhenprevsuspended2.conf19
-rw-r--r--tests/testsuites/execonlywhenprevsuspended3.conf18
-rw-r--r--tests/testsuites/execonlywhenprevsuspended4.conf15
-rw-r--r--tests/testsuites/failover-async.conf9
-rw-r--r--tests/testsuites/failover-basic.conf8
-rw-r--r--tests/testsuites/failover-double.conf9
-rw-r--r--tests/testsuites/failover-no-basic.conf9
-rw-r--r--tests/testsuites/failover-no-rptd.conf9
-rw-r--r--tests/testsuites/failover-rptd.conf10
-rw-r--r--tests/testsuites/imuxsock_ccmiddle_root.conf7
-rw-r--r--tests/testsuites/imuxsock_logger_root.conf7
-rw-r--r--tests/testsuites/imuxsock_traillf_root.conf7
-rw-r--r--tests/testsuites/libdbi-asyn.conf12
-rw-r--r--tests/testsuites/libdbi-basic.conf9
-rw-r--r--tests/testsuites/linkedlistqueue.conf16
-rw-r--r--tests/testsuites/malformed1.parse16
-rw-r--r--tests/testsuites/manytcp-too-few-tls.conf22
-rw-r--r--tests/testsuites/mark.parse17
-rw-r--r--tests/testsuites/master.pmlastmsg28
-rw-r--r--tests/testsuites/mysql-asyn.conf5
-rw-r--r--tests/testsuites/mysql-basic.conf4
-rw-r--r--tests/testsuites/mysql-select-msg.sql2
-rw-r--r--tests/testsuites/mysql-truncate.sql2
-rw-r--r--tests/testsuites/omruleset-queue.conf20
-rw-r--r--tests/testsuites/omruleset.conf16
-rw-r--r--tests/testsuites/parse2.conf8
-rw-r--r--tests/testsuites/parse_8bit_escape.conf9
-rw-r--r--tests/testsuites/pipe_noreader.conf10
-rw-r--r--tests/testsuites/pmlastmsg.conf16
-rw-r--r--tests/testsuites/random.conf5
-rw-r--r--tests/testsuites/rcvr_fail_restore_rcvr.conf8
-rw-r--r--tests/testsuites/rcvr_fail_restore_sender.conf15
-rw-r--r--tests/testsuites/reallife.parse112
-rw-r--r--tests/testsuites/reallife.parse212
-rw-r--r--tests/testsuites/rfc5424-1.parse12
-rw-r--r--tests/testsuites/rfc5424-2.parse12
-rw-r--r--tests/testsuites/rulesetmultiqueue.conf34
-rw-r--r--tests/testsuites/sndrcv_failover_rcvr.conf11
-rw-r--r--tests/testsuites/sndrcv_failover_sender.conf13
-rw-r--r--tests/testsuites/sndrcv_omudpspoof_nonstdpt_rcvr.conf11
-rw-r--r--tests/testsuites/sndrcv_omudpspoof_nonstdpt_sender.conf18
-rw-r--r--tests/testsuites/sndrcv_omudpspoof_rcvr.conf11
-rw-r--r--tests/testsuites/sndrcv_omudpspoof_sender.conf17
-rw-r--r--tests/testsuites/sndrcv_sender.conf1
-rw-r--r--tests/testsuites/sndrcv_udp_nonstdpt_rcvr.conf11
-rw-r--r--tests/testsuites/sndrcv_udp_nonstdpt_sender.conf9
-rw-r--r--tests/testsuites/sndrcv_udp_rcvr.conf11
-rw-r--r--tests/testsuites/sndrcv_udp_sender.conf9
-rw-r--r--tests/testsuites/tabescape_dflt.conf8
-rw-r--r--tests/testsuites/tabescape_off.conf10
-rw-r--r--tests/testsuites/tcp-msgreduc-vg.conf10
-rwxr-xr-xtests/threadingmq.sh2
-rwxr-xr-xtests/threadingmqaq.sh2
-rwxr-xr-xtests/timestamp.sh2
-rwxr-xr-xtests/validation-run.sh1
153 files changed, 2852 insertions, 153 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d3871e3a..77381d2f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,21 +1,27 @@
if ENABLE_TESTBENCH
TESTRUNS = rt_init rscript
-check_PROGRAMS = $(TESTRUNS) ourtail nettester tcpflood chkseq msleep randomgen diagtalker uxsockrcvr inputfilegen
-TESTS = $(TESTRUNS) cfg.sh \
+check_PROGRAMS = $(TESTRUNS) ourtail nettester tcpflood chkseq msleep randomgen diagtalker uxsockrcvr syslog_caller syslog_inject inputfilegen
+TESTS = $(TESTRUNS) cfg.sh
+
+if ENABLE_IMDIAG
+TESTS += \
+ arrayqueue.sh \
+ da-mainmsg-q.sh \
validation-run.sh \
imtcp-multiport.sh \
+ daqueue-persist.sh \
diskqueue.sh \
diskqueue-fsync.sh \
+ rulesetmultiqueue.sh \
manytcp.sh \
rsf_getenv.sh \
- manyptcp.sh \
- imptcp_large.sh \
- imptcp_addtlframedelim.sh \
- imptcp_conndrop.sh \
imtcp_conndrop.sh \
imtcp_addtlframedelim.sh \
sndrcv.sh \
+ sndrcv_failover.sh \
sndrcv_gzip.sh \
+ sndrcv_udp.sh \
+ sndrcv_udp_nonstdpt.sh \
asynwr_simple.sh \
asynwr_timeout.sh \
asynwr_small.sh \
@@ -33,9 +39,81 @@ TESTS = $(TESTRUNS) cfg.sh \
complex1.sh \
queue-persist.sh \
pipeaction.sh \
- uxsock_simple.sh \
execonlyonce.sh \
- queue-persist.sh
+ execonlywhenprevsuspended.sh \
+ execonlywhenprevsuspended2.sh \
+ execonlywhenprevsuspended3.sh \
+ execonlywhenprevsuspended4.sh \
+ pipe_noreader.sh \
+ dircreate_dflt.sh \
+ dircreate_off.sh \
+ imuxsock_logger_root.sh \
+ imuxsock_traillf_root.sh \
+ imuxsock_ccmiddle_root.sh \
+ discard-rptdmsg.sh \
+ discard-allmark.sh \
+ discard.sh \
+ failover-async.sh \
+ failover-double.sh \
+ failover-basic.sh \
+ failover-rptd.sh \
+ failover-no-rptd.sh \
+ failover-no-basic.sh \
+ rcvr_fail_restore.sh \
+ linkedlistqueue.sh
+endif
+
+if HAVE_VALGRIND
+TESTS += \
+ discard-rptdmsg-vg.sh \
+ discard-allmark-vg.sh \
+ failover-basic-vg.sh \
+ failover-rptd-vg.sh \
+ failover-no-basic-vg.sh \
+ failover-no-rptd-vg.sh \
+ tcp-msgreduc-vg.sh
+endif
+
+
+if ENABLE_MYSQL_TESTS
+TESTS += \
+ mysql-basic.sh \
+ mysql-asyn.sh
+if ENABLE_OMLIBDBI
+TESTS += \
+ libdbi-basic.sh \
+ libdbi-asyn.sh
+endif
+if HAVE_VALGRIND
+TESTS += \
+ mysql-basic-vg.sh \
+ mysql-asyn-vg.sh
+endif
+endif
+
+if ENABLE_IMPTCP
+TESTS += \
+ manyptcp.sh \
+ imptcp_large.sh \
+ imptcp_addtlframedelim.sh \
+ imptcp_conndrop.sh
+endif
+
+if ENABLE_GNUTLS
+if HAVE_VALGRIND
+# This test does not work on v5 as we keep DH params
+#TESTS += manytcp-too-few-tls.sh
+endif
+endif
+
+if ENABLE_OMUXSOCK
+TESTS += uxsock_simple.sh
+endif
+
+if ENABLE_OMUDPSPOOF
+TESTS += sndrcv_omudpspoof.sh \
+ sndrcv_omudpspoof_nonstdpt.sh
+endif
if ENABLE_OMSTDOUT
TESTS += omod-if-array.sh \
@@ -45,15 +123,28 @@ TESTS += omod-if-array.sh \
inputname.sh \
threadingmq.sh \
threadingmqaq.sh \
+ badqi.sh \
+ tabescape_dflt.sh \
+ tabescape_off.sh \
fieldtest.sh
endif
+if ENABLE_OMRULESET
+if ENABLE_IMDIAG
+TESTS += omruleset.sh \
+ omruleset-queue.sh
+endif
+endif
+
if ENABLE_EXTENDED_TESTS
TESTS += random.sh
endif
if ENABLE_IMFILE
TESTS += imfile-basic.sh
+if HAVE_VALGRIND
+TESTS += imfile-basic-vg.sh
+endif
endif
endif # if ENABLE_TESTBENCH
@@ -102,11 +193,17 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/master.tspgsql \
testsuites/subsecond.conf \
testsuites/master.subsecond \
+ testsuites/parse_8bit_escape.conf \
+ testsuites/8bit.parse_8bit_escape \
testsuites/parse1.conf \
testsuites/field1.conf \
testsuites/1.parse1 \
testsuites/2.parse1 \
testsuites/3.parse1 \
+ testsuites/4.parse1 \
+ testsuites/mark.parse1 \
+ testsuites/8bit.parse1 \
+ testsuites/empty.parse1 \
testsuites/snare.parse1 \
testsuites/oversizeTag-1.parse1 \
testsuites/weird.parse1 \
@@ -120,6 +217,10 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/rfc5424-2.parse1 \
testsuites/rfc5424-3.parse1 \
testsuites/rfc5424-4.parse1 \
+ testsuites/malformed1.parse1 \
+ testsuites/reallife.parse1 \
+ testsuites/parse2.conf \
+ testsuites/reallife.parse2 \
testsuites/parse3.conf \
testsuites/reallife.parse3 \
testsuites/parse-nodate.conf \
@@ -142,6 +243,12 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/rsf_getenv.conf \
diskqueue.sh \
testsuites/diskqueue.conf \
+ arrayqueue.sh \
+ testsuites/arrayqueue.conf \
+ linkedlistqueue.sh \
+ testsuites/linkedlistqueue.conf \
+ da-mainmsg-q.sh \
+ testsuites/da-mainmsg-q.conf \
diskqueue-fsync.sh \
testsuites/diskqueue-fsync.conf \
imtcp-multiport.sh \
@@ -160,15 +267,46 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/imtcp_conndrop.conf \
imtcp_addtlframedelim.sh \
testsuites/imtcp_addtlframedelim.conf \
+ tcp-msgreduc-vg.sh \
+ testsuites/./tcp-msgreduc-vg.conf \
inputname.sh \
testsuites/inputname_imtcp.conf \
testsuites/1.inputname_imtcp_12514 \
testsuites/1.inputname_imtcp_12515 \
testsuites/1.inputname_imtcp_12516 \
omod-if-array.sh \
+ discard.sh \
+ testsuites/discard.conf \
+ failover-no-rptd.sh \
+ failover-no-rptd-vg.sh \
+ testsuites/failover-no-rptd.conf \
+ failover-no-basic.sh \
+ failover-no-basic-vg.sh \
+ testsuites/failover-no-basic.conf \
+ failover-rptd.sh \
+ failover-rptd-vg.sh \
+ testsuites/failover-rptd.conf \
+ failover-basic.sh \
+ failover-basic-vg.sh \
+ testsuites/failover-basic.conf \
+ failover-async.sh \
+ testsuites/failover-async.conf \
+ failover-double.sh \
+ testsuites/failover-double.conf \
+ discard-rptdmsg.sh \
+ discard-rptdmsg-vg.sh \
+ testsuites/discard-rptdmsg.conf \
+ discard-allmark.sh \
+ discard-allmark-vg.sh \
+ testsuites/discard-allmark.conf \
diag.sh \
testsuites/diag-common.conf \
testsuites/diag-common2.conf \
+ rcvr_fail_restore.sh \
+ testsuites/rcvr_fail_restore_rcvr.conf \
+ testsuites/rcvr_fail_restore_sender.conf \
+ daqueue-persist.sh \
+ daqueue-persist-drvr.sh \
queue-persist.sh \
queue-persist-drvr.sh \
testsuites/queue-persist.conf \
@@ -177,14 +315,32 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
threadingmqaq.sh \
testsuites/threadingmqaq.conf \
sndrcv_drvr.sh \
+ sndrcv_drvr_noexit.sh \
+ sndrcv_failover.sh \
+ testsuites/sndrcv_failover_sender.conf \
+ testsuites/sndrcv_failover_rcvr.conf \
sndrcv.sh \
testsuites/sndrcv_sender.conf \
testsuites/sndrcv_rcvr.conf \
+ sndrcv_udp.sh \
+ testsuites/sndrcv_udp_sender.conf \
+ testsuites/sndrcv_udp_rcvr.conf \
+ sndrcv_udp_nonstdpt.sh \
+ testsuites/sndrcv_udp_nonstdpt_sender.conf \
+ testsuites/sndrcv_udp_nonstdpt_rcvr.conf \
+ sndrcv_omudpspoof.sh \
+ testsuites/sndrcv_omudpspoof_sender.conf \
+ testsuites/sndrcv_omudpspoof_rcvr.conf \
+ sndrcv_omudpspoof_nonstdpt.sh \
+ testsuites/sndrcv_omudpspoof_nonstdpt_sender.conf \
+ testsuites/sndrcv_omudpspoof_nonstdpt_rcvr.conf \
sndrcv_gzip.sh \
testsuites/sndrcv_gzip_sender.conf \
testsuites/sndrcv_gzip_rcvr.conf \
pipeaction.sh \
testsuites/pipeaction.conf \
+ pipe_noreader.sh \
+ testsuites/pipe_noreader.conf \
uxsock_simple.sh \
testsuites/uxsock_simple.conf \
asynwr_simple.sh \
@@ -214,6 +370,7 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
random.sh \
testsuites/random.conf \
imfile-basic.sh \
+ imfile-basic-vg.sh \
testsuites/imfile-basic.conf \
dynfile_invld_async.sh \
dynfile_invld_sync.sh \
@@ -226,18 +383,75 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/master.rfctag \
testsuites/nolimittag.conf \
testsuites/master.nolimittag \
+ rulesetmultiqueue.sh \
+ testsuites/rulesetmultiqueue.conf \
+ omruleset.sh \
+ testsuites/omruleset.conf \
+ omruleset-queue.sh \
+ testsuites/omruleset-queue.conf \
+ badqi.sh \
+ testsuites/badqi.conf \
+ bad_qi/dbq.qi \
execonlyonce.sh \
testsuites/execonlyonce.conf \
testsuites/execonlyonce.data \
+ execonlywhenprevsuspended.sh \
+ testsuites/execonlywhenprevsuspended.conf \
+ execonlywhenprevsuspended2.sh \
+ testsuites/execonlywhenprevsuspended2.conf \
+ execonlywhenprevsuspended3.sh \
+ testsuites/execonlywhenprevsuspended3.conf \
+ execonlywhenprevsuspended4.sh \
+ testsuites/execonlywhenprevsuspended4.conf \
+ tabescape_dflt.sh \
+ testsuites/tabescape_dflt.conf \
+ testsuites/1.tabescape_dflt \
+ tabescape_off.sh \
+ testsuites/tabescape_off.conf \
+ testsuites/1.tabescape_off \
+ dircreate_dflt.sh \
+ testsuites/dircreate_dflt.conf \
+ dircreate_off.sh \
+ testsuites/dircreate_off.conf \
+ imuxsock_logger_root.sh \
+ testsuites/imuxsock_logger_root.conf \
+ resultdata/imuxsock_logger.log \
+ imuxsock_traillf_root.sh \
+ testsuites/imuxsock_traillf_root.conf \
+ resultdata/imuxsock_traillf.log \
+ imuxsock_ccmiddle_root.sh \
+ testsuites/imuxsock_ccmiddle_root.conf \
+ resultdata/imuxsock_ccmiddle.log \
+ testsuites/mysql-truncate.sql \
+ testsuites/mysql-select-msg.sql \
+ libdbi-basic.sh \
+ testsuites/libdbi-basic.conf \
+ libdbi-asyn.sh \
+ testsuites/libdbi-asyn.conf \
+ mysql-basic.sh \
+ mysql-basic-vg.sh \
+ testsuites/mysql-basic.conf \
+ mysql-asyn.sh \
+ mysql-asyn-vg.sh \
+ testsuites/mysql-asyn.conf \
cfg.sh
-uxsockrcvr_SOURCES = uxsockrcvr.c
ourtail_SOURCES = ourtail.c
msleep_SOURCES = msleep.c
chkseq_SOURCES = chkseq.c
+uxsockrcvr_SOURCES = uxsockrcvr.c
+uxsockrcvr_LDADD = $(SOL_LIBS)
+
tcpflood_SOURCES = tcpflood.c
-tcpflood_LDADD = $(SOL_LIBS)
+tcpflood_CPPFLAGS = $(PTHREADS_CFLAGS)
+tcpflood_LDADD = $(SOL_LIBS) $(PTHREADS_LIBS)
+
+syslog_caller_SOURCES = syslog_caller.c
+syslog_caller_LDADD = $(SOL_LIBS)
+
+syslog_inject_SOURCES = syslog_inject.c
+syslog_inject_LDADD = $(SOL_LIBS)
diagtalker_SOURCES = diagtalker.c
diagtalker_LDADD = $(SOL_LIBS)
diff --git a/tests/arrayqueue.sh b/tests/arrayqueue.sh
new file mode 100755
index 00000000..71e1cc21
--- /dev/null
+++ b/tests/arrayqueue.sh
@@ -0,0 +1,18 @@
+# Test for fixedArray queue mode
+# added 2009-05-20 by rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[arrayqueue.sh\]: testing queue fixedArray queue mode
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup arrayqueue.conf
+
+# 40000 messages should be enough
+source $srcdir/diag.sh injectmsg 0 40000
+
+# terminate *now* (don't wait for queue to drain!)
+kill `cat rsyslog.pid`
+
+# now wait until rsyslog.pid is gone (and the process finished)
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 0 39999
+source $srcdir/diag.sh exit
diff --git a/tests/bad_qi/dbq.qi b/tests/bad_qi/dbq.qi
new file mode 100644
index 00000000..5f56e41a
--- /dev/null
+++ b/tests/bad_qi/dbq.qi
@@ -0,0 +1,29 @@
+!OPB:1:queue:1:
++iQueueSize:2:2:84:
++iUngottenObjs:2:1:1:
++tVars.disk.sizeOnDisk:2:5:57906:
++tVars.disk.bytesRead:2:4:1010:
+>End
+.
+<Obj:1:strm:1:
++iCurrFNum:2:1:1:
++pszFName:1:3:dbq:
++iMaxFiles:2:8:10000000:
++bDeleteOnClose:2:1:0:
++sType:2:1:1:
++tOperationsMode:2:1:2:
++tOpenMode:2:3:384:
++iCurrOffs:2:5:57906:
+>End
+.
+<Obj:1:strm:1:
++iCurrFNum:2:1:1:
++pszFName:1:3:dbq:
++iMaxFiles:2:8:10000000:
++bDeleteOnClose:2:1:1:
++sType:2:1:1:
++tOperationsMode:2:1:1:
++tOpenMode:2:3:384:
++iCurrOffs:2:4:1010:
+>End
+.
diff --git a/tests/badqi.sh b/tests/badqi.sh
new file mode 100755
index 00000000..28f76229
--- /dev/null
+++ b/tests/badqi.sh
@@ -0,0 +1,16 @@
+# Test for a startup with a bad qi file. This tests simply tests
+# if the rsyslog engine survives (we had segfaults in this situation
+# in the past).
+# added 2009-10-21 by RGerhards
+# This file is part of the rsyslog project, released under GPLv3
+# uncomment for debugging support:
+echo ===============================================================================
+echo \[badqi.sh\]: test startup with invalid .qi file
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup badqi.conf
+# we just inject a handful of messages so that we have something to wait for...
+source $srcdir/diag.sh tcpflood -m20
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown # wait for process to terminate
+source $srcdir/diag.sh seq-check 0 19
+source $srcdir/diag.sh exit
diff --git a/tests/cfg.sh b/tests/cfg.sh
index cb838354..f850c4d1 100755
--- a/tests/cfg.sh
+++ b/tests/cfg.sh
@@ -31,6 +31,7 @@
#
# A copy of the GPL can be found in the file "COPYING" in this distribution.
#set -x
+echo \[cfg.sh\]:
rm -f tmp
echo "local directory"
#
diff --git a/tests/da-mainmsg-q.sh b/tests/da-mainmsg-q.sh
new file mode 100755
index 00000000..d9cc0d4d
--- /dev/null
+++ b/tests/da-mainmsg-q.sh
@@ -0,0 +1,33 @@
+# Test for DA mode on the main message queue
+# This test checks if DA mode operates correctly. To do so,
+# it uses a small in-memory queue size, so that DA mode is initiated
+# rather soon, and disk spooling used. There is some uncertainty (based
+# on machine speeds), but in general the test should work rather well.
+# We add a few messages after the initial run, just so that we can
+# check everything recovers from DA mode correctly.
+# added 2009-04-22 by Rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo "[da-mainmsg-q.sh]: testing main message queue in DA mode (going to disk)"
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup da-mainmsg-q.conf
+
+# part1: send first 50 messages (in memory, only)
+#source $srcdir/diag.sh tcpflood 127.0.0.1 13514 1 50
+source $srcdir/diag.sh injectmsg 0 50
+source $srcdir/diag.sh wait-queueempty # let queue drain for this test case
+
+# part 2: send bunch of messages. This should trigger DA mode
+#source $srcdir/diag.sh injectmsg 50 20000
+source $srcdir/diag.sh injectmsg 50 2000
+ls -l test-spool # for manual review
+
+# send another handful
+source $srcdir/diag.sh injectmsg 2050 50
+#sleep 1 # we need this so that rsyslogd can receive all outstanding messages
+
+# clean up and check test result
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 0 2099
+source $srcdir/diag.sh exit
diff --git a/tests/daqueue-persist-drvr.sh b/tests/daqueue-persist-drvr.sh
new file mode 100755
index 00000000..7934eb2b
--- /dev/null
+++ b/tests/daqueue-persist-drvr.sh
@@ -0,0 +1,36 @@
+# Test for queue data persisting at shutdown. The
+# plan is to start an instance, emit some data, do a relatively
+# fast shutdown and then re-start the engine to process the
+# remaining data.
+# added 2009-05-27 by Rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+# uncomment for debugging support:
+echo \[daqueue-persist-drvr.sh\]: testing memory daqueue persisting to disk, mode $1
+source $srcdir/diag.sh init
+
+#export RSYSLOG_DEBUG="debug nologfuncflow nostdout noprintmutexaction"
+#export RSYSLOG_DEBUGLOG="log"
+
+# prepare config
+echo \$MainMsgQueueType $1 > work-queuemode.conf
+echo "*.* :omtesting:sleep 0 1000" > work-delay.conf
+
+# inject 10000 msgs, so that DO hit the high watermark
+source $srcdir/diag.sh startup queue-persist.conf
+source $srcdir/diag.sh injectmsg 0 10000
+$srcdir/diag.sh shutdown-immediate
+$srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh check-mainq-spool
+
+echo "Enter phase 2, rsyslogd restart"
+
+exit
+
+# restart engine and have rest processed
+#remove delay
+echo "#" > work-delay.conf
+source $srcdir/diag.sh startup queue-persist.conf
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+$srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 0 99999
+source $srcdir/diag.sh exit
diff --git a/tests/daqueue-persist.sh b/tests/daqueue-persist.sh
new file mode 100755
index 00000000..feb2a347
--- /dev/null
+++ b/tests/daqueue-persist.sh
@@ -0,0 +1,12 @@
+# Test for queue data persisting at shutdown. We use the actual driver
+# to carry out multiple tests with different queue modes
+# added 2009-05-27 by Rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+echo \[daqueue-persist.sh\]: test data persisting at shutdown
+source $srcdir/daqueue-persist-drvr.sh LinkedList
+source $srcdir/daqueue-persist-drvr.sh FixedArray
+# the disk test should not fail, however, the config is extreme and using
+# it more or less is a config error
+source $srcdir/daqueue-persist-drvr.sh Disk
+# we do not test Direct mode because this absolute can not work in direct mode
+# (maybe we should do a fail-type of test?)
diff --git a/tests/diag.sh b/tests/diag.sh
index b0460f72..3e0263c1 100755
--- a/tests/diag.sh
+++ b/tests/diag.sh
@@ -5,12 +5,12 @@
# not always able to convey back states to the upper-level test driver
# begun 2009-05-27 by rgerhards
# This file is part of the rsyslog project, released under GPLv3
-#valgrind="valgrind --log-fd=1"
+#valgrind="valgrind --malloc-fill=ff --free-fill=fe --log-fd=1"
#valgrind="valgrind --tool=drd --log-fd=1"
#valgrind="valgrind --tool=helgrind --log-fd=1"
#valgrind="valgrind --tool=exp-ptrcheck --log-fd=1"
#set -o xtrace
-#export RSYSLOG_DEBUG="debug nostdout noprintmutexaction"
+#export RSYSLOG_DEBUG="debug nologfuncflow noprintmutexaction stdout"
#export RSYSLOG_DEBUGLOG="log"
case $1 in
'init') $srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason
@@ -19,23 +19,29 @@ case $1 in
rm -f rsyslog.action.*.include
rm -f rsyslogd.started work-*.conf rsyslog.random.data
rm -f rsyslogd2.started work-*.conf
- rm -f work rsyslog.out.log rsyslog.out.log.save # common work files
- rm -f rsyslog.out.*.log work-presort
- rm -rf test-spool stat-file1
- rm -f rsyslog.input
+ rm -f work rsyslog.out.log rsyslog2.out.log rsyslog.out.log.save # common work files
+ rm -rf test-spool test-logdir stat-file1
+ rm -f rsyslog.out.*.log work-presort rsyslog.pipe
+ rm -f rsyslog.input rsyslog.empty
rm -f core.* vgcore.*
mkdir test-spool
;;
'exit') rm -f rsyslogd.started work-*.conf diag-common.conf
rm -f rsyslogd2.started diag-common2.conf rsyslog.action.*.include
- rm -f work rsyslog.out.log rsyslog.out.log.save # common work files
- rm -f rsyslog.out.*.log rsyslog.random.data work-presort
- rm -rf test-spool stat-file1
- rm -f rsyslog.input
+ rm -f work rsyslog.out.log rsyslog2.out.log rsyslog.out.log.save # common work files
+ rm -rf test-spool test-logdir stat-file1
+ rm -f rsyslog.out.*.log rsyslog.random.data work-presort rsyslog.pipe
+ rm -f rsyslog.input stat-file1 #rsyslog.empty
+ echo -------------------------------------------------------------------------------
;;
'startup') # start rsyslogd with default params. $2 is the config file name to use
# returns only after successful startup, $3 is the instance (blank or 2!)
- $valgrind ../tools/rsyslogd -c4 -u2 -n -irsyslog$3.pid -M../runtime/.libs:../.libs -f$srcdir/testsuites/$2 &
+ $valgrind ../tools/rsyslogd -c6 -u2 -n -irsyslog$3.pid -M../runtime/.libs:../.libs -f$srcdir/testsuites/$2 &
+ $srcdir/diag.sh wait-startup $3
+ ;;
+ 'startup-vg') # start rsyslogd with default params under valgrind control. $2 is the config file name to use
+ # returns only after successful startup, $3 is the instance (blank or 2!)
+ valgrind --error-exitcode=10 --malloc-fill=ff --free-fill=fe --leak-check=full ../tools/rsyslogd -c6 -u2 -n -irsyslog$3.pid -M../runtime/.libs:../.libs -f$srcdir/testsuites/$2 &
$srcdir/diag.sh wait-startup $3
;;
'wait-startup') # wait for rsyslogd startup ($2 is the instance)
@@ -52,16 +58,53 @@ case $1 in
while test -f rsyslog$2.pid; do
./msleep 100 # wait 100 milliseconds
done
+ if [ -e core.* ]
+ then
+ echo "ABORT! core file exists, starting interactive shell"
+ bash
+ exit 1
+ fi
+ ;;
+ 'wait-shutdown-vg') # actually, we wait for rsyslog.pid to be deleted. $2 is the
+ # instance
+ wait `cat rsyslog.pid`
+ export RSYSLOGD_EXIT=$?
+ echo rsyslogd run exited with $RSYSLOGD_EXIT
+ if [ -e core.* ]
+ then
+ echo "ABORT! core file exists, starting interactive shell"
+ bash
+ exit 1
+ fi
+ ;;
+ 'check-exit-vg') # wait for main message queue to be empty. $2 is the instance.
+ if [ "$RSYSLOGD_EXIT" -eq "10" ]
+ then
+ echo "valgrind run FAILED with exceptions - terminating"
+ exit 1
+ fi
+ ;;
+ 'get-mainqueuesize') # show the current main queue size
+ if [ "$2" == "2" ]
+ then
+ echo getmainmsgqueuesize | ./diagtalker -p13501
+ else
+ echo getmainmsgqueuesize | ./diagtalker
+ fi
;;
'wait-queueempty') # wait for main message queue to be empty. $2 is the instance.
if [ "$2" == "2" ]
then
- echo WaitMainQueueEmpty | ./diagtalker
+ echo WaitMainQueueEmpty | ./diagtalker -p13501
else
echo WaitMainQueueEmpty | ./diagtalker
fi
;;
'shutdown-when-empty') # shut rsyslogd down when main queue is empty. $2 is the instance.
+ if [ "$2" == "2" ]
+ then
+ echo Shutting down instance 2
+ fi
$srcdir/diag.sh wait-queueempty $2
kill `cat rsyslog$2.pid`
# note: we do not wait for the actual termination!
@@ -97,7 +140,8 @@ case $1 in
cp rsyslog.out.log work-presort
sort < rsyslog.out.log > work
# $4... are just to have the abilit to pass in more options...
- ./chkseq -fwork -v -s$2 -e$3 $4 $5 $6 $7
+ # add -v to chkseq if you need more verbose output
+ ./chkseq -fwork -s$2 -e$3 $4 $5 $6 $7
if [ "$?" -ne "0" ]; then
echo "sequence error detected"
exit 1
@@ -109,11 +153,13 @@ case $1 in
rm -f work2
sort < rsyslog2.out.log > work2
# $4... are just to have the abilit to pass in more options...
- ./chkseq -fwork2 -v -s$2 -e$3 $4 $5 $6 $7
+ # add -v to chkseq if you need more verbose output
+ ./chkseq -fwork2 -s$2 -e$3 $4 $5 $6 $7
if [ "$?" -ne "0" ]; then
echo "sequence error detected"
exit 1
fi
+ rm -f work2
;;
'gzip-seq-check') # do the usual sequence check, but for gzip files
rm -f work
@@ -129,7 +175,7 @@ case $1 in
;;
'nettester') # perform nettester-based tests
# use -v for verbose output!
- ./nettester -t$2 -i$3
+ ./nettester -t$2 -i$3 $4
if [ "$?" -ne "0" ]; then
exit 1
fi
diff --git a/tests/diagtalker.c b/tests/diagtalker.c
index 6a721e47..f61270a8 100644
--- a/tests/diagtalker.c
+++ b/tests/diagtalker.c
@@ -1,7 +1,7 @@
/* A yet very simple tool to talk to imdiag (this replaces the
* previous Java implementation in order to get fewer dependencies).
*
- * Copyright 2010 Rainer Gerhards and Adiscon GmbH.
+ * Copyright 2010,2011 Rainer Gerhards and Adiscon GmbH.
*
* This file is part of rsyslog.
*
@@ -70,6 +70,9 @@ int openConn(int *fd)
}
}
}
+ if(retries > 0) {
+ fprintf(stderr, "connection established.\n");
+ }
*fd = sock;
return 0;
@@ -126,7 +129,7 @@ doProcessing()
len = strlen(line);
sendCmd(fd, line, len);
waitRsp(fd, line, sizeof(line));
- printf("imdiag: %s", line);
+ printf("imdiag[%d]: %s", targetPort, line);
}
}
@@ -139,7 +142,7 @@ int main(int argc, char *argv[])
int ret = 0;
int opt;
- while((opt = getopt(argc, argv, "f:t:p:c:C:m:i:I:P:d:n:M:rB")) != -1) {
+ while((opt = getopt(argc, argv, "t:p:")) != -1) {
switch (opt) {
case 't': targetIP = optarg;
break;
diff --git a/tests/dircreate_dflt.sh b/tests/dircreate_dflt.sh
new file mode 100755
index 00000000..71a671f3
--- /dev/null
+++ b/tests/dircreate_dflt.sh
@@ -0,0 +1,20 @@
+# Test for automatic creation of dynafile directories
+# note that we use the "test-spool" directory, because it is handled by diag.sh
+# in any case, so we do not need to add any extra new test dir.
+# added 2009-11-30 by Rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+# uncomment for debugging support:
+echo ===================================================================================
+echo \[dircreate_dflt_dflt.sh\]: testing automatic directory creation for dynafiles - default
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup dircreate_dflt.conf
+source $srcdir/diag.sh injectmsg 0 1 # a single message is sufficient
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
+if [ ! -e test-logdir/rsyslog.out.log ]
+then
+ echo "test-logdir or logfile not created!"
+ exit 1
+fi
+exit
+source $srcdir/diag.sh exit
diff --git a/tests/dircreate_off.sh b/tests/dircreate_off.sh
new file mode 100755
index 00000000..92fdee01
--- /dev/null
+++ b/tests/dircreate_off.sh
@@ -0,0 +1,20 @@
+# Test for automatic creation of dynafile directories
+# note that we use the "test-spool" directory, because it is handled by diag.sh
+# in any case, so we do not need to add any extra new test dir.
+# added 2009-11-30 by Rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+# uncomment for debugging support:
+echo ===================================================================================
+echo \[dircreate_off_off.sh\]: testing automatic directory creation for dynafiles - default
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup dircreate_off.conf
+source $srcdir/diag.sh injectmsg 0 1 # a single message is sufficient
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
+if [ -e test-logdir/rsyslog.out.log ]
+then
+ echo "test-logdir or logfile WAS created where not permitted to!"
+ exit 1
+fi
+exit
+source $srcdir/diag.sh exit
diff --git a/tests/discard-allmark-vg.sh b/tests/discard-allmark-vg.sh
new file mode 100755
index 00000000..57ce8e3e
--- /dev/null
+++ b/tests/discard-allmark-vg.sh
@@ -0,0 +1,13 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[discard-allmark.sh\]: testing discard-allmark functionality
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup-vg discard-allmark.conf
+source $srcdir/diag.sh tcpflood -m10 -i1
+# we need to give rsyslog a little time to settle the receiver
+./msleep 1500
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown-vg
+source $srcdir/diag.sh check-exit-vg
+source $srcdir/diag.sh seq-check 2 10
+source $srcdir/diag.sh exit
diff --git a/tests/discard-allmark.sh b/tests/discard-allmark.sh
new file mode 100755
index 00000000..eb46ae70
--- /dev/null
+++ b/tests/discard-allmark.sh
@@ -0,0 +1,10 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[discard-allmark.sh\]: testing discard-allmark functionality
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup discard-allmark.conf
+source $srcdir/diag.sh tcpflood -m10 -i1
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 2 10
+source $srcdir/diag.sh exit
diff --git a/tests/discard-rptdmsg-vg.sh b/tests/discard-rptdmsg-vg.sh
new file mode 100755
index 00000000..f56ac597
--- /dev/null
+++ b/tests/discard-rptdmsg-vg.sh
@@ -0,0 +1,13 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[discard-rptdmsg.sh\]: testing discard-rptdmsg functionality
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup-vg discard-rptdmsg.conf
+source $srcdir/diag.sh tcpflood -m10 -i1
+# we need to give rsyslog a little time to settle the receiver
+./msleep 1500
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown-vg
+source $srcdir/diag.sh check-exit-vg
+source $srcdir/diag.sh seq-check 2 10
+source $srcdir/diag.sh exit
diff --git a/tests/discard-rptdmsg.sh b/tests/discard-rptdmsg.sh
new file mode 100755
index 00000000..a8be110c
--- /dev/null
+++ b/tests/discard-rptdmsg.sh
@@ -0,0 +1,10 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[discard-rptdmsg.sh\]: testing discard-rptdmsg functionality
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup discard-rptdmsg.conf
+source $srcdir/diag.sh tcpflood -m10 -i1
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 2 10
+source $srcdir/diag.sh exit
diff --git a/tests/discard.sh b/tests/discard.sh
new file mode 100755
index 00000000..96006f01
--- /dev/null
+++ b/tests/discard.sh
@@ -0,0 +1,17 @@
+# Test for discard functionality
+# This test checks if discard works. It is not a perfect test but
+# will find at least segfaults and obviously not discarded messages.
+# added 2009-07-30 by Rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+# uncomment for debugging support:
+echo ===============================================================================
+echo \[discard.sh\]: testing discard functionality
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup discard.conf
+# 20000 messages should be enough - the disk test is slow enough ;)
+sleep 4
+source $srcdir/diag.sh tcpflood -m10 -i1
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 2 10
+source $srcdir/diag.sh exit
diff --git a/tests/diskqueue-fsync.sh b/tests/diskqueue-fsync.sh
index c7745930..fe923c22 100755
--- a/tests/diskqueue-fsync.sh
+++ b/tests/diskqueue-fsync.sh
@@ -5,11 +5,11 @@
# added 2009-06-09 by Rgerhards
# This file is part of the rsyslog project, released under GPLv3
# uncomment for debugging support:
-echo testing queue disk-only mode, fsync case
+echo \[diskqueue-fsync.sh\]: testing queue disk-only mode, fsync case
source $srcdir/diag.sh init
source $srcdir/diag.sh startup diskqueue-fsync.conf
# 1000 messages should be enough - the disk fsync test is very slow!
-source $srcdir/diag.sh tcpflood -m1000
+source $srcdir/diag.sh injectmsg 0 1000
source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
source $srcdir/diag.sh wait-shutdown
source $srcdir/diag.sh seq-check 0 999
diff --git a/tests/diskqueue.sh b/tests/diskqueue.sh
index 7a50d82e..b871e9eb 100755
--- a/tests/diskqueue.sh
+++ b/tests/diskqueue.sh
@@ -5,7 +5,7 @@
# added 2009-04-17 by Rgerhards
# This file is part of the rsyslog project, released under GPLv3
# uncomment for debugging support:
-echo diskqueue.sh: testing queue disk-only mode
+echo \[diskqueue.sh\]: testing queue disk-only mode
# uncomment for debugging support:
#export RSYSLOG_DEBUG="debug nostdout noprintmutexaction"
#export RSYSLOG_DEBUGLOG="log"
diff --git a/tests/execonlyonce.sh b/tests/execonlyonce.sh
index b7f60849..8e184070 100755
--- a/tests/execonlyonce.sh
+++ b/tests/execonlyonce.sh
@@ -16,6 +16,7 @@ sleep 4 # one more than the once inerval!
# and inject another couple of messages
source $srcdir/diag.sh tcpflood -m10 -i100
source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
# now we need your custom logic to see if the result is equal to the
# expected result
diff --git a/tests/execonlywhenprevsuspended.sh b/tests/execonlywhenprevsuspended.sh
new file mode 100755
index 00000000..624f64af
--- /dev/null
+++ b/tests/execonlywhenprevsuspended.sh
@@ -0,0 +1,13 @@
+# we test the execonly if previous is suspended directive. This is the
+# most basic test which soley tests a singel case but no dependencies within
+# the ruleset.
+# rgerhards, 2010-06-23
+echo =====================================================================================
+echo \[execonlywhenprevsuspended.sh\]: test execonly...suspended functionality simple case
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup execonlywhenprevsuspended.conf
+source $srcdir/diag.sh injectmsg 0 1000
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 1 999
+source $srcdir/diag.sh exit
diff --git a/tests/execonlywhenprevsuspended2.sh b/tests/execonlywhenprevsuspended2.sh
new file mode 100755
index 00000000..8af1b4d8
--- /dev/null
+++ b/tests/execonlywhenprevsuspended2.sh
@@ -0,0 +1,17 @@
+# we test the execonly if previous is suspended directive. For this,
+# we have an action that is suspended for all messages but the second.
+# we write two files: one only if the output is suspended and the other one
+# in all cases. This should thouroughly check the logic involved.
+# rgerhards, 2010-06-23
+echo ===============================================================================
+echo \[execonlywhenprevsuspended2.sh\]: test execonly...suspended functionality
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup execonlywhenprevsuspended2.conf
+source $srcdir/diag.sh injectmsg 0 1000
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
+echo check file 1
+source $srcdir/diag.sh seq-check 1 999
+echo check file 2
+source $srcdir/diag.sh seq-check2 0 999
+source $srcdir/diag.sh exit
diff --git a/tests/execonlywhenprevsuspended3.sh b/tests/execonlywhenprevsuspended3.sh
new file mode 100755
index 00000000..408aeba4
--- /dev/null
+++ b/tests/execonlywhenprevsuspended3.sh
@@ -0,0 +1,17 @@
+# we test the execonly if previous is suspended directive.
+# This test checks if, within the same rule, one action can be set
+# to emit only if the previous was suspended while the next action
+# always sends data.
+# rgerhards, 2010-06-24
+echo ===============================================================================
+echo \[execonlywhenprevsuspended3.sh\]: test execonly...suspended functionality
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup execonlywhenprevsuspended3.conf
+source $srcdir/diag.sh injectmsg 0 1000
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
+echo check file 1
+source $srcdir/diag.sh seq-check 1 999
+echo check file 2
+source $srcdir/diag.sh seq-check2 0 999
+source $srcdir/diag.sh exit
diff --git a/tests/execonlywhenprevsuspended4.sh b/tests/execonlywhenprevsuspended4.sh
new file mode 100755
index 00000000..87008b33
--- /dev/null
+++ b/tests/execonlywhenprevsuspended4.sh
@@ -0,0 +1,16 @@
+# we test the execonly if previous is suspended directive.
+# This test checks if multiple backup actions can be defined.
+# rgerhards, 2010-06-24
+echo ===============================================================================
+echo \[execonlywhenprevsuspended4.sh\]: test execonly..suspended multi backup action
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup execonlywhenprevsuspended4.conf
+source $srcdir/diag.sh injectmsg 0 1000
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 1 999
+if [[ -s rsyslog2.out.log ]] ; then
+ echo failure: second output file has data where it should be empty
+ exit 1
+fi ;
+source $srcdir/diag.sh exit
diff --git a/tests/failover-async.sh b/tests/failover-async.sh
new file mode 100755
index 00000000..5fc393de
--- /dev/null
+++ b/tests/failover-async.sh
@@ -0,0 +1,12 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[failover-async.sh\]: async test for failover functionality
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup failover-async.conf
+source $srcdir/diag.sh injectmsg 0 5000
+echo doing shutdown
+source $srcdir/diag.sh shutdown-when-empty
+echo wait on shutdown
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 0 4999
+source $srcdir/diag.sh exit
diff --git a/tests/failover-basic-vg.sh b/tests/failover-basic-vg.sh
new file mode 100755
index 00000000..0eb77caa
--- /dev/null
+++ b/tests/failover-basic-vg.sh
@@ -0,0 +1,13 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[failover-basic.sh\]: basic test for failover functionality
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup-vg failover-basic.conf
+source $srcdir/diag.sh injectmsg 0 5000
+echo doing shutdown
+source $srcdir/diag.sh shutdown-when-empty
+echo wait on shutdown
+source $srcdir/diag.sh wait-shutdown-vg
+source $srcdir/diag.sh check-exit-vg
+source $srcdir/diag.sh seq-check 0 4999
+source $srcdir/diag.sh exit
diff --git a/tests/failover-basic.sh b/tests/failover-basic.sh
new file mode 100755
index 00000000..031ea25b
--- /dev/null
+++ b/tests/failover-basic.sh
@@ -0,0 +1,12 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[failover-basic.sh\]: basic test for failover functionality
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup failover-basic.conf
+source $srcdir/diag.sh injectmsg 0 5000
+echo doing shutdown
+source $srcdir/diag.sh shutdown-when-empty
+echo wait on shutdown
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 0 4999
+source $srcdir/diag.sh exit
diff --git a/tests/failover-double.sh b/tests/failover-double.sh
new file mode 100755
index 00000000..172b91de
--- /dev/null
+++ b/tests/failover-double.sh
@@ -0,0 +1,12 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[failover-double.sh\]: test for double failover functionality
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup failover-double.conf
+source $srcdir/diag.sh injectmsg 0 5000
+echo doing shutdown
+source $srcdir/diag.sh shutdown-when-empty
+echo wait on shutdown
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 0 4999
+source $srcdir/diag.sh exit
diff --git a/tests/failover-no-basic-vg.sh b/tests/failover-no-basic-vg.sh
new file mode 100755
index 00000000..266163d4
--- /dev/null
+++ b/tests/failover-no-basic-vg.sh
@@ -0,0 +1,20 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[failover-no-basic.sh\]: basic test for failover functionality - no failover
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup-vg failover-no-basic.conf
+source $srcdir/diag.sh injectmsg 0 5000
+echo doing shutdown
+source $srcdir/diag.sh shutdown-when-empty
+echo wait on shutdown
+source $srcdir/diag.sh wait-shutdown-vg
+source $srcdir/diag.sh check-exit-vg
+# now we need our custom logic to see if the result file is empty
+# (what it should be!)
+cmp rsyslog.out.log /dev/null
+if [ $? -eq 1 ]
+then
+ echo "ERROR, output file not empty"
+ exit 1
+fi
+source $srcdir/diag.sh exit
diff --git a/tests/failover-no-basic.sh b/tests/failover-no-basic.sh
new file mode 100755
index 00000000..6177e10d
--- /dev/null
+++ b/tests/failover-no-basic.sh
@@ -0,0 +1,19 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[failover-no-basic.sh\]: basic test for failover functionality - no failover
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup failover-no-basic.conf
+source $srcdir/diag.sh injectmsg 0 5000
+echo doing shutdown
+source $srcdir/diag.sh shutdown-when-empty
+echo wait on shutdown
+source $srcdir/diag.sh wait-shutdown
+# now we need our custom logic to see if the result file is empty
+# (what it should be!)
+cmp rsyslog.out.log /dev/null
+if [ $? -eq 1 ]
+then
+ echo "ERROR, output file not empty"
+ exit 1
+fi
+source $srcdir/diag.sh exit
diff --git a/tests/failover-no-rptd-vg.sh b/tests/failover-no-rptd-vg.sh
new file mode 100755
index 00000000..3b77a0a4
--- /dev/null
+++ b/tests/failover-no-rptd-vg.sh
@@ -0,0 +1,20 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[failover-no-rptd.sh\]: rptd test for failover functionality - no failover
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup-vg failover-no-rptd.conf
+source $srcdir/diag.sh injectmsg 0 5000
+echo doing shutdown
+source $srcdir/diag.sh shutdown-when-empty
+echo wait on shutdown
+source $srcdir/diag.sh wait-shutdown-vg
+source $srcdir/diag.sh check-exit-vg
+# now we need our custom logic to see if the result file is empty
+# (what it should be!)
+cmp rsyslog.out.log /dev/null
+if [ $? -eq 1 ]
+then
+ echo "ERROR, output file not empty"
+ exit 1
+fi
+source $srcdir/diag.sh exit
diff --git a/tests/failover-no-rptd.sh b/tests/failover-no-rptd.sh
new file mode 100755
index 00000000..6abeba44
--- /dev/null
+++ b/tests/failover-no-rptd.sh
@@ -0,0 +1,19 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[failover-no-rptd.sh\]: rptd test for failover functionality - no failover
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup failover-no-rptd.conf
+source $srcdir/diag.sh injectmsg 0 5000
+echo doing shutdown
+source $srcdir/diag.sh shutdown-when-empty
+echo wait on shutdown
+source $srcdir/diag.sh wait-shutdown
+# now we need our custom logic to see if the result file is empty
+# (what it should be!)
+cmp rsyslog.out.log /dev/null
+if [ $? -eq 1 ]
+then
+ echo "ERROR, output file not empty"
+ exit 1
+fi
+source $srcdir/diag.sh exit
diff --git a/tests/failover-rptd-vg.sh b/tests/failover-rptd-vg.sh
new file mode 100755
index 00000000..d208003b
--- /dev/null
+++ b/tests/failover-rptd-vg.sh
@@ -0,0 +1,13 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[failover-rptd.sh\]: rptd test for failover functionality
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup-vg failover-rptd.conf
+source $srcdir/diag.sh injectmsg 0 5000
+echo doing shutdown
+source $srcdir/diag.sh shutdown-when-empty
+echo wait on shutdown
+source $srcdir/diag.sh wait-shutdown-vg
+source $srcdir/diag.sh check-exit-vg
+source $srcdir/diag.sh seq-check 0 4999
+source $srcdir/diag.sh exit
diff --git a/tests/failover-rptd.sh b/tests/failover-rptd.sh
new file mode 100755
index 00000000..8a313e9e
--- /dev/null
+++ b/tests/failover-rptd.sh
@@ -0,0 +1,12 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[failover-rptd.sh\]: rptd test for failover functionality
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup failover-rptd.conf
+source $srcdir/diag.sh injectmsg 0 5000
+echo doing shutdown
+source $srcdir/diag.sh shutdown-when-empty
+echo wait on shutdown
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 0 4999
+source $srcdir/diag.sh exit
diff --git a/tests/fieldtest.sh b/tests/fieldtest.sh
index 482fa143..9875fda6 100755
--- a/tests/fieldtest.sh
+++ b/tests/fieldtest.sh
@@ -1,4 +1,4 @@
-echo test fieldtest via udp
+echo \[fieldtest.sh\]: test fieldtest via udp
$srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason
./nettester -tfield1 -iudp
diff --git a/tests/imfile-basic-vg.sh b/tests/imfile-basic-vg.sh
new file mode 100755
index 00000000..92cfc7f6
--- /dev/null
+++ b/tests/imfile-basic-vg.sh
@@ -0,0 +1,15 @@
+# This is part of the rsyslog testbench, licensed under GPLv3
+echo [imfile-basic.sh]
+source $srcdir/diag.sh init
+# generate input file first. Note that rsyslog processes it as
+# soon as it start up (so the file should exist at that point).
+./inputfilegen 50000 > rsyslog.input
+ls -l rsyslog.input
+source $srcdir/diag.sh startup-vg imfile-basic.conf
+# sleep a little to give rsyslog a chance to begin processing
+sleep 1
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown-vg
+source $srcdir/diag.sh check-exit-vg
+source $srcdir/diag.sh seq-check 0 49999
+source $srcdir/diag.sh exit
diff --git a/tests/imtcp_conndrop.sh b/tests/imtcp_conndrop.sh
index 2caa0ce2..0bfcd99c 100755
--- a/tests/imtcp_conndrop.sh
+++ b/tests/imtcp_conndrop.sh
@@ -6,10 +6,10 @@ echo ===========================================================================
echo TEST: \[imtcp_conndrop.sh\]: test imtcp with random connection drops
cat rsyslog.action.1.include
source $srcdir/diag.sh init
-source $srcdir/diag.sh startup imptcp_large.conf
+source $srcdir/diag.sh startup imtcp_conndrop.conf
# 100 byte messages to gain more practical data use
source $srcdir/diag.sh tcpflood -c20 -m50000 -r -d100 -P129 -D
-sleep 4 # due to large messages, we need this time for the tcp receiver to settle...
+sleep 10 # 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 49999 -E
diff --git a/tests/imuxsock_ccmiddle_root.sh b/tests/imuxsock_ccmiddle_root.sh
new file mode 100755
index 00000000..b487611a
--- /dev/null
+++ b/tests/imuxsock_ccmiddle_root.sh
@@ -0,0 +1,18 @@
+# note: we must be root and no other syslogd running in order to
+# carry out this test
+echo \[imuxsock_ccmiddle_root.sh\]: test trailing LF handling in imuxsock
+echo This test must be run as root with no other active syslogd
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup imuxsock_ccmiddle_root.conf
+# send a message with trailing LF
+./syslog_inject -c
+# the sleep below is needed to prevent too-early termination of rsyslogd
+./msleep 100
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown # we need to wait until rsyslogd is finished!
+cmp rsyslog.out.log $srcdir/resultdata/imuxsock_ccmiddle.log
+if [ ! $? -eq 0 ]; then
+echo "imuxsock_ccmiddle_root.sh failed"
+exit 1
+fi;
+source $srcdir/diag.sh exit
diff --git a/tests/imuxsock_logger_root.sh b/tests/imuxsock_logger_root.sh
new file mode 100755
index 00000000..377999f7
--- /dev/null
+++ b/tests/imuxsock_logger_root.sh
@@ -0,0 +1,18 @@
+# note: we must be root and no other syslogd running in order to
+# carry out this test.
+echo \[imuxsock_logger_root.sh\]: test trailing LF handling in imuxsock
+echo This test must be run as root with no other active syslogd
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup imuxsock_logger_root.conf
+# send a message with trailing LF
+logger test
+# the sleep below is needed to prevent too-early termination of rsyslogd
+./msleep 100
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown # we need to wait until rsyslogd is finished!
+cmp rsyslog.out.log $srcdir/resultdata/imuxsock_logger.log
+if [ ! $? -eq 0 ]; then
+echo "imuxsock_logger.sh failed"
+exit 1
+fi;
+source $srcdir/diag.sh exit
diff --git a/tests/imuxsock_traillf_root.sh b/tests/imuxsock_traillf_root.sh
new file mode 100755
index 00000000..1b821ee7
--- /dev/null
+++ b/tests/imuxsock_traillf_root.sh
@@ -0,0 +1,18 @@
+# note: we must be root and no other syslogd running in order to
+# carry out this test
+echo \[imuxsock_traillf_root.sh\]: test trailing LF handling in imuxsock
+echo This test must be run as root with no other active syslogd
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup imuxsock_traillf_root.conf
+# send a message with trailing LF
+./syslog_inject -l
+# the sleep below is needed to prevent too-early termination of rsyslogd
+./msleep 100
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown # we need to wait until rsyslogd is finished!
+cmp rsyslog.out.log $srcdir/resultdata/imuxsock_traillf.log
+if [ ! $? -eq 0 ]; then
+echo "imuxsock_traillf_root.sh failed"
+exit 1
+fi;
+source $srcdir/diag.sh exit
diff --git a/tests/inputname.sh b/tests/inputname.sh
index e1a58517..71f11c1e 100755
--- a/tests/inputname.sh
+++ b/tests/inputname.sh
@@ -1,4 +1,4 @@
-echo testing $InputTCPServerInputName directive
+echo \[inputname.sh\]: testing $InputTCPServerInputName directive
$srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason
echo port 12514
diff --git a/tests/libdbi-asyn.sh b/tests/libdbi-asyn.sh
new file mode 100755
index 00000000..0076da9c
--- /dev/null
+++ b/tests/libdbi-asyn.sh
@@ -0,0 +1,13 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[libdbi-asyn.sh\]: asyn test for libdbi functionality
+source $srcdir/diag.sh init
+mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql
+source $srcdir/diag.sh startup libdbi-asyn.conf
+source $srcdir/diag.sh injectmsg 0 50000
+source $srcdir/diag.sh shutdown-when-empty
+source $srcdir/diag.sh wait-shutdown
+# note "-s" is requried to suppress the select "field header"
+mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log
+source $srcdir/diag.sh seq-check 0 49999
+source $srcdir/diag.sh exit
diff --git a/tests/libdbi-basic-vg.sh b/tests/libdbi-basic-vg.sh
new file mode 100755
index 00000000..75d12857
--- /dev/null
+++ b/tests/libdbi-basic-vg.sh
@@ -0,0 +1,16 @@
+# This file is part of the rsyslog project, released under GPLv3
+# this test is currently not included in the testbench as libdbi
+# itself seems to have a memory leak
+echo ===============================================================================
+echo \[libdbi-basic.sh\]: basic test for libdbi-basic functionality via mysql
+source $srcdir/diag.sh init
+mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql
+source $srcdir/diag.sh startup-vg libdbi-basic.conf
+source $srcdir/diag.sh injectmsg 0 5000
+source $srcdir/diag.sh shutdown-when-empty
+source $srcdir/diag.sh wait-shutdown-vg
+source $srcdir/diag.sh check-exit-vg
+# note "-s" is requried to suppress the select "field header"
+mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log
+source $srcdir/diag.sh seq-check 0 4999
+source $srcdir/diag.sh exit
diff --git a/tests/libdbi-basic.sh b/tests/libdbi-basic.sh
new file mode 100755
index 00000000..a854a565
--- /dev/null
+++ b/tests/libdbi-basic.sh
@@ -0,0 +1,13 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[libdbi-basic.sh\]: basic test for libdbi-basic functionality via mysql
+source $srcdir/diag.sh init
+mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql
+source $srcdir/diag.sh startup libdbi-basic.conf
+source $srcdir/diag.sh injectmsg 0 5000
+source $srcdir/diag.sh shutdown-when-empty
+source $srcdir/diag.sh wait-shutdown
+# note "-s" is requried to suppress the select "field header"
+mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log
+source $srcdir/diag.sh seq-check 0 4999
+source $srcdir/diag.sh exit
diff --git a/tests/linkedlistqueue.sh b/tests/linkedlistqueue.sh
new file mode 100755
index 00000000..e6d48a68
--- /dev/null
+++ b/tests/linkedlistqueue.sh
@@ -0,0 +1,17 @@
+# Test for Linkedlist queue mode
+# added 2009-05-20 by rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+echo \[linkedlistqueue.sh\]: testing queue Linkedlist queue mode
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup linkedlistqueue.conf
+
+# 40000 messages should be enough
+source $srcdir/diag.sh injectmsg 0 40000
+
+# terminate *now* (don't wait for queue to drain)
+kill `cat rsyslog.pid`
+
+# now wait until rsyslog.pid is gone (and the process finished)
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 0 39999
+source $srcdir/diag.sh exit
diff --git a/tests/manytcp-too-few-tls.sh b/tests/manytcp-too-few-tls.sh
new file mode 100755
index 00000000..970a572d
--- /dev/null
+++ b/tests/manytcp-too-few-tls.sh
@@ -0,0 +1,19 @@
+# test many concurrent tcp connections
+echo \[manytcp-too-few-tls.sh\]: test concurrent tcp connections
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup-vg manytcp-too-few-tls.conf
+echo wait for DH param generation -- NOT needed in v6!
+sleep 15
+# the config file specifies exactly 1100 connections
+source $srcdir/diag.sh tcpflood -c1000 -m40000
+# the sleep below is needed to prevent too-early termination of the tcp listener
+sleep 1
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown-vg # we need to wait until rsyslogd is finished!
+source $srcdir/diag.sh check-exit-vg
+# we do not do a seq check, as of the design of this test some messages
+# will be lost. So there is no point in checking if all were received. The
+# point is that we look at the valgrind result, to make sure we do not
+# have a mem leak in those error cases (we had in the past, thus the test
+# to prevent that in the future).
+source $srcdir/diag.sh exit
diff --git a/tests/manytcp.sh b/tests/manytcp.sh
index 94a5c035..ec8f2453 100755
--- a/tests/manytcp.sh
+++ b/tests/manytcp.sh
@@ -1,4 +1,5 @@
# test many concurrent tcp connections
+echo \[manytcp.sh\]: test concurrent tcp connections
source $srcdir/diag.sh init
source $srcdir/diag.sh startup manytcp.conf
# the config file specifies exactly 1100 connections
diff --git a/tests/mysql-asyn-vg.sh b/tests/mysql-asyn-vg.sh
new file mode 100755
index 00000000..dfe68665
--- /dev/null
+++ b/tests/mysql-asyn-vg.sh
@@ -0,0 +1,14 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[mysql-asyn.sh\]: asyn test for mysql functionality
+source $srcdir/diag.sh init
+mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql
+source $srcdir/diag.sh startup-vg mysql-asyn.conf
+source $srcdir/diag.sh injectmsg 0 50000
+source $srcdir/diag.sh shutdown-when-empty
+source $srcdir/diag.sh wait-shutdown-vg
+source $srcdir/diag.sh check-exit-vg
+# note "-s" is requried to suppress the select "field header"
+mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log
+source $srcdir/diag.sh seq-check 0 49999
+source $srcdir/diag.sh exit
diff --git a/tests/mysql-asyn.sh b/tests/mysql-asyn.sh
new file mode 100755
index 00000000..de6d6fde
--- /dev/null
+++ b/tests/mysql-asyn.sh
@@ -0,0 +1,13 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[mysql-asyn.sh\]: asyn test for mysql functionality
+source $srcdir/diag.sh init
+mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql
+source $srcdir/diag.sh startup mysql-asyn.conf
+source $srcdir/diag.sh injectmsg 0 50000
+source $srcdir/diag.sh shutdown-when-empty
+source $srcdir/diag.sh wait-shutdown
+# note "-s" is requried to suppress the select "field header"
+mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log
+source $srcdir/diag.sh seq-check 0 49999
+source $srcdir/diag.sh exit
diff --git a/tests/mysql-basic-vg.sh b/tests/mysql-basic-vg.sh
new file mode 100755
index 00000000..215f41f0
--- /dev/null
+++ b/tests/mysql-basic-vg.sh
@@ -0,0 +1,14 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[mysql-basic-vg.sh\]: basic test for mysql-basic functionality/valgrind
+source $srcdir/diag.sh init
+mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql
+source $srcdir/diag.sh startup-vg mysql-basic.conf
+source $srcdir/diag.sh injectmsg 0 5000
+source $srcdir/diag.sh shutdown-when-empty
+source $srcdir/diag.sh wait-shutdown-vg
+source $srcdir/diag.sh check-exit-vg
+# note "-s" is requried to suppress the select "field header"
+mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log
+source $srcdir/diag.sh seq-check 0 4999
+source $srcdir/diag.sh exit
diff --git a/tests/mysql-basic.sh b/tests/mysql-basic.sh
new file mode 100755
index 00000000..ba9d00f2
--- /dev/null
+++ b/tests/mysql-basic.sh
@@ -0,0 +1,13 @@
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[mysql-basic.sh\]: basic test for mysql-basic functionality
+source $srcdir/diag.sh init
+mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql
+source $srcdir/diag.sh startup mysql-basic.conf
+source $srcdir/diag.sh injectmsg 0 5000
+source $srcdir/diag.sh shutdown-when-empty
+source $srcdir/diag.sh wait-shutdown
+# note "-s" is requried to suppress the select "field header"
+mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log
+source $srcdir/diag.sh seq-check 0 4999
+source $srcdir/diag.sh exit
diff --git a/tests/nettester.c b/tests/nettester.c
index 609f586e..9e68ebcc 100644
--- a/tests/nettester.c
+++ b/tests/nettester.c
@@ -47,6 +47,7 @@
#include <signal.h>
#include <netinet/in.h>
#include <getopt.h>
+#include <errno.h>
#include <ctype.h>
#define EXIT_FAILURE 1
@@ -62,6 +63,7 @@ static char *testSuite = NULL; /* name of current test suite */
static int iPort = 12514; /* port which shall be used for sending data */
static char* pszCustomConf = NULL; /* custom config file, use -c conf to specify */
static int verbose = 0; /* verbose output? -v option */
+static int IPv4Only = 0; /* use only IPv4 in rsyslogd call? */
static char **ourEnvp;
/* these two are quick hacks... */
@@ -92,6 +94,7 @@ void readLine(int fd, char *ln)
if(verbose)
fprintf(stderr, "begin readLine\n");
lenRead = read(fd, &c, 1);
+
while(lenRead == 1 && c != '\n') {
if(c == '\0') {
*ln = c;
@@ -104,6 +107,11 @@ void readLine(int fd, char *ln)
}
*ln = '\0';
+ if(lenRead < 0) {
+ printf("read from rsyslogd returned with error '%s' - aborting test\n", strerror(errno));
+ exit(1);
+ }
+
if(verbose)
fprintf(stderr, "end readLine, val read '%s'\n", orig);
}
@@ -157,7 +165,7 @@ tcpSend(char *buf, int lenBuf)
iRet = 1;
goto finalize_it;
} else {
- usleep(100000); /* 0.1 sec, these are us! */
+ usleep(100000); /* ms = 1000 us! */
}
}
}
@@ -236,13 +244,16 @@ int openPipe(char *configFile, pid_t *pid, int *pfd)
int pipefd[2];
pid_t cpid;
char *newargv[] = {"../tools/rsyslogd", "dummy", "-c4", "-u2", "-n", "-irsyslog.pid",
- "-M../runtime/.libs:../.libs", NULL };
+ "-M../runtime/.libs:../.libs", NULL, NULL};
char confFile[1024];
sprintf(confFile, "-f%s/testsuites/%s.conf", srcdir,
(pszCustomConf == NULL) ? configFile : pszCustomConf);
newargv[1] = confFile;
+ if(IPv4Only)
+ newargv[(sizeof(newargv)/sizeof(char*)) - 2] = "-4";
+
if (pipe(pipefd) == -1) {
perror("pipe");
exit(EXIT_FAILURE);
@@ -384,12 +395,17 @@ processTestFile(int fd, char *pszFileName)
/* pull response from server and then check if it meets our expectation */
//printf("try pull pipe...\n");
readLine(fd, buf);
+ if(strlen(buf) == 0) {
+ printf("something went wrong - read a zero-length string from rsyslogd\n");
+ exit(1);
+ }
if(strcmp(expected, buf)) {
++iFailed;
printf("\nFile %s:\nExpected Response:\n'%s'\nActual Response:\n'%s'\n",
pszFileName, expected, buf);
ret = 1;
}
+
/* we need to free buffers, as we have potentially modified them! */
free(testdata);
testdata = NULL;
@@ -397,7 +413,6 @@ processTestFile(int fd, char *pszFileName)
expected = NULL;
}
- free(expected);
fclose(fp);
return(ret);
}
@@ -452,11 +467,24 @@ doTests(int fd, char *files)
return(iFailed);
}
+
+/* indicate that our child has died (where it is not permitted to!).
+ */
+void childDied(__attribute__((unused)) int sig)
+{
+ printf("ERROR: child died unexpectedly (maybe a segfault?)!\n");
+ exit(1);
+}
+
+
/* cleanup */
void doAtExit(void)
{
int status;
+ /* disarm died-child handler */
+ signal(SIGCHLD, SIG_IGN);
+
if(rsyslogdPid != 0) {
kill(rsyslogdPid, SIGTERM);
waitpid(rsyslogdPid, &status, 0); /* wait until instance terminates */
@@ -480,8 +508,11 @@ int main(int argc, char *argv[], char *envp[])
char testcases[4096];
ourEnvp = envp;
- while((opt = getopt(argc, argv, "dc:i:p:t:v")) != EOF) {
+ while((opt = getopt(argc, argv, "4c:i:p:t:v")) != EOF) {
switch((char)opt) {
+ case '4':
+ IPv4Only = 1;
+ break;
case 'c':
pszCustomConf = optarg;
break;
@@ -538,6 +569,9 @@ int main(int argc, char *argv[], char *envp[])
}
fclose(fp);
+ /* arm died-child handler */
+ signal(SIGCHLD, childDied);
+
/* make sure we do not abort if there is an issue with pipes.
* our code does the necessary error handling.
*/
@@ -553,5 +587,6 @@ int main(int argc, char *argv[], char *envp[])
ret = 1;
if(verbose) printf("End of nettester run (%d).\n", ret);
+
exit(ret);
}
diff --git a/tests/omod-if-array.sh b/tests/omod-if-array.sh
index 2c2a8ef3..4e916f1e 100755
--- a/tests/omod-if-array.sh
+++ b/tests/omod-if-array.sh
@@ -1,4 +1,4 @@
-echo test omod-if-array via udp
+echo \[omod-if-array.sh\]: test omod-if-array via udp
$srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason
./nettester -tomod-if-array -iudp -p4711
diff --git a/tests/omruleset-queue.sh b/tests/omruleset-queue.sh
new file mode 100755
index 00000000..cfb80c62
--- /dev/null
+++ b/tests/omruleset-queue.sh
@@ -0,0 +1,19 @@
+# test for omruleset. What we do is have the main queue forward
+# all messages to a secondary ruleset via omruleset, which then does
+# the actual file write. We check if all messages arrive at the file,
+# what implies that omruleset works. No filters or special queue modes
+# are used, but the ruleset uses its own queue. So we can also inject
+# more messages without running into troubles.
+# added 2009-11-02 by rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[omruleset-queue.sh\]: test for omruleset functionality with a ruleset queue
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup omruleset-queue.conf
+source $srcdir/diag.sh injectmsg 0 20000
+echo doing shutdown
+source $srcdir/diag.sh shutdown-when-empty
+echo wait on shutdown
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 0 19999
+source $srcdir/diag.sh exit
diff --git a/tests/omruleset.sh b/tests/omruleset.sh
new file mode 100755
index 00000000..dbc5cb31
--- /dev/null
+++ b/tests/omruleset.sh
@@ -0,0 +1,22 @@
+# Basic test for omruleset. What we do is have the main queue forward
+# all messages to a secondary ruleset via omruleset, which then does
+# the actual file write. We check if all messages arrive at the file,
+# what implies that omruleset works. No filters or special queue modes
+# are used, so the message is re-enqueued into the main message queue.
+# We inject just 5,000 message because we may otherwise run into
+# queue full conditions (as we use the same queue) and that
+# would result in longer execution time. In any case, 5000 messages
+# are well enough to test what we want to test.
+# added 2009-11-02 by rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[omruleset.sh\]: basic test for omruleset functionality
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup omruleset.conf
+source $srcdir/diag.sh injectmsg 0 5000
+echo doing shutdown
+source $srcdir/diag.sh shutdown-when-empty
+echo wait on shutdown
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 0 4999
+source $srcdir/diag.sh exit
diff --git a/tests/parsertest.sh b/tests/parsertest.sh
index fc68ab84..9f9c2f74 100755
--- a/tests/parsertest.sh
+++ b/tests/parsertest.sh
@@ -2,6 +2,10 @@ echo TEST: \[parsertest.sh\]: various parser tests
source $srcdir/diag.sh init
source $srcdir/diag.sh nettester parse1 udp
source $srcdir/diag.sh nettester parse1 tcp
+source $srcdir/diag.sh nettester parse2 udp
+source $srcdir/diag.sh nettester parse2 tcp
+source $srcdir/diag.sh nettester parse_8bit_escape udp
+source $srcdir/diag.sh nettester parse_8bit_escape tcp
source $srcdir/diag.sh nettester parse3 udp
source $srcdir/diag.sh nettester parse3 tcp
source $srcdir/diag.sh nettester parse_invld_regex udp
@@ -18,6 +22,10 @@ source $srcdir/diag.sh nettester snare_ccoff_udp2 udp
echo \[parsertest.sh]: redoing tests in IPv4-only mode
source $srcdir/diag.sh nettester parse1 udp -4
source $srcdir/diag.sh nettester parse1 tcp -4
+source $srcdir/diag.sh nettester parse2 udp -4
+source $srcdir/diag.sh nettester parse2 tcp -4
+source $srcdir/diag.sh nettester parse_8bit_escape udp -4
+source $srcdir/diag.sh nettester parse_8bit_escape tcp -4
source $srcdir/diag.sh nettester parse3 udp -4
source $srcdir/diag.sh nettester parse3 tcp -4
source $srcdir/diag.sh nettester parse_invld_regex udp -4
diff --git a/tests/pipe_noreader.sh b/tests/pipe_noreader.sh
new file mode 100755
index 00000000..b2c46581
--- /dev/null
+++ b/tests/pipe_noreader.sh
@@ -0,0 +1,29 @@
+# This is test driver for a pipe that has no reader. This mimics a usual
+# real-world scenario, the /dev/xconsole pipe. Some versions of rsyslog
+# were known to hang or loop on this pipe, thus we added this scenario
+# as a permanent testcase. For some details, please see bug tracker
+# http://bugzilla.adiscon.com/show_bug.cgi?id=186
+#
+# IMPORTANT: we do NOT check any result message set. The whole point in
+# this test is to verify that we do NOT run into an eternal loop. As such,
+# the test is "PASS", if rsyslogd terminates. If it does not terminate, we
+# obviously do not cause "FAIL", but processing will hang, which should be
+# a good-enough indication of failure.
+#
+# added 2010-04-26 by Rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo TEST: \[pipe_noreader.sh\]: test for pipe writing without reader
+# uncomment for debugging support:
+#export RSYSLOG_DEBUG="debug nostdout noprintmutexaction"
+#export RSYSLOG_DEBUGLOG="log"
+source $srcdir/diag.sh init
+mkfifo ./rsyslog.pipe
+source $srcdir/diag.sh startup pipe_noreader.conf
+# we need to emit ~ 128K of data according to bug report
+source $srcdir/diag.sh tcpflood -m1000 -d500
+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
+# NO need to check seqno -- see header comment
+echo we did not loop, so the test is sucessfull
+source $srcdir/diag.sh exit
diff --git a/tests/pmlastmsg.sh b/tests/pmlastmsg.sh
new file mode 100755
index 00000000..9a14ce21
--- /dev/null
+++ b/tests/pmlastmsg.sh
@@ -0,0 +1,6 @@
+echo ==============================================================================
+echo \[pmlastmsg.sh\]: tests for pmlastmsg
+source $srcdir/diag.sh init
+source $srcdir/diag.sh nettester pmlastmsg udp
+source $srcdir/diag.sh nettester pmlastmsg tcp
+source $srcdir/diag.sh exit
diff --git a/tests/proprepltest.sh b/tests/proprepltest.sh
index 3c252e52..2e59a31d 100755
--- a/tests/proprepltest.sh
+++ b/tests/proprepltest.sh
@@ -1,4 +1,4 @@
-echo TEST: proprepltest.sh - various tests for the property replacer
+echo \[proprepltest.sh\]: various tests for the property replacer
source $srcdir/diag.sh init
source $srcdir/diag.sh nettester rfctag udp
source $srcdir/diag.sh nettester rfctag tcp
diff --git a/tests/queue-persist-drvr.sh b/tests/queue-persist-drvr.sh
index ea5386a7..53fbcb8b 100755
--- a/tests/queue-persist-drvr.sh
+++ b/tests/queue-persist-drvr.sh
@@ -24,5 +24,6 @@ source $srcdir/diag.sh check-mainq-spool
echo "#" > work-delay.conf
source $srcdir/diag.sh startup queue-persist.conf
source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+$srcdir/diag.sh wait-shutdown
source $srcdir/diag.sh seq-check 0 4999
source $srcdir/diag.sh exit
diff --git a/tests/queue-persist.sh b/tests/queue-persist.sh
index 999655b1..ff1842bb 100755
--- a/tests/queue-persist.sh
+++ b/tests/queue-persist.sh
@@ -2,6 +2,7 @@
# to carry out multiple tests with different queue modes
# added 2009-05-27 by Rgerhards
# This file is part of the rsyslog project, released under GPLv3
+echo \[queue-persist.sh\]:
source $srcdir/queue-persist-drvr.sh LinkedList
source $srcdir/queue-persist-drvr.sh FixedArray
# the disk test should not fail, however, the config is extreme and using
diff --git a/tests/rcvr_fail_restore.sh b/tests/rcvr_fail_restore.sh
new file mode 100755
index 00000000..79486f10
--- /dev/null
+++ b/tests/rcvr_fail_restore.sh
@@ -0,0 +1,122 @@
+# Copyright (C) 2011 by Rainer Gerhards
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[rcvr_fail_restore.sh\]: test failed receiver restore case
+source $srcdir/diag.sh init
+#
+# STEP1: start both instances and send 1000 messages.
+# Note: receiver is instance 2, sender instance 1.
+#
+# start up the instances. Note that the envrionment settings can be changed to
+# set instance-specific debugging parameters!
+#export RSYSLOG_DEBUG="debug nostdout"
+#export RSYSLOG_DEBUGLOG="log2"
+source $srcdir/diag.sh startup rcvr_fail_restore_rcvr.conf 2
+#export RSYSLOG_DEBUGLOG="log"
+#valgrind="valgrind"
+source $srcdir/diag.sh startup rcvr_fail_restore_sender.conf
+# re-set params so that new instances do not thrash it...
+#unset RSYSLOG_DEBUG
+#unset RSYSLOG_DEBUGLOG
+
+# now inject the messages into instance 2. It will connect to instance 1,
+# and that instance will record the data.
+source $srcdir/diag.sh injectmsg 1 1000
+source $srcdir/diag.sh wait-queueempty
+./msleep 1000 # let things settle down a bit
+
+#
+# Step 2: shutdown receiver, then send some more data, which then
+# needs to go into the queue.
+#
+
+source $srcdir/diag.sh shutdown-when-empty 2
+source $srcdir/diag.sh wait-shutdown 2
+
+source $srcdir/diag.sh injectmsg 1001 10000
+./msleep 3000 # make sure some retries happen (retry interval is set to 3 second)
+source $srcdir/diag.sh get-mainqueuesize
+ls -l test-spool
+
+#
+# Step 3: restart receiver, wait that the sender drains its queue
+#
+#export RSYSLOG_DEBUGLOG="log2"
+source $srcdir/diag.sh startup rcvr_fail_restore_rcvr.conf 2
+echo waiting for sender to drain queue [may need a short while]
+source $srcdir/diag.sh wait-queueempty
+ls -l test-spool
+OLDFILESIZE=$(stat -c%s test-spool/mainq.00000001)
+echo file size to expect is $OLDFILESIZE
+
+
+#
+# Step 4: send new data. Queue files are not permitted to grow now
+# (but one file continous to exist).
+#
+source $srcdir/diag.sh injectmsg 11001 10
+source $srcdir/diag.sh wait-queueempty
+
+# at this point, the queue file shall not have grown. Note
+# that we MUST NOT shut down the instance right now, because it
+# would clean up the queue files! So we need to do our checks
+# first (here!).
+ls -l test-spool
+NEWFILESIZE=$(stat -c%s test-spool/mainq.00000001)
+if [ $NEWFILESIZE != $OLDFILESIZE ]
+then
+ echo file sizes do not match, expected $OLDFILESIZE, actual $NEWFILESIZE
+ echo this means that data has been written to the queue file where it
+ echo no longer should be written.
+ # abort will happen below, because we must ensure proper system shutdown
+ # HOWEVER, during actual testing it may be useful to do an exit here (so
+ # that e.g. the debug log is pointed right at the correct spot).
+ # exit 1
+fi
+
+#
+# We now do an extra test (so this is two in one ;)) to see if the DA
+# queue can be reactivated after its initial shutdown. In essence, we
+# redo steps 2 and 3.
+#
+# Step 5: stop receiver again, then send some more data, which then
+# needs to go into the queue.
+#
+echo "*** done primary test *** now checking if DA can be restarted"
+source $srcdir/diag.sh shutdown-when-empty 2
+source $srcdir/diag.sh wait-shutdown 2
+
+source $srcdir/diag.sh injectmsg 11011 10000
+sleep 1 # we need to wait, otherwise we may be so fast that the receiver
+# comes up before we have finally suspended the action
+source $srcdir/diag.sh get-mainqueuesize
+ls -l test-spool
+
+#
+# Step 6: restart receiver, wait that the sender drains its queue
+#
+source $srcdir/diag.sh startup rcvr_fail_restore_rcvr.conf 2
+echo waiting for sender to drain queue [may need a short while]
+source $srcdir/diag.sh wait-queueempty
+ls -l test-spool
+
+#
+# Queue file size checks done. Now it is time to terminate the system
+# and see if everything could be received (the usual check, done here
+# for completeness, more or less as a bonus).
+#
+source $srcdir/diag.sh shutdown-when-empty
+source $srcdir/diag.sh wait-shutdown
+
+# now it is time to stop the receiver as well
+source $srcdir/diag.sh shutdown-when-empty 2
+source $srcdir/diag.sh wait-shutdown 2
+
+# now abort test if we need to (due to filesize predicate)
+if [ $NEWFILESIZE != $OLDFILESIZE ]
+then
+ exit 1
+fi
+# do the final check
+source $srcdir/diag.sh seq-check 1 21010
+source $srcdir/diag.sh exit
diff --git a/tests/resultdata/imuxsock_ccmiddle.log b/tests/resultdata/imuxsock_ccmiddle.log
new file mode 100644
index 00000000..d2531f9d
--- /dev/null
+++ b/tests/resultdata/imuxsock_ccmiddle.log
@@ -0,0 +1 @@
+ test 1#0112
diff --git a/tests/resultdata/imuxsock_logger.log b/tests/resultdata/imuxsock_logger.log
new file mode 100644
index 00000000..883dabdf
--- /dev/null
+++ b/tests/resultdata/imuxsock_logger.log
@@ -0,0 +1 @@
+ test
diff --git a/tests/resultdata/imuxsock_traillf.log b/tests/resultdata/imuxsock_traillf.log
new file mode 100644
index 00000000..883dabdf
--- /dev/null
+++ b/tests/resultdata/imuxsock_traillf.log
@@ -0,0 +1 @@
+ test
diff --git a/tests/rt-init.c b/tests/rt-init.c
index dbe94b4a..2d43943f 100644
--- a/tests/rt-init.c
+++ b/tests/rt-init.c
@@ -28,7 +28,6 @@
MODULE_TYPE_TESTBENCH
-
BEGINInit
CODESTARTInit
ENDInit
diff --git a/tests/rulesetmultiqueue.sh b/tests/rulesetmultiqueue.sh
new file mode 100755
index 00000000..71ed9dce
--- /dev/null
+++ b/tests/rulesetmultiqueue.sh
@@ -0,0 +1,33 @@
+# Test for disk-only queue mode
+# This tests defines three rulesets, each one with its own queue. Then, it
+# sends data to them and checks the outcome. Note that we do need to
+# use some custom code as the test driver framework does not (yet?)
+# support multi-output-file operations.
+# added 2009-10-30 by Rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[rulesetmultiqueu.sh\]: testing multiple queues via rulesets
+source $srcdir/diag.sh init
+rm -f rsyslog.out1.log rsyslog.out2.log rsyslog.out3.log
+source $srcdir/diag.sh startup rulesetmultiqueue.conf
+source $srcdir/diag.sh wait-startup
+# now fill the three files (a bit sequentially, but they should
+# still get their share of concurrency - to increase the chance
+# we use three connections per set).
+source $srcdir/diag.sh tcpflood -c3 -p13514 -m20000 -i0
+source $srcdir/diag.sh tcpflood -c3 -p13515 -m20000 -i20000
+source $srcdir/diag.sh tcpflood -c3 -p13516 -m20000 -i40000
+
+# in this version of the imdiag, we do not have the capability to poll
+# all queues for emptyness. So we do a sleep in the hopes that this will
+# sufficiently drain the queues. This is race, but the best we currently
+# can do... - rgerhards, 2009-11-05
+sleep 2
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
+# now consolidate all logs into a single one so that we can use the
+# regular check logic
+cat rsyslog.out1.log rsyslog.out2.log rsyslog.out3.log > rsyslog.out.log
+source $srcdir/diag.sh seq-check 0 59999
+rm -f rsyslog.out1.log rsyslog.out2.log rsyslog.out3.log
+source $srcdir/diag.sh exit
diff --git a/tests/runtime-dummy.c b/tests/runtime-dummy.c
index 38e6bba1..5a9039bf 100644
--- a/tests/runtime-dummy.c
+++ b/tests/runtime-dummy.c
@@ -34,12 +34,13 @@ int repeatinterval = 30;
int bActExecWhenPrevSusp = 0;
int iActExecOnceInterval = 1;
int MarkInterval = 30;
+void *pMsgQueue = NULL;
void cflineClassic(void) {};
void selectorAddList(void) {};
void selectorConstruct(void) {};
void selectorDestruct(void) {};
-void getFIOPName(void) {};
+rsRetVal createMainQueue(void) { return RS_RET_ERR; }
ruleset_t *pCurrRuleset;
/* these are required by some dynamically loaded modules */
diff --git a/tests/sndrcv_drvr.sh b/tests/sndrcv_drvr.sh
index 3d613069..f9092647 100755
--- a/tests/sndrcv_drvr.sh
+++ b/tests/sndrcv_drvr.sh
@@ -1,50 +1,2 @@
-# This is test driver for testing two rsyslog instances. It can be
-# utilized by any test that just needs two instances with different
-# config files, where messages are injected in instance TWO and
-# (with whatever rsyslog mechanism) being relayed over to instance ONE,
-# where they are written to the log file. After the run, the completeness
-# of that log file is checked.
-# The code is almost the same, but the config files differ (probably greatly)
-# for different test cases. As such, this driver needs to be called with the
-# config file name ($2). From that name, the sender and receiver config file
-# names are automatically generated.
-# So: $1 config file name, $2 number of messages
-#
-# A note on TLS testing: the current testsuite (in git!) already contains
-# TLS test cases. However, getting these test cases correct is not simple.
-# That's not a problem with the code itself, but rater a problem with
-# synchronization in the test environment. So I have deciced to keep the
-# TLS tests in, but not yet actually utilize them. This is most probably
-# left as an excercise for future (devel) releases. -- rgerhards, 2009-11-11
-#
-# added 2009-11-11 by Rgerhards
-# This file is part of the rsyslog project, released under GPLv3
-# uncomment for debugging support:
-source $srcdir/diag.sh init
-# start up the instances
-#export RSYSLOG_DEBUG="debug nostdout noprintmutexaction"
-#export RSYSLOG_DEBUGLOG="log"
-source $srcdir/diag.sh startup $1_rcvr.conf
-source $srcdir/diag.sh wait-startup
-#export RSYSLOG_DEBUGLOG="log2"
-#valgrind="valgrind"
-source $srcdir/diag.sh startup $1_sender.conf 2
-source $srcdir/diag.sh wait-startup 2
-# may be needed by TLS (once we do it): sleep 30
-
-# now inject the messages into instance 2. It will connect to instance 1,
-# and that instance will record the data.
-source $srcdir/diag.sh tcpflood -m$2 -i1
-sleep 2 # make sure all data is received in input buffers
-# shut down sender when everything is sent, receiver continues to run concurrently
-# may be needed by TLS (once we do it): sleep 60
-source $srcdir/diag.sh shutdown-when-empty 2
-source $srcdir/diag.sh wait-shutdown 2
-# now it is time to stop the receiver as well
-source $srcdir/diag.sh shutdown-when-empty
-source $srcdir/diag.sh wait-shutdown
-
-# may be needed by TLS (once we do it): sleep 60
-# do the final check
-source $srcdir/diag.sh seq-check 1 $2
+source $srcdir/sndrcv_drvr_noexit.sh $1 $2
source $srcdir/diag.sh exit
diff --git a/tests/sndrcv_drvr_noexit.sh b/tests/sndrcv_drvr_noexit.sh
new file mode 100755
index 00000000..899eace3
--- /dev/null
+++ b/tests/sndrcv_drvr_noexit.sh
@@ -0,0 +1,49 @@
+# This is test driver for testing two rsyslog instances. It can be
+# utilized by any test that just needs two instances with different
+# config files, where messages are injected in instance TWO and
+# (with whatever rsyslog mechanism) being relayed over to instance ONE,
+# where they are written to the log file. After the run, the completeness
+# of that log file is checked.
+# The code is almost the same, but the config files differ (probably greatly)
+# for different test cases. As such, this driver needs to be called with the
+# config file name ($2). From that name, the sender and receiver config file
+# names are automatically generated.
+# So: $1 config file name, $2 number of messages
+#
+# A note on TLS testing: the current testsuite (in git!) already contains
+# TLS test cases. However, getting these test cases correct is not simple.
+# That's not a problem with the code itself, but rater a problem with
+# synchronization in the test environment. So I have deciced to keep the
+# TLS tests in, but not yet actually utilize them. This is most probably
+# left as an excercise for future (devel) releases. -- rgerhards, 2009-11-11
+#
+# added 2009-11-11 by Rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+# uncomment for debugging support:
+source $srcdir/diag.sh init
+# start up the instances
+#export RSYSLOG_DEBUG="debug nostdout noprintmutexaction"
+#export RSYSLOG_DEBUGLOG="log"
+source $srcdir/diag.sh startup $1_rcvr.conf
+source $srcdir/diag.sh wait-startup
+#export RSYSLOG_DEBUGLOG="log2"
+#valgrind="valgrind"
+source $srcdir/diag.sh startup $1_sender.conf 2
+source $srcdir/diag.sh wait-startup 2
+# may be needed by TLS (once we do it): sleep 30
+
+# now inject the messages into instance 2. It will connect to instance 1,
+# and that instance will record the data.
+source $srcdir/diag.sh tcpflood -m$2 -i1
+sleep 2 # make sure all data is received in input buffers
+# shut down sender when everything is sent, receiver continues to run concurrently
+# may be needed by TLS (once we do it): sleep 60
+source $srcdir/diag.sh shutdown-when-empty 2
+source $srcdir/diag.sh wait-shutdown 2
+# now it is time to stop the receiver as well
+source $srcdir/diag.sh shutdown-when-empty
+source $srcdir/diag.sh wait-shutdown
+
+# may be needed by TLS (once we do it): sleep 60
+# do the final check
+source $srcdir/diag.sh seq-check 1 $2
diff --git a/tests/sndrcv_failover.sh b/tests/sndrcv_failover.sh
new file mode 100755
index 00000000..4c5e1831
--- /dev/null
+++ b/tests/sndrcv_failover.sh
@@ -0,0 +1,21 @@
+# This tests failover capabilities. Data is sent to local port 13516, where
+# no process shall listen. Then it fails over to a second instance, then to
+# a file. The second instance is started. So all data should be received
+# there and none be logged to the file.
+# This builds on the basic sndrcv.sh test, but adds a first, failing,
+# location to the conf file.
+# added 2011-06-20 by Rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[sndrcv_failover.sh\]: testing failover capabilities for tcp sending
+source $srcdir/sndrcv_drvr_noexit.sh sndrcv_failover 50000
+ls -l rsyslog.empty
+if [[ -s rsyslog.empty ]] ; then
+ echo "FAIL: rsyslog.empty has data. Failover handling failed. Data is written"
+ echo " even though the previous action (in a failover chain!) properly"
+ echo " worked."
+ exit 1
+else
+ echo "rsyslog.empty is empty - OK"
+fi ;
+source $srcdir/diag.sh exit
diff --git a/tests/sndrcv_omudpspoof.sh b/tests/sndrcv_omudpspoof.sh
new file mode 100755
index 00000000..bb804d93
--- /dev/null
+++ b/tests/sndrcv_omudpspoof.sh
@@ -0,0 +1,10 @@
+# This runs sends and receives messages via UDP to the standard
+# ports. Note that with UDP we can always have message loss. While this is
+# less likely in a local environment, we strongly limit the amount of data
+# we send in the hope to not lose any messages. However, failure of this
+# test does not necessarily mean that the code is wrong (but it is very likely!)
+# added 2009-11-11 by Rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[sndrcv_omudpspoof.sh\]: testing sending and receiving via omudp
+source $srcdir/sndrcv_drvr.sh sndrcv_omudpspoof 50
diff --git a/tests/sndrcv_omudpspoof_nonstdpt.sh b/tests/sndrcv_omudpspoof_nonstdpt.sh
new file mode 100755
index 00000000..6aeb1a5f
--- /dev/null
+++ b/tests/sndrcv_omudpspoof_nonstdpt.sh
@@ -0,0 +1,10 @@
+# This runs sends and receives messages via UDP to the standard
+# ports. Note that with UDP we can always have message loss. While this is
+# less likely in a local environment, we strongly limit the amount of data
+# we send in the hope to not lose any messages. However, failure of this
+# test does not necessarily mean that the code is wrong (but it is very likely!)
+# added 2009-11-11 by Rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[sndrcv_omudpspoof_nonstdpt.sh\]: testing sending and receiving via omudp
+source $srcdir/sndrcv_drvr.sh sndrcv_omudpspoof_nonstdpt 50
diff --git a/tests/sndrcv_udp.sh b/tests/sndrcv_udp.sh
new file mode 100755
index 00000000..274a414a
--- /dev/null
+++ b/tests/sndrcv_udp.sh
@@ -0,0 +1,10 @@
+# This runs sends and receives messages via UDP to the standard
+# ports. Note that with UDP we can always have message loss. While this is
+# less likely in a local environment, we strongly limit the amount of data
+# we send in the hope to not lose any messages. However, failure of this
+# test does not necessarily mean that the code is wrong (but it is very likely!)
+# added 2009-11-11 by Rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[sndrcv_udp.sh\]: testing sending and receiving via udp
+source $srcdir/sndrcv_drvr.sh sndrcv_udp 50
diff --git a/tests/sndrcv_udp_nonstdpt.sh b/tests/sndrcv_udp_nonstdpt.sh
new file mode 100755
index 00000000..2ad2906f
--- /dev/null
+++ b/tests/sndrcv_udp_nonstdpt.sh
@@ -0,0 +1,10 @@
+# This runs sends and receives messages via UDP to the non-standard port 2514
+# Note that with UDP we can always have message loss. While this is
+# less likely in a local environment, we strongly limit the amount of data
+# we send in the hope to not lose any messages. However, failure of this
+# test does not necessarily mean that the code is wrong (but it is very likely!)
+# added 2009-11-11 by Rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[sndrcv_udp_nonstdpt.sh\]: testing sending and receiving via udp
+source $srcdir/sndrcv_drvr.sh sndrcv_udp_nonstdpt 50
diff --git a/tests/syslog_caller.c b/tests/syslog_caller.c
new file mode 100644
index 00000000..3f2702a6
--- /dev/null
+++ b/tests/syslog_caller.c
@@ -0,0 +1,75 @@
+/* A very primitive testing tool that just emits a number of
+ * messages to the system log socket. Currently sufficient, but
+ * obviously room for improvement.
+ *
+ * It is highly suggested NOT to "base" any derivative work
+ * on this tool ;)
+ *
+ * Options
+ *
+ * -s severity (0..7 accoding to syslog spec, r "rolling", default 6)
+ * -m number of messages to generate (default 500)
+ *
+ * Part of the testbench for rsyslog.
+ *
+ * Copyright 2010 Rainer Gerhards and Adiscon GmbH.
+ *
+ * This file is part of rsyslog.
+ *
+ * Rsyslog is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Rsyslog is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Rsyslog. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * A copy of the GPL can be found in the file "COPYING" in this distribution.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <syslog.h>
+
+static void usage(void)
+{
+ fprintf(stderr, "usage: syslog_caller num-messages\n");
+ exit(1);
+}
+
+
+int main(int argc, char *argv[])
+{
+ int i;
+ int opt;
+ int bRollingSev = 0;
+ int sev = 6;
+ int msgs = 500;
+
+ while((opt = getopt(argc, argv, "m:s:")) != -1) {
+ switch (opt) {
+ case 's': if(*optarg == 'r') {
+ bRollingSev = 1;
+ sev = 0;
+ } else
+ sev = atoi(optarg);
+ break;
+ case 'm': msgs = atoi(optarg);
+ break;
+ default: usage();
+ break;
+ }
+ }
+
+ for(i = 0 ; i < msgs ; ++i) {
+ syslog(sev % 8, "test message nbr %d, severity=%d", i, sev % 8);
+ if(bRollingSev)
+ sev++;
+ }
+ return(0);
+}
diff --git a/tests/syslog_inject.c b/tests/syslog_inject.c
new file mode 100644
index 00000000..a5d77b1a
--- /dev/null
+++ b/tests/syslog_inject.c
@@ -0,0 +1,28 @@
+/* This tool deliberately logs a message with the a trailing LF */
+/* Options:
+ * -l: inject linefeed at end of message
+ * -c: inject control character in middle of message
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <syslog.h>
+#include <string.h>
+
+static inline void usage(void) {
+ fprintf(stderr, "Usage: syslog_inject [-l] [-c]\n");
+ exit(1);
+}
+
+int main(int argc, char *argv[])
+{
+ if(argc != 2)
+ usage();
+ if(!strcmp(argv[1], "-l"))
+ syslog(LOG_NOTICE, "test\n");
+ else if(!strcmp(argv[1], "-c"))
+ syslog(LOG_NOTICE, "test 1\t2");
+ else
+ usage();
+
+ return 0;
+}
diff --git a/tests/tabescape_dflt.sh b/tests/tabescape_dflt.sh
new file mode 100755
index 00000000..d0e13ec9
--- /dev/null
+++ b/tests/tabescape_dflt.sh
@@ -0,0 +1,14 @@
+echo ===============================================================================
+echo \[tabescape_dflt.sh\]: test for default tab escaping
+$srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason
+
+./nettester -ttabescape_dflt -iudp
+if [ "$?" -ne "0" ]; then
+ exit 1
+fi
+
+echo test via tcp
+./nettester -ttabescape_dflt -itcp
+if [ "$?" -ne "0" ]; then
+ exit 1
+fi
diff --git a/tests/tabescape_off.sh b/tests/tabescape_off.sh
new file mode 100755
index 00000000..71ede7c0
--- /dev/null
+++ b/tests/tabescape_off.sh
@@ -0,0 +1,14 @@
+echo ===============================================================================
+echo \[tabescape_off.sh\]: test for tab escaping off
+$srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason
+
+./nettester -ttabescape_off -iudp
+if [ "$?" -ne "0" ]; then
+ exit 1
+fi
+
+echo test via tcp
+./nettester -ttabescape_off -itcp
+if [ "$?" -ne "0" ]; then
+ exit 1
+fi
diff --git a/tests/tcp-msgreduc-vg.sh b/tests/tcp-msgreduc-vg.sh
new file mode 100755
index 00000000..cd8534e4
--- /dev/null
+++ b/tests/tcp-msgreduc-vg.sh
@@ -0,0 +1,16 @@
+# check if valgrind violations occur. Correct output is not checked.
+# added 2011-03-01 by Rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[tcp-msgreduc-vg.sh\]: testing msg reduction via UDP
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup-vg tcp-msgreduc-vg.conf
+source $srcdir/diag.sh wait-startup
+./tcpflood -t 127.0.0.1 -m 4 -r -M "<133>2011-03-01T11:22:12Z host tag msgh ..."
+./tcpflood -t 127.0.0.1 -m 1 -r -M "<133>2011-03-01T11:22:12Z host tag msgh ...x"
+# we need to give rsyslog a little time to settle the receiver
+./msleep 1500
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown-vg
+source $srcdir/diag.sh check-exit-vg
+source $srcdir/diag.sh exit
diff --git a/tests/tcpflood.c b/tests/tcpflood.c
index c34f87c9..8485acbb 100644
--- a/tests/tcpflood.c
+++ b/tests/tcpflood.c
@@ -5,6 +5,7 @@
* -t target address (default 127.0.0.1)
* -p target port (default 13514)
* -n number of target ports (targets are in range -p..(-p+-n-1)
+ * Note -c must also be set to at LEAST the number of -n!
* -c number of connections (default 1)
* -m number of messages to send (connection is random)
* -i initial message number (optional)
@@ -15,6 +16,7 @@
* bytes as forth. Add -r to randomize the amount of extra
* data included in the range 1..(value of -d).
* -r randomize amount of extra data added (-d must be > 0)
+ * -s (silent) do not show progress indicator (never done on non-tty)
* -f support for testing dynafiles. If given, include a dynafile ID
* in the range 0..(f-1) as the SECOND field, shifting all field values
* one field to the right. Zero (default) disables this functionality.
@@ -31,6 +33,24 @@
* -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
+ * -R number of times the test shall be run (very useful for gathering performance
+ * data and other repetitive things). Default: 1
+ * -S number of seconds to sleep between different runs (-R) Default: 30
+ * -X generate sTats data records. Default: off
+ * -e encode output in CSV (not yet everywhere supported)
+ * for performance data:
+ * each inidividual line has the runtime of one test
+ * the last line has 0 in field 1, followed by numberRuns,TotalRuntime,
+ * Average,min,max
+ * -T transport to use. Currently supported: "udp", "tcp" (default)
+ * Note: UDP supports a single target port, only
+ * -W wait time between sending batches of messages, in microseconds (Default: 0)
+ * -b number of messages within a batch (default: 100,000,000 millions)
+ * -Y use multiple threads, one per connection (which means 1 if one only connection
+ * is configured!)
+ * -z private key file for TLS mode
+ * -Z cert (public key) file for TLS mode
+ * -L loglevel to use for GnuTLS troubleshooting (0-off to 10-all, 0 default)
*
* Part of the testbench for rsyslog.
*
@@ -65,7 +85,15 @@
#include <unistd.h>
#include <string.h>
#include <netinet/in.h>
+#include <pthread.h>
#include <sys/resource.h>
+#include <sys/time.h>
+#include <errno.h>
+#ifdef ENABLE_GNUTLS
+# include <gnutls/gnutls.h>
+# include <gcrypt.h>
+ GCRY_THREAD_OPTION_PTHREAD_IMPL;
+#endif
#define EXIT_FAILURE 1
#define INVALID_SOCKET -1
@@ -73,6 +101,7 @@
#define NETTEST_INPUT_CONF_FILE "nettest.input.conf" /* name of input file, must match $IncludeConfig in .conf files */
#define MAX_EXTRADATA_LEN 100*1024
+#define MAX_SENDBUF 2 * MAX_EXTRADATA_LEN
static char *targetIP = "127.0.0.1";
static char *msgPRI = "167";
@@ -82,10 +111,11 @@ static int dynFileIDs = 0;
static int extraDataLen = 0; /* amount of extra data to add to message */
static int bRandomizeExtraData = 0; /* randomize amount of extra data added */
static int numMsgsToSend; /* number of messages to send */
-static int numConnections = 1; /* number of connections to create */
+static unsigned numConnections = 1; /* number of connections to create */
static int *sockArray; /* array of sockets to use */
static int msgNum = 0; /* initial message number to start with */
static int bShowProgress = 1; /* show progress messages */
+static int bSilent = 0; /* completely silent operation */
static int bRandConnDrop = 0; /* randomly drop connections? */
static char *MsgToSend = NULL; /* if non-null, this is the actual message to send */
static int bBinaryFile = 0; /* is -I file binary */
@@ -94,6 +124,75 @@ 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) */
+static int numRuns = 1; /* number of times the test shall be run */
+static int sleepBetweenRuns = 30; /* number of seconds to sleep between runs */
+static int bStatsRecords = 0; /* generate stats records */
+static int bCSVoutput = 0; /* generate output in CSV (where applicable) */
+static long long batchsize = 100000000ll;
+static int waittime = 0;
+static int runMultithreaded = 0; /* run tests in multithreaded mode */
+static int numThrds = 1; /* number of threads to use */
+static char *tlsCertFile = NULL;
+static char *tlsKeyFile = NULL;
+static int tlsLogLevel = 0;
+
+#ifdef ENABLE_GNUTLS
+static gnutls_session_t *sessArray; /* array of TLS sessions to use */
+static gnutls_certificate_credentials tlscred;
+#endif
+
+/* variables for managing multi-threaded operations */
+int runningThreads; /* number of threads currently running */
+int doRun; /* shall sender thread begin to run? */
+pthread_mutex_t thrdMgmt; /* mutex for controling startup/shutdown */
+pthread_cond_t condStarted;
+pthread_cond_t condDoRun;
+
+/* the following struct provides information for a generator instance (thread) */
+struct instdata {
+ /* lower and upper bounds for the thread in question */
+ unsigned long long lower;
+ unsigned long long numMsgs; /* number of messages to send */
+ unsigned long long numSent; /* number of messages already sent */
+ unsigned idx; /**< index of fd to be used for sending */
+ pthread_t thread; /**< thread processing this instance */
+} *instarray = NULL;
+
+/* the following structure is used to gather performance data */
+struct runstats {
+ unsigned long long totalRuntime;
+ unsigned long minRuntime;
+ unsigned long maxRuntime;
+ int numRuns;
+};
+
+static int udpsock; /* socket for sending in UDP mode */
+static struct sockaddr_in udpRcvr; /* remote receiver in UDP mode */
+
+static enum { TP_UDP, TP_TCP, TP_TLS } transport = TP_TCP;
+
+/* forward definitions */
+static void initTLSSess(int);
+static int sendTLS(int i, char *buf, int lenBuf);
+static void closeTLSSess(int __attribute__((unused)) i);
+
+/* prepare send subsystem for UDP send */
+static inline int
+setupUDP(void)
+{
+ if((udpsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
+ return 1;
+
+ memset((char *) &udpRcvr, 0, sizeof(udpRcvr));
+ udpRcvr.sin_family = AF_INET;
+ udpRcvr.sin_port = htons(targetPort);
+ if(inet_aton(targetIP, &udpRcvr.sin_addr)==0) {
+ fprintf(stderr, "inet_aton() failed\n");
+ return(1);
+ }
+
+ return 0;
+}
/* open a single tcp connection
@@ -149,12 +248,18 @@ int openConn(int *fd)
*/
int openConnections(void)
{
- int i;
+ unsigned i;
char msgBuf[128];
size_t lenMsg;
+ if(transport == TP_UDP)
+ return setupUDP();
+
if(bShowProgress)
write(1, " open connections", sizeof(" open connections")-1);
+# ifdef ENABLE_GNUTLS
+ sessArray = calloc(numConnections, sizeof(gnutls_session_t));
+# endif
sockArray = calloc(numConnections, sizeof(int));
for(i = 0 ; i < numConnections ; ++i) {
if(i % 10 == 0) {
@@ -165,9 +270,14 @@ int openConnections(void)
printf("error in trying to open connection i=%d\n", i);
return 1;
}
+ if(transport == TP_TLS) {
+ initTLSSess(i);
+ }
+ }
+ if(bShowProgress) {
+ lenMsg = sprintf(msgBuf, "\r%5.5d open connections\n", i);
+ write(1, msgBuf, lenMsg);
}
- lenMsg = sprintf(msgBuf, "\r%5.5d open connections\n", i);
- write(1, msgBuf, lenMsg);
return 0;
}
@@ -182,11 +292,14 @@ int openConnections(void)
*/
void closeConnections(void)
{
- int i;
+ unsigned i;
size_t lenMsg;
struct linger ling;
char msgBuf[128];
+ if(transport == TP_UDP)
+ return;
+
if(bShowProgress)
write(1, " close connections", sizeof(" close connections")-1);
for(i = 0 ; i < numConnections ; ++i) {
@@ -203,11 +316,15 @@ void closeConnections(void)
ling.l_onoff = 1;
ling.l_linger = 1;
setsockopt(sockArray[i], SOL_SOCKET, SO_LINGER, &ling, sizeof(ling));
+ if(transport == TP_TLS)
+ closeTLSSess(i);
close(sockArray[i]);
}
}
- lenMsg = sprintf(msgBuf, "\r%5.5d close connections\n", i);
- write(1, msgBuf, lenMsg);
+ if(bShowProgress) {
+ lenMsg = sprintf(msgBuf, "\r%5.5d close connections\n", i);
+ write(1, msgBuf, lenMsg);
+ }
}
@@ -217,12 +334,11 @@ void closeConnections(void)
* of constructing test messages. -- rgerhards, 2010-03-31
*/
static inline void
-genMsg(char *buf, size_t maxBuf, int *pLenBuf)
+genMsg(char *buf, size_t maxBuf, int *pLenBuf, struct instdata *inst)
{
int edLen; /* actual extra data length to use */
char extraData[MAX_EXTRADATA_LEN + 1];
char dynFileIDBuf[128] = "";
- static int numMsgsGen = 0;
int done;
if(dataFP != NULL) {
@@ -261,11 +377,9 @@ genMsg(char *buf, size_t maxBuf, int *pLenBuf)
/* use fixed message format from command line */
*pLenBuf = snprintf(buf, maxBuf, "%s\n", MsgToSend);
}
+ ++inst->numSent;
- if(numMsgsGen++ >= numMsgsToSend)
- *pLenBuf = 0; /* indicate end of run */
-
-finalize_it: ;
+finalize_it: /*EMPTY to keep the compiler happy */;
}
/* send messages to the tcp connections we keep open. We use
@@ -276,50 +390,72 @@ finalize_it: ;
* last. All messages in between are sent over random connections.
* Note that message numbers start at 0.
*/
-int sendMessages(void)
+int sendMessages(struct instdata *inst)
{
- int i = 0;
+ unsigned i = 0;
int socknum;
int lenBuf;
- int lenSend;
- char *statusText;
+ int lenSend = 0;
+ char *statusText = "";
char buf[MAX_EXTRADATA_LEN + 1024];
+ char sendBuf[MAX_SENDBUF];
+ int offsSendBuf = 0;
- if(dataFile == NULL) {
- printf("Sending %d messages.\n", numMsgsToSend);
- statusText = "messages";
- } else {
- printf("Sending file '%s' %d times.\n", dataFile, numFileIterations);
- statusText = "kb";
+ if(!bSilent) {
+ if(dataFile == NULL) {
+ printf("Sending %llu messages.\n", inst->numMsgs);
+ statusText = "messages";
+ } else {
+ printf("Sending file '%s' %d times.\n", dataFile,
+ numFileIterations);
+ statusText = "kb";
+ }
}
if(bShowProgress)
printf("\r%8.8d %s sent", 0, statusText);
- while(1) { /* broken inside loop! */
- if(i < numConnections)
- socknum = i;
- else if(i >= numMsgsToSend - numConnections)
- socknum = i - (numMsgsToSend - numConnections);
- else {
- int rnd = rand();
- socknum = rnd % numConnections;
+ while(i < inst->numMsgs) {
+ if(runMultithreaded) {
+ socknum = inst->idx;
+ } else {
+ if(i < numConnections)
+ socknum = i;
+ else if(i >= inst->numMsgs - numConnections) {
+ socknum = i - (inst->numMsgs - numConnections);
+ } else {
+ int rnd = rand();
+ socknum = rnd % numConnections;
+ }
}
- genMsg(buf, sizeof(buf), &lenBuf); /* generate the message to send according to params */
- if(lenBuf == 0)
- break; /* end of processing! */
- if(sockArray[socknum] == -1) {
- /* connection was dropped, need to re-establish */
- if(openConn(&(sockArray[socknum])) != 0) {
- printf("error in trying to re-open connection %d\n", socknum);
- exit(1);
+ genMsg(buf, sizeof(buf), &lenBuf, inst); /* generate the message to send according to params */
+ if(transport == TP_TCP) {
+ if(sockArray[socknum] == -1) {
+ /* connection was dropped, need to re-establish */
+ if(openConn(&(sockArray[socknum])) != 0) {
+ printf("error in trying to re-open connection %d\n", socknum);
+ exit(1);
+ }
+ }
+ lenSend = send(sockArray[socknum], buf, lenBuf, 0);
+ } else if(transport == TP_UDP) {
+ lenSend = sendto(udpsock, buf, lenBuf, 0, &udpRcvr, sizeof(udpRcvr));
+ } else if(transport == TP_TLS) {
+ if(offsSendBuf + lenBuf < MAX_SENDBUF) {
+ memcpy(sendBuf+offsSendBuf, buf, lenBuf);
+ offsSendBuf += lenBuf;
+ lenSend = lenBuf; /* simulate "good" call */
+ } else {
+ lenSend = sendTLS(socknum, sendBuf, offsSendBuf);
+ lenSend = (lenSend == offsSendBuf) ? lenBuf : -1;
+ memcpy(sendBuf, buf, lenBuf);
+ offsSendBuf = lenBuf;
}
}
- lenSend = send(sockArray[socknum], buf, lenBuf, 0);
if(lenSend != lenBuf) {
printf("\r%5.5d\n", i);
fflush(stdout);
perror("send test data");
- printf("send() failed at socket %d, index %d, msgNum %d\n",
- sockArray[socknum], i, msgNum);
+ printf("send() failed at socket %d, index %d, msgNum %lld\n",
+ sockArray[socknum], i, inst->numSent);
fflush(stderr);
return(1);
}
@@ -327,7 +463,7 @@ int sendMessages(void)
if(bShowProgress)
printf("\r%8.8d", i);
}
- if(bRandConnDrop) {
+ if(!runMultithreaded && bRandConnDrop) {
/* if we need to randomly drop connections, see if we
* are a victim
*/
@@ -337,14 +473,333 @@ int sendMessages(void)
sockArray[socknum] = -1;
}
}
+ if(inst->numSent % batchsize == 0) {
+ usleep(waittime);
+ }
++msgNum;
++i;
}
- printf("\r%8.8d %s sent\n", i, statusText);
+ if(transport == TP_TLS && offsSendBuf != 0) {
+ /* send remaining buffer */
+ lenSend = sendTLS(socknum, sendBuf, offsSendBuf);
+ }
+ if(!bSilent)
+ printf("\r%8.8d %s sent\n", i, statusText);
+
+ return 0;
+}
+
+
+/* this is the thread that starts a generator
+ */
+static void *
+thrdStarter(void *arg)
+{
+ struct instdata *inst = (struct instdata*) arg;
+ pthread_mutex_lock(&thrdMgmt);
+ runningThreads++;
+ pthread_cond_signal(&condStarted);
+ while(doRun == 0) {
+ pthread_cond_wait(&condDoRun, &thrdMgmt);
+ }
+ pthread_mutex_unlock(&thrdMgmt);
+ if(sendMessages(inst) != 0) {
+ printf("error sending messages\n");
+ }
+ return NULL;
+}
+
+
+/* This function initializes the actual traffic generators. The function sets up all required
+ * parameter blocks and starts threads. It returns when all threads are ready to run
+ * and the main task must just enable them.
+ */
+static inline void
+prepareGenerators()
+{
+ int i;
+ long long msgsThrd;
+ long long starting = 0;
+
+ if(runMultithreaded) {
+ bSilent = 1;
+ numThrds = numConnections;
+ } else {
+ numThrds = 1;
+ }
+
+ runningThreads = 0;
+ doRun = 0;
+ pthread_mutex_init(&thrdMgmt, NULL);
+ pthread_cond_init(&condStarted, NULL);
+ pthread_cond_init(&condDoRun, NULL);
+
+ if(instarray != NULL) {
+ free(instarray);
+ }
+ instarray = calloc(numThrds, sizeof(struct instdata));
+ msgsThrd = numMsgsToSend / numThrds;
+
+ for(i = 0 ; i < numThrds ; ++i) {
+ instarray[i].lower = starting;
+ instarray[i].numMsgs = msgsThrd;
+ instarray[i].numSent = 0;
+ instarray[i].idx = i;
+ pthread_create(&(instarray[i].thread), NULL, thrdStarter, instarray + i);
+ /*printf("started thread %x\n", (unsigned) instarray[i].thread);*/
+ starting += msgsThrd;
+ }
+}
+
+/* Let all generators run. Threads must have been started. Here we wait until
+ * all threads are initialized and then broadcast that they can begin to run.
+ */
+static inline void
+runGenerators()
+{
+ pthread_mutex_lock(&thrdMgmt);
+ while(runningThreads != numThrds){
+ pthread_cond_wait(&condStarted, &thrdMgmt);
+ }
+ doRun = 1;
+ pthread_cond_broadcast(&condDoRun);
+ pthread_mutex_unlock(&thrdMgmt);
+}
+
+
+/* Wait for all traffic generators to stop.
+ */
+static inline void
+waitGenerators()
+{
+ int i;
+ for(i = 0 ; i < numThrds ; ++i) {
+ pthread_join(instarray[i].thread, NULL);
+ /*printf("thread %x stopped\n", (unsigned) instarray[i].thread);*/
+ }
+ pthread_mutex_destroy(&thrdMgmt);
+ pthread_cond_destroy(&condStarted);
+ pthread_cond_destroy(&condDoRun);
+}
+
+/* functions related to computing statistics on the runtime of a test. This is
+ * a separate function primarily not to mess up the test driver.
+ * rgerhards, 2010-12-08
+ */
+static inline void
+endTiming(struct timeval *tvStart, struct runstats *stats)
+{
+ long sec, usec;
+ unsigned long runtime;
+ struct timeval tvEnd;
+
+ gettimeofday(&tvEnd, NULL);
+ if(tvStart->tv_usec > tvEnd.tv_usec) {
+ tvEnd.tv_sec--;
+ tvEnd.tv_usec += 1000000;
+ }
+
+ sec = tvEnd.tv_sec - tvStart->tv_sec;
+ usec = tvEnd.tv_usec - tvStart->tv_usec;
+
+ runtime = sec * 1000 + (usec / 1000);
+ stats->totalRuntime += runtime;
+ if(runtime < stats->minRuntime)
+ stats->minRuntime = runtime;
+ if(runtime > stats->maxRuntime)
+ stats->maxRuntime = runtime;
+
+ if(!bSilent || bStatsRecords) {
+ if(bCSVoutput) {
+ printf("%ld.%3.3ld\n", runtime / 1000, runtime % 1000);
+ } else {
+ printf("runtime: %ld.%3.3ld\n", runtime / 1000, runtime % 1000);
+ }
+ }
+}
+
+
+/* generate stats summary record at end of run
+ */
+static inline void
+genStats(struct runstats *stats)
+{
+ long unsigned avg;
+ avg = stats->totalRuntime / stats->numRuns;
+
+ if(bCSVoutput) {
+ printf("#numRuns,TotalRuntime,AvgRuntime,MinRuntime,MaxRuntime\n");
+ printf("%d,%llu.%3.3d,%lu.%3.3lu,%lu.%3.3lu,%lu.%3.3lu\n",
+ stats->numRuns,
+ stats->totalRuntime / 1000, (int) stats->totalRuntime % 1000,
+ avg / 1000, avg % 1000,
+ stats->minRuntime / 1000, stats->minRuntime % 1000,
+ stats->maxRuntime / 1000, stats->maxRuntime % 1000);
+ } else {
+ printf("Runs: %d\n", stats->numRuns);
+ printf("Runtime:\n");
+ printf(" total: %llu.%3.3d\n", stats->totalRuntime / 1000,
+ (int) stats->totalRuntime % 1000);
+ printf(" avg: %lu.%3.3lu\n", avg / 1000, avg % 1000);
+ printf(" min: %lu.%3.3lu\n", stats->minRuntime / 1000, stats->minRuntime % 1000);
+ printf(" max: %lu.%3.3lu\n", stats->maxRuntime / 1000, stats->maxRuntime % 1000);
+ printf("All times are wallclock time.\n");
+ }
+}
+
+
+/* Run the actual test. This function handles various meta-parameters, like
+ * a specified number of iterations, performance measurement and so on...
+ * rgerhards, 2010-12-08
+ */
+static int
+runTests(void)
+{
+ struct timeval tvStart;
+ struct runstats stats;
+ int run;
+
+ stats.totalRuntime = 0;
+ stats.minRuntime = (unsigned long long) 0xffffffffffffffffll;
+ stats.maxRuntime = 0;
+ stats.numRuns = numRuns;
+ run = 1;
+ while(1) { /* loop broken inside */
+ if(!bSilent)
+ printf("starting run %d\n", run);
+ prepareGenerators();
+ gettimeofday(&tvStart, NULL);
+ runGenerators();
+ waitGenerators();
+ endTiming(&tvStart, &stats);
+ if(run == numRuns)
+ break;
+ if(!bSilent)
+ printf("sleeping %d seconds before next run\n", sleepBetweenRuns);
+ sleep(sleepBetweenRuns);
+ ++run;
+ }
+
+ if(bStatsRecords) {
+ genStats(&stats);
+ }
return 0;
}
+# if defined(ENABLE_GNUTLS)
+/* This defines a log function to be provided to GnuTLS. It hopefully
+ * helps us track down hard to find problems.
+ * rgerhards, 2008-06-20
+ */
+static void tlsLogFunction(int level, const char *msg)
+{
+ printf("GnuTLS (level %d): %s", level, msg);
+
+}
+
+
+/* global init GnuTLS
+ */
+static void
+initTLS(void)
+{
+ int r;
+
+ /* order of gcry_control and gnutls_global_init matters! */
+ gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+ gnutls_global_init();
+ /* set debug mode, if so required by the options */
+ if(tlsLogLevel > 0) {
+ gnutls_global_set_log_function(tlsLogFunction);
+ gnutls_global_set_log_level(tlsLogLevel);
+ }
+
+ r = gnutls_certificate_allocate_credentials(&tlscred);
+ if(r != GNUTLS_E_SUCCESS) {
+ printf("error allocating credentials\n");
+ gnutls_perror(r);
+ exit(1);
+ }
+ r = gnutls_certificate_set_x509_key_file(tlscred, tlsCertFile, tlsKeyFile, GNUTLS_X509_FMT_PEM);
+ if(r != GNUTLS_E_SUCCESS) {
+ printf("error setting certificate files -- have you mixed up key and certificate?\n");
+ printf("If in doubt, try swapping the files in -z/-Z\n");
+ printf("Certifcate is: '%s'\n", tlsCertFile);
+ printf("Key is: '%s'\n", tlsKeyFile);
+ gnutls_perror(r);
+ r = gnutls_certificate_set_x509_key_file(tlscred, tlsKeyFile, tlsCertFile,
+ GNUTLS_X509_FMT_PEM);
+ if(r == GNUTLS_E_SUCCESS) {
+ printf("Tried swapping files, this seems to work "
+ "(but results may be unpredictable!)\n");
+ } else {
+ exit(1);
+ }
+ }
+}
+
+
+static void
+initTLSSess(int i)
+{
+ int r;
+ gnutls_init(sessArray + i, GNUTLS_CLIENT);
+
+ /* Use default priorities */
+ gnutls_set_default_priority(sessArray[i]);
+
+ /* put our credentials to the current session */
+ r = gnutls_credentials_set(sessArray[i], GNUTLS_CRD_CERTIFICATE, tlscred);
+ if(r != GNUTLS_E_SUCCESS) {
+ fprintf (stderr, "Setting credentials failed\n");
+ gnutls_perror(r);
+ exit(1);
+ }
+
+ /* NOTE: the following statement generates a cast warning, but there seems to
+ * be no way around it with current GnuTLS. Do NOT try to "fix" the situation!
+ */
+ gnutls_transport_set_ptr(sessArray[i], (gnutls_transport_ptr_t) sockArray[i]);
+
+ /* Perform the TLS handshake */
+ r = gnutls_handshake(sessArray[i]);
+ if(r < 0) {
+ fprintf (stderr, "TLS Handshake failed\n");
+ gnutls_perror(r);
+ exit(1);
+ }
+}
+
+static int
+sendTLS(int i, char *buf, int lenBuf)
+{
+ int lenSent;
+ int r;
+
+ lenSent = 0;
+ while(lenSent != lenBuf) {
+ r = gnutls_record_send(sessArray[i], buf + lenSent, lenBuf - lenSent);
+ if(r < 0)
+ break;
+ lenSent += r;
+ }
+
+ return lenSent;
+}
+
+static void
+closeTLSSess(int i)
+{
+ gnutls_bye(sessArray[i], GNUTLS_SHUT_RDWR);
+ gnutls_deinit(sessArray[i]);
+}
+# else /* NO TLS available */
+static void initTLS(void) {}
+static void initTLSSess(int __attribute__((unused)) i) {}
+static int sendTLS(int __attribute__((unused)) i, char __attribute__((unused)) *buf, int __attribute__((unused)) lenBuf) { return 0; }
+static void closeTLSSess(int __attribute__((unused)) i) {}
+# endif
/* Run the test.
* rgerhards, 2009-04-03
@@ -369,18 +824,17 @@ int main(int argc, char *argv[])
setvbuf(stdout, buf, _IONBF, 48);
- if(!isatty(1))
- bShowProgress = 0;
-
- while((opt = getopt(argc, argv, "f:F:t:p:c:C:m:i:I:P:d:Dn:M:rB")) != -1) {
+ while((opt = getopt(argc, argv, "b:ef:F:t:p:c:C:m:i:I:P:d:Dn:L:M:rsBR:S:T:XW:Yz:Z:")) != -1) {
switch (opt) {
+ case 'b': batchsize = atoll(optarg);
+ break;
case 't': targetIP = optarg;
break;
case 'p': targetPort = atoi(optarg);
break;
case 'n': numTargetPorts = atoi(optarg);
break;
- case 'c': numConnections = atoi(optarg);
+ case 'c': numConnections = (unsigned) atoi(optarg);
break;
case 'C': numFileIterations = atoi(optarg);
break;
@@ -405,6 +859,8 @@ int main(int argc, char *argv[])
break;
case 'F': frameDelim = atoi(optarg);
break;
+ case 'L': tlsLogLevel = atoi(optarg);
+ break;
case 'M': MsgToSend = optarg;
break;
case 'I': dataFile = optarg;
@@ -413,20 +869,62 @@ int main(int argc, char *argv[])
*/
numMsgsToSend = 1000000;
break;
+ case 's': bSilent = 1;
+ break;
case 'B': bBinaryFile = 1;
break;
+ case 'R': numRuns = atoi(optarg);
+ break;
+ case 'S': sleepBetweenRuns = atoi(optarg);
+ break;
+ case 'X': bStatsRecords = 1;
+ break;
+ case 'e': bCSVoutput = 1;
+ break;
+ case 'T': if(!strcmp(optarg, "udp")) {
+ transport = TP_UDP;
+ } else if(!strcmp(optarg, "tcp")) {
+ transport = TP_TCP;
+ } else if(!strcmp(optarg, "tls")) {
+# if defined(ENABLE_GNUTLS)
+ transport = TP_TLS;
+# else
+ fprintf(stderr, "compiled without TLS support: "
+ "\"-Ttls\" not supported!\n");
+ exit(1);
+# endif
+ } else {
+ fprintf(stderr, "unknown transport '%s'\n", optarg);
+ exit(1);
+ }
+ break;
+ case 'W': waittime = atoi(optarg);
+ break;
+ case 'Y': runMultithreaded = 1;
+ break;
+ case 'z': tlsKeyFile = optarg;
+ break;
+ case 'Z': tlsCertFile = optarg;
+ break;
default: printf("invalid option '%c' or value missing - terminating...\n", opt);
exit (1);
break;
}
}
+ if(bStatsRecords && waittime) {
+ fprintf(stderr, "warning: generating performance stats and using a waittime "
+ "is somewhat contradictory!\n");
+ }
+
+ if(!isatty(1) || bSilent)
+ bShowProgress = 0;
+
if(numConnections > 20) {
/* if we use many (whatever this means, 20 is randomly picked)
* connections, we need to make sure we have a high enough
* limit. -- rgerhards, 2010-03-25
*/
- struct rlimit maxFiles;
maxFiles.rlim_cur = numConnections + 20;
maxFiles.rlim_max = numConnections + 20;
if(setrlimit(RLIMIT_NOFILE, &maxFiles) < 0) {
@@ -445,20 +943,27 @@ int main(int argc, char *argv[])
}
}
+ if(transport == TP_TLS) {
+ initTLS();
+ }
+
if(openConnections() != 0) {
printf("error opening connections\n");
exit(1);
}
- if(sendMessages() != 0) {
- printf("error sending messages\n");
+ if(runTests() != 0) {
+ printf("error running tests\n");
exit(1);
}
- if(nConnDrops > 0)
+ closeConnections(); /* this is important so that we do not finish too early! */
+
+ if(nConnDrops > 0 && !bSilent)
printf("-D option initiated %ld connection closures\n", nConnDrops);
- printf("End of tcpflood Run\n");
- closeConnections(); /* this is important so that we do not finish too early! */
+ if(!bSilent)
+ printf("End of tcpflood Run\n");
+
exit(ret);
}
diff --git a/tests/testconfgen.c b/tests/testconfgen.c
new file mode 100644
index 00000000..9f191cc7
--- /dev/null
+++ b/tests/testconfgen.c
@@ -0,0 +1,72 @@
+/* a testcase generator
+ * THis program reads stdin, which must consist of (name,stmt) tupels
+ * where name is a part of the config name (small!) and stmt is an actual
+ * config statement. These tupels must be encoded as
+ * name<SP>stmt<LF>
+ * on stdin. After all tupels are read, the power set of all possible
+ * configurations is generated.
+ * Copyright (C) 2011 by Rainer Gerhards and Adiscon GmbH
+ * Released under the GPLv3 as part of the rsyslog project.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static int arr[128];
+static char *name[128];
+static char *stmt[128];
+
+void output(int n)
+{
+ int i;
+
+ printf("name:");
+ for(i = 0 ; i < n ; ++i) {
+ if(arr[i]) {
+ printf("-%s", name[i]);
+ }
+ }
+ printf("\n");
+}
+
+void pows(int n, int i)
+{
+ if(i == 0) {
+ output(n);
+ } else {
+ --i;
+ arr[i] = 0;
+ pows(n, i);
+ arr[i] = 1;
+ pows(n, i);
+ }
+}
+
+
+int main(int argc, char *argv[])
+{
+ int n;
+ char iname[512];
+ char istmt[2048];
+ int nscanned;
+
+ n = 0;
+ while(!feof(stdin)) {
+ nscanned = scanf("%s %[^\n]s\n", iname, istmt);
+ if(nscanned == EOF)
+ break;
+ else if(nscanned != 2) {
+ fprintf(stderr, "problem scanning entry %d, scanned %d\n",
+ n, nscanned);
+ exit(1);
+ }
+ name[n] = strdup(iname);
+ stmt[n] = strdup(istmt);
+ n++;
+ printf("name: %s, stmt: %s\n", iname, istmt);
+ }
+ /* n is on to high for an index, but just right as the actual number! */
+
+ printf("read %d entries\n", n);
+ pows(n, n);
+}
diff --git a/tests/testsuites/1.tabescape_dflt b/tests/testsuites/1.tabescape_dflt
new file mode 100644
index 00000000..91444bd3
--- /dev/null
+++ b/tests/testsuites/1.tabescape_dflt
@@ -0,0 +1,3 @@
+<167>Mar 6 16:57:54 172.20.245.8 test: before HT after HT (do NOT remove TAB!)
+ before HT#011after HT (do NOT remove TAB!)
+#Only the first two lines are important, you may place anything behind them!
diff --git a/tests/testsuites/1.tabescape_off b/tests/testsuites/1.tabescape_off
new file mode 100644
index 00000000..6a331c35
--- /dev/null
+++ b/tests/testsuites/1.tabescape_off
@@ -0,0 +1,3 @@
+<167>Mar 6 16:57:54 172.20.245.8 test: before HT after HT (do NOT remove TAB!)
+ before HT after HT (do NOT remove TAB!)
+#Only the first two lines are important, you may place anything behind them!
diff --git a/tests/testsuites/4.parse1 b/tests/testsuites/4.parse1
new file mode 100644
index 00000000..07e2445a
--- /dev/null
+++ b/tests/testsuites/4.parse1
@@ -0,0 +1,4 @@
+<29>Jul 31 21:39:21 example-b example-gw[10538]: disconnect host=/192.0.2.1 destination=192.0.2.2/11282 in=3274 out=1448 duration=0
+29,daemon,notice,Jul 31 21:39:21,example-b,example-gw,example-gw[10538]:, disconnect host=/192.0.2.1 destination=192.0.2.2/11282 in=3274 out=1448 duration=0
+# yet another real-life sample where we had some issues with - the important
+# part is the dash inside the hostname!
diff --git a/tests/testsuites/8bit.parse1 b/tests/testsuites/8bit.parse1
new file mode 100644
index 00000000..90db6352
--- /dev/null
+++ b/tests/testsuites/8bit.parse1
@@ -0,0 +1,2 @@
+<6>AUG 10 22:18:24 host tag This msg contains 8-bit European chars: äöü
+6,kern,info,Aug 10 22:18:24,host,tag,tag, This msg contains 8-bit European chars: äöü
diff --git a/tests/testsuites/8bit.parse_8bit_escape b/tests/testsuites/8bit.parse_8bit_escape
new file mode 100644
index 00000000..b2f6335c
--- /dev/null
+++ b/tests/testsuites/8bit.parse_8bit_escape
@@ -0,0 +1,2 @@
+<6>AUG 10 22:18:24 host tag This msg contains 8-bit European chars: äöü
+6,kern,info,Aug 10 22:18:24,host,tag,tag, This msg contains 8-bit European chars: #303#244#303#266#303#274
diff --git a/tests/testsuites/arrayqueue.conf b/tests/testsuites/arrayqueue.conf
new file mode 100644
index 00000000..c5874a83
--- /dev/null
+++ b/tests/testsuites/arrayqueue.conf
@@ -0,0 +1,14 @@
+# Test for queue fixedArray mode (see .sh file for details)
+# rgerhards, 2009-04-17
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+$MainMsgQueueTimeoutShutdown 10000
+$InputTCPServerRun 13514
+
+# set spool locations and switch queue to disk-only mode
+$MainMsgQueueType FixedArray
+
+$template outfmt,"%msg:F,58:2%\n"
+$template dynfile,"rsyslog.out.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile;outfmt
diff --git a/tests/testsuites/badqi.conf b/tests/testsuites/badqi.conf
new file mode 100644
index 00000000..0ab059df
--- /dev/null
+++ b/tests/testsuites/badqi.conf
@@ -0,0 +1,15 @@
+# Test for bad .qi file (see .sh file for details)
+# rgerhards, 2009-10-21
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+$MainMsgQueueTimeoutShutdown 10000
+$InputTCPServerRun 13514
+
+$template outfmt,"%msg:F,58:2%\n"
+$template dynfile,"rsyslog.out.log" # trick to use relative path names!
+# instruct to use bad .qi file
+$WorkDirectory bad_qi
+$ActionQueueType LinkedList
+$ActionQueueFileName dbq
+:msg, contains, "msgnum:" ?dynfile;outfmt
diff --git a/tests/testsuites/da-mainmsg-q.conf b/tests/testsuites/da-mainmsg-q.conf
new file mode 100644
index 00000000..843a3e4f
--- /dev/null
+++ b/tests/testsuites/da-mainmsg-q.conf
@@ -0,0 +1,21 @@
+# Test for DA mode in main message queue (see .sh file for details)
+# rgerhards, 2009-04-22
+$ModLoad ../plugins/imtcp/.libs/imtcp
+$MainMsgQueueTimeoutShutdown 10000
+$InputTCPServerRun 13514
+
+$IncludeConfig diag-common.conf
+
+# set spool locations and switch queue to disk assisted mode
+$WorkDirectory test-spool
+$MainMsgQueueSize 200 # this *should* trigger moving on to DA mode...
+# note: we must set QueueSize sufficiently high, so that 70% (light delay mark)
+# is high enough above HighWatermark!
+$MainMsgQueueHighWatermark 80
+$MainMsgQueueLowWatermark 40
+$MainMsgQueueFilename mainq
+$MainMsgQueueType linkedlist
+
+$template outfmt,"%msg:F,58:2%\n"
+$template dynfile,"rsyslog.out.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile;outfmt
diff --git a/tests/testsuites/diag-common.conf b/tests/testsuites/diag-common.conf
index 9e9e28fe..d76e2d15 100644
--- a/tests/testsuites/diag-common.conf
+++ b/tests/testsuites/diag-common.conf
@@ -13,4 +13,7 @@ $IMDiagServerRun 13500
$template startupfile,"rsyslogd.started" # trick to use relative path names!
:syslogtag, contains, "rsyslogd" ?startupfile
-$ErrorMessagesToStderr off
+# I have disabled the directive below, so that we see errors in testcase
+# creation. I am not sure why it was present in the first place, so for
+# now I just leave it commented out -- rgerhards, 2011-03-30
+#$ErrorMessagesToStderr off
diff --git a/tests/testsuites/dircreate_dflt.conf b/tests/testsuites/dircreate_dflt.conf
new file mode 100644
index 00000000..9b9aadb8
--- /dev/null
+++ b/tests/testsuites/dircreate_dflt.conf
@@ -0,0 +1,11 @@
+# see .sh file for description
+# rgerhards, 2009-11-30
+$IncludeConfig diag-common.conf
+
+# set spool locations and switch queue to disk-only mode
+$WorkDirectory test-spool
+$MainMsgQueueFilename mainq
+$MainMsgQueueType disk
+
+$template dynfile,"test-logdir/rsyslog.out.log" # trick to use relative path names!
+*.* ?dynfile
diff --git a/tests/testsuites/dircreate_off.conf b/tests/testsuites/dircreate_off.conf
new file mode 100644
index 00000000..28ccbd8c
--- /dev/null
+++ b/tests/testsuites/dircreate_off.conf
@@ -0,0 +1,12 @@
+# see .sh file for description
+# rgerhards, 2009-11-30
+$IncludeConfig diag-common.conf
+
+# set spool locations and switch queue to disk-only mode
+$WorkDirectory test-spool
+$MainMsgQueueFilename mainq
+$MainMsgQueueType disk
+
+$CreateDirs off
+$template dynfile,"test-logdir/rsyslog.out.log" # trick to use relative path names!
+*.* ?dynfile
diff --git a/tests/testsuites/discard-allmark.conf b/tests/testsuites/discard-allmark.conf
new file mode 100644
index 00000000..8a4983c1
--- /dev/null
+++ b/tests/testsuites/discard-allmark.conf
@@ -0,0 +1,15 @@
+# Test for discard functionality
+# rgerhards, 2009-07-30
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+$MainMsgQueueTimeoutShutdown 10000
+$InputTCPServerRun 13514
+
+$ActionWriteAllMarkMessages on
+
+:msg, contains, "00000001" ~
+
+$template outfmt,"%msg:F,58:2%\n"
+$template dynfile,"rsyslog.out.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile;outfmt
diff --git a/tests/testsuites/discard-rptdmsg.conf b/tests/testsuites/discard-rptdmsg.conf
new file mode 100644
index 00000000..74060e31
--- /dev/null
+++ b/tests/testsuites/discard-rptdmsg.conf
@@ -0,0 +1,15 @@
+# Test for discard functionality
+# rgerhards, 2009-07-30
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+$MainMsgQueueTimeoutShutdown 10000
+$InputTCPServerRun 13514
+
+$RepeatedMsgReduction on
+
+:msg, contains, "00000001" ~
+
+$template outfmt,"%msg:F,58:2%\n"
+$template dynfile,"rsyslog.out.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile;outfmt
diff --git a/tests/testsuites/discard.conf b/tests/testsuites/discard.conf
new file mode 100644
index 00000000..bbe2fe77
--- /dev/null
+++ b/tests/testsuites/discard.conf
@@ -0,0 +1,13 @@
+# Test for discard functionality
+# rgerhards, 2009-07-30
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+$MainMsgQueueTimeoutShutdown 10000
+$InputTCPServerRun 13514
+
+:msg, contains, "00000001" ~
+
+$template outfmt,"%msg:F,58:2%\n"
+$template dynfile,"rsyslog.out.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile;outfmt
diff --git a/tests/testsuites/empty.parse1 b/tests/testsuites/empty.parse1
new file mode 100644
index 00000000..86a86986
--- /dev/null
+++ b/tests/testsuites/empty.parse1
@@ -0,0 +1,3 @@
+<14>Jan 6 2009 15:22:26 localhost
+14,user,info,Jan 6 15:22:26,localhost,,,
+#Note: there is one space after localhost, but then \n!
diff --git a/tests/testsuites/execonlywhenprevsuspended.conf b/tests/testsuites/execonlywhenprevsuspended.conf
new file mode 100644
index 00000000..04dc6b59
--- /dev/null
+++ b/tests/testsuites/execonlywhenprevsuspended.conf
@@ -0,0 +1,13 @@
+# See main .sh file for info
+# rgerhards, 2010-06-23
+$IncludeConfig diag-common.conf
+
+# omtesting provides the ability to cause "SUSPENDED" action state
+$ModLoad ../plugins/omtesting/.libs/omtesting
+
+$MainMsgQueueTimeoutShutdown 100000
+$template outfmt,"%msg:F,58:2%\n"
+
+:msg, contains, "msgnum:" :omtesting:fail 2 0
+$ActionExecOnlyWhenPreviousIsSuspended on
+& ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/execonlywhenprevsuspended2.conf b/tests/testsuites/execonlywhenprevsuspended2.conf
new file mode 100644
index 00000000..86aa8832
--- /dev/null
+++ b/tests/testsuites/execonlywhenprevsuspended2.conf
@@ -0,0 +1,19 @@
+# See main .sh file for info
+# rgerhards, 2010-06-23
+$IncludeConfig diag-common.conf
+
+# omtesting provides the ability to cause "SUSPENDED" action state
+$ModLoad ../plugins/omtesting/.libs/omtesting
+
+$MainMsgQueueTimeoutShutdown 100000
+$template outfmt,"%msg:F,58:2%\n"
+
+:msg, contains, "msgnum:" :omtesting:fail 2 0
+$ActionExecOnlyWhenPreviousIsSuspended on
+& ./rsyslog.out.log;outfmt
+# note that we MUST re-set PrevSusp, else it will remain active
+# for all other actions as well (this tells us how bad the current
+# config language is...). -- rgerhards, 2010-06-24
+$ActionExecOnlyWhenPreviousIsSuspended off
+
+:msg, contains, "msgnum:" ./rsyslog2.out.log;outfmt
diff --git a/tests/testsuites/execonlywhenprevsuspended3.conf b/tests/testsuites/execonlywhenprevsuspended3.conf
new file mode 100644
index 00000000..d2750e9a
--- /dev/null
+++ b/tests/testsuites/execonlywhenprevsuspended3.conf
@@ -0,0 +1,18 @@
+# See main .sh file for info
+# rgerhards, 2010-06-23
+$IncludeConfig diag-common.conf
+
+# omtesting provides the ability to cause "SUSPENDED" action state
+$ModLoad ../plugins/omtesting/.libs/omtesting
+
+$MainMsgQueueTimeoutShutdown 100000
+$template outfmt,"%msg:F,58:2%\n"
+
+:msg, contains, "msgnum:" :omtesting:fail 2 0
+$ActionExecOnlyWhenPreviousIsSuspended on
+& ./rsyslog.out.log;outfmt
+# note that we MUST re-set PrevSusp, else it will remain active
+# for all other actions as well (this tells us how bad the current
+# config language is...). -- rgerhards, 2010-06-24
+$ActionExecOnlyWhenPreviousIsSuspended off
+& ./rsyslog2.out.log;outfmt
diff --git a/tests/testsuites/execonlywhenprevsuspended4.conf b/tests/testsuites/execonlywhenprevsuspended4.conf
new file mode 100644
index 00000000..04bc3805
--- /dev/null
+++ b/tests/testsuites/execonlywhenprevsuspended4.conf
@@ -0,0 +1,15 @@
+# See main .sh file for info
+# rgerhards, 2010-06-23
+$IncludeConfig diag-common.conf
+
+# omtesting provides the ability to cause "SUSPENDED" action state
+$ModLoad ../plugins/omtesting/.libs/omtesting
+
+$MainMsgQueueTimeoutShutdown 100000
+$template outfmt,"%msg:F,58:2%\n"
+
+:msg, contains, "msgnum:" :omtesting:fail 2 0
+$ActionExecOnlyWhenPreviousIsSuspended on
+& ./rsyslog.out.log;outfmt
+# note that $ActionExecOnlyWhenPreviousIsSuspended on is still active!
+& ./rsyslog2.out.log;outfmt
diff --git a/tests/testsuites/failover-async.conf b/tests/testsuites/failover-async.conf
new file mode 100644
index 00000000..76445de3
--- /dev/null
+++ b/tests/testsuites/failover-async.conf
@@ -0,0 +1,9 @@
+# see the equally-named .sh file for details
+$IncludeConfig diag-common.conf
+
+$template outfmt,"%msg:F,58:2%\n"
+# note: the target server shall not be available!
+
+$ActionQueueType LinkedList
+:msg, contains, "msgnum:" @@127.0.0.1:13514
+& ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/failover-basic.conf b/tests/testsuites/failover-basic.conf
new file mode 100644
index 00000000..a858769c
--- /dev/null
+++ b/tests/testsuites/failover-basic.conf
@@ -0,0 +1,8 @@
+# see the equally-named .sh file for details
+$IncludeConfig diag-common.conf
+
+$template outfmt,"%msg:F,58:2%\n"
+# note: the target server shall not be available!
+:msg, contains, "msgnum:" @@127.0.0.1:13514
+$ActionExecOnlyWhenPreviousIsSuspended on
+& ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/failover-double.conf b/tests/testsuites/failover-double.conf
new file mode 100644
index 00000000..a9991321
--- /dev/null
+++ b/tests/testsuites/failover-double.conf
@@ -0,0 +1,9 @@
+$IncludeConfig diag-common.conf
+
+$template outfmt,"%msg:F,58:2%\n"
+
+:msg, contains, "msgnum:" @@127.0.0.1:13516
+$ActionExecOnlyWhenPreviousIsSuspended on
+& @@127.0.0.1:1234
+& ./rsyslog.out.log;outfmt
+$ActionExecOnlyWhenPreviousIsSuspended off
diff --git a/tests/testsuites/failover-no-basic.conf b/tests/testsuites/failover-no-basic.conf
new file mode 100644
index 00000000..b40ef7d7
--- /dev/null
+++ b/tests/testsuites/failover-no-basic.conf
@@ -0,0 +1,9 @@
+# see the equally-named .sh file for details
+$IncludeConfig diag-common.conf
+
+$RepeatedMsgReduction off
+
+# second action should never execute
+:msg, contains, "msgnum:" /dev/null
+$ActionExecOnlyWhenPreviousIsSuspended on
+& ./rsyslog.out.log
diff --git a/tests/testsuites/failover-no-rptd.conf b/tests/testsuites/failover-no-rptd.conf
new file mode 100644
index 00000000..a46ce116
--- /dev/null
+++ b/tests/testsuites/failover-no-rptd.conf
@@ -0,0 +1,9 @@
+# see the equally-named .sh file for details
+$IncludeConfig diag-common.conf
+
+$RepeatedMsgReduction on
+
+# second action should never execute
+:msg, contains, "msgnum:" /dev/null
+$ActionExecOnlyWhenPreviousIsSuspended on
+& ./rsyslog.out.log
diff --git a/tests/testsuites/failover-rptd.conf b/tests/testsuites/failover-rptd.conf
new file mode 100644
index 00000000..d3553dbb
--- /dev/null
+++ b/tests/testsuites/failover-rptd.conf
@@ -0,0 +1,10 @@
+# see the equally-named .sh file for details
+$IncludeConfig diag-common.conf
+
+$RepeatedMsgReduction on
+
+$template outfmt,"%msg:F,58:2%\n"
+# note: the target server shall not be available!
+:msg, contains, "msgnum:" @@127.0.0.1:13514
+$ActionExecOnlyWhenPreviousIsSuspended on
+& ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/imuxsock_ccmiddle_root.conf b/tests/testsuites/imuxsock_ccmiddle_root.conf
new file mode 100644
index 00000000..8336ecfa
--- /dev/null
+++ b/tests/testsuites/imuxsock_ccmiddle_root.conf
@@ -0,0 +1,7 @@
+# rgerhards, 2011-02-21
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imuxsock/.libs/imuxsock
+
+$template outfmt,"%msg:%\n"
+*.notice ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/imuxsock_logger_root.conf b/tests/testsuites/imuxsock_logger_root.conf
new file mode 100644
index 00000000..8336ecfa
--- /dev/null
+++ b/tests/testsuites/imuxsock_logger_root.conf
@@ -0,0 +1,7 @@
+# rgerhards, 2011-02-21
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imuxsock/.libs/imuxsock
+
+$template outfmt,"%msg:%\n"
+*.notice ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/imuxsock_traillf_root.conf b/tests/testsuites/imuxsock_traillf_root.conf
new file mode 100644
index 00000000..8336ecfa
--- /dev/null
+++ b/tests/testsuites/imuxsock_traillf_root.conf
@@ -0,0 +1,7 @@
+# rgerhards, 2011-02-21
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imuxsock/.libs/imuxsock
+
+$template outfmt,"%msg:%\n"
+*.notice ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/libdbi-asyn.conf b/tests/testsuites/libdbi-asyn.conf
new file mode 100644
index 00000000..39b01fbc
--- /dev/null
+++ b/tests/testsuites/libdbi-asyn.conf
@@ -0,0 +1,12 @@
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/omlibdbi/.libs/omlibdbi
+
+$ActionQueueType LinkedList
+
+$ActionLibdbiDriver mysql
+$ActionLibdbiHost 127.0.0.1
+$ActionLibdbiUserName root
+$ActionLibdbiPassword pass
+$ActionLibdbiDBName Syslog
+:msg, contains, "msgnum:" :omlibdbi:
diff --git a/tests/testsuites/libdbi-basic.conf b/tests/testsuites/libdbi-basic.conf
new file mode 100644
index 00000000..212225cc
--- /dev/null
+++ b/tests/testsuites/libdbi-basic.conf
@@ -0,0 +1,9 @@
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/omlibdbi/.libs/omlibdbi
+$ActionLibdbiDriver mysql
+$ActionLibdbiHost 127.0.0.1
+$ActionLibdbiUserName root
+$ActionLibdbiPassword pass
+$ActionLibdbiDBName Syslog
+:msg, contains, "msgnum:" :omlibdbi:
diff --git a/tests/testsuites/linkedlistqueue.conf b/tests/testsuites/linkedlistqueue.conf
new file mode 100644
index 00000000..92a9649c
--- /dev/null
+++ b/tests/testsuites/linkedlistqueue.conf
@@ -0,0 +1,16 @@
+# Test for queue LinkedList mode (see .sh file for details)
+# rgerhards, 2009-04-17
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+$MainMsgQueueTimeoutShutdown 10000
+$InputTCPServerRun 13514
+
+$ErrorMessagesToStderr off
+
+# set spool locations and switch queue to disk-only mode
+$MainMsgQueueType LinkedList
+
+$template outfmt,"%msg:F,58:2%\n"
+$template dynfile,"rsyslog.out.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile;outfmt
diff --git a/tests/testsuites/malformed1.parse1 b/tests/testsuites/malformed1.parse1
new file mode 100644
index 00000000..a8825fe8
--- /dev/null
+++ b/tests/testsuites/malformed1.parse1
@@ -0,0 +1,6 @@
+<131>Oct 8 23:05:06 10.321.1.123 05",result_code=200,b
+131,local0,err,Oct 8 23:05:06,10.321.1.123,05",result_code=200,b,05",result_code=200,b,
+# a somewhat mangeld-with real-life sample of a malformed message
+# the key here is not what is being parsed, but that we do not abort!
+# NOTE: if a parser enhancement breaks the format, this is probably OK
+# also note that the above message does NOT contain a MSG part
diff --git a/tests/testsuites/manytcp-too-few-tls.conf b/tests/testsuites/manytcp-too-few-tls.conf
new file mode 100644
index 00000000..5269e73b
--- /dev/null
+++ b/tests/testsuites/manytcp-too-few-tls.conf
@@ -0,0 +1,22 @@
+# Test for tcp "flood" testing
+# rgerhards, 2009-04-08
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+$MainMsgQueueTimeoutShutdown 10000
+$MaxOpenFiles 200
+$InputTCPMaxSessions 1100
+# certificates
+$DefaultNetstreamDriverCAFile testsuites/x.509/ca.pem
+$DefaultNetstreamDriverCertFile testsuites/x.509/client-cert.pem
+$DefaultNetstreamDriverKeyFile testsuites/x.509/client-key.pem
+
+$DefaultNetstreamDriver gtls # use gtls netstream driver
+
+$InputTCPServerStreamDriverMode 1
+$InputTCPServerStreamDriverAuthMode anon
+$InputTCPServerRun 13514
+
+$template outfmt,"%msg:F,58:2%\n"
+$template dynfile,"rsyslog.out.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile;outfmt
diff --git a/tests/testsuites/mark.parse1 b/tests/testsuites/mark.parse1
new file mode 100644
index 00000000..fff9ae6d
--- /dev/null
+++ b/tests/testsuites/mark.parse1
@@ -0,0 +1,7 @@
+#This is a malformed message, but one from real life. At least,
+#it should be parsed as can be seen here.
+<6>Feb 18 16:01:59 serverX -- MARK --
+6,kern,info,Feb 18 16:01:59,serverX,--,--, MARK --
+# and the next one as an extreme case (note the absence of PRI)
+Feb 18 16:01:59 serverX -- MARK --
+13,user,notice,Feb 18 16:01:59,serverX,--,--, MARK --
diff --git a/tests/testsuites/master.pmlastmsg b/tests/testsuites/master.pmlastmsg
new file mode 100644
index 00000000..170538b0
--- /dev/null
+++ b/tests/testsuites/master.pmlastmsg
@@ -0,0 +1,28 @@
+# the following messages should be processed by pmlastmsg:
+<13>last message repeated 5 times
+last message repeated 5 times
+#
+<13>last message repeated 0090909787348927349875 times
+last message repeated 0090909787348927349875 times
+# now slightly malformed formats that should NOT be processed
+# by pmlasmsg:
+<13>last message repeated 5 times
+ repeated 5 times
+#
+<13>last message repeated 5 times -- more data
+ repeated 5 times -- more data
+# message count invalid:
+<13>last message repeated 5.2 times
+ repeated 5.2 times
+#
+#
+# now follow samples of non-pmlastmsg messages:
+#
+<167>Mar 6 16:57:54 172.20.245.8 TAG: Rest of message...
+ Rest of message...
+# Now exactly with 32 characters
+<167>Mar 6 16:57:54 172.20.245.8 TAG long message ================================================================================
+ long message ================================================================================
+# RFC5424 messages
+<34>1 2003-11-11T22:14:15.003Z mymachine.example.com su - ID47 last message repeated 5 times
+last message repeated 5 times
diff --git a/tests/testsuites/mysql-asyn.conf b/tests/testsuites/mysql-asyn.conf
new file mode 100644
index 00000000..acdf9bbd
--- /dev/null
+++ b/tests/testsuites/mysql-asyn.conf
@@ -0,0 +1,5 @@
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/ommysql/.libs/ommysql
+$ActionQueueType LinkedList
+:msg, contains, "msgnum:" :ommysql:127.0.0.1,Syslog,rsyslog,testbench;
diff --git a/tests/testsuites/mysql-basic.conf b/tests/testsuites/mysql-basic.conf
new file mode 100644
index 00000000..070094f5
--- /dev/null
+++ b/tests/testsuites/mysql-basic.conf
@@ -0,0 +1,4 @@
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/ommysql/.libs/ommysql
+:msg, contains, "msgnum:" :ommysql:127.0.0.1,Syslog,rsyslog,testbench;
diff --git a/tests/testsuites/mysql-select-msg.sql b/tests/testsuites/mysql-select-msg.sql
new file mode 100644
index 00000000..2d27a331
--- /dev/null
+++ b/tests/testsuites/mysql-select-msg.sql
@@ -0,0 +1,2 @@
+use Syslog;
+select substring(Message,9,8) from SystemEvents;
diff --git a/tests/testsuites/mysql-truncate.sql b/tests/testsuites/mysql-truncate.sql
new file mode 100644
index 00000000..ca852beb
--- /dev/null
+++ b/tests/testsuites/mysql-truncate.sql
@@ -0,0 +1,2 @@
+use Syslog;
+truncate table SystemEvents;
diff --git a/tests/testsuites/omruleset-queue.conf b/tests/testsuites/omruleset-queue.conf
new file mode 100644
index 00000000..edc33c40
--- /dev/null
+++ b/tests/testsuites/omruleset-queue.conf
@@ -0,0 +1,20 @@
+# test for omruleset (see .sh file for details)
+# rgerhards, 2009-11-02
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/omruleset/.libs/omruleset
+$ModLoad ../plugins/imtcp/.libs/imtcp
+$InputTCPServerRun 13514
+
+$ruleset rsinclude
+# create ruleset main queue with default parameters
+$RulesetCreateMainQueue on
+# make sure we do not terminate too early!
+$MainMsgQueueTimeoutShutdown 10000
+$template outfmt,"%msg:F,58:2%\n"
+$template dynfile,"rsyslog.out.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile;outfmt
+
+$ruleset RSYSLOG_DefaultRuleset
+$ActionOmrulesetRulesetName rsinclude
+*.* :omruleset:
diff --git a/tests/testsuites/omruleset.conf b/tests/testsuites/omruleset.conf
new file mode 100644
index 00000000..fa6b906e
--- /dev/null
+++ b/tests/testsuites/omruleset.conf
@@ -0,0 +1,16 @@
+# Basic test for omruleset (see .sh file for details)
+# rgerhards, 2009-11-02
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/omruleset/.libs/omruleset
+$ModLoad ../plugins/imtcp/.libs/imtcp
+$InputTCPServerRun 13514
+
+$ruleset rsinclude
+$template outfmt,"%msg:F,58:2%\n"
+$template dynfile,"rsyslog.out.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile;outfmt
+
+$ruleset RSYSLOG_DefaultRuleset
+$ActionOmrulesetRulesetName rsinclude
+*.* :omruleset:
diff --git a/tests/testsuites/parse2.conf b/tests/testsuites/parse2.conf
new file mode 100644
index 00000000..04d910bc
--- /dev/null
+++ b/tests/testsuites/parse2.conf
@@ -0,0 +1,8 @@
+$ModLoad ../plugins/omstdout/.libs/omstdout
+$IncludeConfig nettest.input.conf # This picks the to be tested input from the test driver!
+
+$ErrorMessagesToStderr off
+
+# use a special format that we can easily parse in expect
+$template output,"%PRI%,%syslogfacility-text%,%syslogseverity-text%,%timestamp%,%programname%,%syslogtag%,%msg%\n"
+*.* :omstdout:;output
diff --git a/tests/testsuites/parse_8bit_escape.conf b/tests/testsuites/parse_8bit_escape.conf
new file mode 100644
index 00000000..0598f33f
--- /dev/null
+++ b/tests/testsuites/parse_8bit_escape.conf
@@ -0,0 +1,9 @@
+$ModLoad ../plugins/omstdout/.libs/omstdout
+$IncludeConfig nettest.input.conf # This picks the to be tested input from the test driver!
+
+$ErrorMessagesToStderr off
+$Escape8BitCharactersOnReceive on
+
+# use a special format that we can easily parse in expect
+$template expect,"%PRI%,%syslogfacility-text%,%syslogseverity-text%,%timestamp%,%hostname%,%programname%,%syslogtag%,%msg%\n"
+*.* :omstdout:;expect
diff --git a/tests/testsuites/pipe_noreader.conf b/tests/testsuites/pipe_noreader.conf
new file mode 100644
index 00000000..63997760
--- /dev/null
+++ b/tests/testsuites/pipe_noreader.conf
@@ -0,0 +1,10 @@
+# simple async writing test
+# rgerhards, 2010-03-09
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+$MainMsgQueueTimeoutShutdown 10000
+$InputTCPServerRun 13514
+
+$template outfmt,"%msg:F,58:2%\n"
+:msg, contains, "msgnum:" |./rsyslog.pipe
diff --git a/tests/testsuites/pmlastmsg.conf b/tests/testsuites/pmlastmsg.conf
new file mode 100644
index 00000000..59142dca
--- /dev/null
+++ b/tests/testsuites/pmlastmsg.conf
@@ -0,0 +1,16 @@
+$ModLoad ../plugins/omstdout/.libs/omstdout
+$ModLoad ../plugins/pmlastmsg/.libs/pmlastmsg
+$IncludeConfig nettest.input.conf # This picks the to be tested input from the test driver!
+
+$ErrorMessagesToStderr off
+
+# in this test, we use pmlastmsg, followed by the one-size-fits-all
+# pm3164 (built-in) module. So we can test if non-pmlastmsg messages
+# are also correctly detected.
+$RulesetParser rsyslog.lastline
+$RulesetParser rsyslog.rfc5424
+$RulesetParser rsyslog.rfc3164
+
+# use a special format
+$template fmt,"%msg%\n"
+*.* :omstdout:;fmt
diff --git a/tests/testsuites/random.conf b/tests/testsuites/random.conf
index a7079df1..74ec61a8 100644
--- a/tests/testsuites/random.conf
+++ b/tests/testsuites/random.conf
@@ -4,6 +4,11 @@
# rgerhards, 2010-04-01
$IncludeConfig diag-common.conf
+# The random data will generate TCP framing error messages. We will
+# not clutter the test output with them. So we disable error messages
+# to stderr.
+$ErrorMessagesToStderr off
+
$ModLoad ../plugins/imtcp/.libs/imtcp
$MainMsgQueueTimeoutShutdown 10000
$InputTCPServerRun 13514
diff --git a/tests/testsuites/rcvr_fail_restore_rcvr.conf b/tests/testsuites/rcvr_fail_restore_rcvr.conf
new file mode 100644
index 00000000..38ebad29
--- /dev/null
+++ b/tests/testsuites/rcvr_fail_restore_rcvr.conf
@@ -0,0 +1,8 @@
+$IncludeConfig diag-common2.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+# then SENDER sends to this port (not tcpflood!)
+$InputTCPServerRun 13515
+
+$template outfmt,"%msg:F,58:2%\n"
+:msg, contains, "msgnum:" ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/rcvr_fail_restore_sender.conf b/tests/testsuites/rcvr_fail_restore_sender.conf
new file mode 100644
index 00000000..6b11aa4a
--- /dev/null
+++ b/tests/testsuites/rcvr_fail_restore_sender.conf
@@ -0,0 +1,15 @@
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+# this listener is for message generation by the test framework!
+$InputTCPServerRun 13514
+
+$WorkDirectory test-spool
+$MainMsgQueueMaxFileSize 1g
+$MainMsgQueueFileName mainq
+
+# we use the shortest resume interval a) to let the test not run too long
+# and b) make sure some retries happen before the reconnect
+$ActionResumeInterval 1
+$ActionResumeRetryCount -1
+*.* @@127.0.0.1:13515
diff --git a/tests/testsuites/reallife.parse1 b/tests/testsuites/reallife.parse1
new file mode 100644
index 00000000..a83d2dca
--- /dev/null
+++ b/tests/testsuites/reallife.parse1
@@ -0,0 +1,12 @@
+# New tests should be added to this file if there is no specific
+# reason for not doing that. Initially, we could only handle one test
+# case per file, but this restriction has been removed some time ago.
+# So it is less troublesome (and easier to overlook) to have all related
+# tests in a single file.
+# This file contains a lot of real-life samples (of course mangled so
+# that they can not be traced back to the original submitter). Note
+# that IP addr 192.0.2.1 is specifically set aside for testing and
+# documentation by IANA.
+# rgerhards, 2009-10-19
+<29>Oct 16 20:47:24 example-p exam-pl[12345]: connect host= /192.0.2.1
+29,daemon,notice,Oct 16 20:47:24,example-p,exam-pl,exam-pl[12345]:, connect host= /192.0.2.1
diff --git a/tests/testsuites/reallife.parse2 b/tests/testsuites/reallife.parse2
new file mode 100644
index 00000000..c42f2526
--- /dev/null
+++ b/tests/testsuites/reallife.parse2
@@ -0,0 +1,12 @@
+# New tests should be added to this file if there is no specific
+# reason for not doing that. Initially, we could only handle one test
+# case per file, but this restriction has been removed some time ago.
+# So it is less troublesome (and easier to overlook) to have all related
+# tests in a single file.
+# This file contains a lot of real-life samples (of course mangled so
+# that they can not be traced back to the original submitter). Note
+# that IP addr 192.0.2.1 is specifically set aside for testing and
+# documentation by IANA.
+# rgerhards, 2009-10-19
+<175>Oct 16 23:47:31 #001 MSWinEventLog 0#011Security#01119023582#011Fri Oct 16 16:30:44 2009#011592#011Security#011rgabcde#011User#011Success Audit#011XSXSXSN01#011Detailed Tracking#011#0112572#01119013885
+175,local5,debug,Oct 16 23:47:31,#001,#001, MSWinEventLog 0#011Security#01119023582#011Fri Oct 16 16:30:44 2009#011592#011Security#011rgabcde#011User#011Success Audit#011XSXSXSN01#011Detailed Tracking#011#0112572#01119013885
diff --git a/tests/testsuites/rfc5424-1.parse1 b/tests/testsuites/rfc5424-1.parse1
index 23836c9f..8a66d7ba 100644
--- a/tests/testsuites/rfc5424-1.parse1
+++ b/tests/testsuites/rfc5424-1.parse1
@@ -1,3 +1,3 @@
#Example from RFC5424, section 6.5 / sample 1
<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8
-34,auth,crit,Oct 11 22:14:15,mymachine.example.com,,su,- BOM'su root' failed for lonvick on /dev/pts/8
+34,auth,crit,Oct 11 22:14:15,mymachine.example.com,,su,BOM'su root' failed for lonvick on /dev/pts/8
diff --git a/tests/testsuites/rfc5424-2.parse1 b/tests/testsuites/rfc5424-2.parse1
index a86fbc35..f5449e68 100644
--- a/tests/testsuites/rfc5424-2.parse1
+++ b/tests/testsuites/rfc5424-2.parse1
@@ -1,4 +1,4 @@
<165>1 2003-08-24T05:14:15.000003-07:00 192.0.2.1 myproc 8710 - - %% It's time to make the do-nuts.
-165,local4,notice,Aug 24 05:14:15,192.0.2.1,,myproc[8710],- %% It's time to make the do-nuts.
+165,local4,notice,Aug 24 05:14:15,192.0.2.1,,myproc[8710],%% It's time to make the do-nuts.
#Example from RFC5424, section 6.5 / sample 2
#Only the first two lines are important, you may place anything behind them!
diff --git a/tests/testsuites/rulesetmultiqueue.conf b/tests/testsuites/rulesetmultiqueue.conf
new file mode 100644
index 00000000..c8a82dd6
--- /dev/null
+++ b/tests/testsuites/rulesetmultiqueue.conf
@@ -0,0 +1,34 @@
+# Test for multiple ruleset queues (see .sh file for details)
+# rgerhards, 2009-10-30
+$IncludeConfig diag-common.conf
+$ModLoad ../plugins/imtcp/.libs/imtcp
+$MainMsgQueueTimeoutShutdown 10000
+
+# general definition
+$template outfmt,"%msg:F,58:2%\n"
+
+# create the individual rulesets
+$ruleset file1
+$RulesetCreateMainQueue on
+$template dynfile1,"rsyslog.out1.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile1;outfmt
+
+$ruleset file2
+$RulesetCreateMainQueue on
+$template dynfile2,"rsyslog.out2.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile2;outfmt
+
+$ruleset file3
+$RulesetCreateMainQueue on
+$template dynfile3,"rsyslog.out3.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile3;outfmt
+
+# start listeners and bind them to rulesets
+$InputTCPServerBindRuleset file1
+$InputTCPServerRun 13514
+
+$InputTCPServerBindRuleset file2
+$InputTCPServerRun 13515
+
+$InputTCPServerBindRuleset file3
+$InputTCPServerRun 13516
diff --git a/tests/testsuites/sndrcv_failover_rcvr.conf b/tests/testsuites/sndrcv_failover_rcvr.conf
new file mode 100644
index 00000000..6f7ce34b
--- /dev/null
+++ b/tests/testsuites/sndrcv_failover_rcvr.conf
@@ -0,0 +1,11 @@
+# see equally-named shell file for details
+# rgerhards, 2009-11-11
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+# then SENDER sends to this port (not tcpflood!)
+$InputTCPServerRun 13515
+
+$template outfmt,"%msg:F,58:2%\n"
+$template dynfile,"rsyslog.out.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile;outfmt
diff --git a/tests/testsuites/sndrcv_failover_sender.conf b/tests/testsuites/sndrcv_failover_sender.conf
new file mode 100644
index 00000000..b8e7c186
--- /dev/null
+++ b/tests/testsuites/sndrcv_failover_sender.conf
@@ -0,0 +1,13 @@
+# see tcpsndrcv.sh for details
+# rgerhards, 2009-11-11
+$IncludeConfig diag-common2.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+# this listener is for message generation by the test framework!
+$InputTCPServerRun 13514
+
+*.* @@127.0.0.1:13516 # this must be DEAD
+$ActionExecOnlyWhenPreviousIsSuspended on
+& @@127.0.0.1:13515
+& ./rsyslog.empty
+$ActionExecOnlyWhenPreviousIsSuspended off
diff --git a/tests/testsuites/sndrcv_omudpspoof_nonstdpt_rcvr.conf b/tests/testsuites/sndrcv_omudpspoof_nonstdpt_rcvr.conf
new file mode 100644
index 00000000..65659f00
--- /dev/null
+++ b/tests/testsuites/sndrcv_omudpspoof_nonstdpt_rcvr.conf
@@ -0,0 +1,11 @@
+# see equally-named shell file for details
+# rgerhards, 2009-11-12
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imudp/.libs/imudp
+# then SENDER sends to this port (not tcpflood!)
+$UDPServerRun 2514
+
+$template outfmt,"%msg:F,58:2%\n"
+$template dynfile,"rsyslog.out.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile;outfmt
diff --git a/tests/testsuites/sndrcv_omudpspoof_nonstdpt_sender.conf b/tests/testsuites/sndrcv_omudpspoof_nonstdpt_sender.conf
new file mode 100644
index 00000000..29a30145
--- /dev/null
+++ b/tests/testsuites/sndrcv_omudpspoof_nonstdpt_sender.conf
@@ -0,0 +1,18 @@
+# see equally-named shell file for details
+# rgerhards, 2009-11-11
+$IncludeConfig diag-common2.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+# this listener is for message generation by the test framework!
+$InputTCPServerRun 13514
+
+$ModLoad ../plugins/omudpspoof/.libs/omudpspoof
+$template spoofaddr,"127.0.0.1"
+
+#begin action definition
+$ActionOMUDPSpoofSourceNameTemplate spoofaddr
+$ActionOMUDPSpoofTargetHost 127.0.0.1
+$ActionOMUDPSpoofTargetPort 2514
+$ActionOMUDPSpoofSourcePortStart 514
+$ActionOMUDPSpoofSourcePortEnd 514
+*.* :omudpspoof:
diff --git a/tests/testsuites/sndrcv_omudpspoof_rcvr.conf b/tests/testsuites/sndrcv_omudpspoof_rcvr.conf
new file mode 100644
index 00000000..e5401811
--- /dev/null
+++ b/tests/testsuites/sndrcv_omudpspoof_rcvr.conf
@@ -0,0 +1,11 @@
+# see equally-named shell file for details
+# rgerhards, 2009-11-12
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imudp/.libs/imudp
+# then SENDER sends to this port (not tcpflood!)
+$UDPServerRun 514
+
+$template outfmt,"%msg:F,58:2%\n"
+$template dynfile,"rsyslog.out.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile;outfmt
diff --git a/tests/testsuites/sndrcv_omudpspoof_sender.conf b/tests/testsuites/sndrcv_omudpspoof_sender.conf
new file mode 100644
index 00000000..c0d25935
--- /dev/null
+++ b/tests/testsuites/sndrcv_omudpspoof_sender.conf
@@ -0,0 +1,17 @@
+# see equally-named shell file for details
+# rgerhards, 2009-11-11
+$IncludeConfig diag-common2.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+# this listener is for message generation by the test framework!
+$InputTCPServerRun 13514
+
+$ModLoad ../plugins/omudpspoof/.libs/omudpspoof
+$template spoofaddr,"127.0.0.1"
+
+#begin action definition
+$ActionOMUDPSpoofSourceNameTemplate spoofaddr
+$ActionOMUDPSpoofTargetHost 127.0.0.1
+$ActionOMUDPSpoofSourcePortStart 514
+$ActionOMUDPSpoofSourcePortEnd 514
+*.* :omudpspoof:
diff --git a/tests/testsuites/sndrcv_sender.conf b/tests/testsuites/sndrcv_sender.conf
index c874c068..f3d6ba53 100644
--- a/tests/testsuites/sndrcv_sender.conf
+++ b/tests/testsuites/sndrcv_sender.conf
@@ -3,6 +3,7 @@
$IncludeConfig diag-common2.conf
$ModLoad ../plugins/imtcp/.libs/imtcp
+# this listener is for message generation by the test framework!
$InputTCPServerRun 13514
*.* @@127.0.0.1:13515
diff --git a/tests/testsuites/sndrcv_udp_nonstdpt_rcvr.conf b/tests/testsuites/sndrcv_udp_nonstdpt_rcvr.conf
new file mode 100644
index 00000000..65659f00
--- /dev/null
+++ b/tests/testsuites/sndrcv_udp_nonstdpt_rcvr.conf
@@ -0,0 +1,11 @@
+# see equally-named shell file for details
+# rgerhards, 2009-11-12
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imudp/.libs/imudp
+# then SENDER sends to this port (not tcpflood!)
+$UDPServerRun 2514
+
+$template outfmt,"%msg:F,58:2%\n"
+$template dynfile,"rsyslog.out.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile;outfmt
diff --git a/tests/testsuites/sndrcv_udp_nonstdpt_sender.conf b/tests/testsuites/sndrcv_udp_nonstdpt_sender.conf
new file mode 100644
index 00000000..2975f938
--- /dev/null
+++ b/tests/testsuites/sndrcv_udp_nonstdpt_sender.conf
@@ -0,0 +1,9 @@
+# see equally-named shell file for details
+# rgerhards, 2009-11-11
+$IncludeConfig diag-common2.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+# this listener is for message generation by the test framework!
+$InputTCPServerRun 13514
+
+*.* @127.0.0.1:2514
diff --git a/tests/testsuites/sndrcv_udp_rcvr.conf b/tests/testsuites/sndrcv_udp_rcvr.conf
new file mode 100644
index 00000000..e5401811
--- /dev/null
+++ b/tests/testsuites/sndrcv_udp_rcvr.conf
@@ -0,0 +1,11 @@
+# see equally-named shell file for details
+# rgerhards, 2009-11-12
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imudp/.libs/imudp
+# then SENDER sends to this port (not tcpflood!)
+$UDPServerRun 514
+
+$template outfmt,"%msg:F,58:2%\n"
+$template dynfile,"rsyslog.out.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile;outfmt
diff --git a/tests/testsuites/sndrcv_udp_sender.conf b/tests/testsuites/sndrcv_udp_sender.conf
new file mode 100644
index 00000000..28e913ef
--- /dev/null
+++ b/tests/testsuites/sndrcv_udp_sender.conf
@@ -0,0 +1,9 @@
+# see equally-named shell file for details
+# rgerhards, 2009-11-11
+$IncludeConfig diag-common2.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+# this listener is for message generation by the test framework!
+$InputTCPServerRun 13514
+
+*.* @127.0.0.1
diff --git a/tests/testsuites/tabescape_dflt.conf b/tests/testsuites/tabescape_dflt.conf
new file mode 100644
index 00000000..b9d92a37
--- /dev/null
+++ b/tests/testsuites/tabescape_dflt.conf
@@ -0,0 +1,8 @@
+$ModLoad ../plugins/omstdout/.libs/omstdout
+$IncludeConfig nettest.input.conf # This picks the to be tested input from the test driver!
+
+$ErrorMessagesToStderr off
+
+# use a special format that we can easily parse in expect
+$template fmt,"%msg%\n"
+*.* :omstdout:;fmt
diff --git a/tests/testsuites/tabescape_off.conf b/tests/testsuites/tabescape_off.conf
new file mode 100644
index 00000000..c1eca305
--- /dev/null
+++ b/tests/testsuites/tabescape_off.conf
@@ -0,0 +1,10 @@
+$ModLoad ../plugins/omstdout/.libs/omstdout
+$IncludeConfig nettest.input.conf # This picks the to be tested input from the test driver!
+
+$ErrorMessagesToStderr off
+
+$EscapeControlCharacterTab off
+
+# use a special format that we can easily parse in expect
+$template fmt,"%msg%\n"
+*.* :omstdout:;fmt
diff --git a/tests/testsuites/tcp-msgreduc-vg.conf b/tests/testsuites/tcp-msgreduc-vg.conf
new file mode 100644
index 00000000..72420f04
--- /dev/null
+++ b/tests/testsuites/tcp-msgreduc-vg.conf
@@ -0,0 +1,10 @@
+# Test for queue disk mode (see .sh file for details)
+# rgerhards, 2009-05-22
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imtcp/.libs/imtcp
+$InputTCPServerRun 13514
+$RepeatedMsgReduction on
+
+$template outfmt,"%msg:F,58:2%\n"
+*.* ./rsyslog.out.log;outfmt
diff --git a/tests/threadingmq.sh b/tests/threadingmq.sh
index bdb5f35e..ea5d7837 100755
--- a/tests/threadingmq.sh
+++ b/tests/threadingmq.sh
@@ -6,7 +6,7 @@
# in practice many threading bugs result in an abort rather quickly and these
# should be covered by this test here.
# rgerhards, 2009-06-26
-echo TEST: threadingmq.sh - main queue concurrency
+echo \[threadingmq.sh\]: main queue concurrency
source $srcdir/diag.sh init
source $srcdir/diag.sh startup threadingmq.conf
source $srcdir/diag.sh injectmsg 0 100000
diff --git a/tests/threadingmqaq.sh b/tests/threadingmqaq.sh
index 0104be00..ae5d3568 100755
--- a/tests/threadingmqaq.sh
+++ b/tests/threadingmqaq.sh
@@ -6,7 +6,7 @@
# in practice many threading bugs result in an abort rather quickly and these
# should be covered by this test here.
# rgerhards, 2009-06-26
-echo TEST: threadingmqaq.sh - main/action queue concurrency
+echo \[threadingmqaq.sh\]: main/action queue concurrency
source $srcdir/diag.sh init
source $srcdir/diag.sh startup threadingmqaq.conf
#source $srcdir/diag.sh tcpflood -c2 -m100000
diff --git a/tests/timestamp.sh b/tests/timestamp.sh
index 7699a4af..71416c33 100755
--- a/tests/timestamp.sh
+++ b/tests/timestamp.sh
@@ -1,4 +1,4 @@
-echo various timestamp tests
+echo \[timestamp.sh\]: various timestamp tests
source $srcdir/diag.sh init
source $srcdir/diag.sh nettester ts3164 udp
source $srcdir/diag.sh nettester ts3164 tcp
diff --git a/tests/validation-run.sh b/tests/validation-run.sh
index 2e922283..cc29482a 100755
--- a/tests/validation-run.sh
+++ b/tests/validation-run.sh
@@ -21,6 +21,7 @@
#
# A copy of the GPL can be found in the file "COPYING" in this distribution.
#set -x
+echo \[validation-run.sh\]: testing configuraton validation
echo "testing a failed configuration verification run"
../tools/rsyslogd -dn -u2 -c4 -N1 -f$srcdir/testsuites/invalid.conf -M../runtime/.libs:../.libs
if [ $? -ne 1 ]; then