summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am36
-rwxr-xr-xtests/cee_diskqueue.sh14
-rwxr-xr-xtests/cee_simple.sh13
-rwxr-xr-xtests/diag.sh6
-rwxr-xr-xtests/imptcp_addtlframedelim.sh1
-rwxr-xr-xtests/imptcp_conndrop.sh3
-rwxr-xr-xtests/imptcp_large.sh1
-rwxr-xr-xtests/imtcp_addtlframedelim.sh1
-rwxr-xr-xtests/incltest_dir_empty_wildcard.sh13
-rw-r--r--tests/minitcpsrvr.c62
-rw-r--r--tests/nettester.c2
-rwxr-xr-xtests/queue-persist-drvr.sh8
-rwxr-xr-xtests/rscript_field.sh13
-rwxr-xr-xtests/rscript_optimizer1.sh13
-rwxr-xr-xtests/rscript_prifilt.sh13
-rwxr-xr-xtests/rscript_ruleset_call.sh13
-rwxr-xr-xtests/rscript_stop.sh13
-rwxr-xr-xtests/rscript_stop2.sh13
-rw-r--r--tests/runtime-dummy.c1
-rwxr-xr-xtests/tcp_forwarding_tpl.sh30
-rw-r--r--tests/tcpflood.c12
-rw-r--r--tests/testsuites/cee_diskqueue.conf9
-rw-r--r--tests/testsuites/cee_simple.conf6
-rw-r--r--tests/testsuites/complex1.conf5
-rw-r--r--tests/testsuites/imptcp_addtlframedelim.conf1
-rw-r--r--tests/testsuites/imptcp_conndrop.conf1
-rw-r--r--tests/testsuites/imptcp_large.conf1
-rw-r--r--tests/testsuites/imtcp_addtlframedelim.conf1
-rw-r--r--tests/testsuites/incltest_dir_empty_wildcard.conf11
-rw-r--r--tests/testsuites/rscript_field.conf11
-rw-r--r--tests/testsuites/rscript_optimizer1.conf12
-rw-r--r--tests/testsuites/rscript_prifilt.conf10
-rw-r--r--tests/testsuites/rscript_ruleset_call.conf22
-rw-r--r--tests/testsuites/rscript_stop.conf13
-rw-r--r--tests/testsuites/rscript_stop2.conf18
-rw-r--r--tests/testsuites/tcp_forwarding_tpl.conf7
-rwxr-xr-xtests/threadingmq.sh3
-rw-r--r--tests/tls-certs/ca-key.pem15
-rw-r--r--tests/tls-certs/ca.pem15
-rw-r--r--tests/tls-certs/cert.pem16
-rw-r--r--tests/tls-certs/key.pem15
41 files changed, 453 insertions, 20 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e7122653..b339e797 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,6 @@
if ENABLE_TESTBENCH
# TODO: reenable TESTRUNS = rt_init rscript
-check_PROGRAMS = $(TESTRUNS) ourtail nettester tcpflood chkseq msleep randomgen diagtalker uxsockrcvr syslog_caller syslog_inject inputfilegen
+check_PROGRAMS = $(TESTRUNS) ourtail nettester tcpflood chkseq msleep randomgen diagtalker uxsockrcvr syslog_caller syslog_inject inputfilegen minitcpsrv
TESTS = $(TESTRUNS)
#TESTS = $(TESTRUNS) cfg.sh
@@ -65,9 +65,18 @@ TESTS += \
failover-no-basic.sh \
rcvr_fail_restore.sh \
rscript_contains.sh \
+ rscript_field.sh \
+ rscript_stop.sh \
+ rscript_stop2.sh \
+ rscript_prifilt.sh \
+ rscript_optimizer1.sh \
+ rscript_ruleset_call.sh \
+ cee_simple.sh \
+ cee_diskqueue.sh \
incltest.sh \
incltest_dir.sh \
incltest_dir_wildcard.sh \
+ incltest_dir_empty_wildcard.sh \
linkedlistqueue.sh
if HAVE_VALGRIND
@@ -172,6 +181,10 @@ test_files = testbench.h runtime-dummy.c
EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
validation-run.sh \
+ tls-certs/ca-key.pem \
+ tls-certs/ca.pem \
+ tls-certs/cert.pem \
+ tls-certs/key.pem \
testsuites/x.509/ca.pem \
testsuites/x.509/ca-key.pem \
testsuites/x.509/client-cert.pem \
@@ -270,10 +283,28 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/arrayqueue.conf \
rscript_contains.sh \
testsuites/rscript_contains.conf \
+ rscript_field.sh \
+ testsuites/rscript_field.conf \
+ rscript_stop.sh \
+ testsuites/rscript_stop.conf \
+ rscript_stop2.sh \
+ testsuites/rscript_stop2.conf \
+ rscript_prifilt.sh \
+ testsuites/rscript_prifilt.conf \
+ rscript_optimizer1.sh \
+ testsuites/rscript_optimizer1.conf \
+ rscript_ruleset_call.sh \
+ testsuites/rscript_ruleset_call.conf \
+ cee_simple.sh \
+ testsuites/cee_simple.conf \
+ cee_diskqueue.sh \
+ testsuites/cee_diskqueue.conf \
incltest.sh \
testsuites/incltest.conf \
incltest_dir.sh \
testsuites/incltest_dir.conf \
+ incltest_dir_empty_wildcard.sh \
+ testsuites/incltest_dir_empty_wildcard.conf \
incltest_dir_wildcard.sh \
testsuites/incltest_dir_wildcard.conf \
testsuites/incltest.d/include.conf \
@@ -505,6 +536,9 @@ if ENABLE_GNUTLS
tcpflood_LDADD += -lgcrypt
endif
+minitcpsrv_SOURCES = minitcpsrvr.c
+minitcpsrv_LDADD = $(SOL_LIBS)
+
syslog_caller_SOURCES = syslog_caller.c
syslog_caller_LDADD = $(SOL_LIBS)
diff --git a/tests/cee_diskqueue.sh b/tests/cee_diskqueue.sh
new file mode 100755
index 00000000..4e19855b
--- /dev/null
+++ b/tests/cee_diskqueue.sh
@@ -0,0 +1,14 @@
+# check if CEE properties are properly saved & restored to/from disk queue
+# added 2012-09-19 by rgerhards
+# This file is part of the rsyslog project, released under ASL 2.0
+echo ===============================================================================
+echo \[cee_diskqueue.sh\]: CEE and diskqueue test
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup cee_diskqueue.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/cee_simple.sh b/tests/cee_simple.sh
new file mode 100755
index 00000000..32f56393
--- /dev/null
+++ b/tests/cee_simple.sh
@@ -0,0 +1,13 @@
+# added 2012-09-19 by rgerhards
+# This file is part of the rsyslog project, released under ASL 2.0
+echo ===============================================================================
+echo \[cee_simple.sh\]: basic CEE property test
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup cee_simple.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/diag.sh b/tests/diag.sh
index bd38b29d..7883d93b 100755
--- a/tests/diag.sh
+++ b/tests/diag.sh
@@ -16,7 +16,6 @@ case $1 in
'init') $srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason
cp $srcdir/testsuites/diag-common.conf diag-common.conf
cp $srcdir/testsuites/diag-common2.conf diag-common2.conf
- 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 rsyslog2.out.log rsyslog.out.log.save # common work files
@@ -24,6 +23,10 @@ case $1 in
rm -f rsyslog.out.*.log work-presort rsyslog.pipe
rm -f rsyslog.input rsyslog.empty
rm -f core.* vgcore.*
+ # Note: rsyslog.action.*.include must NOT be deleted, as it
+ # is used to setup some parameters BEFORE calling init. This
+ # happens in chained test scripts. Delete on exit is fine,
+ # though.
mkdir test-spool
;;
'exit') rm -f rsyslogd.started work-*.conf diag-common.conf
@@ -106,6 +109,7 @@ case $1 in
echo Shutting down instance 2
fi
$srcdir/diag.sh wait-queueempty $2
+ ./msleep 100 # wait 100 milliseconds
kill `cat rsyslog$2.pid`
# note: we do not wait for the actual termination!
;;
diff --git a/tests/imptcp_addtlframedelim.sh b/tests/imptcp_addtlframedelim.sh
index b26fc85b..00276ab3 100755
--- a/tests/imptcp_addtlframedelim.sh
+++ b/tests/imptcp_addtlframedelim.sh
@@ -3,7 +3,6 @@
# This file is part of the rsyslog project, released under GPLv3
echo ====================================================================================
echo TEST: \[imptcp_addtlframedelim.sh\]: test imptcp additional frame delimiter
-cat rsyslog.action.1.include
source $srcdir/diag.sh init
source $srcdir/diag.sh startup imptcp_addtlframedelim.conf
source $srcdir/diag.sh tcpflood -m20000 -F0 -P129
diff --git a/tests/imptcp_conndrop.sh b/tests/imptcp_conndrop.sh
index 684de6b5..0cf0ba5e 100755
--- a/tests/imptcp_conndrop.sh
+++ b/tests/imptcp_conndrop.sh
@@ -4,9 +4,8 @@
# This file is part of the rsyslog project, released under GPLv3
echo ====================================================================================
echo TEST: \[imptcp_conndrop.sh\]: test imptcp 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 imptcp_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...
diff --git a/tests/imptcp_large.sh b/tests/imptcp_large.sh
index b4d130bb..43027069 100755
--- a/tests/imptcp_large.sh
+++ b/tests/imptcp_large.sh
@@ -4,7 +4,6 @@
# This file is part of the rsyslog project, released under GPLv3
echo ====================================================================================
echo TEST: \[imptcp_large.sh\]: test imptcp with large-size messages
-cat rsyslog.action.1.include
source $srcdir/diag.sh init
source $srcdir/diag.sh startup imptcp_large.conf
# send 4000 messages of 10.000bytes plus header max, randomized
diff --git a/tests/imtcp_addtlframedelim.sh b/tests/imtcp_addtlframedelim.sh
index 8de7ca58..4c1fd9cb 100755
--- a/tests/imtcp_addtlframedelim.sh
+++ b/tests/imtcp_addtlframedelim.sh
@@ -3,7 +3,6 @@
# This file is part of the rsyslog project, released under GPLv3
echo ====================================================================================
echo TEST: \[imtcp_addtlframedelim.sh\]: test imtcp additional frame delimiter
-cat rsyslog.action.1.include
source $srcdir/diag.sh init
source $srcdir/diag.sh startup imtcp_addtlframedelim.conf
source $srcdir/diag.sh tcpflood -m20000 -F0 -P129
diff --git a/tests/incltest_dir_empty_wildcard.sh b/tests/incltest_dir_empty_wildcard.sh
new file mode 100755
index 00000000..6cdb3b21
--- /dev/null
+++ b/tests/incltest_dir_empty_wildcard.sh
@@ -0,0 +1,13 @@
+# This test checks if an empty includeConfig directory causes problems. It
+# should not, as this is a valid situation that by default exists on many
+# distros.
+echo ===============================================================================
+echo \[incltest_dir_empty_wildcard.sh\]: test $IncludeConfig for \"empty\" wildcard
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup incltest_dir_empty_wildcard.conf
+# 100 messages are enough - the question is if the include is read ;)
+source $srcdir/diag.sh injectmsg 0 100
+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/minitcpsrvr.c b/tests/minitcpsrvr.c
new file mode 100644
index 00000000..8ac59f25
--- /dev/null
+++ b/tests/minitcpsrvr.c
@@ -0,0 +1,62 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <arpa/inet.h>
+
+static void
+errout(char *reason)
+{
+ perror(reason);
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ int fds;
+ int fdc;
+ int fdf;
+ struct sockaddr_in srvAddr;
+ struct sockaddr_in cliAddr;
+ unsigned int srvAddrLen;
+ unsigned int cliAddrLen;
+ char wrkBuf[4096];
+ ssize_t nRead;
+
+ if(argc != 4) {
+ fprintf(stderr, "usage: minitcpsrvr ip-addr port outfile\n");
+ exit(1);
+ }
+
+ if(!strcmp(argv[3], "-")) {
+ fdf = 1;
+ } else {
+ fdf = open(argv[3], O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR|S_IWUSR);
+ if(fdf == -1) errout(argv[3]);
+ }
+
+ fds = socket(AF_INET, SOCK_STREAM, 0);
+ srvAddr.sin_family = AF_INET;
+ srvAddr.sin_addr.s_addr = inet_addr(argv[1]);
+ srvAddr.sin_port = htons(atoi(argv[2]));
+ srvAddrLen = sizeof(srvAddr);
+ if(bind(fds, (struct sockaddr *)&srvAddr, srvAddrLen) != 0)
+ errout("bind");
+ if(listen(fds, 20) != 0) errout("listen");
+ cliAddrLen = sizeof(cliAddr);
+
+ fdc = accept(fds, (struct sockaddr *)&cliAddr, &cliAddrLen);
+ while(1) {
+ nRead = read(fdc, wrkBuf, sizeof(wrkBuf));
+ if(nRead == 0) break;
+ if(write(fdf, wrkBuf, nRead) != nRead)
+ errout("write");
+ }
+ /* let the OS do the cleanup */
+ return 0;
+}
diff --git a/tests/nettester.c b/tests/nettester.c
index 9e68ebcc..4e4fe55a 100644
--- a/tests/nettester.c
+++ b/tests/nettester.c
@@ -243,7 +243,7 @@ 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",
+ char *newargv[] = {"../tools/rsyslogd", "dummy", "-u2", "-n", "-irsyslog.pid",
"-M../runtime/.libs:../.libs", NULL, NULL};
char confFile[1024];
diff --git a/tests/queue-persist-drvr.sh b/tests/queue-persist-drvr.sh
index 53fbcb8b..823fed6c 100755
--- a/tests/queue-persist-drvr.sh
+++ b/tests/queue-persist-drvr.sh
@@ -24,6 +24,12 @@ 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
+./msleep 500
$srcdir/diag.sh wait-shutdown
-source $srcdir/diag.sh seq-check 0 4999
+# note: we need to permit duplicate messages, as due to the forced
+# shutdown some messages may be flagged as "unprocessed" while they
+# actually were processed. This is inline with rsyslog's philosophy
+# to better duplicate than loose messages. Duplicate messages are
+# permitted by the -d seq-check option.
+source $srcdir/diag.sh seq-check 0 4999 -d
source $srcdir/diag.sh exit
diff --git a/tests/rscript_field.sh b/tests/rscript_field.sh
new file mode 100755
index 00000000..e989e666
--- /dev/null
+++ b/tests/rscript_field.sh
@@ -0,0 +1,13 @@
+# added 2012-09-20 by rgerhards
+# This file is part of the rsyslog project, released under ASL 2.0
+echo ===============================================================================
+echo \[rscript_field.sh\]: testing rainerscript field\(\) function
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup rscript_field.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/rscript_optimizer1.sh b/tests/rscript_optimizer1.sh
new file mode 100755
index 00000000..1d2dcf87
--- /dev/null
+++ b/tests/rscript_optimizer1.sh
@@ -0,0 +1,13 @@
+# added 2012-09-20 by rgerhards
+# This file is part of the rsyslog project, released under ASL 2.0
+echo ===============================================================================
+echo \[rscript_optimizer1.sh\]: testing rainerscript optimizer
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup rscript_optimizer1.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/rscript_prifilt.sh b/tests/rscript_prifilt.sh
new file mode 100755
index 00000000..815492ab
--- /dev/null
+++ b/tests/rscript_prifilt.sh
@@ -0,0 +1,13 @@
+# added 2012-09-20 by rgerhards
+# This file is part of the rsyslog project, released under ASL 2.0
+echo ===============================================================================
+echo \[rscript_prifilt.sh\]: testing rainerscript prifield\(\) function
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup rscript_prifilt.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/rscript_ruleset_call.sh b/tests/rscript_ruleset_call.sh
new file mode 100755
index 00000000..e29f21da
--- /dev/null
+++ b/tests/rscript_ruleset_call.sh
@@ -0,0 +1,13 @@
+# added 2012-10-29 by rgerhards
+# This file is part of the rsyslog project, released under ASL 2.0
+echo ===============================================================================
+echo \[rscript_ruleset_call.sh\]: testing rainerscript ruleset\(\) and call statement
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup rscript_ruleset_call.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/rscript_stop.sh b/tests/rscript_stop.sh
new file mode 100755
index 00000000..e532a522
--- /dev/null
+++ b/tests/rscript_stop.sh
@@ -0,0 +1,13 @@
+# added 2012-09-20 by rgerhards
+# This file is part of the rsyslog project, released under ASL 2.0
+echo ===============================================================================
+echo \[rscript_stop.sh\]: testing rainerscript STOP statement
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup rscript_stop.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_stop2.sh b/tests/rscript_stop2.sh
new file mode 100755
index 00000000..eae36cce
--- /dev/null
+++ b/tests/rscript_stop2.sh
@@ -0,0 +1,13 @@
+# added 2012-09-20 by rgerhards
+# This file is part of the rsyslog project, released under ASL 2.0
+echo ===============================================================================
+echo \[rscript_stop2.sh\]: testing rainerscript STOP statement, alternate method
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup rscript_stop2.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/runtime-dummy.c b/tests/runtime-dummy.c
index 5a9039bf..f6f2d07f 100644
--- a/tests/runtime-dummy.c
+++ b/tests/runtime-dummy.c
@@ -30,7 +30,6 @@
#include "rsyslog.h"
int bReduceRepeatMsgs = 0;
-int repeatinterval = 30;
int bActExecWhenPrevSusp = 0;
int iActExecOnceInterval = 1;
int MarkInterval = 30;
diff --git a/tests/tcp_forwarding_tpl.sh b/tests/tcp_forwarding_tpl.sh
new file mode 100755
index 00000000..61114507
--- /dev/null
+++ b/tests/tcp_forwarding_tpl.sh
@@ -0,0 +1,30 @@
+# This test tests tcp forwarding with assigned template. To do so, a simple
+# tcp listener service is started.
+# added 2012-10-30 by Rgerhards. Released under GNU GPLv3+
+echo ===============================================================================
+echo \[tcp_forwarding_tpl.sh\]: test for tcp forwarding with assigned template
+
+# create the pipe and start a background process that copies data from
+# it to the "regular" work file
+source $srcdir/diag.sh init
+./minitcpsrvr 127.0.0.1 13514 rsyslog.out.log &
+BGPROCESS=$!
+echo background minitcpsrvr process id is $BGPROCESS
+
+# now do the usual run
+source $srcdir/diag.sh startup tcp_forwarding_tpl.conf
+# 10000 messages should be enough
+source $srcdir/diag.sh injectmsg 0 10000
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
+
+# note: minitcpsrvr shuts down automatically if the connection is closed!
+# (we still leave the code here in in case we need it later)
+#echo shutting down minitcpsrv...
+#kill $BGPROCESS
+#wait $BGPROCESS
+#echo background process has terminated, continue test...
+
+# and continue the usual checks
+source $srcdir/diag.sh seq-check 0 9999
+source $srcdir/diag.sh exit
diff --git a/tests/tcpflood.c b/tests/tcpflood.c
index 4a3199c8..b3cef2e0 100644
--- a/tests/tcpflood.c
+++ b/tests/tcpflood.c
@@ -258,7 +258,7 @@ int openConnections(void)
return setupUDP();
if(bShowProgress)
- write(1, " open connections", sizeof(" open connections")-1);
+ if(write(1, " open connections", sizeof(" open connections")-1)){}
# ifdef ENABLE_GNUTLS
sessArray = calloc(numConnections, sizeof(gnutls_session_t));
# endif
@@ -278,7 +278,7 @@ int openConnections(void)
}
if(bShowProgress) {
lenMsg = sprintf(msgBuf, "\r%5.5d open connections\n", i);
- write(1, msgBuf, lenMsg);
+ if(write(1, msgBuf, lenMsg)) {}
}
return 0;
@@ -303,12 +303,12 @@ void closeConnections(void)
return;
if(bShowProgress)
- write(1, " close connections", sizeof(" close connections")-1);
+ if(write(1, " close connections", sizeof(" close connections")-1)){}
for(i = 0 ; i < numConnections ; ++i) {
if(i % 10 == 0) {
if(bShowProgress) {
lenMsg = sprintf(msgBuf, "\r%5.5d", i);
- write(1, msgBuf, lenMsg);
+ if(write(1, msgBuf, lenMsg)){}
}
}
if(sockArray[i] != -1) {
@@ -325,7 +325,7 @@ void closeConnections(void)
}
if(bShowProgress) {
lenMsg = sprintf(msgBuf, "\r%5.5d close connections\n", i);
- write(1, msgBuf, lenMsg);
+ if(write(1, msgBuf, lenMsg)){}
}
}
@@ -347,7 +347,7 @@ genMsg(char *buf, size_t maxBuf, int *pLenBuf, struct instdata *inst)
/* get message from file */
do {
done = 1;
- *pLenBuf = fread(buf, 1, 1024, dataFP);
+ *pLenBuf = fread(buf, 1, MAX_EXTRADATA_LEN + 1024, dataFP);
if(*pLenBuf == 0) {
if(--numFileIterations > 0) {
rewind(dataFP);
diff --git a/tests/testsuites/cee_diskqueue.conf b/tests/testsuites/cee_diskqueue.conf
new file mode 100644
index 00000000..a9b98e80
--- /dev/null
+++ b/tests/testsuites/cee_diskqueue.conf
@@ -0,0 +1,9 @@
+$IncludeConfig diag-common.conf
+
+global(workDirectory="/tmp")
+template(name="outfmt" type="string" string="%$!usr!msg:F,58:2%\n")
+
+set $!usr!msg = $msg;
+if $msg contains 'msgnum' then
+ action(type="omfile" file="./rsyslog.out.log" template="outfmt"
+ queue.type="disk" queue.filename="rsyslog-act1")
diff --git a/tests/testsuites/cee_simple.conf b/tests/testsuites/cee_simple.conf
new file mode 100644
index 00000000..1bcf83c1
--- /dev/null
+++ b/tests/testsuites/cee_simple.conf
@@ -0,0 +1,6 @@
+$IncludeConfig diag-common.conf
+
+template(name="outfmt" type="string" string="%$!usr!msg:F,58:2%\n")
+set $!usr!msg = $msg;
+if $msg contains 'msgnum' then
+ action(type="omfile" file="./rsyslog.out.log" template="outfmt")
diff --git a/tests/testsuites/complex1.conf b/tests/testsuites/complex1.conf
index 9e2441d4..9b6a9f35 100644
--- a/tests/testsuites/complex1.conf
+++ b/tests/testsuites/complex1.conf
@@ -3,6 +3,8 @@
$MaxMessageSize 10k
$IncludeConfig diag-common.conf
+$MainMsgQueueTimeoutEnqueue 5000
+
$ModLoad ../plugins/imtcp/.libs/imtcp
$MainMsgQueueTimeoutShutdown 10000
@@ -13,6 +15,7 @@ $template dynfile,"rsyslog.out.%inputname%.%msg:F,58:2%.log"
$Ruleset R13514
# queue params:
$ActionQueueTimeoutShutdown 60000
+$ActionQueueTimeoutEnqueue 5000
$ActionQueueSize 5000
$ActionQueueSaveOnShutdown on
$ActionQueueHighWaterMark 4900
@@ -36,6 +39,7 @@ $InputTCPServerRun 13514
$Ruleset R13515
# queue params:
$ActionQueueTimeoutShutdown 60000
+$ActionQueueTimeoutEnqueue 5000
$ActionQueueSize 5000
$ActionQueueSaveOnShutdown on
$ActionQueueHighWaterMark 4900
@@ -60,6 +64,7 @@ $InputTCPServerRun 13515
$Ruleset R13516
# queue params:
$ActionQueueTimeoutShutdown 60000
+$ActionQueueTimeoutEnqueue 5000
$ActionQueueSize 5000
$ActionQueueSaveOnShutdown on
$ActionQueueHighWaterMark 4900
diff --git a/tests/testsuites/imptcp_addtlframedelim.conf b/tests/testsuites/imptcp_addtlframedelim.conf
index eb7ed0c4..bf302fb4 100644
--- a/tests/testsuites/imptcp_addtlframedelim.conf
+++ b/tests/testsuites/imptcp_addtlframedelim.conf
@@ -9,5 +9,4 @@ $template outfmt,"%msg:F,58:2%\n"
$OMFileFlushOnTXEnd off
$OMFileFlushInterval 2
$OMFileIOBufferSize 256k
-$IncludeConfig rsyslog.action.1.include
local0.* ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/imptcp_conndrop.conf b/tests/testsuites/imptcp_conndrop.conf
index 677e33f6..77a5d79a 100644
--- a/tests/testsuites/imptcp_conndrop.conf
+++ b/tests/testsuites/imptcp_conndrop.conf
@@ -12,5 +12,4 @@ $template dynfile,"rsyslog.out.log" # trick to use relative path names!
$OMFileFlushOnTXEnd off
$OMFileFlushInterval 2
$OMFileIOBufferSize 256k
-$IncludeConfig rsyslog.action.1.include
local0.* ?dynfile;outfmt
diff --git a/tests/testsuites/imptcp_large.conf b/tests/testsuites/imptcp_large.conf
index 677e33f6..77a5d79a 100644
--- a/tests/testsuites/imptcp_large.conf
+++ b/tests/testsuites/imptcp_large.conf
@@ -12,5 +12,4 @@ $template dynfile,"rsyslog.out.log" # trick to use relative path names!
$OMFileFlushOnTXEnd off
$OMFileFlushInterval 2
$OMFileIOBufferSize 256k
-$IncludeConfig rsyslog.action.1.include
local0.* ?dynfile;outfmt
diff --git a/tests/testsuites/imtcp_addtlframedelim.conf b/tests/testsuites/imtcp_addtlframedelim.conf
index 3b4759c5..6558c519 100644
--- a/tests/testsuites/imtcp_addtlframedelim.conf
+++ b/tests/testsuites/imtcp_addtlframedelim.conf
@@ -9,5 +9,4 @@ $template outfmt,"%msg:F,58:2%\n"
$OMFileFlushOnTXEnd off
$OMFileFlushInterval 2
$OMFileIOBufferSize 256k
-$IncludeConfig rsyslog.action.1.include
local0.* ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/incltest_dir_empty_wildcard.conf b/tests/testsuites/incltest_dir_empty_wildcard.conf
new file mode 100644
index 00000000..5e750c5b
--- /dev/null
+++ b/tests/testsuites/incltest_dir_empty_wildcard.conf
@@ -0,0 +1,11 @@
+# see .sh file for description
+# rgerhards, 2009-11-30
+$IncludeConfig diag-common.conf
+
+# the following include leads to no files actually being included
+# but MUST NOT abort rsyslog's startup sequence. No files matching
+# the wildcard is valid (as long as the path exists)!
+$IncludeConfig testsuites/incltest.d/*.conf-not-there
+
+$template outfmt,"%msg:F,58:2%\n"
+:msg, contains, "msgnum:" ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/rscript_field.conf b/tests/testsuites/rscript_field.conf
new file mode 100644
index 00000000..d7eb9066
--- /dev/null
+++ b/tests/testsuites/rscript_field.conf
@@ -0,0 +1,11 @@
+$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);
+ action(type="omfile" file="./rsyslog.out.log" template="outfmt")
+}
diff --git a/tests/testsuites/rscript_optimizer1.conf b/tests/testsuites/rscript_optimizer1.conf
new file mode 100644
index 00000000..7720af7a
--- /dev/null
+++ b/tests/testsuites/rscript_optimizer1.conf
@@ -0,0 +1,12 @@
+$IncludeConfig diag-common.conf
+
+template(name="outfmt" type="list") {
+ property(name="msg" field.delimiter="58" field.number="2")
+ constant(value="\n")
+}
+
+/* tcpflood uses local4.=debug */
+if prifilt("syslog.*") then
+ stop # it actually doesn't matter what we do here
+else
+ action(type="omfile" file="./rsyslog.out.log" template="outfmt")
diff --git a/tests/testsuites/rscript_prifilt.conf b/tests/testsuites/rscript_prifilt.conf
new file mode 100644
index 00000000..8cb13a0f
--- /dev/null
+++ b/tests/testsuites/rscript_prifilt.conf
@@ -0,0 +1,10 @@
+$IncludeConfig diag-common.conf
+
+template(name="outfmt" type="list") {
+ property(name="msg" field.delimiter="58" field.number="2")
+ constant(value="\n")
+}
+
+/* tcpflood uses local4.=debug, we use a bit more generic filter */
+if prifilt("local4.*") then
+ action(type="omfile" file="./rsyslog.out.log" template="outfmt")
diff --git a/tests/testsuites/rscript_ruleset_call.conf b/tests/testsuites/rscript_ruleset_call.conf
new file mode 100644
index 00000000..96eab293
--- /dev/null
+++ b/tests/testsuites/rscript_ruleset_call.conf
@@ -0,0 +1,22 @@
+$IncludeConfig diag-common.conf
+
+template(name="outfmt" type="list") {
+ property(name="msg" field.delimiter="58" field.number="2")
+ constant(value="\n")
+}
+
+
+# we deliberately include continue/stop to make sure we have more than
+# one statement. This catches grammar erorrs
+ruleset(name="rs2") {
+ continue
+ action(type="omfile" file="./rsyslog.out.log" template="outfmt")
+ stop
+}
+
+# this time we make sure a single statement is properly supported
+ruleset(name="rs1") {
+ call rs2
+}
+
+if $msg contains 'msgnum' then call rs1
diff --git a/tests/testsuites/rscript_stop.conf b/tests/testsuites/rscript_stop.conf
new file mode 100644
index 00000000..ab9569e5
--- /dev/null
+++ b/tests/testsuites/rscript_stop.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 cnum($!usr!msgnum) >= 5000 then
+ stop
+ action(type="omfile" file="./rsyslog.out.log" template="outfmt")
+}
diff --git a/tests/testsuites/rscript_stop2.conf b/tests/testsuites/rscript_stop2.conf
new file mode 100644
index 00000000..9ac9143e
--- /dev/null
+++ b/tests/testsuites/rscript_stop2.conf
@@ -0,0 +1,18 @@
+$IncludeConfig diag-common.conf
+
+template(name="outfmt" type="list") {
+ property(name="$!usr!msgnum")
+ constant(value="\n")
+}
+
+if not ($msg contains 'msgnum') then
+ stop
+
+set $!usr!msgnum = field($msg, 58, 2);
+if cnum($!usr!msgnum) >= 5000 then
+ stop
+/* We could use yet another method, but we like to have the action statement
+ * without a filter in rsyslog.conf top level hierarchy - so this test, as
+ * a side-effect, also tests this ability.
+ */
+action(type="omfile" file="./rsyslog.out.log" template="outfmt")
diff --git a/tests/testsuites/tcp_forwarding_tpl.conf b/tests/testsuites/tcp_forwarding_tpl.conf
new file mode 100644
index 00000000..686c73ac
--- /dev/null
+++ b/tests/testsuites/tcp_forwarding_tpl.conf
@@ -0,0 +1,7 @@
+$IncludeConfig diag-common.conf
+$MainMsgQueueTimeoutShutdown 10000
+template(name="outfmt" type="string" string="%msg:F,58:2%\n")
+
+if $msg contains "msgnum:" then
+ action(type="omfwd" template="outfmt"
+ target="127.0.0.1" port="13514" protocol="tcp")
diff --git a/tests/threadingmq.sh b/tests/threadingmq.sh
index ea5d7837..98f195d4 100755
--- a/tests/threadingmq.sh
+++ b/tests/threadingmq.sh
@@ -11,6 +11,9 @@ source $srcdir/diag.sh init
source $srcdir/diag.sh startup threadingmq.conf
source $srcdir/diag.sh injectmsg 0 100000
source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+# we give an extra seconds for things to settle, especially
+# important on slower test machines
+./msleep 1000
source $srcdir/diag.sh wait-shutdown
source $srcdir/diag.sh seq-check 0 99999
source $srcdir/diag.sh exit
diff --git a/tests/tls-certs/ca-key.pem b/tests/tls-certs/ca-key.pem
new file mode 100644
index 00000000..181a8ad9
--- /dev/null
+++ b/tests/tls-certs/ca-key.pem
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQDDaz5X5YIruPH0wukMPik7xIKqrpCcr8Gm28oz5h4GtX253eWr
+piBuk2a/f/CKDjeuqmiWqTs90PFNb+Z1c+Yzvagqv80VzZwDI4RcrwlNaKrBz/9X
+iowCcoV8s7GvV2vtZEPSThNzz4FYkxCMvbOYZeJIYQVhZggUcuadfhmDIwIDAQAB
+AoGAIG5AUD2jmYDzD+UhiultVgtkifyNaEtsuQsZu/zbt85P2VQ0z4SINlbvrXvc
+iJ9tEzzEPa3udHGj/MTDe3OAB4TK5tImX1pe2gw+zaOB/DaH5i4QhXeltU7epCHF
+oUv9EVNzL8Bl00MFiWcLY0LisQVfHeW5rcN9U7EbvTlWbRkCQQDR2/Qn1ceavwDU
+qYt2TbEicJVC8aQMYYyc6Xvi4mZaNa8gGCpWpurgQop0Ln0QE8vA0601UVs6N3tm
+g8FJ8rXpAkEA7mKCtp2MXCbHMdkZCyQt6drUYCyU9N/HtmBEtFGpqt1PdMyUI07m
+rlVFDwUH9JFmg18RP1X2ufj7+ZbJzaMtKwJBAJgbw1Z0P19Mfj+mPC2dlnyN+cIx
+/2Px+Mdq/J6w1tsf+jVbDqUMC0ZNNKmNYJycnJzBUNRKicMin9DoQttkjrECQQCC
+s/aRY+6adBSRi0QE7NBTwUzicm81mCDrKPtilsfdTDyNgMHUXiVy/oO/yXVkLfi0
+HQLa5CpEK3UUkw2Qt2BDAkA0XXvQzW0+tEHiktLNljIluhiyOAx2bBywY/9Qmn6C
+hv4sOSCzTR39jNmuNZ0X6ZZvt4VsWTHhpche/ud1+3p6
+-----END RSA PRIVATE KEY-----
diff --git a/tests/tls-certs/ca.pem b/tests/tls-certs/ca.pem
new file mode 100644
index 00000000..6324c7d5
--- /dev/null
+++ b/tests/tls-certs/ca.pem
@@ -0,0 +1,15 @@
+-----BEGIN CERTIFICATE-----
+MIICYjCCAc2gAwIBAgIBATALBgkqhkiG9w0BAQUwWDELMAkGA1UEBhMCREUxHTAb
+BgNVBAoTFHJzeXNsb2cgdGVzdCByb290IENBMQswCQYDVQQLEwJDQTEdMBsGA1UE
+AxMUcnN5c2xvZy10ZXN0LXJvb3QtY2EwHhcNMDgwNTIwMTI1ODEyWhcNMTgwNTE4
+MTI1ODI0WjBYMQswCQYDVQQGEwJERTEdMBsGA1UEChMUcnN5c2xvZyB0ZXN0IHJv
+b3QgQ0ExCzAJBgNVBAsTAkNBMR0wGwYDVQQDExRyc3lzbG9nLXRlc3Qtcm9vdC1j
+YTCBnDALBgkqhkiG9w0BAQEDgYwAMIGIAoGAw2s+V+WCK7jx9MLpDD4pO8SCqq6Q
+nK/BptvKM+YeBrV9ud3lq6YgbpNmv3/wig43rqpolqk7PdDxTW/mdXPmM72oKr/N
+Fc2cAyOEXK8JTWiqwc//V4qMAnKFfLOxr1dr7WRD0k4Tc8+BWJMQjL2zmGXiSGEF
+YWYIFHLmnX4ZgyMCAwEAAaNDMEEwDwYDVR0TAQH/BAUwAwEB/zAPBgNVHQ8BAf8E
+BQMDBwYAMB0GA1UdDgQWBBQzYQQgUm0YLNdarJnc2c1LxYVClDALBgkqhkiG9w0B
+AQUDgYEAuGWtH7Jkpa0n/izqQ5ddDQP/LT6taivCwlpEYEU9aumpQPWWxtYywKaP
+RfM1JTMLAiYd8MS7TJ8TYRvvR32Y02Y+OhXn11xERkWvBT2M9yzqX6hDfRueN7RT
+fPWsfm/NBTVojzjaECcTFenZid7PC5JiFbcU6PSUMZ49/JPhxAo=
+-----END CERTIFICATE-----
diff --git a/tests/tls-certs/cert.pem b/tests/tls-certs/cert.pem
new file mode 100644
index 00000000..6b5b13cd
--- /dev/null
+++ b/tests/tls-certs/cert.pem
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIIChjCCAfGgAwIBAgIBADALBgkqhkiG9w0BAQUwWDELMAkGA1UEBhMCREUxHTAb
+BgNVBAoTFHJzeXNsb2cgdGVzdCByb290IENBMQswCQYDVQQLEwJDQTEdMBsGA1UE
+AxMUcnN5c2xvZy10ZXN0LXJvb3QtY2EwHhcNMDgwNTIwMTMwNDE5WhcNMTgwNTE4
+MTMwNDI2WjA6MQswCQYDVQQGEwJERTEQMA4GA1UEChMHcnN5c2xvZzEZMBcGA1UE
+CxMQdGVzdCBjZXJ0aWZpY2F0ZTCBnDALBgkqhkiG9w0BAQEDgYwAMIGIAoGAxmHe
+fztJgaGxFYEceiUg0hdMlRVWBqoZelJ8BeXTDnXcu/5F2HtM+l+QDyDaGjKlx+NI
+K4rkj7d6Wd3AKPgOYS0VSDZe3a1xf9rRYzOthWTv7tYi4/LTqPXqN5lKE71dgrB/
+/gOmvV/1YD776FIxVGCSAT0hHwkFC3slmpJSwD8CAwEAAaOBhDCBgTAMBgNVHRMB
+Af8EAjAAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDATASBgNVHREECzAJ
+ggdyc3lzbG9nMB0GA1UdDgQWBBQYu6eC9UALvC+5K5VOnFRi5OC98TAfBgNVHSME
+GDAWgBQzYQQgUm0YLNdarJnc2c1LxYVClDALBgkqhkiG9w0BAQUDgYEAXaymqsG9
+PNBhhWIRFvXCDMaDM71vUtgSFoNUbxIV607ua2HQosPPM4EHIda6N6hdBK1bMQoG
+yqBwhvw0JVaVaO70Kbs2m2Ypk3YcpJtRqyp8q8+2y/w1Mk1QazFZC29aYgX2iNVf
+X4/x38YEL7Gu5vqPrTn++agnV4ZXECKuvLQ=
+-----END CERTIFICATE-----
diff --git a/tests/tls-certs/key.pem b/tests/tls-certs/key.pem
new file mode 100644
index 00000000..3ff507f0
--- /dev/null
+++ b/tests/tls-certs/key.pem
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICWwIBAAKBgQDGYd5/O0mBobEVgRx6JSDSF0yVFVYGqhl6UnwF5dMOddy7/kXY
+e0z6X5APINoaMqXH40griuSPt3pZ3cAo+A5hLRVINl7drXF/2tFjM62FZO/u1iLj
+8tOo9eo3mUoTvV2CsH/+A6a9X/VgPvvoUjFUYJIBPSEfCQULeyWaklLAPwIDAQAB
+AoGARIwKqmHc+0rYenq7UUVE+vMMBjNyHyllVkvsCMmpzMRS+i5ZCf1I0vZ0O5X5
+ZrX7bH8PL+R1J2eZgjXKMR3NMZBuyKHewItD9t2rIC0eD/ITlwq3VybbaMsw666e
+INxSmax+dS5CEcLevHHP3c+Q7S7QAFiWV43TdFUGXWJktIkCQQDPQ5WAZ+/Tvv0Q
+vtRjXMeTVaw/bSuKNUeDzFkmGyePnFeCReNFtJLE9PFSQWcPuYcbZgU59JTfA5ac
+Un+cHm31AkEA9Qek+q7PcJ+kON9E6SNodCZn6gLyHjnWrq4tf8pZO3NvoX2QiuD4
+rwF7KWjr6q1JzADpLtwXnuYEhyiLFjJA4wJAcElMCEnG2y+ASH8p7z7HfKGQdLg/
+O1wMB3JA5e0WLK5lllUogI4IaZ3N02NNY25+rLBDqpc/w+ZcxQnIypqNtQJATs9p
+ofON5wSB1oUBbhckZo9fxuWxqEUkJsUA/2Q+9R843XE8h166vdc1HOmRT8bywHne
+hmLl+gazmCFTMw1wzwJAHng+3zGUl4D8Ov3MPFD6hwYYK6/pEdtz/NUsCSazF7eK
+XuuP+DXPHNhXOuF1A3tP74pfc/fC1uCUH2G5z3Fy0Q==
+-----END RSA PRIVATE KEY-----