From 037576dcc79bb93b78ec8d91305fa605f8bf7a3d Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 30 Oct 2009 09:06:50 +0100 Subject: 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] --- ChangeLog | 3 +++ tests/imtcp-multiport.sh | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7c2c9c28..ef3e9a52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,9 @@ Version 4.5.6 [v4-beta] (rgerhards), 2009-09-?? * bugfix: zero-sized UDP messages are no longer processed * bugfix: random data could be appended to message * bugfix: reverse lookup reduction logic in imudp do DNS queries too often +- 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] --------------------------------------------------------------------------- Version 4.5.5 [v4-beta] (rgerhards), 2009-10-21 - added $InputTCPServerNotifyOnConnectionClose config directive diff --git a/tests/imtcp-multiport.sh b/tests/imtcp-multiport.sh index 702f8834..47a33cb9 100755 --- a/tests/imtcp-multiport.sh +++ b/tests/imtcp-multiport.sh @@ -7,11 +7,13 @@ # # added 2009-05-22 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 -echo testing imtcp multiple listeners +echo =============================================================================== +echo \[imtcp-multiport.sh\]: testing imtcp multiple listeners source $srcdir/diag.sh init source $srcdir/diag.sh startup imtcp-multiport.conf source $srcdir/diag.sh tcpflood 127.0.0.1 13514 1 10000 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 9999 source $srcdir/diag.sh exit # @@ -23,6 +25,7 @@ source $srcdir/diag.sh init source $srcdir/diag.sh startup imtcp-multiport.conf source $srcdir/diag.sh tcpflood 127.0.0.1 13515 1 10000 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 9999 source $srcdir/diag.sh exit # @@ -34,5 +37,6 @@ source $srcdir/diag.sh init source $srcdir/diag.sh startup imtcp-multiport.conf source $srcdir/diag.sh tcpflood 127.0.0.1 13516 1 10000 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 9999 source $srcdir/diag.sh exit -- cgit From a5cd509be736fcff3c8ae3104712d2fe85776416 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 5 Nov 2009 12:44:57 +0100 Subject: bugfix: named pipes did no longer work (they always got an open error) this was a regression from the omfile rewrite in 4.5.0 --- ChangeLog | 4 ++++ runtime/stream.c | 1 + tools/omfile.c | 7 +++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef3e9a52..a1e82ff3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- Version 4.5.6 [v4-beta] (rgerhards), 2009-09-?? +- bugfix: named pipes did no longer work (they always got an open error) + this was a regression from the omfile rewrite in 4.5.0 - bugfix(minor): diag function returned wrong queue memeber count for the main queue if an active DA queue existed. This had no relevance to real deployments (assuming they are not running the debug/diagnostic @@ -133,6 +135,8 @@ Version 4.5.0 [DEVEL] (rgerhards), 2009-07-02 removes false positives (but may cause some trouble with hostname parsing). For details, see this bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=126 +- omfile rewrite to natively support zip files (includes large extension + of the stream class) - added configuration commands (see doc for explanations) * $OMFileZipLevel * $OMFileIOBufferSize diff --git a/runtime/stream.c b/runtime/stream.c index ac90df28..2d1e9380 100644 --- a/runtime/stream.c +++ b/runtime/stream.c @@ -211,6 +211,7 @@ doPhysOpen(strm_t *pThis) } pThis->fd = open((char*)pThis->pszCurrFName, iFlags, pThis->tOpenMode); + DBGPRINTF("file '%s' opened as #%d with mode %d\n", pThis->pszCurrFName, pThis->fd, pThis->tOpenMode); if(pThis->fd == -1) { int ierrnoSave = errno; dbgoprint((obj_t*) pThis, "open error %d, file '%s'\n", errno, pThis->pszCurrFName); diff --git a/tools/omfile.c b/tools/omfile.c index 9d6b3d1d..bea94e99 100644 --- a/tools/omfile.c +++ b/tools/omfile.c @@ -1,8 +1,6 @@ /* omfile.c * This is the implementation of the build-in file output module. * - * Handles: eTypeCONSOLE, eTypeTTY, eTypeFILE, eTypePIPE - * * NOTE: read comments in module-template.h to understand how this file * works! * @@ -667,6 +665,11 @@ CODESTARTparseSelectorAct case '|': case '/': CODE_STD_STRING_REQUESTparseSelectorAct(1) + /* we now have the same semantics for files and pipes, but we need to skip over + * the pipe indicator traditionally seen in config files... + */ + if(*p == '|') + ++p; CHKiRet(cflineParseFileName(p, (uchar*) pData->f_fname, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS, (pszTplName == NULL) ? (uchar*)"RSYSLOG_FileFormat" : pszTplName)); pData->bDynamicName = 0; -- cgit From 6a99be469643ef0214729391f9cef4867b8e9fca Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 5 Nov 2009 14:31:37 +0100 Subject: added pipe action test to testbench & testbench bugfix --- ChangeLog | 2 ++ tests/Makefile.am | 5 ++++- tests/chkseq.c | 10 +++++++++- tests/diag.sh | 4 +++- tests/pipeaction.sh | 33 +++++++++++++++++++++++++++++++++ tests/testsuites/pipeaction.conf | 16 ++++++++++++++++ tests/testsuites/threadingmq.conf | 6 +----- tests/testsuites/threadingmqaq.conf | 4 ---- tests/threadingmq.sh | 3 ++- tests/threadingmqaq.sh | 5 ++++- 10 files changed, 74 insertions(+), 14 deletions(-) create mode 100755 tests/pipeaction.sh create mode 100644 tests/testsuites/pipeaction.conf 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 -- cgit