From d1eb6e0edc51a78f3209448e800b25eda50340f2 Mon Sep 17 00:00:00 2001 From: Bojan Smojver Date: Wed, 23 Feb 2011 11:25:43 +0100 Subject: added work-around for bug in gtls, which causes fd leak when using TLS The capability has been added for module to specify that they do not like being unloaded. related bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=222 Signed-off-by: Rainer Gerhards --- tests/rt-init.c | 1 - 1 file changed, 1 deletion(-) (limited to 'tests') diff --git a/tests/rt-init.c b/tests/rt-init.c index dbe94b4a..2d43943f 100644 --- a/tests/rt-init.c +++ b/tests/rt-init.c @@ -28,7 +28,6 @@ MODULE_TYPE_TESTBENCH - BEGINInit CODESTARTInit ENDInit -- cgit From b8610a107ee4fd9e4b1ba06e7bd43dd6cbd72ea7 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 4 Mar 2011 09:19:08 +0100 Subject: added first experimental skeleton of what is to become a testconfig generator currently it generates only the power set, more work to do to make it a real config generator. --- tests/testconfgen.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 tests/testconfgen.c (limited to 'tests') diff --git a/tests/testconfgen.c b/tests/testconfgen.c new file mode 100644 index 00000000..9f191cc7 --- /dev/null +++ b/tests/testconfgen.c @@ -0,0 +1,72 @@ +/* a testcase generator + * THis program reads stdin, which must consist of (name,stmt) tupels + * where name is a part of the config name (small!) and stmt is an actual + * config statement. These tupels must be encoded as + * namestmt + * on stdin. After all tupels are read, the power set of all possible + * configurations is generated. + * Copyright (C) 2011 by Rainer Gerhards and Adiscon GmbH + * Released under the GPLv3 as part of the rsyslog project. + */ +#include +#include +#include + +static int arr[128]; +static char *name[128]; +static char *stmt[128]; + +void output(int n) +{ + int i; + + printf("name:"); + for(i = 0 ; i < n ; ++i) { + if(arr[i]) { + printf("-%s", name[i]); + } + } + printf("\n"); +} + +void pows(int n, int i) +{ + if(i == 0) { + output(n); + } else { + --i; + arr[i] = 0; + pows(n, i); + arr[i] = 1; + pows(n, i); + } +} + + +int main(int argc, char *argv[]) +{ + int n; + char iname[512]; + char istmt[2048]; + int nscanned; + + n = 0; + while(!feof(stdin)) { + nscanned = scanf("%s %[^\n]s\n", iname, istmt); + if(nscanned == EOF) + break; + else if(nscanned != 2) { + fprintf(stderr, "problem scanning entry %d, scanned %d\n", + n, nscanned); + exit(1); + } + name[n] = strdup(iname); + stmt[n] = strdup(istmt); + n++; + printf("name: %s, stmt: %s\n", iname, istmt); + } + /* n is on to high for an index, but just right as the actual number! */ + + printf("read %d entries\n", n); + pows(n, n); +} -- cgit From 5709b056c5be16df1f1a2369a737e40711f20979 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 4 Mar 2011 16:33:01 +0100 Subject: changed testbench parser patterns for more usual system config a problem in the current testbench is that it depends on the locally assigned system name. We have changed the default to the most common default value. However, in the long term we need to fix this (and will do so via a preloaded DNS cache, which we do not yet have!) --- tests/testsuites/samples.parse-nodate | 2 +- tests/testsuites/samples.snare_ccoff_udp | 2 +- tests/testsuites/samples.snare_ccoff_udp2 | 8 ++++---- tests/testsuites/weird.parse1 | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/testsuites/samples.parse-nodate b/tests/testsuites/samples.parse-nodate index 7f16181c..5432bcac 100644 --- a/tests/testsuites/samples.parse-nodate +++ b/tests/testsuites/samples.parse-nodate @@ -1,5 +1,5 @@ <27>xapi: [error|xen3|15|Guest liveness monitor D:bca30ab3f1c1|master_connection] Connection to master died. I will continue to retry indefinitely (supressing future logging of this message) -27,daemon,err,localhost,xapi,xapi:, [error|xen3|15|Guest liveness monitor D:bca30ab3f1c1|master_connection] Connection to master died. I will continue to retry indefinitely (supressing future logging of this message) +27,daemon,err,localhost.localdomain,xapi,xapi:, [error|xen3|15|Guest liveness monitor D:bca30ab3f1c1|master_connection] Connection to master died. I will continue to retry indefinitely (supressing future logging of this message) # a message with just text (as permitted by rfc 3164) # it is questionable if the current sample result is really correct as of 3164! This is a message! diff --git a/tests/testsuites/samples.snare_ccoff_udp b/tests/testsuites/samples.snare_ccoff_udp index 010e44d5..1ae7e8b4 100644 --- a/tests/testsuites/samples.snare_ccoff_udp +++ b/tests/testsuites/samples.snare_ccoff_udp @@ -3,7 +3,7 @@ # *real* cases (just mangled to anonymize them...) # Sample 1 - note the absence of PRI! windowsserver MSWinEventLog 1 Security 1167 Fri Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733\n -13,user,notice,localhost,windowsserver,windowsserver MSWinEventLog 1 Security 1167 Fri, Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733 +13,user,notice,localhost.localdomain,windowsserver,windowsserver MSWinEventLog 1 Security 1167 Fri, Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733 # Sample 2 # the samples below need to be disabled for the "workaround patch" for the message # parser to work. They need to be re-enabled once a final solution has been crafted diff --git a/tests/testsuites/samples.snare_ccoff_udp2 b/tests/testsuites/samples.snare_ccoff_udp2 index 337cd97c..da3a2b14 100644 --- a/tests/testsuites/samples.snare_ccoff_udp2 +++ b/tests/testsuites/samples.snare_ccoff_udp2 @@ -14,13 +14,13 @@ test insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values ('', 1, 'test',5, '20100321185328', '20100321185328', 1, '') # and yet another one we have seen in practice UX=Abcd-efg-hij-klmno; XXXXX=1111111111, Z123=192.12.231.245:11111, S1234=123456789, XXXXXX=111111111 -insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' XXXXX=1111111111, Z123=192.12.231.245:11111, S1234=123456789, XXXXXX=111111111', 1, 'localhost',5, '20100321185328', '20100321185328', 1, 'UX=Abcd-efg-hij-klmno;') +insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' XXXXX=1111111111, Z123=192.12.231.245:11111, S1234=123456789, XXXXXX=111111111', 1, 'localhost.localdomain',5, '20100321185328', '20100321185328', 1, 'UX=Abcd-efg-hij-klmno;') # Sample 1 - note the absence of PRI! windowsserver MSWinEventLog 1 Security 1167 Fri Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733\n -insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733', 1, 'localhost',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1167 Fri') +insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733', 1, 'localhost.localdomain',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1167 Fri') # Sample 2 windowsserver MSWinEventLog 1 Security 1166 Fri Mar 19 15:33:30 2010 576 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Special privileges assigned to new logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Privileges: SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilege SeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilege SeImpersonatePrivilege SeEnableDelegationPrivilege 732\n -insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 576 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Special privileges assigned to new logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Privileges: SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilege SeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilege SeImpersonatePrivilege SeEnableDelegationPrivilege 732', 1, 'localhost',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1166 Fri') +insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 576 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Special privileges assigned to new logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Privileges: SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilege SeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilege SeImpersonatePrivilege SeEnableDelegationPrivilege 732', 1, 'localhost.localdomain',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1166 Fri') # Sample 3 windowsserver MSWinEventLog 1 Security 1165 Fri Mar 19 15:33:30 2010 538 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff User Logoff: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF8830B) Logon Type: 3 731\n -insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 538 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff User Logoff: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF8830B) Logon Type: 3 731', 1, 'localhost',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1165 Fri') +insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 538 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff User Logoff: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF8830B) Logon Type: 3 731', 1, 'localhost.localdomain',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1165 Fri') diff --git a/tests/testsuites/weird.parse1 b/tests/testsuites/weird.parse1 index e8b90c74..907198a1 100644 --- a/tests/testsuites/weird.parse1 +++ b/tests/testsuites/weird.parse1 @@ -11,10 +11,10 @@ 14,user,info,Aug 30 23:00:05,X4711,,, # there is a SP at the end of the line <14>Aug 30 23:00:05 -14,user,info,Aug 30 23:00:05,localhost,,, +14,user,info,Aug 30 23:00:05,localhost.localdomain,,, # and here is no SP at the end of the line <14>Aug 30 23:00:05 -14,user,info,Aug 30 23:00:05,localhost,,, +14,user,info,Aug 30 23:00:05,localhost.localdomain,,, # unfortunately, I can not test missing dates with this test suite, because # we would have the current date in the response, which we can not check against # @@ -31,7 +31,7 @@ 14,user,info,Aug 30 23:00:05,X4711,,, # there is a SP at the end of the line <14>2010-08-30T23:00:05Z -14,user,info,Aug 30 23:00:05,localhost,,, +14,user,info,Aug 30 23:00:05,localhost.localdomain,,, # and here is no SP at the end of the line <14>2010-08-30T23:00:05Z -14,user,info,Aug 30 23:00:05,localhost,,, +14,user,info,Aug 30 23:00:05,localhost.localdomain,,, -- cgit From 4fb7dd296efc6a798e884f0504fdf0bedebba9f5 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sun, 6 Mar 2011 15:50:48 +0100 Subject: backported new testbench support for valgrind --- tests/diag.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'tests') 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 -- cgit From 36899ac8c40e78767ba58e440167a76dd4a73db1 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sun, 6 Mar 2011 16:09:17 +0100 Subject: added new test to check RepeatedMsgReduction (via TCP) This is kind of a backport of a similar UDP-based test from v6. However, we do not have everything required for UDP in the v5 test tool base, so we mimic the test with tcp -- which is not bad at all, because the code path for TCP is somewhat different (and thus once we merge this patch into v6, it is a useful addition). --- tests/Makefile.am | 3 +++ tests/tcp-msgreduc-vg.sh | 20 ++++++++++++++++++++ tests/testsuites/tcp-msgreduc-vg.conf | 10 ++++++++++ 3 files changed, 33 insertions(+) create mode 100755 tests/tcp-msgreduc-vg.sh create mode 100644 tests/testsuites/tcp-msgreduc-vg.conf (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 694b28ab..2e2e47aa 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -13,6 +13,7 @@ TESTS = $(TESTRUNS) cfg.sh \ rulesetmultiqueue.sh \ manytcp.sh \ rsf_getenv.sh \ + tcp-msgreduc-vg.sh \ imtcp_conndrop.sh \ imtcp_addtlframedelim.sh \ sndrcv.sh \ @@ -210,6 +211,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/imtcp_conndrop.conf \ imtcp_addtlframedelim.sh \ testsuites/imtcp_addtlframedelim.conf \ + tcp-msgreduc-vg.sh \ + testsuites/./tcp-msgreduc-vg.conf \ inputname.sh \ testsuites/inputname_imtcp.conf \ testsuites/1.inputname_imtcp_12514 \ diff --git a/tests/tcp-msgreduc-vg.sh b/tests/tcp-msgreduc-vg.sh new file mode 100755 index 00000000..82747f3b --- /dev/null +++ b/tests/tcp-msgreduc-vg.sh @@ -0,0 +1,20 @@ +# 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 \[tcp-msgreduc-vg.sh\]: testing msg reduction via UDP +source $srcdir/diag.sh init +source $srcdir/diag.sh startup-vg tcp-msgreduc-vg.conf +source $srcdir/diag.sh wait-startup +./tcpflood -t 127.0.0.1 -m 4 -r -M "<133>2011-03-01T11:22:12Z host tag msgh ..." +./tcpflood -t 127.0.0.1 -m 1 -r -M "<133>2011-03-01T11:22:12Z host tag msgh ...x" +# we need to give rsyslog a little time to settle the receiver +./msleep 1500 +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 "tcp-msgreduc-vg.sh FAILED" + exit 1 +fi +source $srcdir/diag.sh exit diff --git a/tests/testsuites/tcp-msgreduc-vg.conf b/tests/testsuites/tcp-msgreduc-vg.conf new file mode 100644 index 00000000..72420f04 --- /dev/null +++ b/tests/testsuites/tcp-msgreduc-vg.conf @@ -0,0 +1,10 @@ +# Test for queue disk mode (see .sh file for details) +# rgerhards, 2009-05-22 +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/imtcp/.libs/imtcp +$InputTCPServerRun 13514 +$RepeatedMsgReduction on + +$template outfmt,"%msg:F,58:2%\n" +*.* ./rsyslog.out.log;outfmt -- cgit From 027e6434c97c102d6c67648a49cb1ccc378346d2 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 7 Mar 2011 19:03:02 +0100 Subject: small bug in testbench, wrong config file pulled in one test --- tests/imtcp_conndrop.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/imtcp_conndrop.sh b/tests/imtcp_conndrop.sh index 2caa0ce2..9855ee3b 100755 --- a/tests/imtcp_conndrop.sh +++ b/tests/imtcp_conndrop.sh @@ -6,7 +6,7 @@ echo =========================================================================== echo TEST: \[imtcp_conndrop.sh\]: test imtcp with random connection drops cat rsyslog.action.1.include source $srcdir/diag.sh init -source $srcdir/diag.sh startup imptcp_large.conf +source $srcdir/diag.sh startup imtcp_conndrop.conf # 100 byte messages to gain more practical data use source $srcdir/diag.sh tcpflood -c20 -m50000 -r -d100 -P129 -D sleep 4 # due to large messages, we need this time for the tcp receiver to settle... -- cgit From 5d3783b0c0449df1d4d1b0d38ce35dc2995ce22a Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 8 Mar 2011 18:18:14 +0100 Subject: added new test to testbench --- tests/Makefile.am | 5 ++++- tests/discard-rptdmsg.sh | 17 +++++++++++++++++ tests/testsuites/discard-rptdmsg.conf | 15 +++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 tests/discard-rptdmsg.sh create mode 100644 tests/testsuites/discard-rptdmsg.conf (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 3c00c24a..3f703fcb 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -46,6 +46,8 @@ TESTS = $(TESTRUNS) cfg.sh \ pipe_noreader.sh \ dircreate_dflt.sh \ dircreate_off.sh \ + discard-rptdmsg.sh \ + discard.sh \ queue-persist.sh if ENABLE_IMPTCP @@ -68,7 +70,6 @@ TESTS += omod-if-array.sh \ inputname.sh \ threadingmq.sh \ threadingmqaq.sh \ - discard.sh \ badqi.sh \ tabescape_dflt.sh \ tabescape_off.sh \ @@ -212,6 +213,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ omod-if-array.sh \ discard.sh \ testsuites/discard.conf \ + discard-rptdmsg.sh \ + testsuites/discard-rptdmsg.conf \ diag.sh \ testsuites/diag-common.conf \ testsuites/diag-common2.conf \ diff --git a/tests/discard-rptdmsg.sh b/tests/discard-rptdmsg.sh new file mode 100755 index 00000000..a8b35c38 --- /dev/null +++ b/tests/discard-rptdmsg.sh @@ -0,0 +1,17 @@ +# Test for discard-rptdmsg functionality +# This test checks if discard-rptdmsg works. It is not a perfect test but +# will find at least segfaults and obviously not discard-rptdmsged messages. +# added 2009-07-30 by Rgerhards +# This file is part of the rsyslog project, released under GPLv3 +# uncomment for debugging support: +echo =============================================================================== +echo \[discard-rptdmsg.sh\]: testing discard-rptdmsg functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh startup discard-rptdmsg.conf +# 20000 messages should be enough - the disk test is slow enough ;) +sleep 4 +source $srcdir/diag.sh tcpflood -m10 -i1 +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 2 10 +source $srcdir/diag.sh exit diff --git a/tests/testsuites/discard-rptdmsg.conf b/tests/testsuites/discard-rptdmsg.conf new file mode 100644 index 00000000..74060e31 --- /dev/null +++ b/tests/testsuites/discard-rptdmsg.conf @@ -0,0 +1,15 @@ +# Test for discard functionality +# rgerhards, 2009-07-30 +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/imtcp/.libs/imtcp +$MainMsgQueueTimeoutShutdown 10000 +$InputTCPServerRun 13514 + +$RepeatedMsgReduction on + +:msg, contains, "00000001" ~ + +$template outfmt,"%msg:F,58:2%\n" +$template dynfile,"rsyslog.out.log" # trick to use relative path names! +:msg, contains, "msgnum:" ?dynfile;outfmt -- cgit From 1a0875865300472150c411afa8335e47a1722bae Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 8 Mar 2011 18:58:28 +0100 Subject: further improved testbench some cosmetic issues, plus a new valgrind-based test --- tests/Makefile.am | 2 ++ tests/diag.sh | 7 +++++++ tests/discard-rptdmsg-vg.sh | 13 +++++++++++++ tests/discard-rptdmsg.sh | 7 ------- tests/tcp-msgreduc-vg.sh | 6 +----- 5 files changed, 23 insertions(+), 12 deletions(-) create mode 100755 tests/discard-rptdmsg-vg.sh (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index c834ef6e..3e07e1c6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -49,6 +49,7 @@ TESTS = $(TESTRUNS) cfg.sh \ imuxsock_traillf_root.sh \ imuxsock_ccmiddle_root.sh \ discard-rptdmsg.sh \ + discard-rptdmsg-vg.sh \ discard.sh \ queue-persist.sh @@ -223,6 +224,7 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ discard.sh \ testsuites/discard.conf \ discard-rptdmsg.sh \ + discard-rptdmsg-vg.sh \ testsuites/discard-rptdmsg.conf \ diag.sh \ testsuites/diag-common.conf \ diff --git a/tests/diag.sh b/tests/diag.sh index 64b507e6..e8e3ce1c 100755 --- a/tests/diag.sh +++ b/tests/diag.sh @@ -75,6 +75,13 @@ case $1 in exit 1 fi ;; + 'check-exit-vg') # wait for main message queue to be empty. $2 is the instance. + if [ "$RSYSLOGD_EXIT" -eq "10" ] + then + echo "valgrind run FAILED with exceptions - terminating" + 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/discard-rptdmsg-vg.sh b/tests/discard-rptdmsg-vg.sh new file mode 100755 index 00000000..f56ac597 --- /dev/null +++ b/tests/discard-rptdmsg-vg.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[discard-rptdmsg.sh\]: testing discard-rptdmsg functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh startup-vg discard-rptdmsg.conf +source $srcdir/diag.sh tcpflood -m10 -i1 +# we need to give rsyslog a little time to settle the receiver +./msleep 1500 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg +source $srcdir/diag.sh seq-check 2 10 +source $srcdir/diag.sh exit diff --git a/tests/discard-rptdmsg.sh b/tests/discard-rptdmsg.sh index a8b35c38..a8be110c 100755 --- a/tests/discard-rptdmsg.sh +++ b/tests/discard-rptdmsg.sh @@ -1,15 +1,8 @@ -# Test for discard-rptdmsg functionality -# This test checks if discard-rptdmsg works. It is not a perfect test but -# will find at least segfaults and obviously not discard-rptdmsged messages. -# added 2009-07-30 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 -# uncomment for debugging support: echo =============================================================================== echo \[discard-rptdmsg.sh\]: testing discard-rptdmsg functionality source $srcdir/diag.sh init source $srcdir/diag.sh startup discard-rptdmsg.conf -# 20000 messages should be enough - the disk test is slow enough ;) -sleep 4 source $srcdir/diag.sh tcpflood -m10 -i1 source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages source $srcdir/diag.sh wait-shutdown diff --git a/tests/tcp-msgreduc-vg.sh b/tests/tcp-msgreduc-vg.sh index 82747f3b..7e388360 100755 --- a/tests/tcp-msgreduc-vg.sh +++ b/tests/tcp-msgreduc-vg.sh @@ -12,9 +12,5 @@ source $srcdir/diag.sh wait-startup ./msleep 1500 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 "tcp-msgreduc-vg.sh FAILED" - exit 1 -fi +source $srcdir/diag.sh wait-shutdown-vg source $srcdir/diag.sh exit -- cgit From 22f36ffbbd0c4e0fe1bfe331cb7ca15ec6ae80aa Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 08:23:16 +0100 Subject: testbench: valgrind tests only executed if valgrind is available --- tests/Makefile.am | 8 ++++++-- tests/imtcp_conndrop.sh | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 3e07e1c6..7527b27f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -13,7 +13,6 @@ TESTS = $(TESTRUNS) cfg.sh \ rulesetmultiqueue.sh \ manytcp.sh \ rsf_getenv.sh \ - tcp-msgreduc-vg.sh \ imtcp_conndrop.sh \ imtcp_addtlframedelim.sh \ sndrcv.sh \ @@ -49,10 +48,15 @@ TESTS = $(TESTRUNS) cfg.sh \ imuxsock_traillf_root.sh \ imuxsock_ccmiddle_root.sh \ discard-rptdmsg.sh \ - discard-rptdmsg-vg.sh \ discard.sh \ queue-persist.sh +if HAVE_VALGRIND +TESTS += \ + discard-rptdmsg-vg.sh \ + tcp-msgreduc-vg.sh +endif + if ENABLE_IMPTCP TESTS += \ manyptcp.sh \ diff --git a/tests/imtcp_conndrop.sh b/tests/imtcp_conndrop.sh index 9855ee3b..c7eb89e8 100755 --- a/tests/imtcp_conndrop.sh +++ b/tests/imtcp_conndrop.sh @@ -9,7 +9,7 @@ source $srcdir/diag.sh init source $srcdir/diag.sh startup imtcp_conndrop.conf # 100 byte messages to gain more practical data use source $srcdir/diag.sh tcpflood -c20 -m50000 -r -d100 -P129 -D -sleep 4 # due to large messages, we need this time for the tcp receiver to settle... +sleep 6 # due to large messages, we need this time for the tcp receiver to settle... source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages source $srcdir/diag.sh wait-shutdown # and wait for it to terminate source $srcdir/diag.sh seq-check 0 49999 -E -- cgit From 3f657f5b056c02cddb17ad639b226f24ebb047c5 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 09:58:07 +0100 Subject: make testbench not errout if imdiag is not enabled --- tests/Makefile.am | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 7527b27f..a720c0c3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,7 +1,10 @@ if ENABLE_TESTBENCH TESTRUNS = rt_init rscript check_PROGRAMS = $(TESTRUNS) ourtail nettester tcpflood chkseq msleep randomgen diagtalker uxsockrcvr syslog_caller syslog_inject -TESTS = $(TESTRUNS) cfg.sh \ +TESTS = $(TESTRUNS) cfg.sh + +if ENABLE_IMDIAG +TESTS += \ arrayqueue.sh \ linkedlistqueue.sh \ da-mainmsg-q.sh \ @@ -49,7 +52,10 @@ TESTS = $(TESTRUNS) cfg.sh \ imuxsock_ccmiddle_root.sh \ discard-rptdmsg.sh \ discard.sh \ - queue-persist.sh + queue-persist.sh \ + arrayqueue.sh \ + linkedlistqueue.sh +endif if HAVE_VALGRIND TESTS += \ @@ -89,9 +95,11 @@ TESTS += omod-if-array.sh \ endif if ENABLE_OMRULESET +if ENABLE_IMDIAG TESTS += omruleset.sh \ omruleset-queue.sh endif +endif if ENABLE_EXTENDED_TESTS TESTS += random.sh @@ -193,9 +201,7 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/rsf_getenv.conf \ diskqueue.sh \ testsuites/diskqueue.conf \ - arrayqueue.sh \ testsuites/arrayqueue.conf \ - linkedlistqueue.sh \ testsuites/linkedlistqueue.conf \ da-mainmsg-q.sh \ testsuites/da-mainmsg-q.conf \ -- cgit From 67a52bbd1d236f2f24297efdbceaf20c6fa10906 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 10:01:19 +0100 Subject: preparing for 5.7.8 release --- tests/imtcp_conndrop.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/imtcp_conndrop.sh b/tests/imtcp_conndrop.sh index c7eb89e8..0bfcd99c 100755 --- a/tests/imtcp_conndrop.sh +++ b/tests/imtcp_conndrop.sh @@ -9,7 +9,7 @@ source $srcdir/diag.sh init source $srcdir/diag.sh startup imtcp_conndrop.conf # 100 byte messages to gain more practical data use source $srcdir/diag.sh tcpflood -c20 -m50000 -r -d100 -P129 -D -sleep 6 # due to large messages, we need this time for the tcp receiver to settle... +sleep 10 # due to large messages, we need this time for the tcp receiver to settle... source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages source $srcdir/diag.sh wait-shutdown # and wait for it to terminate source $srcdir/diag.sh seq-check 0 49999 -E -- cgit From d1ae9e393885fb6d9fc69fc1bb08a098a8ac0328 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 11:28:22 +0100 Subject: improved testbench --- tests/Makefile.am | 5 +++++ tests/discard-allmark-vg.sh | 13 +++++++++++++ tests/discard-allmark.sh | 10 ++++++++++ tests/testsuites/discard-allmark.conf | 15 +++++++++++++++ 4 files changed, 43 insertions(+) create mode 100755 tests/discard-allmark-vg.sh create mode 100755 tests/discard-allmark.sh create mode 100644 tests/testsuites/discard-allmark.conf (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index a720c0c3..35513614 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -51,6 +51,7 @@ TESTS += \ imuxsock_traillf_root.sh \ imuxsock_ccmiddle_root.sh \ discard-rptdmsg.sh \ + discard-allmark.sh \ discard.sh \ queue-persist.sh \ arrayqueue.sh \ @@ -60,6 +61,7 @@ endif if HAVE_VALGRIND TESTS += \ discard-rptdmsg-vg.sh \ + discard-allmark-vg.sh \ tcp-msgreduc-vg.sh endif @@ -236,6 +238,9 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ discard-rptdmsg.sh \ discard-rptdmsg-vg.sh \ testsuites/discard-rptdmsg.conf \ + discard-allmark.sh \ + discard-allmark-vg.sh \ + testsuites/discard-allmark.conf \ diag.sh \ testsuites/diag-common.conf \ testsuites/diag-common2.conf \ diff --git a/tests/discard-allmark-vg.sh b/tests/discard-allmark-vg.sh new file mode 100755 index 00000000..57ce8e3e --- /dev/null +++ b/tests/discard-allmark-vg.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[discard-allmark.sh\]: testing discard-allmark functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh startup-vg discard-allmark.conf +source $srcdir/diag.sh tcpflood -m10 -i1 +# we need to give rsyslog a little time to settle the receiver +./msleep 1500 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg +source $srcdir/diag.sh seq-check 2 10 +source $srcdir/diag.sh exit diff --git a/tests/discard-allmark.sh b/tests/discard-allmark.sh new file mode 100755 index 00000000..eb46ae70 --- /dev/null +++ b/tests/discard-allmark.sh @@ -0,0 +1,10 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[discard-allmark.sh\]: testing discard-allmark functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh startup discard-allmark.conf +source $srcdir/diag.sh tcpflood -m10 -i1 +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 2 10 +source $srcdir/diag.sh exit diff --git a/tests/testsuites/discard-allmark.conf b/tests/testsuites/discard-allmark.conf new file mode 100644 index 00000000..8a4983c1 --- /dev/null +++ b/tests/testsuites/discard-allmark.conf @@ -0,0 +1,15 @@ +# Test for discard functionality +# rgerhards, 2009-07-30 +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/imtcp/.libs/imtcp +$MainMsgQueueTimeoutShutdown 10000 +$InputTCPServerRun 13514 + +$ActionWriteAllMarkMessages on + +:msg, contains, "00000001" ~ + +$template outfmt,"%msg:F,58:2%\n" +$template dynfile,"rsyslog.out.log" # trick to use relative path names! +:msg, contains, "msgnum:" ?dynfile;outfmt -- cgit From 533a5351365cec93f233e0e99d98cedeadc5bd69 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 12:40:58 +0100 Subject: added MySQL life tests for ommysql tests run against a life database instance which must be setup in a specific way. --- tests/Makefile.am | 19 +++++++++++++++++++ tests/mysql-asyn-vg.sh | 14 ++++++++++++++ tests/mysql-asyn.sh | 13 +++++++++++++ tests/mysql-basic-vg.sh | 14 ++++++++++++++ tests/mysql-basic.sh | 13 +++++++++++++ tests/tcp-msgreduc-vg.sh | 2 +- tests/testsuites/mysql-asyn.conf | 5 +++++ tests/testsuites/mysql-basic.conf | 4 ++++ tests/testsuites/mysql-select-msg.sql | 2 ++ tests/testsuites/mysql-truncate.sql | 2 ++ 10 files changed, 87 insertions(+), 1 deletion(-) create mode 100755 tests/mysql-asyn-vg.sh create mode 100755 tests/mysql-asyn.sh create mode 100755 tests/mysql-basic-vg.sh create mode 100755 tests/mysql-basic.sh create mode 100644 tests/testsuites/mysql-asyn.conf create mode 100644 tests/testsuites/mysql-basic.conf create mode 100644 tests/testsuites/mysql-select-msg.sql create mode 100644 tests/testsuites/mysql-truncate.sql (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 35513614..acadda04 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -65,6 +65,17 @@ TESTS += \ tcp-msgreduc-vg.sh endif +if ENABLE_MYSQL_TESTS +TESTS += \ + mysql-basic.sh \ + mysql-asyn.sh +if HAVE_VALGRIND +TESTS += \ + mysql-basic-vg.sh \ + mysql-asyn-vg.sh +endif +endif + if ENABLE_IMPTCP TESTS += \ manyptcp.sh \ @@ -354,6 +365,14 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ imuxsock_ccmiddle_root.sh \ testsuites/imuxsock_ccmiddle_root.conf \ resultdata/imuxsock_ccmiddle.log \ + testsuites\mysql-truncate.sql \ + testsuites\mysql-select-msg.sql \ + mysql-basic.sh \ + mysql-basic-vg.sh \ + testsuites\mysql-basic.sh \ + mysql-asyn.sh \ + mysql-asyn-vg.sh \ + testsuites\mysql-asyn.sh \ cfg.sh ourtail_SOURCES = ourtail.c diff --git a/tests/mysql-asyn-vg.sh b/tests/mysql-asyn-vg.sh new file mode 100755 index 00000000..dfe68665 --- /dev/null +++ b/tests/mysql-asyn-vg.sh @@ -0,0 +1,14 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[mysql-asyn.sh\]: asyn test for mysql functionality +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup-vg mysql-asyn.conf +source $srcdir/diag.sh injectmsg 0 50000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 49999 +source $srcdir/diag.sh exit diff --git a/tests/mysql-asyn.sh b/tests/mysql-asyn.sh new file mode 100755 index 00000000..de6d6fde --- /dev/null +++ b/tests/mysql-asyn.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[mysql-asyn.sh\]: asyn test for mysql functionality +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup mysql-asyn.conf +source $srcdir/diag.sh injectmsg 0 50000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 49999 +source $srcdir/diag.sh exit diff --git a/tests/mysql-basic-vg.sh b/tests/mysql-basic-vg.sh new file mode 100755 index 00000000..215f41f0 --- /dev/null +++ b/tests/mysql-basic-vg.sh @@ -0,0 +1,14 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[mysql-basic-vg.sh\]: basic test for mysql-basic functionality/valgrind +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup-vg mysql-basic.conf +source $srcdir/diag.sh injectmsg 0 5000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 4999 +source $srcdir/diag.sh exit diff --git a/tests/mysql-basic.sh b/tests/mysql-basic.sh new file mode 100755 index 00000000..ba9d00f2 --- /dev/null +++ b/tests/mysql-basic.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[mysql-basic.sh\]: basic test for mysql-basic functionality +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup mysql-basic.conf +source $srcdir/diag.sh injectmsg 0 5000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 4999 +source $srcdir/diag.sh exit diff --git a/tests/tcp-msgreduc-vg.sh b/tests/tcp-msgreduc-vg.sh index 7e388360..cd8534e4 100755 --- a/tests/tcp-msgreduc-vg.sh +++ b/tests/tcp-msgreduc-vg.sh @@ -12,5 +12,5 @@ source $srcdir/diag.sh wait-startup ./msleep 1500 source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages source $srcdir/diag.sh wait-shutdown-vg -source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg source $srcdir/diag.sh exit diff --git a/tests/testsuites/mysql-asyn.conf b/tests/testsuites/mysql-asyn.conf new file mode 100644 index 00000000..acdf9bbd --- /dev/null +++ b/tests/testsuites/mysql-asyn.conf @@ -0,0 +1,5 @@ +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/ommysql/.libs/ommysql +$ActionQueueType LinkedList +:msg, contains, "msgnum:" :ommysql:127.0.0.1,Syslog,rsyslog,testbench; diff --git a/tests/testsuites/mysql-basic.conf b/tests/testsuites/mysql-basic.conf new file mode 100644 index 00000000..070094f5 --- /dev/null +++ b/tests/testsuites/mysql-basic.conf @@ -0,0 +1,4 @@ +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/ommysql/.libs/ommysql +:msg, contains, "msgnum:" :ommysql:127.0.0.1,Syslog,rsyslog,testbench; diff --git a/tests/testsuites/mysql-select-msg.sql b/tests/testsuites/mysql-select-msg.sql new file mode 100644 index 00000000..2d27a331 --- /dev/null +++ b/tests/testsuites/mysql-select-msg.sql @@ -0,0 +1,2 @@ +use Syslog; +select substring(Message,9,8) from SystemEvents; diff --git a/tests/testsuites/mysql-truncate.sql b/tests/testsuites/mysql-truncate.sql new file mode 100644 index 00000000..ca852beb --- /dev/null +++ b/tests/testsuites/mysql-truncate.sql @@ -0,0 +1,2 @@ +use Syslog; +truncate table SystemEvents; -- cgit From 32acf5b9f7c706c1104e94e654fe8c934e7340ea Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Mar 2011 17:47:16 +0100 Subject: fixed problems in testbench makefile (just introduced...) --- tests/Makefile.am | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index acadda04..4a1bfe57 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -365,14 +365,14 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ imuxsock_ccmiddle_root.sh \ testsuites/imuxsock_ccmiddle_root.conf \ resultdata/imuxsock_ccmiddle.log \ - testsuites\mysql-truncate.sql \ - testsuites\mysql-select-msg.sql \ + testsuites/mysql-truncate.sql \ + testsuites/mysql-select-msg.sql \ mysql-basic.sh \ mysql-basic-vg.sh \ - testsuites\mysql-basic.sh \ + testsuites/mysql-basic.conf \ mysql-asyn.sh \ mysql-asyn-vg.sh \ - testsuites\mysql-asyn.sh \ + testsuites/mysql-asyn.conf \ cfg.sh ourtail_SOURCES = ourtail.c -- cgit From 225aa0e367a604d3891bba13d470bfacc3dfe544 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 10 Mar 2011 03:41:17 +0100 Subject: fixed problem in testbench Makefile, added module to distcheck Thanks to Michael Biebl for mentioning that some modules were not included in make distcheck. --- tests/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 4a1bfe57..eb7ad94f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -6,7 +6,6 @@ TESTS = $(TESTRUNS) cfg.sh if ENABLE_IMDIAG TESTS += \ arrayqueue.sh \ - linkedlistqueue.sh \ da-mainmsg-q.sh \ validation-run.sh \ imtcp-multiport.sh \ @@ -54,7 +53,6 @@ TESTS += \ discard-allmark.sh \ discard.sh \ queue-persist.sh \ - arrayqueue.sh \ linkedlistqueue.sh endif @@ -214,7 +212,9 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/rsf_getenv.conf \ diskqueue.sh \ testsuites/diskqueue.conf \ + arrayqueue.sh \ testsuites/arrayqueue.conf \ + linkedlistqueue.sh \ testsuites/linkedlistqueue.conf \ da-mainmsg-q.sh \ testsuites/da-mainmsg-q.conf \ -- cgit From 9cc963926bad3de9a78df51a19456f419c34492a Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 10 Mar 2011 14:46:47 +0100 Subject: bugfix: minor memory leak in omlibdbi (< 1k per instance and run) also testbench improvement (omlibdbi now also receives a couple of tests if we have a life MySQL server). --- tests/Makefile.am | 11 +++++++++++ tests/libdbi-asyn.sh | 13 +++++++++++++ tests/libdbi-basic-vg.sh | 16 ++++++++++++++++ tests/libdbi-basic.sh | 13 +++++++++++++ tests/testsuites/libdbi-asyn.conf | 12 ++++++++++++ tests/testsuites/libdbi-basic.conf | 9 +++++++++ 6 files changed, 74 insertions(+) create mode 100755 tests/libdbi-asyn.sh create mode 100755 tests/libdbi-basic-vg.sh create mode 100755 tests/libdbi-basic.sh create mode 100644 tests/testsuites/libdbi-asyn.conf create mode 100644 tests/testsuites/libdbi-basic.conf (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index eb7ad94f..ea6860d5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -63,10 +63,16 @@ TESTS += \ tcp-msgreduc-vg.sh endif + if ENABLE_MYSQL_TESTS TESTS += \ mysql-basic.sh \ mysql-asyn.sh +if ENABLE_OMLIBDBI +TESTS += \ + libdbi-basic.sh \ + libdbi-asyn.sh +endif if HAVE_VALGRIND TESTS += \ mysql-basic-vg.sh \ @@ -74,6 +80,7 @@ TESTS += \ endif endif + if ENABLE_IMPTCP TESTS += \ manyptcp.sh \ @@ -367,6 +374,10 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ resultdata/imuxsock_ccmiddle.log \ testsuites/mysql-truncate.sql \ testsuites/mysql-select-msg.sql \ + libdbi-basic.sh \ + testsuites/libdbi-basic.conf \ + libdbi-asyn.sh \ + testsuites/libdbi-asyn.conf \ mysql-basic.sh \ mysql-basic-vg.sh \ testsuites/mysql-basic.conf \ diff --git a/tests/libdbi-asyn.sh b/tests/libdbi-asyn.sh new file mode 100755 index 00000000..0076da9c --- /dev/null +++ b/tests/libdbi-asyn.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[libdbi-asyn.sh\]: asyn test for libdbi functionality +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup libdbi-asyn.conf +source $srcdir/diag.sh injectmsg 0 50000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 49999 +source $srcdir/diag.sh exit diff --git a/tests/libdbi-basic-vg.sh b/tests/libdbi-basic-vg.sh new file mode 100755 index 00000000..75d12857 --- /dev/null +++ b/tests/libdbi-basic-vg.sh @@ -0,0 +1,16 @@ +# This file is part of the rsyslog project, released under GPLv3 +# this test is currently not included in the testbench as libdbi +# itself seems to have a memory leak +echo =============================================================================== +echo \[libdbi-basic.sh\]: basic test for libdbi-basic functionality via mysql +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup-vg libdbi-basic.conf +source $srcdir/diag.sh injectmsg 0 5000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 4999 +source $srcdir/diag.sh exit diff --git a/tests/libdbi-basic.sh b/tests/libdbi-basic.sh new file mode 100755 index 00000000..a854a565 --- /dev/null +++ b/tests/libdbi-basic.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[libdbi-basic.sh\]: basic test for libdbi-basic functionality via mysql +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup libdbi-basic.conf +source $srcdir/diag.sh injectmsg 0 5000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 4999 +source $srcdir/diag.sh exit diff --git a/tests/testsuites/libdbi-asyn.conf b/tests/testsuites/libdbi-asyn.conf new file mode 100644 index 00000000..39b01fbc --- /dev/null +++ b/tests/testsuites/libdbi-asyn.conf @@ -0,0 +1,12 @@ +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/omlibdbi/.libs/omlibdbi + +$ActionQueueType LinkedList + +$ActionLibdbiDriver mysql +$ActionLibdbiHost 127.0.0.1 +$ActionLibdbiUserName root +$ActionLibdbiPassword pass +$ActionLibdbiDBName Syslog +:msg, contains, "msgnum:" :omlibdbi: diff --git a/tests/testsuites/libdbi-basic.conf b/tests/testsuites/libdbi-basic.conf new file mode 100644 index 00000000..212225cc --- /dev/null +++ b/tests/testsuites/libdbi-basic.conf @@ -0,0 +1,9 @@ +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/omlibdbi/.libs/omlibdbi +$ActionLibdbiDriver mysql +$ActionLibdbiHost 127.0.0.1 +$ActionLibdbiUserName root +$ActionLibdbiPassword pass +$ActionLibdbiDBName Syslog +:msg, contains, "msgnum:" :omlibdbi: -- cgit