summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-11-05 14:34:21 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2009-11-05 14:34:21 +0100
commit4578dc6a2dc65112f4aaae1524f83cc9b075295d (patch)
tree7f86aaf79a9b4a77bfb297336b25f1f61007db72
parent6d9c54c7a2d4f07b0414082ef9681bd197ed6bde (diff)
parentcd5f653ad8fa87727bf3ab12b90a41babaaf1ee5 (diff)
downloadrsyslog-4578dc6a2dc65112f4aaae1524f83cc9b075295d.tar.gz
rsyslog-4578dc6a2dc65112f4aaae1524f83cc9b075295d.tar.xz
rsyslog-4578dc6a2dc65112f4aaae1524f83cc9b075295d.zip
Merge branch 'v4-devel' into tmp
-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/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
12 files changed, 87 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 7ac01469..196f866a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -238,6 +238,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
@@ -248,6 +250,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
@@ -368,6 +375,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 cc460bf6..3673db91 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 918dbdd5..28d51b40 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -13,7 +13,8 @@ TESTS = $(TESTRUNS) cfg.sh \
rulesetmultiqueue.sh \
manytcp.sh \
rsf_getenv.sh \
- queue-persist.sh
+ queue-persist.sh \
+ pipeaction.sh
if ENABLE_OMSTDOUT
TESTS += omod-if-array.sh \
@@ -143,6 +144,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 d1bcbe44..50749eaa 100755
--- a/tests/diag.sh
+++ b/tests/diag.sh
@@ -68,6 +68,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?)
;;
@@ -83,7 +84,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 46e47155..ea5d7837 100755
--- a/tests/threadingmq.sh
+++ b/tests/threadingmq.sh
@@ -9,7 +9,8 @@
echo \[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 9f83b1f4..83f5fedc 100755
--- a/tests/threadingmqaq.sh
+++ b/tests/threadingmqaq.sh
@@ -9,7 +9,10 @@
echo \[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 a724a695..0e6d9617 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!
*
@@ -701,6 +699,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;