summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2014-03-13 17:57:11 +0100
committerMichael Biebl <biebl@debian.org>2014-03-13 17:57:11 +0100
commit29867b5cc18d25191fbbdcc4af4f79cc3a4da43e (patch)
tree1ffedd33b2a2e167aeb4b01a6c5c72aeb98a1b90 /tests
parent5fccf771f37973a2cea543fbdf1ed94ed9706faf (diff)
downloadrsyslog-29867b5cc18d25191fbbdcc4af4f79cc3a4da43e.tar.gz
Imported Upstream version 7.6.1upstream/7.6.1
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am28
-rw-r--r--tests/Makefile.in69
-rw-r--r--tests/chkseq.c29
-rwxr-xr-xtests/daqueue-persist.sh1
-rwxr-xr-xtests/diskqueue.sh1
-rwxr-xr-xtests/mmpstrucdata.sh12
-rwxr-xr-xtests/rcvr_fail_restore.sh2
-rwxr-xr-xtests/rfc5424parser.sh12
-rwxr-xr-xtests/rs_optimizer_pri.sh17
-rwxr-xr-xtests/rscript_eq.sh13
-rwxr-xr-xtests/rscript_ge.sh13
-rwxr-xr-xtests/rscript_gt.sh13
-rwxr-xr-xtests/rscript_le.sh13
-rwxr-xr-xtests/rscript_lt.sh13
-rwxr-xr-xtests/rscript_ne.sh13
-rwxr-xr-xtests/stop-msgvar.sh12
-rw-r--r--tests/tcpflood.c28
-rw-r--r--tests/testsuites/mmpstrucdata.conf12
-rw-r--r--tests/testsuites/rfc5424parser.conf10
-rw-r--r--tests/testsuites/rs_optimizer_pri.conf8
-rw-r--r--tests/testsuites/rscript_eq.conf14
-rw-r--r--tests/testsuites/rscript_ge.conf13
-rw-r--r--tests/testsuites/rscript_gt.conf12
-rw-r--r--tests/testsuites/rscript_le.conf12
-rw-r--r--tests/testsuites/rscript_lt.conf12
-rw-r--r--tests/testsuites/rscript_ne.conf18
-rw-r--r--tests/testsuites/stop-localvar.conf8
-rw-r--r--tests/testsuites/stop-msgvar.conf21
28 files changed, 396 insertions, 33 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fd1dbce..489cd59 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -7,6 +7,8 @@ TESTS = $(TESTRUNS)
if ENABLE_IMDIAG
TESTS += \
stop-localvar.sh \
+ stop-msgvar.sh \
+ rfc5424parser.sh \
arrayqueue.sh \
da-mainmsg-q.sh \
validation-run.sh \
@@ -72,6 +74,7 @@ TESTS += \
rscript_prifilt.sh \
rscript_optimizer1.sh \
rscript_ruleset_call.sh \
+ rs_optimizer_pri.sh \
cee_simple.sh \
cee_diskqueue.sh \
incltest.sh \
@@ -118,6 +121,11 @@ TESTS += \
imptcp_conndrop.sh
endif
+if ENABLE_MMPSTRUCDATA
+TESTS += \
+ mmpstrucdata.sh
+endif
+
if ENABLE_GNUTLS
# TODO: re-enable in newer version
#TESTS += \
@@ -290,8 +298,26 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/rscript_stop.conf \
rscript_stop2.sh \
testsuites/rscript_stop2.conf \
+ rscript_le.sh \
+ testsuites/rscript_le.conf \
+ rscript_ge.sh \
+ testsuites/rscript_ge.conf \
+ rscript_lt.sh \
+ testsuites/rscript_lt.conf \
+ rscript_gt.sh \
+ testsuites/rscript_gt.conf \
+ rscript_ne.sh \
+ testsuites/rscript_ne.conf \
+ rscript_eq.sh \
+ testsuites/rscript_eq.conf \
stop-localvar.sh \
testsuites/stop-localvar.conf \
+ stop-msgvar.sh \
+ testsuites/stop-msgvar.conf \
+ rfc5424parser.sh \
+ testsuites/rfc5424parser.conf \
+ rs_optimizer_pri.sh \
+ testsuites/rs_optimizer_pri.conf \
rscript_prifilt.sh \
testsuites/rscript_prifilt.conf \
rscript_optimizer1.sh \
@@ -514,6 +540,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
mysql-asyn.sh \
mysql-asyn-vg.sh \
testsuites/mysql-asyn.conf \
+ mmpstrucdata.sh \
+ testsuites/mmpstrucdata.conf \
cfg.sh
# TODO: re-enable
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 06c6453..d8bcfaa 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -48,10 +48,12 @@ host_triplet = @host@
@ENABLE_TESTBENCH_TRUE@ $(am__append_7) $(am__append_8) \
@ENABLE_TESTBENCH_TRUE@ $(am__append_9) $(am__append_10) \
@ENABLE_TESTBENCH_TRUE@ $(am__append_11) $(am__append_12) \
-@ENABLE_TESTBENCH_TRUE@ $(am__append_13)
+@ENABLE_TESTBENCH_TRUE@ $(am__append_13) $(am__append_14)
#TESTS = $(TESTRUNS) cfg.sh
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_1 = \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ stop-localvar.sh \
+@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ stop-msgvar.sh \
+@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rfc5424parser.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ arrayqueue.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ da-mainmsg-q.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ validation-run.sh \
@@ -117,6 +119,7 @@ host_triplet = @host@
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_prifilt.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_optimizer1.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_ruleset_call.sh \
+@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rs_optimizer_pri.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ cee_simple.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ cee_diskqueue.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ incltest.sh \
@@ -153,20 +156,23 @@ host_triplet = @host@
@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ imptcp_addtlframedelim.sh \
@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ imptcp_conndrop.sh
+@ENABLE_MMPSTRUCDATA_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_7 = \
+@ENABLE_MMPSTRUCDATA_TRUE@@ENABLE_TESTBENCH_TRUE@ mmpstrucdata.sh
+
# TODO: re-enable in newer version
#TESTS += \
# #sndrcv_tls_anon.sh \
# #sndrcv_tls_anon_rebind.sh \
# #imtcp-tls-basic.sh
-@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@am__append_7 = imtcp-tls-basic-vg.sh \
+@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@am__append_8 = imtcp-tls-basic-vg.sh \
@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ imtcp_conndrop_tls-vg.sh
-@ENABLE_OMUXSOCK_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_8 = uxsock_simple.sh
-@ENABLE_OMUDPSPOOF_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_9 = sndrcv_omudpspoof.sh \
+@ENABLE_OMUXSOCK_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_9 = uxsock_simple.sh
+@ENABLE_OMUDPSPOOF_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_10 = sndrcv_omudpspoof.sh \
@ENABLE_OMUDPSPOOF_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_omudpspoof_nonstdpt.sh
-@ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_10 = omod-if-array.sh \
+@ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_11 = omod-if-array.sh \
@ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@ proprepltest.sh \
@ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@ parsertest.sh \
@ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp.sh \
@@ -178,16 +184,16 @@ host_triplet = @host@
@ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@ tabescape_off.sh \
@ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@ fieldtest.sh
-@ENABLE_IMDIAG_TRUE@@ENABLE_OMRULESET_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_11 = omruleset.sh \
+@ENABLE_IMDIAG_TRUE@@ENABLE_OMRULESET_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_12 = omruleset.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_OMRULESET_TRUE@@ENABLE_TESTBENCH_TRUE@ omruleset-queue.sh
# random.sh is temporarily disabled as it needs some work
# to rsyslog core to complete in reasonable time
#TESTS += random.sh
-@ENABLE_IMFILE_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_12 = imfile-basic.sh
-@ENABLE_IMFILE_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@am__append_13 = imfile-basic-vg.sh
-@ENABLE_GNUTLS_TRUE@am__append_14 = -lgcrypt
+@ENABLE_IMFILE_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_13 = imfile-basic.sh
+@ENABLE_IMFILE_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@am__append_14 = imfile-basic-vg.sh
+@ENABLE_GNUTLS_TRUE@am__append_15 = -lgcrypt
subdir = tests
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -351,6 +357,8 @@ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
+LIBLOGGING_STDLOG_CFLAGS = @LIBLOGGING_STDLOG_CFLAGS@
+LIBLOGGING_STDLOG_LIBS = @LIBLOGGING_STDLOG_LIBS@
LIBLOGNORM_CFLAGS = @LIBLOGNORM_CFLAGS@
LIBLOGNORM_LIBS = @LIBLOGNORM_LIBS@
LIBM = @LIBM@
@@ -375,6 +383,8 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
ORACLE_CFLAGS = @ORACLE_CFLAGS@
ORACLE_LIBS = @ORACLE_LIBS@
OTOOL = @OTOOL@
@@ -586,8 +596,26 @@ EXTRA_DIST = 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/rscript_stop.conf \
rscript_stop2.sh \
testsuites/rscript_stop2.conf \
+ rscript_le.sh \
+ testsuites/rscript_le.conf \
+ rscript_ge.sh \
+ testsuites/rscript_ge.conf \
+ rscript_lt.sh \
+ testsuites/rscript_lt.conf \
+ rscript_gt.sh \
+ testsuites/rscript_gt.conf \
+ rscript_ne.sh \
+ testsuites/rscript_ne.conf \
+ rscript_eq.sh \
+ testsuites/rscript_eq.conf \
stop-localvar.sh \
testsuites/stop-localvar.conf \
+ stop-msgvar.sh \
+ testsuites/stop-msgvar.conf \
+ rfc5424parser.sh \
+ testsuites/rfc5424parser.conf \
+ rs_optimizer_pri.sh \
+ testsuites/rs_optimizer_pri.conf \
rscript_prifilt.sh \
testsuites/rscript_prifilt.conf \
rscript_optimizer1.sh \
@@ -810,6 +838,8 @@ EXTRA_DIST = 1.rstest 2.rstest 3.rstest err1.rstest \
mysql-asyn.sh \
mysql-asyn-vg.sh \
testsuites/mysql-asyn.conf \
+ mmpstrucdata.sh \
+ testsuites/mmpstrucdata.conf \
cfg.sh
@@ -829,7 +859,7 @@ uxsockrcvr_LDADD = $(SOL_LIBS)
tcpflood_SOURCES = tcpflood.c
tcpflood_CPPFLAGS = $(PTHREADS_CFLAGS) $(GNUTLS_CFLAGS)
tcpflood_LDADD = $(SOL_LIBS) $(PTHREADS_LIBS) $(GNUTLS_LIBS) \
- $(am__append_14)
+ $(am__append_15)
minitcpsrv_SOURCES = minitcpsrvr.c
minitcpsrv_LDADD = $(SOL_LIBS)
syslog_caller_SOURCES = syslog_caller.c
@@ -945,22 +975,25 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uxsockrcvr.Po@am__quote@
.c.o:
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
diff --git a/tests/chkseq.c b/tests/chkseq.c
index bea9f83..bd8597e 100644
--- a/tests/chkseq.c
+++ b/tests/chkseq.c
@@ -51,6 +51,7 @@ int main(int argc, char *argv[])
int reachedEOF;
int edLen; /* length of extra data */
static char edBuf[500*1024]; /* buffer for extra data (pretty large to be on the save side...) */
+ static char ioBuf[sizeof(edBuf)+1024];
char *file = NULL;
while((opt = getopt(argc, argv, "e:f:ds:vE")) != EOF) {
@@ -103,14 +104,22 @@ int main(int argc, char *argv[])
for(i = start ; i < end+1 ; ++i) {
if(bHaveExtraData) {
- scanfOK = fscanf(fp, "%d,%d,%s\n", &val, &edLen, edBuf) == 3 ? 1 : 0;
+ if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) {
+ scanfOK = 0;
+ } else {
+ scanfOK = sscanf(ioBuf, "%d,%d,%s\n", &val, &edLen, edBuf) == 3 ? 1 : 0;
+ }
if(edLen != (int) strlen(edBuf)) {
printf("extra data length specified %d, but actually is %ld in record %d\n",
edLen, (long) strlen(edBuf), i);
exit(1);
}
} else {
- scanfOK = fscanf(fp, "%d\n", &val) == 1 ? 1 : 0;
+ if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) {
+ scanfOK = 0;
+ } else {
+ scanfOK = sscanf(ioBuf, "%d\n", &val) == 1 ? 1 : 0;
+ }
}
if(!scanfOK) {
printf("scanf error in index i=%d\n", i);
@@ -132,9 +141,11 @@ int main(int argc, char *argv[])
exit(1);
}
- if(feof(fp)) {
+ int c = getc(fp);
+ if(c == EOF) {
reachedEOF = 1;
} else {
+ ungetc(c, fp);
/* if duplicates are permitted, we need to do a final check if we have duplicates at the
* end of file.
*/
@@ -142,14 +153,22 @@ int main(int argc, char *argv[])
i = end;
while(!feof(fp)) {
if(bHaveExtraData) {
- scanfOK = fscanf(fp, "%d,%d,%s\n", &val, &edLen, edBuf) == 3 ? 1 : 0;
+ if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) {
+ scanfOK = 0;
+ } else {
+ scanfOK = sscanf(ioBuf, "%d,%d,%s\n", &val, &edLen, edBuf) == 3 ? 1 : 0;
+ }
if(edLen != (int) strlen(edBuf)) {
printf("extra data length specified %d, but actually is %ld in record %d\n",
edLen, (long) strlen(edBuf), i);
exit(1);
}
} else {
- scanfOK = fscanf(fp, "%d\n", &val) == 1 ? 1 : 0;
+ if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) {
+ scanfOK = 0;
+ } else {
+ scanfOK = sscanf(ioBuf, "%d\n", &val) == 1 ? 1 : 0;
+ }
}
if(val != i) {
diff --git a/tests/daqueue-persist.sh b/tests/daqueue-persist.sh
index feb2a34..0781a7d 100755
--- a/tests/daqueue-persist.sh
+++ b/tests/daqueue-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 ===============================================================================
echo \[daqueue-persist.sh\]: test data persisting at shutdown
source $srcdir/daqueue-persist-drvr.sh LinkedList
source $srcdir/daqueue-persist-drvr.sh FixedArray
diff --git a/tests/diskqueue.sh b/tests/diskqueue.sh
index b871e9e..853a836 100755
--- a/tests/diskqueue.sh
+++ b/tests/diskqueue.sh
@@ -5,6 +5,7 @@
# added 2009-04-17 by Rgerhards
# This file is part of the rsyslog project, released under GPLv3
# uncomment for debugging support:
+echo ===============================================================================
echo \[diskqueue.sh\]: testing queue disk-only mode
# uncomment for debugging support:
#export RSYSLOG_DEBUG="debug nostdout noprintmutexaction"
diff --git a/tests/mmpstrucdata.sh b/tests/mmpstrucdata.sh
new file mode 100755
index 0000000..62b6ba9
--- /dev/null
+++ b/tests/mmpstrucdata.sh
@@ -0,0 +1,12 @@
+# This file is part of the rsyslog project, released under ASL 2.0
+# rgerhards, 2013-11-22
+echo ===============================================================================
+echo \[mmpstrucdata.sh\]: testing mmpstrucdata
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup mmpstrucdata.conf
+sleep 1
+source $srcdir/diag.sh tcpflood -m100 -y
+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 99
+source $srcdir/diag.sh exit
diff --git a/tests/rcvr_fail_restore.sh b/tests/rcvr_fail_restore.sh
index 79486f1..a8c44ea 100755
--- a/tests/rcvr_fail_restore.sh
+++ b/tests/rcvr_fail_restore.sh
@@ -11,9 +11,11 @@ source $srcdir/diag.sh init
# set instance-specific debugging parameters!
#export RSYSLOG_DEBUG="debug nostdout"
#export RSYSLOG_DEBUGLOG="log2"
+echo starting receiver
source $srcdir/diag.sh startup rcvr_fail_restore_rcvr.conf 2
#export RSYSLOG_DEBUGLOG="log"
#valgrind="valgrind"
+echo starting sender
source $srcdir/diag.sh startup rcvr_fail_restore_sender.conf
# re-set params so that new instances do not thrash it...
#unset RSYSLOG_DEBUG
diff --git a/tests/rfc5424parser.sh b/tests/rfc5424parser.sh
new file mode 100755
index 0000000..3f5be49
--- /dev/null
+++ b/tests/rfc5424parser.sh
@@ -0,0 +1,12 @@
+# This file is part of the rsyslog project, released under ASL 2.0
+# rgerhards, 2013-11-22
+echo ===============================================================================
+echo \[rfc5424parser.sh\]: testing mmpstrucdata
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup rfc5424parser.conf
+sleep 1
+source $srcdir/diag.sh tcpflood -m100 -y
+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 99
+source $srcdir/diag.sh exit
diff --git a/tests/rs_optimizer_pri.sh b/tests/rs_optimizer_pri.sh
new file mode 100755
index 0000000..4d6e463
--- /dev/null
+++ b/tests/rs_optimizer_pri.sh
@@ -0,0 +1,17 @@
+# Test for the RainerScript optimizer, folding of
+# syslogfacility/priority-text to prifilt. Unfortunately, we cannot yet
+# automatically detect if the optimizer does not correctly fold, but we
+# can at least detect if it segfaults or otherwise creates incorrect code.
+# This file is part of the rsyslog project, released under ASL 2.0
+# rgerhards, 2013-11-20
+echo ===============================================================================
+echo \[rs_optimizer_pri.sh\]: testing RainerScript PRI optimizer
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup rs_optimizer_pri.conf
+sleep 1
+source $srcdir/diag.sh tcpflood -m100 # correct facility
+source $srcdir/diag.sh tcpflood -m100 -P175 # incorrect facility --> must be ignored
+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 99
+source $srcdir/diag.sh exit
diff --git a/tests/rscript_eq.sh b/tests/rscript_eq.sh
new file mode 100755
index 0000000..5668d4b
--- /dev/null
+++ b/tests/rscript_eq.sh
@@ -0,0 +1,13 @@
+# added 2014-01-17 by rgerhards
+# This file is part of the rsyslog project, released under ASL 2.0
+echo ===============================================================================
+echo \[rscript_eq.sh\]: testing rainerscript EQ statement
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup rscript_eq.conf
+source $srcdir/diag.sh injectmsg 0 8000
+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 5000 5002
+source $srcdir/diag.sh exit
diff --git a/tests/rscript_ge.sh b/tests/rscript_ge.sh
new file mode 100755
index 0000000..798e944
--- /dev/null
+++ b/tests/rscript_ge.sh
@@ -0,0 +1,13 @@
+# added 2014-01-17 by rgerhards
+# This file is part of the rsyslog project, released under ASL 2.0
+echo ===============================================================================
+echo \[rscript_ge.sh\]: testing rainerscript GE statement
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup rscript_ge.conf
+source $srcdir/diag.sh injectmsg 0 8000
+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/rscript_gt.sh b/tests/rscript_gt.sh
new file mode 100755
index 0000000..157f6f3
--- /dev/null
+++ b/tests/rscript_gt.sh
@@ -0,0 +1,13 @@
+# added 2014-01-17 by rgerhards
+# This file is part of the rsyslog project, released under ASL 2.0
+echo ===============================================================================
+echo \[rscript_gt.sh\]: testing rainerscript GT statement
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup rscript_gt.conf
+source $srcdir/diag.sh injectmsg 0 8000
+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 5000 7999
+source $srcdir/diag.sh exit
diff --git a/tests/rscript_le.sh b/tests/rscript_le.sh
new file mode 100755
index 0000000..426f207
--- /dev/null
+++ b/tests/rscript_le.sh
@@ -0,0 +1,13 @@
+# added 2014-01-17 by rgerhards
+# This file is part of the rsyslog project, released under ASL 2.0
+echo ===============================================================================
+echo \[rscript_le.sh\]: testing rainerscript LE statement
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup rscript_le.conf
+source $srcdir/diag.sh injectmsg 0 8000
+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 5000
+source $srcdir/diag.sh exit
diff --git a/tests/rscript_lt.sh b/tests/rscript_lt.sh
new file mode 100755
index 0000000..5d35164
--- /dev/null
+++ b/tests/rscript_lt.sh
@@ -0,0 +1,13 @@
+# added 2014-01-17 by rgerhards
+# This file is part of the rsyslog project, released under ASL 2.0
+echo ===============================================================================
+echo \[rscript_lt.sh\]: testing rainerscript LT statement
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup rscript_lt.conf
+source $srcdir/diag.sh injectmsg 0 8000
+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/rscript_ne.sh b/tests/rscript_ne.sh
new file mode 100755
index 0000000..9459ddd
--- /dev/null
+++ b/tests/rscript_ne.sh
@@ -0,0 +1,13 @@
+# added 2014-01-17 by rgerhards
+# This file is part of the rsyslog project, released under ASL 2.0
+echo ===============================================================================
+echo \[rscript_ne.sh\]: testing rainerscript NE statement
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup rscript_ne.conf
+source $srcdir/diag.sh injectmsg 0 8000
+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 5000 5002
+source $srcdir/diag.sh exit
diff --git a/tests/stop-msgvar.sh b/tests/stop-msgvar.sh
new file mode 100755
index 0000000..d8902da
--- /dev/null
+++ b/tests/stop-msgvar.sh
@@ -0,0 +1,12 @@
+# Test for "stop" statement
+# This file is part of the rsyslog project, released under ASL 2.0
+echo ===============================================================================
+echo \[stop-msgvar.sh\]: testing stop statement together with message variables
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup stop-msgvar.conf
+sleep 1
+source $srcdir/diag.sh tcpflood -m2000 -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 100 999
+source $srcdir/diag.sh exit
diff --git a/tests/tcpflood.c b/tests/tcpflood.c
index b3cef2e..f17363f 100644
--- a/tests/tcpflood.c
+++ b/tests/tcpflood.c
@@ -48,13 +48,14 @@
* -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!)
+ * -y use RFC5424 style test message
* -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.
*
- * Copyright 2009, 2010 Rainer Gerhards and Adiscon GmbH.
+ * Copyright 2009, 2013 Rainer Gerhards and Adiscon GmbH.
*
* This file is part of rsyslog.
*
@@ -111,6 +112,7 @@ static int targetPort = 13514;
static int numTargetPorts = 1;
static int dynFileIDs = 0;
static int extraDataLen = 0; /* amount of extra data to add to message */
+static int useRFC5424Format = 0; /* should the test message be in RFC5424 format? */
static int bRandomizeExtraData = 0; /* randomize amount of extra data added */
static int numMsgsToSend; /* number of messages to send */
static unsigned numConnections = 1; /* number of connections to create */
@@ -363,8 +365,14 @@ genMsg(char *buf, size_t maxBuf, int *pLenBuf, struct instdata *inst)
snprintf(dynFileIDBuf, sizeof(dynFileIDBuf), "%d:", rand() % dynFileIDs);
}
if(extraDataLen == 0) {
- *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%c",
- msgPRI, dynFileIDBuf, msgNum, frameDelim);
+ if(useRFC5424Format) {
+ *pLenBuf = snprintf(buf, maxBuf, "<%s>1 2003-03-01T01:00:00.000Z mymachine.example.com tcpflood "
+ "- tag [tcpflood@32473 MSGNUM=\"%8.8d\"] msgnum:%s%8.8d:%c",
+ msgPRI, msgNum, dynFileIDBuf, msgNum, frameDelim);
+ } else {
+ *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%c",
+ msgPRI, dynFileIDBuf, msgNum, frameDelim);
+ }
} else {
if(bRandomizeExtraData)
edLen = ((long) rand() + extraDataLen) % extraDataLen + 1;
@@ -372,8 +380,14 @@ genMsg(char *buf, size_t maxBuf, int *pLenBuf, struct instdata *inst)
edLen = extraDataLen;
memset(extraData, 'X', edLen);
extraData[edLen] = '\0';
- *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%d:%s%c",
- msgPRI, dynFileIDBuf, msgNum, edLen, extraData, frameDelim);
+ if(useRFC5424Format) {
+ *pLenBuf = snprintf(buf, maxBuf, "<%s>1 2003-03-01T01:00:00.000Z mymachine.example.com tcpflood "
+ "- tag [tcpflood@32473 MSGNUM=\"%8.8d\"] msgnum:%s%8.8d:%c",
+ msgPRI, msgNum, dynFileIDBuf, msgNum, frameDelim);
+ } else {
+ *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%d:%s%c",
+ msgPRI, dynFileIDBuf, msgNum, edLen, extraData, frameDelim);
+ }
}
} else {
/* use fixed message format from command line */
@@ -830,7 +844,7 @@ int main(int argc, char *argv[])
setvbuf(stdout, buf, _IONBF, 48);
- 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) {
+ while((opt = getopt(argc, argv, "b:ef:F:t:p:c:C:m:i:I:P:d:Dn:L:M:rsBR:S:T:XW:yYz:Z:")) != -1) {
switch (opt) {
case 'b': batchsize = atoll(optarg);
break;
@@ -908,6 +922,8 @@ int main(int argc, char *argv[])
break;
case 'Y': runMultithreaded = 1;
break;
+ case 'y': useRFC5424Format = 1;
+ break;
case 'z': tlsKeyFile = optarg;
break;
case 'Z': tlsCertFile = optarg;
diff --git a/tests/testsuites/mmpstrucdata.conf b/tests/testsuites/mmpstrucdata.conf
new file mode 100644
index 0000000..fd18fd9
--- /dev/null
+++ b/tests/testsuites/mmpstrucdata.conf
@@ -0,0 +1,12 @@
+$IncludeConfig diag-common.conf
+
+module(load="../plugins/mmpstrucdata/.libs/mmpstrucdata")
+module(load="../plugins/imtcp/.libs/imtcp")
+
+template(name="outfmt" type="string" string="%$!rfc5424-sd!tcpflood@32473!msgnum%\n")
+
+input(type="imtcp" port="13514")
+
+action(type="mmpstrucdata")
+if $msg contains "msgnum" then
+ action(type="omfile" template="outfmt" file="rsyslog.out.log")
diff --git a/tests/testsuites/rfc5424parser.conf b/tests/testsuites/rfc5424parser.conf
new file mode 100644
index 0000000..cd90d12
--- /dev/null
+++ b/tests/testsuites/rfc5424parser.conf
@@ -0,0 +1,10 @@
+$IncludeConfig diag-common.conf
+
+module(load="../plugins/imtcp/.libs/imtcp")
+
+template(name="outfmt" type="string" string="%msg:F,58:2%\n")
+
+input(type="imtcp" port="13514")
+
+if $msg contains "msgnum" then
+ action(type="omfile" template="outfmt" file="rsyslog.out.log")
diff --git a/tests/testsuites/rs_optimizer_pri.conf b/tests/testsuites/rs_optimizer_pri.conf
new file mode 100644
index 0000000..9ff27dc
--- /dev/null
+++ b/tests/testsuites/rs_optimizer_pri.conf
@@ -0,0 +1,8 @@
+$IncludeConfig diag-common.conf
+template(name="outfmt" type="string" string="%msg:F,58:2%\n")
+
+module(load="../plugins/imtcp/.libs/imtcp")
+input(type="imtcp" port="13514")
+
+if $syslogfacility-text == "local4" then
+ action(type="omfile" template="outfmt" file="rsyslog.out.log")
diff --git a/tests/testsuites/rscript_eq.conf b/tests/testsuites/rscript_eq.conf
new file mode 100644
index 0000000..0130aed
--- /dev/null
+++ b/tests/testsuites/rscript_eq.conf
@@ -0,0 +1,14 @@
+$IncludeConfig diag-common.conf
+
+template(name="outfmt" type="list") {
+ property(name="$!usr!msgnum")
+ constant(value="\n")
+}
+
+if $msg contains 'msgnum' then {
+ set $!usr!msgnum = field($msg, 58, 2);
+ if $!usr!msgnum == "00005000" or
+ $!usr!msgnum == "00005001" or
+ $!usr!msgnum == "00005002" then
+ action(type="omfile" file="./rsyslog.out.log" template="outfmt")
+}
diff --git a/tests/testsuites/rscript_ge.conf b/tests/testsuites/rscript_ge.conf
new file mode 100644
index 0000000..c2ff86a
--- /dev/null
+++ b/tests/testsuites/rscript_ge.conf
@@ -0,0 +1,13 @@
+$IncludeConfig diag-common.conf
+
+template(name="outfmt" type="list") {
+ property(name="$!usr!msgnum")
+ constant(value="\n")
+}
+
+if $msg contains 'msgnum' then {
+ set $!usr!msgnum = field($msg, 58, 2);
+ if $!usr!msgnum >= "00005000" then
+ stop
+ action(type="omfile" file="./rsyslog.out.log" template="outfmt")
+}
diff --git a/tests/testsuites/rscript_gt.conf b/tests/testsuites/rscript_gt.conf
new file mode 100644
index 0000000..9a651ad
--- /dev/null
+++ b/tests/testsuites/rscript_gt.conf
@@ -0,0 +1,12 @@
+$IncludeConfig diag-common.conf
+
+template(name="outfmt" type="list") {
+ property(name="$!usr!msgnum")
+ constant(value="\n")
+}
+
+if $msg contains 'msgnum' then {
+ set $!usr!msgnum = field($msg, 58, 2);
+ if $!usr!msgnum > "00004999" then
+ action(type="omfile" file="./rsyslog.out.log" template="outfmt")
+}
diff --git a/tests/testsuites/rscript_le.conf b/tests/testsuites/rscript_le.conf
new file mode 100644
index 0000000..1963cc5
--- /dev/null
+++ b/tests/testsuites/rscript_le.conf
@@ -0,0 +1,12 @@
+$IncludeConfig diag-common.conf
+
+template(name="outfmt" type="list") {
+ property(name="$!usr!msgnum")
+ constant(value="\n")
+}
+
+if $msg contains 'msgnum' then {
+ set $!usr!msgnum = field($msg, 58, 2);
+ if $!usr!msgnum <= "00005000" then
+ action(type="omfile" file="./rsyslog.out.log" template="outfmt")
+}
diff --git a/tests/testsuites/rscript_lt.conf b/tests/testsuites/rscript_lt.conf
new file mode 100644
index 0000000..1f455ec
--- /dev/null
+++ b/tests/testsuites/rscript_lt.conf
@@ -0,0 +1,12 @@
+$IncludeConfig diag-common.conf
+
+template(name="outfmt" type="list") {
+ property(name="$!usr!msgnum")
+ constant(value="\n")
+}
+
+if $msg contains 'msgnum' then {
+ set $!usr!msgnum = field($msg, 58, 2);
+ if $!usr!msgnum < "00005000" then
+ action(type="omfile" file="./rsyslog.out.log" template="outfmt")
+}
diff --git a/tests/testsuites/rscript_ne.conf b/tests/testsuites/rscript_ne.conf
new file mode 100644
index 0000000..43148ca
--- /dev/null
+++ b/tests/testsuites/rscript_ne.conf
@@ -0,0 +1,18 @@
+$IncludeConfig diag-common.conf
+
+template(name="outfmt" type="list") {
+ property(name="$!usr!msgnum")
+ constant(value="\n")
+}
+
+if $msg contains 'msgnum' then {
+ set $!usr!msgnum = field($msg, 58, 2);
+ if $!usr!msgnum != "00005000" and
+ $!usr!msgnum != "00005001" and
+ $!usr!msgnum != "00005002" then
+ set $!usr!write = 0;
+ else
+ set $!usr!write = 1;
+ if $!usr!write == 1 then
+ action(type="omfile" file="./rsyslog.out.log" template="outfmt")
+}
diff --git a/tests/testsuites/stop-localvar.conf b/tests/testsuites/stop-localvar.conf
index 020ebd8..63df650 100644
--- a/tests/testsuites/stop-localvar.conf
+++ b/tests/testsuites/stop-localvar.conf
@@ -5,17 +5,17 @@
* rgerhards, 2013-11-19
*/
$IncludeConfig diag-common.conf
-template(name="outfmt" type="string" string="%$!nbr%\n")
+template(name="outfmt" type="string" string="%$.nbr%\n")
module(load="../plugins/imtcp/.libs/imtcp")
input(type="imtcp" port="13514")
if $msg contains "msgnum:" then {
- set $!nbr = field($msg, 58, 2);
- if cnum($!nbr) < 100 then
+ set $.nbr = field($msg, 58, 2);
+ if cnum($.nbr) < 100 then
stop
/* check is intentionally more complex than needed! */
- else if not (cnum($!nbr) > 999) then {
+ else if not (cnum($.nbr) > 999) then {
action(type="omfile" file="rsyslog.out.log" template="outfmt")
}
}
diff --git a/tests/testsuites/stop-msgvar.conf b/tests/testsuites/stop-msgvar.conf
new file mode 100644
index 0000000..020ebd8
--- /dev/null
+++ b/tests/testsuites/stop-msgvar.conf
@@ -0,0 +1,21 @@
+/* note: variables are strings (at least in v7), so we need to convert
+ * to a number when we check the conditon.
+ * Even if we change the variable representation at some later point,
+ * we should NOT change this test here, but better add a new one.
+ * rgerhards, 2013-11-19
+ */
+$IncludeConfig diag-common.conf
+template(name="outfmt" type="string" string="%$!nbr%\n")
+
+module(load="../plugins/imtcp/.libs/imtcp")
+input(type="imtcp" port="13514")
+
+if $msg contains "msgnum:" then {
+ set $!nbr = field($msg, 58, 2);
+ if cnum($!nbr) < 100 then
+ stop
+ /* check is intentionally more complex than needed! */
+ else if not (cnum($!nbr) > 999) then {
+ action(type="omfile" file="rsyslog.out.log" template="outfmt")
+ }
+}