diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-06-24 12:13:48 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-06-24 12:13:48 +0200 |
commit | 31fae7b93d7aa94b7b3fcbfdf101328230ea6302 (patch) | |
tree | e9efcb9247dcd1142831c14e81652e67f03bd043 /tests | |
parent | f48128f34a17aae7e7b9405fe32b396db45443ca (diff) | |
download | rsyslog-31fae7b93d7aa94b7b3fcbfdf101328230ea6302.tar.gz rsyslog-31fae7b93d7aa94b7b3fcbfdf101328230ea6302.tar.xz rsyslog-31fae7b93d7aa94b7b3fcbfdf101328230ea6302.zip |
bugfix: "$ActionExecOnlyWhenPreviousIsSuspended on" was broken
Note that, as it looks, the directive was already broken in previous v5 versions.
So while I solved what looked like a (intentional) regression from the
performance tuning, I actually solved a previous regression as well ;)
I have also added new test cases to the testbench in order to capture such
problems in the future. This version does now look pretty good in shape.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 12 | ||||
-rwxr-xr-x | tests/diag.sh | 7 | ||||
-rwxr-xr-x | tests/execonlywhenprevsuspended.sh | 13 | ||||
-rwxr-xr-x | tests/execonlywhenprevsuspended2.sh | 17 | ||||
-rwxr-xr-x | tests/execonlywhenprevsuspended3.sh | 17 | ||||
-rwxr-xr-x | tests/execonlywhenprevsuspended4.sh | 16 | ||||
-rw-r--r-- | tests/testsuites/execonlywhenprevsuspended.conf | 13 | ||||
-rw-r--r-- | tests/testsuites/execonlywhenprevsuspended2.conf | 19 | ||||
-rw-r--r-- | tests/testsuites/execonlywhenprevsuspended3.conf | 18 | ||||
-rw-r--r-- | tests/testsuites/execonlywhenprevsuspended4.conf | 15 |
10 files changed, 144 insertions, 3 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index ba0bb7ba..a0cc8c7d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -35,6 +35,10 @@ TESTS = $(TESTRUNS) cfg.sh \ queue-persist.sh \ pipeaction.sh \ execonlyonce.sh \ + execonlywhenprevsuspended.sh \ + execonlywhenprevsuspended2.sh \ + execonlywhenprevsuspended3.sh \ + execonlywhenprevsuspended4.sh \ pipe_noreader.sh \ dircreate_dflt.sh \ dircreate_off.sh \ @@ -269,6 +273,14 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ execonlyonce.sh \ testsuites/execonlyonce.conf \ testsuites/execonlyonce.data \ + execonlywhenprevsuspended.sh \ + testsuites/execonlywhenprevsuspended.sh \ + execonlywhenprevsuspended2.sh \ + testsuites/execonlywhenprevsuspended2.sh \ + execonlywhenprevsuspended3.sh \ + testsuites/execonlywhenprevsuspended3.sh \ + execonlywhenprevsuspended4.sh \ + testsuites/execonlywhenprevsuspended4.sh \ tabescape_dflt.sh \ testsuites/tabescape_dflt.conf \ testsuites/1.tabescape_dflt \ diff --git a/tests/diag.sh b/tests/diag.sh index 5b74a6dc..3d072880 100755 --- a/tests/diag.sh +++ b/tests/diag.sh @@ -19,7 +19,7 @@ case $1 in 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 rsyslog.out.log.save # common work files + rm -f work rsyslog.out.log rsyslog2.out.log rsyslog.out.log.save # common work files rm -rf test-spool test-logdir rm -f rsyslog.out.*.log work-presort rsyslog.pipe rm -f core.* vgcore.* @@ -27,7 +27,7 @@ case $1 in ;; 'exit') rm -f rsyslogd.started work-*.conf diag-common.conf rm -f rsyslogd2.started diag-common2.conf rsyslog.action.*.include - rm -f work rsyslog.out.log rsyslog.out.log.save # common work files + rm -f work rsyslog.out.log rsyslog2.out.log rsyslog.out.log.save # common work files rm -rf test-spool test-logdir rm -f rsyslog.out.*.log rsyslog.random.data work-presort rsyslog.pipe echo ------------------------------------------------------------------------------- @@ -115,7 +115,8 @@ case $1 in rm -f work2 sort < rsyslog2.out.log > work2 # $4... are just to have the abilit to pass in more options... - ./chkseq -fwork2 -v -s$2 -e$3 $4 $5 $6 $7 + # add -v to chkseq if you need more verbose output + ./chkseq -fwork2 -s$2 -e$3 $4 $5 $6 $7 if [ "$?" -ne "0" ]; then echo "sequence error detected" exit 1 diff --git a/tests/execonlywhenprevsuspended.sh b/tests/execonlywhenprevsuspended.sh new file mode 100755 index 00000000..624f64af --- /dev/null +++ b/tests/execonlywhenprevsuspended.sh @@ -0,0 +1,13 @@ +# we test the execonly if previous is suspended directive. This is the +# most basic test which soley tests a singel case but no dependencies within +# the ruleset. +# rgerhards, 2010-06-23 +echo ===================================================================================== +echo \[execonlywhenprevsuspended.sh\]: test execonly...suspended functionality simple case +source $srcdir/diag.sh init +source $srcdir/diag.sh startup execonlywhenprevsuspended.conf +source $srcdir/diag.sh injectmsg 0 1000 +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 1 999 +source $srcdir/diag.sh exit diff --git a/tests/execonlywhenprevsuspended2.sh b/tests/execonlywhenprevsuspended2.sh new file mode 100755 index 00000000..8af1b4d8 --- /dev/null +++ b/tests/execonlywhenprevsuspended2.sh @@ -0,0 +1,17 @@ +# we test the execonly if previous is suspended directive. For this, +# we have an action that is suspended for all messages but the second. +# we write two files: one only if the output is suspended and the other one +# in all cases. This should thouroughly check the logic involved. +# rgerhards, 2010-06-23 +echo =============================================================================== +echo \[execonlywhenprevsuspended2.sh\]: test execonly...suspended functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh startup execonlywhenprevsuspended2.conf +source $srcdir/diag.sh injectmsg 0 1000 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +echo check file 1 +source $srcdir/diag.sh seq-check 1 999 +echo check file 2 +source $srcdir/diag.sh seq-check2 0 999 +source $srcdir/diag.sh exit diff --git a/tests/execonlywhenprevsuspended3.sh b/tests/execonlywhenprevsuspended3.sh new file mode 100755 index 00000000..408aeba4 --- /dev/null +++ b/tests/execonlywhenprevsuspended3.sh @@ -0,0 +1,17 @@ +# we test the execonly if previous is suspended directive. +# This test checks if, within the same rule, one action can be set +# to emit only if the previous was suspended while the next action +# always sends data. +# rgerhards, 2010-06-24 +echo =============================================================================== +echo \[execonlywhenprevsuspended3.sh\]: test execonly...suspended functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh startup execonlywhenprevsuspended3.conf +source $srcdir/diag.sh injectmsg 0 1000 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +echo check file 1 +source $srcdir/diag.sh seq-check 1 999 +echo check file 2 +source $srcdir/diag.sh seq-check2 0 999 +source $srcdir/diag.sh exit diff --git a/tests/execonlywhenprevsuspended4.sh b/tests/execonlywhenprevsuspended4.sh new file mode 100755 index 00000000..87008b33 --- /dev/null +++ b/tests/execonlywhenprevsuspended4.sh @@ -0,0 +1,16 @@ +# we test the execonly if previous is suspended directive. +# This test checks if multiple backup actions can be defined. +# rgerhards, 2010-06-24 +echo =============================================================================== +echo \[execonlywhenprevsuspended4.sh\]: test execonly..suspended multi backup action +source $srcdir/diag.sh init +source $srcdir/diag.sh startup execonlywhenprevsuspended4.conf +source $srcdir/diag.sh injectmsg 0 1000 +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 1 999 +if [[ -s rsyslog2.out.log ]] ; then + echo failure: second output file has data where it should be empty + exit 1 +fi ; +source $srcdir/diag.sh exit diff --git a/tests/testsuites/execonlywhenprevsuspended.conf b/tests/testsuites/execonlywhenprevsuspended.conf new file mode 100644 index 00000000..04dc6b59 --- /dev/null +++ b/tests/testsuites/execonlywhenprevsuspended.conf @@ -0,0 +1,13 @@ +# See main .sh file for info +# rgerhards, 2010-06-23 +$IncludeConfig diag-common.conf + +# omtesting provides the ability to cause "SUSPENDED" action state +$ModLoad ../plugins/omtesting/.libs/omtesting + +$MainMsgQueueTimeoutShutdown 100000 +$template outfmt,"%msg:F,58:2%\n" + +:msg, contains, "msgnum:" :omtesting:fail 2 0 +$ActionExecOnlyWhenPreviousIsSuspended on +& ./rsyslog.out.log;outfmt diff --git a/tests/testsuites/execonlywhenprevsuspended2.conf b/tests/testsuites/execonlywhenprevsuspended2.conf new file mode 100644 index 00000000..86aa8832 --- /dev/null +++ b/tests/testsuites/execonlywhenprevsuspended2.conf @@ -0,0 +1,19 @@ +# See main .sh file for info +# rgerhards, 2010-06-23 +$IncludeConfig diag-common.conf + +# omtesting provides the ability to cause "SUSPENDED" action state +$ModLoad ../plugins/omtesting/.libs/omtesting + +$MainMsgQueueTimeoutShutdown 100000 +$template outfmt,"%msg:F,58:2%\n" + +:msg, contains, "msgnum:" :omtesting:fail 2 0 +$ActionExecOnlyWhenPreviousIsSuspended on +& ./rsyslog.out.log;outfmt +# note that we MUST re-set PrevSusp, else it will remain active +# for all other actions as well (this tells us how bad the current +# config language is...). -- rgerhards, 2010-06-24 +$ActionExecOnlyWhenPreviousIsSuspended off + +:msg, contains, "msgnum:" ./rsyslog2.out.log;outfmt diff --git a/tests/testsuites/execonlywhenprevsuspended3.conf b/tests/testsuites/execonlywhenprevsuspended3.conf new file mode 100644 index 00000000..d2750e9a --- /dev/null +++ b/tests/testsuites/execonlywhenprevsuspended3.conf @@ -0,0 +1,18 @@ +# See main .sh file for info +# rgerhards, 2010-06-23 +$IncludeConfig diag-common.conf + +# omtesting provides the ability to cause "SUSPENDED" action state +$ModLoad ../plugins/omtesting/.libs/omtesting + +$MainMsgQueueTimeoutShutdown 100000 +$template outfmt,"%msg:F,58:2%\n" + +:msg, contains, "msgnum:" :omtesting:fail 2 0 +$ActionExecOnlyWhenPreviousIsSuspended on +& ./rsyslog.out.log;outfmt +# note that we MUST re-set PrevSusp, else it will remain active +# for all other actions as well (this tells us how bad the current +# config language is...). -- rgerhards, 2010-06-24 +$ActionExecOnlyWhenPreviousIsSuspended off +& ./rsyslog2.out.log;outfmt diff --git a/tests/testsuites/execonlywhenprevsuspended4.conf b/tests/testsuites/execonlywhenprevsuspended4.conf new file mode 100644 index 00000000..04bc3805 --- /dev/null +++ b/tests/testsuites/execonlywhenprevsuspended4.conf @@ -0,0 +1,15 @@ +# See main .sh file for info +# rgerhards, 2010-06-23 +$IncludeConfig diag-common.conf + +# omtesting provides the ability to cause "SUSPENDED" action state +$ModLoad ../plugins/omtesting/.libs/omtesting + +$MainMsgQueueTimeoutShutdown 100000 +$template outfmt,"%msg:F,58:2%\n" + +:msg, contains, "msgnum:" :omtesting:fail 2 0 +$ActionExecOnlyWhenPreviousIsSuspended on +& ./rsyslog.out.log;outfmt +# note that $ActionExecOnlyWhenPreviousIsSuspended on is still active! +& ./rsyslog2.out.log;outfmt |