From 9079f6683057c5aad0a73eb56e33a1f1445f6e65 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 21 Oct 2009 15:17:19 +0200 Subject: improved testbench - added a test to check handling of damaged .qi files on startup - made sure each test identifies itself on startup --- tests/Makefile.am | 4 ++++ tests/bad_qi/dbq.qi | 29 +++++++++++++++++++++++++++++ tests/badqi.sh | 15 +++++++++++++++ tests/cfg.sh | 1 + tests/daqueue-persist-drvr.sh | 2 +- tests/daqueue-persist.sh | 2 +- tests/discard.sh | 2 +- tests/diskqueue-fsync.sh | 2 +- tests/diskqueue.sh | 2 +- tests/fieldtest.sh | 2 +- tests/imtcp-multiport.sh | 2 +- tests/linkedlistqueue.sh | 2 +- tests/manytcp.sh | 1 + tests/omod-if-array.sh | 2 +- tests/proprepltest.sh | 2 +- tests/queue-persist.sh | 2 +- tests/testsuites/badqi.conf | 15 +++++++++++++++ tests/threadingmq.sh | 2 +- tests/threadingmqaq.sh | 2 +- tests/timestamp.sh | 2 +- tests/validation-run.sh | 1 + 21 files changed, 80 insertions(+), 14 deletions(-) create mode 100644 tests/bad_qi/dbq.qi create mode 100755 tests/badqi.sh create mode 100644 tests/testsuites/badqi.conf diff --git a/tests/Makefile.am b/tests/Makefile.am index 4ba7db75..7e27b1ac 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -22,6 +22,7 @@ TESTS += omod-if-array.sh \ threadingmq.sh \ threadingmqaq.sh \ discard.sh \ + badqi.sh \ fieldtest.sh endif @@ -138,6 +139,9 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/master.rfctag \ testsuites/nolimittag.conf \ testsuites/master.nolimittag \ + badqi.sh \ + testsuites/badqi.conf \ + bad_qi/dbq.qi \ DiagTalker.java \ cfg.sh diff --git a/tests/bad_qi/dbq.qi b/tests/bad_qi/dbq.qi new file mode 100644 index 00000000..5f56e41a --- /dev/null +++ b/tests/bad_qi/dbq.qi @@ -0,0 +1,29 @@ +!OPB:1:queue:1: ++iQueueSize:2:2:84: ++iUngottenObjs:2:1:1: ++tVars.disk.sizeOnDisk:2:5:57906: ++tVars.disk.bytesRead:2:4:1010: +>End +. +End +. +End +. diff --git a/tests/badqi.sh b/tests/badqi.sh new file mode 100755 index 00000000..1e6df760 --- /dev/null +++ b/tests/badqi.sh @@ -0,0 +1,15 @@ +# Test for a startup with a bad qi file. This tests simply tests +# if the rsyslog engine survives (we had segfaults in this situation +# in the past). +# added 2009-10-21 by RGerhards +# This file is part of the rsyslog project, released under GPLv3 +# uncomment for debugging support: +echo \[badqi.sh\]: test startup with invalid .qi file +source $srcdir/diag.sh init +source $srcdir/diag.sh startup badqi.conf +# we just inject a handful of messages so that we have something to wait for... +source $srcdir/diag.sh tcpflood 127.0.0.1 13514 1 20 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown # wait for process to terminate +source $srcdir/diag.sh seq-check 0 20 +source $srcdir/diag.sh exit diff --git a/tests/cfg.sh b/tests/cfg.sh index cb838354..f850c4d1 100755 --- a/tests/cfg.sh +++ b/tests/cfg.sh @@ -31,6 +31,7 @@ # # A copy of the GPL can be found in the file "COPYING" in this distribution. #set -x +echo \[cfg.sh\]: rm -f tmp echo "local directory" # diff --git a/tests/daqueue-persist-drvr.sh b/tests/daqueue-persist-drvr.sh index 50b96ef2..30a7c635 100755 --- a/tests/daqueue-persist-drvr.sh +++ b/tests/daqueue-persist-drvr.sh @@ -5,7 +5,7 @@ # added 2009-05-27 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 # uncomment for debugging support: -echo testing memory daqueue persisting to disk, mode $1 +echo \[daqueue-persist-drvr.sh\]: testing memory daqueue persisting to disk, mode $1 source $srcdir/diag.sh init # prepare config diff --git a/tests/daqueue-persist.sh b/tests/daqueue-persist.sh index ff81c987..feb2a347 100755 --- a/tests/daqueue-persist.sh +++ b/tests/daqueue-persist.sh @@ -2,7 +2,7 @@ # to carry out multiple tests with different queue modes # added 2009-05-27 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 -echo TEST: daqueue-persist.sh +echo \[daqueue-persist.sh\]: test data persisting at shutdown source $srcdir/daqueue-persist-drvr.sh LinkedList source $srcdir/daqueue-persist-drvr.sh FixedArray # the disk test should not fail, however, the config is extreme and using diff --git a/tests/discard.sh b/tests/discard.sh index 0fafc7d9..b7ba4eba 100755 --- a/tests/discard.sh +++ b/tests/discard.sh @@ -4,7 +4,7 @@ # added 2009-07-30 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 # uncomment for debugging support: -echo TEST discard.sh: testing discard functionality +echo \[discard.sh\]: testing discard functionality source $srcdir/diag.sh init source $srcdir/diag.sh startup discard.conf # 20000 messages should be enough - the disk test is slow enough ;) diff --git a/tests/diskqueue-fsync.sh b/tests/diskqueue-fsync.sh index 0282202d..c826d32c 100755 --- a/tests/diskqueue-fsync.sh +++ b/tests/diskqueue-fsync.sh @@ -5,7 +5,7 @@ # added 2009-06-09 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 # uncomment for debugging support: -echo testing queue disk-only mode, fsync case +echo \[diskqueue-fsync.sh\]: testing queue disk-only mode, fsync case source $srcdir/diag.sh init source $srcdir/diag.sh startup diskqueue-fsync.conf # 1000 messages should be enough - the disk fsync test is very slow! diff --git a/tests/diskqueue.sh b/tests/diskqueue.sh index 8233d569..e91f0633 100755 --- a/tests/diskqueue.sh +++ b/tests/diskqueue.sh @@ -5,7 +5,7 @@ # added 2009-04-17 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 # uncomment for debugging support: -echo diskqueue.sh: testing queue disk-only mode +echo \[diskqueue.sh\]: testing queue disk-only mode source $srcdir/diag.sh init source $srcdir/diag.sh startup diskqueue.conf # 20000 messages should be enough - the disk test is slow enough ;) diff --git a/tests/fieldtest.sh b/tests/fieldtest.sh index 482fa143..9875fda6 100755 --- a/tests/fieldtest.sh +++ b/tests/fieldtest.sh @@ -1,4 +1,4 @@ -echo test fieldtest via udp +echo \[fieldtest.sh\]: test fieldtest via udp $srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason ./nettester -tfield1 -iudp diff --git a/tests/imtcp-multiport.sh b/tests/imtcp-multiport.sh index 702f8834..ad1f90a8 100755 --- a/tests/imtcp-multiport.sh +++ b/tests/imtcp-multiport.sh @@ -7,7 +7,7 @@ # # added 2009-05-22 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 -echo testing imtcp multiple listeners +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 diff --git a/tests/linkedlistqueue.sh b/tests/linkedlistqueue.sh index 72c2a403..e6d48a68 100755 --- a/tests/linkedlistqueue.sh +++ b/tests/linkedlistqueue.sh @@ -1,7 +1,7 @@ # Test for Linkedlist queue mode # added 2009-05-20 by rgerhards # This file is part of the rsyslog project, released under GPLv3 -echo testing queue Linkedlist queue mode +echo \[linkedlistqueue.sh\]: testing queue Linkedlist queue mode source $srcdir/diag.sh init source $srcdir/diag.sh startup linkedlistqueue.conf diff --git a/tests/manytcp.sh b/tests/manytcp.sh index c55eb9c0..06e2fac9 100755 --- a/tests/manytcp.sh +++ b/tests/manytcp.sh @@ -1,4 +1,5 @@ # test many concurrent tcp connections +echo \[manytcp.sh\]: test concurrent tcp connections source $srcdir/diag.sh init source $srcdir/diag.sh startup manytcp.conf # the config file specifies exactly 1100 connections diff --git a/tests/omod-if-array.sh b/tests/omod-if-array.sh index 2c2a8ef3..4e916f1e 100755 --- a/tests/omod-if-array.sh +++ b/tests/omod-if-array.sh @@ -1,4 +1,4 @@ -echo test omod-if-array via udp +echo \[omod-if-array.sh\]: test omod-if-array via udp $srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason ./nettester -tomod-if-array -iudp -p4711 diff --git a/tests/proprepltest.sh b/tests/proprepltest.sh index 3c252e52..2e59a31d 100755 --- a/tests/proprepltest.sh +++ b/tests/proprepltest.sh @@ -1,4 +1,4 @@ -echo TEST: proprepltest.sh - various tests for the property replacer +echo \[proprepltest.sh\]: various tests for the property replacer source $srcdir/diag.sh init source $srcdir/diag.sh nettester rfctag udp source $srcdir/diag.sh nettester rfctag tcp diff --git a/tests/queue-persist.sh b/tests/queue-persist.sh index e05b3da3..ff1842bb 100755 --- a/tests/queue-persist.sh +++ b/tests/queue-persist.sh @@ -2,7 +2,7 @@ # to carry out multiple tests with different queue modes # added 2009-05-27 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 -echo TEST: queue-persist.sh +echo \[queue-persist.sh\]: source $srcdir/queue-persist-drvr.sh LinkedList source $srcdir/queue-persist-drvr.sh FixedArray # the disk test should not fail, however, the config is extreme and using diff --git a/tests/testsuites/badqi.conf b/tests/testsuites/badqi.conf new file mode 100644 index 00000000..0ab059df --- /dev/null +++ b/tests/testsuites/badqi.conf @@ -0,0 +1,15 @@ +# Test for bad .qi file (see .sh file for details) +# rgerhards, 2009-10-21 +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/imtcp/.libs/imtcp +$MainMsgQueueTimeoutShutdown 10000 +$InputTCPServerRun 13514 + +$template outfmt,"%msg:F,58:2%\n" +$template dynfile,"rsyslog.out.log" # trick to use relative path names! +# instruct to use bad .qi file +$WorkDirectory bad_qi +$ActionQueueType LinkedList +$ActionQueueFileName dbq +:msg, contains, "msgnum:" ?dynfile;outfmt diff --git a/tests/threadingmq.sh b/tests/threadingmq.sh index 5c29ec60..46e47155 100755 --- a/tests/threadingmq.sh +++ b/tests/threadingmq.sh @@ -6,7 +6,7 @@ # in practice many threading bugs result in an abort rather quickly and these # should be covered by this test here. # rgerhards, 2009-06-26 -echo TEST: threadingmq.sh - main queue concurrency +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 diff --git a/tests/threadingmqaq.sh b/tests/threadingmqaq.sh index 009551fd..9f83b1f4 100755 --- a/tests/threadingmqaq.sh +++ b/tests/threadingmqaq.sh @@ -6,7 +6,7 @@ # in practice many threading bugs result in an abort rather quickly and these # should be covered by this test here. # rgerhards, 2009-06-26 -echo TEST: threadingmqaq.sh - main/action queue concurrency +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 diff --git a/tests/timestamp.sh b/tests/timestamp.sh index 7699a4af..71416c33 100755 --- a/tests/timestamp.sh +++ b/tests/timestamp.sh @@ -1,4 +1,4 @@ -echo various timestamp tests +echo \[timestamp.sh\]: various timestamp tests source $srcdir/diag.sh init source $srcdir/diag.sh nettester ts3164 udp source $srcdir/diag.sh nettester ts3164 tcp diff --git a/tests/validation-run.sh b/tests/validation-run.sh index 2e922283..cc29482a 100755 --- a/tests/validation-run.sh +++ b/tests/validation-run.sh @@ -21,6 +21,7 @@ # # A copy of the GPL can be found in the file "COPYING" in this distribution. #set -x +echo \[validation-run.sh\]: testing configuraton validation echo "testing a failed configuration verification run" ../tools/rsyslogd -dn -u2 -c4 -N1 -f$srcdir/testsuites/invalid.conf -M../runtime/.libs:../.libs if [ $? -ne 1 ]; then -- cgit