summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-11-05 14:34:08 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2009-11-05 14:34:08 +0100
commitcd5f653ad8fa87727bf3ab12b90a41babaaf1ee5 (patch)
tree4e98efffdf24157afe8601a8c381dcc56a0ad354
parente4ca8a3119ece504819605b340a3f5ba36b3eab6 (diff)
parent6a99be469643ef0214729391f9cef4867b8e9fca (diff)
downloadrsyslog-cd5f653ad8fa87727bf3ab12b90a41babaaf1ee5.tar.gz
rsyslog-cd5f653ad8fa87727bf3ab12b90a41babaaf1ee5.tar.xz
rsyslog-cd5f653ad8fa87727bf3ab12b90a41babaaf1ee5.zip
Merge branch 'v4-beta' into v4-devel
Conflicts: tests/Makefile.am
-rw-r--r--ChangeLog9
-rw-r--r--runtime/stream.c1
-rw-r--r--tests/Makefile.am5
-rw-r--r--tests/chkseq.c10
-rwxr-xr-xtests/diag.sh4
-rwxr-xr-xtests/imtcp-multiport.sh6
-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
-rw-r--r--tools/omfile.c7
13 files changed, 92 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index d9466e9a..21861491 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,8 @@ Version 4.7.0 [v4-devel] (rgerhards), 2009-09-??
- imported changes from 4.5.6 and below
---------------------------------------------------------------------------
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
@@ -25,6 +27,11 @@ 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]
+- 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
@@ -146,6 +153,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/tests/Makefile.am b/tests/Makefile.am
index 33f94eef..d91df77b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -8,7 +8,8 @@ TESTS = $(TESTRUNS) cfg.sh \
diskqueue-fsync.sh \
manytcp.sh \
rsf_getenv.sh \
- queue-persist.sh
+ queue-persist.sh \
+ pipeaction.sh
if ENABLE_OMSTDOUT
TESTS += omod-if-array.sh \
@@ -116,6 +117,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 b2bd13ac..4ace2845 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/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
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
diff --git a/tools/omfile.c b/tools/omfile.c
index 65140ac4..82548247 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!
*
@@ -687,6 +685,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;