summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-10-19 17:33:53 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-10-19 17:33:53 +0200
commit0ca6000d3a0dda2279e199b776c683200c5e48d9 (patch)
treea25a7d4827f1f5e6415aa379b9891f262820e9fe
parent13ca93c27aeabbb3e1e217c05b5aa13e00be2475 (diff)
parent0acdae34bd087cca0d1a3e0f63c2b15f8655992a (diff)
downloadrsyslog-0ca6000d3a0dda2279e199b776c683200c5e48d9.tar.gz
rsyslog-0ca6000d3a0dda2279e199b776c683200c5e48d9.tar.xz
rsyslog-0ca6000d3a0dda2279e199b776c683200c5e48d9.zip
Merge branch 'david-segfault'
-rw-r--r--runtime/rule.c1
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/nettester.c7
-rwxr-xr-xtests/parsertest.sh2
-rw-r--r--tests/testsuites/parse2.conf8
-rw-r--r--tests/testsuites/reallife.parse112
-rw-r--r--tests/testsuites/reallife.parse212
7 files changed, 43 insertions, 2 deletions
diff --git a/runtime/rule.c b/runtime/rule.c
index 182d616a..fe2cf432 100644
--- a/runtime/rule.c
+++ b/runtime/rule.c
@@ -138,6 +138,7 @@ shouldProcessThisMessage(rule_t *pRule, msg_t *pMsg, int *bProcessMsg)
}
}
+RUNLOG_VAR("%p", pRule->pCSProgNameComp);
if(pRule->pCSProgNameComp != NULL) {
int bInv = 0, bEqv = 0, offset = 0;
if(*(rsCStrGetSzStrNoNULL(pRule->pCSProgNameComp)) == '-') {
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cdf2c4be..e46fb9de 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -91,6 +91,9 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/rfc5424-3.parse1 \
testsuites/rfc5424-4.parse1 \
testsuites/malformed.parse1 \
+ testsuites/reallife.parse1 \
+ testsuites/parse2.conf \
+ testsuites/reallife.parse2 \
testsuites/omod-if-array.conf \
testsuites/1.omod-if-array \
testsuites/1.field1 \
diff --git a/tests/nettester.c b/tests/nettester.c
index 2838b919..47e75243 100644
--- a/tests/nettester.c
+++ b/tests/nettester.c
@@ -326,10 +326,13 @@ processTestFile(int fd, char *pszFileName)
ret = 1;
}
+ /* clean up after the try */
+ free(testdata);
+ testdata = NULL;
+ free(expected);
+ expected = NULL;
}
- free(testdata);
- free(expected);
fclose(fp);
return(ret);
}
diff --git a/tests/parsertest.sh b/tests/parsertest.sh
index ef33256e..6cfa59b1 100755
--- a/tests/parsertest.sh
+++ b/tests/parsertest.sh
@@ -2,4 +2,6 @@ echo TEST: parsertest.sh - various parser tests
source $srcdir/diag.sh init
source $srcdir/diag.sh nettester parse1 udp
source $srcdir/diag.sh nettester parse1 tcp
+source $srcdir/diag.sh nettester parse2 udp
+source $srcdir/diag.sh nettester parse2 tcp
source $srcdir/diag.sh init
diff --git a/tests/testsuites/parse2.conf b/tests/testsuites/parse2.conf
new file mode 100644
index 00000000..04d910bc
--- /dev/null
+++ b/tests/testsuites/parse2.conf
@@ -0,0 +1,8 @@
+$ModLoad ../plugins/omstdout/.libs/omstdout
+$IncludeConfig nettest.input.conf # This picks the to be tested input from the test driver!
+
+$ErrorMessagesToStderr off
+
+# use a special format that we can easily parse in expect
+$template output,"%PRI%,%syslogfacility-text%,%syslogseverity-text%,%timestamp%,%programname%,%syslogtag%,%msg%\n"
+*.* :omstdout:;output
diff --git a/tests/testsuites/reallife.parse1 b/tests/testsuites/reallife.parse1
new file mode 100644
index 00000000..a83d2dca
--- /dev/null
+++ b/tests/testsuites/reallife.parse1
@@ -0,0 +1,12 @@
+# New tests should be added to this file if there is no specific
+# reason for not doing that. Initially, we could only handle one test
+# case per file, but this restriction has been removed some time ago.
+# So it is less troublesome (and easier to overlook) to have all related
+# tests in a single file.
+# This file contains a lot of real-life samples (of course mangled so
+# that they can not be traced back to the original submitter). Note
+# that IP addr 192.0.2.1 is specifically set aside for testing and
+# documentation by IANA.
+# rgerhards, 2009-10-19
+<29>Oct 16 20:47:24 example-p exam-pl[12345]: connect host= /192.0.2.1
+29,daemon,notice,Oct 16 20:47:24,example-p,exam-pl,exam-pl[12345]:, connect host= /192.0.2.1
diff --git a/tests/testsuites/reallife.parse2 b/tests/testsuites/reallife.parse2
new file mode 100644
index 00000000..c42f2526
--- /dev/null
+++ b/tests/testsuites/reallife.parse2
@@ -0,0 +1,12 @@
+# New tests should be added to this file if there is no specific
+# reason for not doing that. Initially, we could only handle one test
+# case per file, but this restriction has been removed some time ago.
+# So it is less troublesome (and easier to overlook) to have all related
+# tests in a single file.
+# This file contains a lot of real-life samples (of course mangled so
+# that they can not be traced back to the original submitter). Note
+# that IP addr 192.0.2.1 is specifically set aside for testing and
+# documentation by IANA.
+# rgerhards, 2009-10-19
+<175>Oct 16 23:47:31 #001 MSWinEventLog 0#011Security#01119023582#011Fri Oct 16 16:30:44 2009#011592#011Security#011rgabcde#011User#011Success Audit#011XSXSXSN01#011Detailed Tracking#011#0112572#01119013885
+175,local5,debug,Oct 16 23:47:31,#001,#001, MSWinEventLog 0#011Security#01119023582#011Fri Oct 16 16:30:44 2009#011592#011Security#011rgabcde#011User#011Success Audit#011XSXSXSN01#011Detailed Tracking#011#0112572#01119013885