summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-11-05 14:31:37 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2009-11-05 14:31:37 +0100
commit6a99be469643ef0214729391f9cef4867b8e9fca (patch)
tree3ae549560d49a2fa2f7db507f561562f3f6a7594
parenta5cd509be736fcff3c8ae3104712d2fe85776416 (diff)
downloadrsyslog-6a99be469643ef0214729391f9cef4867b8e9fca.tar.gz
rsyslog-6a99be469643ef0214729391f9cef4867b8e9fca.tar.xz
rsyslog-6a99be469643ef0214729391f9cef4867b8e9fca.zip
added pipe action test to testbench & testbench bugfix
-rw-r--r--ChangeLog2
-rw-r--r--tests/Makefile.am5
-rw-r--r--tests/chkseq.c10
-rwxr-xr-xtests/diag.sh4
-rwxr-xr-xtests/pipeaction.sh33
-rw-r--r--tests/testsuites/pipeaction.conf16
-rw-r--r--tests/testsuites/threadingmq.conf6
-rw-r--r--tests/testsuites/threadingmqaq.conf4
-rwxr-xr-xtests/threadingmq.sh3
-rwxr-xr-xtests/threadingmqaq.sh5
10 files changed, 74 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index a1e82ff3..7370412b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,8 @@ Version 4.5.6 [v4-beta] (rgerhards), 2009-09-??
- bugfix(testbench): testcase did not properly wait for rsyslod shutdown
thus some unpredictable behavior and a false negative test result
could occur. [BACKPORTED from v5]
+- bugfix(testbench): sequence check was not always performed correctly,
+ that could result in tests reporting success when they actually failed
---------------------------------------------------------------------------
Version 4.5.5 [v4-beta] (rgerhards), 2009-10-21
- added $InputTCPServerNotifyOnConnectionClose config directive
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c5deaa47..37f4e1a2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -7,7 +7,8 @@ TESTS = $(TESTRUNS) cfg.sh \
diskqueue.sh \
diskqueue-fsync.sh \
manytcp.sh \
- queue-persist.sh
+ queue-persist.sh \
+ pipeaction.sh
if ENABLE_OMSTDOUT
TESTS += omod-if-array.sh \
@@ -113,6 +114,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/threadingmq.conf \
threadingmqaq.sh \
testsuites/threadingmqaq.conf \
+ pipeaction.sh \
+ testsuites/pipeaction.conf \
proprepltest.sh \
testsuites/rfctag.conf \
testsuites/master.rfctag \
diff --git a/tests/chkseq.c b/tests/chkseq.c
index 8c5fc61a..6334d787 100644
--- a/tests/chkseq.c
+++ b/tests/chkseq.c
@@ -40,13 +40,14 @@ int main(int argc, char *argv[])
int val;
int i;
int ret = 0;
+ int verbose = 0;
int dupsPermitted = 0;
int start = 0, end = 0;
int opt;
int nDups = 0;
char *file = NULL;
- while((opt = getopt(argc, argv, "e:f:ds:")) != EOF) {
+ while((opt = getopt(argc, argv, "e:f:ds:v")) != EOF) {
switch((char)opt) {
case 'f':
file = optarg;
@@ -60,6 +61,9 @@ int main(int argc, char *argv[])
case 's':
start = atoi(optarg);
break;
+ case 'v':
+ ++verbose;
+ break;
default:printf("Invalid call of chkseq\n");
printf("Usage: chkseq file -sstart -eend -d\n");
exit(1);
@@ -76,6 +80,10 @@ int main(int argc, char *argv[])
exit(1);
}
+ if(verbose) {
+ printf("chkseq: start %d, end %d\n", start, end);
+ }
+
/* read file */
fp = fopen(file, "r");
if(fp == NULL) {
diff --git a/tests/diag.sh b/tests/diag.sh
index 13bb877d..60a56f07 100755
--- a/tests/diag.sh
+++ b/tests/diag.sh
@@ -61,6 +61,7 @@ case $1 in
fi
;;
'injectmsg') # inject messages via our inject interface (imdiag)
+ echo injecting $3 messages
echo injectmsg $2 $3 $4 $5 | java -classpath $abs_top_builddir DiagTalker
# TODO: some return state checking? (does it really make sense here?)
;;
@@ -76,7 +77,8 @@ case $1 in
'seq-check') # do the usual sequence check to see if everything was properly received
rm -f work
sort < rsyslog.out.log > work
- ./chkseq -fwork -e$2 $3
+ # $4... are just to have the abilit to pass in more options...
+ ./chkseq -fwork -v -s$2 -e$3 $4 $5 $6 $7
if [ "$?" -ne "0" ]; then
echo "sequence error detected"
exit 1
diff --git a/tests/pipeaction.sh b/tests/pipeaction.sh
new file mode 100755
index 00000000..26a4c22a
--- /dev/null
+++ b/tests/pipeaction.sh
@@ -0,0 +1,33 @@
+# Test for the pipe output action.
+# will create a fifo in the current directory, write to it and
+# then do the usual sequence checks.
+# added 2009-11-05 by RGerhards
+echo ===============================================================================
+echo \[pipeaction.sh\]: testing pipe output action
+
+# create the pipe and start a background process that copies data from
+# it to the "regular" work file
+source $srcdir/diag.sh init
+rm -f rsyslog-testbench-fifo
+mkfifo rsyslog-testbench-fifo
+cp rsyslog-testbench-fifo rsyslog.out.log &
+CPPROCESS=$!
+echo background cp process id is $CPPROCESS
+
+# now do the usual run
+source $srcdir/diag.sh startup pipeaction.conf
+# 20000 messages should be enough
+#source $srcdir/diag.sh tcpflood 127.0.0.1 13514 1 20000
+source $srcdir/diag.sh injectmsg 0 20000
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
+
+# wait for the cp process to finish, do pipe-specific cleanup
+echo waiting for background cp to terminate...
+wait $CPPROCESS
+rm -f rsyslog-testbench-fifo
+echo background cp has terminated, continue test...
+
+# and continue the usual checks
+source $srcdir/diag.sh seq-check 0 19999
+source $srcdir/diag.sh exit
diff --git a/tests/testsuites/pipeaction.conf b/tests/testsuites/pipeaction.conf
new file mode 100644
index 00000000..f58b6d65
--- /dev/null
+++ b/tests/testsuites/pipeaction.conf
@@ -0,0 +1,16 @@
+# Test for pipe output action (see .sh file for details)
+# rgerhards, 2009-11-05
+$IncludeConfig diag-common.conf
+
+$MainMsgQueueTimeoutShutdown 10000
+
+# set spool locations and switch queue to disk-only mode
+$WorkDirectory test-spool
+$MainMsgQueueFilename mainq
+$MainMsgQueueType disk
+
+$template outfmt,"%msg:F,58:2%\n"
+# with pipes, we do not need to use absolute path names, so
+# we can simply refer to our working pipe via the usual relative
+# path name
+:msg, contains, "msgnum:" |rsyslog-testbench-fifo;outfmt
diff --git a/tests/testsuites/threadingmq.conf b/tests/testsuites/threadingmq.conf
index aa5197bb..b98f9b5a 100644
--- a/tests/testsuites/threadingmq.conf
+++ b/tests/testsuites/threadingmq.conf
@@ -3,11 +3,7 @@
# rgerhards, 2009-06-26
$IncludeConfig diag-common.conf
-$ModLoad ../plugins/imtcp/.libs/imtcp
-$MainMsgQueueTimeoutShutdown 10000
-$MaxOpenFiles 2000
-$InputTCPMaxSessions 1100
-$InputTCPServerRun 13514
+$MainMsgQueueTimeoutShutdown 100000
$MainMsgQueueWorkerThreadMinimumMessages 10
$MainMsgQueueWorkerThreads 5
diff --git a/tests/testsuites/threadingmqaq.conf b/tests/testsuites/threadingmqaq.conf
index f1bb72df..f0d39057 100644
--- a/tests/testsuites/threadingmqaq.conf
+++ b/tests/testsuites/threadingmqaq.conf
@@ -3,11 +3,7 @@
# rgerhards, 2009-06-26
$IncludeConfig diag-common.conf
-$ModLoad ../plugins/imtcp/.libs/imtcp
$MainMsgQueueTimeoutShutdown 10000
-$MaxOpenFiles 2000
-$InputTCPMaxSessions 1100
-$InputTCPServerRun 13514
$MainMsgQueueWorkerThreadMinimumMessages 10
$MainMsgQueueWorkerThreads 5
diff --git a/tests/threadingmq.sh b/tests/threadingmq.sh
index 5c29ec60..bdb5f35e 100755
--- a/tests/threadingmq.sh
+++ b/tests/threadingmq.sh
@@ -9,7 +9,8 @@
echo TEST: threadingmq.sh - main queue concurrency
source $srcdir/diag.sh init
source $srcdir/diag.sh startup threadingmq.conf
-source $srcdir/diag.sh tcpflood 127.0.0.1 13514 2 100000
+source $srcdir/diag.sh injectmsg 0 100000
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 99999
source $srcdir/diag.sh exit
diff --git a/tests/threadingmqaq.sh b/tests/threadingmqaq.sh
index 009551fd..9f2ea793 100755
--- a/tests/threadingmqaq.sh
+++ b/tests/threadingmqaq.sh
@@ -9,7 +9,10 @@
echo TEST: threadingmqaq.sh - main/action queue concurrency
source $srcdir/diag.sh init
source $srcdir/diag.sh startup threadingmqaq.conf
-source $srcdir/diag.sh tcpflood 127.0.0.1 13514 2 100000
+#source $srcdir/diag.sh tcpflood 127.0.0.1 13514 2 100000
+#source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh injectmsg 0 100000
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 99999
source $srcdir/diag.sh exit