summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-03-01 16:00:22 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2011-03-01 16:00:22 +0100
commitc130eb20215d5f4ed4fc23c4bf0223b77176617b (patch)
treecf00632ac5c70f2e4aa70be76938127e4fa5d054 /tests
parent74a71e798efd58e20cc150b04de2613bf518eed4 (diff)
downloadrsyslog-c130eb20215d5f4ed4fc23c4bf0223b77176617b.tar.gz
rsyslog-c130eb20215d5f4ed4fc23c4bf0223b77176617b.tar.xz
rsyslog-c130eb20215d5f4ed4fc23c4bf0223b77176617b.zip
improved testbench
- added valgrind-based test (the first one ever ;)) - fixed memory leak in imdiag (guess how this was detected...)
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am3
-rwxr-xr-xtests/diag.sh19
-rw-r--r--tests/testsuites/udp-msgreduc-vg.conf11
-rwxr-xr-xtests/udp-msgreduc-vg.sh18
4 files changed, 50 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 261a56c1..a040a9d9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -47,6 +47,7 @@ TESTS = $(TESTRUNS) cfg.sh \
imuxsock_logger_root.sh \
imuxsock_traillf_root.sh \
imuxsock_ccmiddle_root.sh \
+ udp-msgreduc-vg.sh \
queue-persist.sh
if ENABLE_IMPTCP
@@ -196,6 +197,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/diskqueue-fsync.conf \
imtcp-multiport.sh \
testsuites/imtcp-multiport.conf \
+ udp-msgreduc-vg.sh \
+ testsuites/udp-msgreduc-vg.conf \
manytcp.sh \
testsuites/manytcp.conf \
manyptcp.sh \
diff --git a/tests/diag.sh b/tests/diag.sh
index 2f307750..64b507e6 100755
--- a/tests/diag.sh
+++ b/tests/diag.sh
@@ -34,7 +34,12 @@ case $1 in
;;
'startup') # start rsyslogd with default params. $2 is the config file name to use
# returns only after successful startup, $3 is the instance (blank or 2!)
- $valgrind ../tools/rsyslogd -c4 -u2 -n -irsyslog$3.pid -M../runtime/.libs:../.libs -f$srcdir/testsuites/$2 &
+ $valgrind ../tools/rsyslogd -c6 -u2 -n -irsyslog$3.pid -M../runtime/.libs:../.libs -f$srcdir/testsuites/$2 &
+ $srcdir/diag.sh wait-startup $3
+ ;;
+ 'startup-vg') # start rsyslogd with default params under valgrind control. $2 is the config file name to use
+ # returns only after successful startup, $3 is the instance (blank or 2!)
+ valgrind --error-exitcode=10 --malloc-fill=ff --free-fill=fe --leak-check=full ../tools/rsyslogd -c6 -u2 -n -irsyslog$3.pid -M../runtime/.libs:../.libs -f$srcdir/testsuites/$2 &
$srcdir/diag.sh wait-startup $3
;;
'wait-startup') # wait for rsyslogd startup ($2 is the instance)
@@ -58,6 +63,18 @@ case $1 in
exit 1
fi
;;
+ 'wait-shutdown-vg') # actually, we wait for rsyslog.pid to be deleted. $2 is the
+ # instance
+ wait `cat rsyslog.pid`
+ export RSYSLOGD_EXIT=$?
+ echo rsyslogd run exited with $RSYSLOGD_EXIT
+ if [ -e core.* ]
+ then
+ echo "ABORT! core file exists, starting interactive shell"
+ bash
+ exit 1
+ fi
+ ;;
'wait-queueempty') # wait for main message queue to be empty. $2 is the instance.
if [ "$2" == "2" ]
then
diff --git a/tests/testsuites/udp-msgreduc-vg.conf b/tests/testsuites/udp-msgreduc-vg.conf
new file mode 100644
index 00000000..150bef2e
--- /dev/null
+++ b/tests/testsuites/udp-msgreduc-vg.conf
@@ -0,0 +1,11 @@
+# Test for queue disk mode (see .sh file for details)
+# rgerhards, 2009-05-22
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imudp/.libs/imudp
+$UDPServerRun 13514
+$RepeatedMsgReduction on
+
+$template outfmt,"%msg:F,58:2%\n"
+*.* ./rsyslog.out.log;outfmt
+#:msg, contains, "msgnum:" ./rsyslog.out.log;outfmt
diff --git a/tests/udp-msgreduc-vg.sh b/tests/udp-msgreduc-vg.sh
new file mode 100755
index 00000000..e19ffd86
--- /dev/null
+++ b/tests/udp-msgreduc-vg.sh
@@ -0,0 +1,18 @@
+# check if valgrind violations occur. Correct output is not checked.
+# added 2011-03-01 by Rgerhards
+# This file is part of the rsyslog project, released under GPLv3
+echo ===============================================================================
+echo \[udp-msgreduc-vg.sh\]: testing imtcp multiple listeners
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup-vg udp-msgreduc-vg.conf
+source $srcdir/diag.sh wait-startup
+./tcpflood -t 127.0.0.1 -m 4 -r -Tudp -M "<133>2011-03-01T11:22:12Z host tag msgh ..."
+./tcpflood -t 127.0.0.1 -m 1 -r -Tudp -M "<133>2011-03-01T11:22:12Z host tag msgh ...x"
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown-vg
+if [ "$RSYSLOGD_EXIT" -eq "10" ]
+then
+ echo "udp-msgreduc-vg.sh FAILED"
+ exit 1
+fi
+source $srcdir/diag.sh exit