summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-07-09 16:35:13 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-07-09 16:35:13 +0200
commitab40107149038898ef24479a6911d9cd7770a56c (patch)
tree7a4bd016dd56583263c63e10808859c6ef848ffc /tests
parent5221a1e42e16c8c39b48a4a1a18ee6322c38cd17 (diff)
parent9de685929e4c202d470e07ec28fda41a5efc8eaf (diff)
downloadrsyslog-ab40107149038898ef24479a6911d9cd7770a56c.tar.gz
rsyslog-ab40107149038898ef24479a6911d9cd7770a56c.tar.xz
rsyslog-ab40107149038898ef24479a6911d9cd7770a56c.zip
Merge branch 'v4-beta' into v4-devel
Conflicts: tests/nettester.c
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am6
-rwxr-xr-xtests/diag.sh1
-rw-r--r--tests/nettester.c20
-rwxr-xr-xtests/parsertest.sh18
-rwxr-xr-xtests/proprepltest.sh7
-rw-r--r--tests/testsuites/master.nolimittag11
-rw-r--r--tests/testsuites/master.rfctag11
-rw-r--r--tests/testsuites/nolimittag.conf8
-rw-r--r--tests/testsuites/rfctag.conf9
9 files changed, 74 insertions, 17 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b34daa06..c50b7cd6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -11,6 +11,7 @@ TESTS = $(TESTRUNS) cfg.sh \
if ENABLE_OMSTDOUT
TESTS += omod-if-array.sh \
+ proprepltest.sh \
parsertest.sh \
timestamp.sh \
inputname.sh \
@@ -112,6 +113,11 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/threadingmq.conf \
threadingmqaq.sh \
testsuites/threadingmqaq.conf \
+ proprepltest.sh \
+ testsuites/rfctag.conf \
+ testsuites/master.rfctag \
+ testsuites/nolimittag.conf \
+ testsuites/master.nolimittag \
DiagTalker.java \
cfg.sh
diff --git a/tests/diag.sh b/tests/diag.sh
index 299c5d71..13bb877d 100755
--- a/tests/diag.sh
+++ b/tests/diag.sh
@@ -83,6 +83,7 @@ case $1 in
fi
;;
'nettester') # perform nettester-based tests
+ # use -v for verbose output!
./nettester -t$2 -i$3
if [ "$?" -ne "0" ]; then
exit 1
diff --git a/tests/nettester.c b/tests/nettester.c
index 73abc46e..209c2a6f 100644
--- a/tests/nettester.c
+++ b/tests/nettester.c
@@ -38,6 +38,7 @@
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/stat.h>
+#include <sys/time.h>
#include <arpa/inet.h>
#include <assert.h>
#include <unistd.h>
@@ -82,14 +83,27 @@ static char *inputMode2Str(inputMode_t mode)
void readLine(int fd, char *ln)
{
+ char *orig = ln;
char c;
int lenRead;
+
+ if(verbose)
+ fprintf(stderr, "begin readLine\n");
lenRead = read(fd, &c, 1);
while(lenRead == 1 && c != '\n') {
+ if(c == '\0') {
+ *ln = c;
+ fprintf(stderr, "Warning: there was a '\\0'-Byte in the read response "
+ "right after this string: '%s'\n", orig);
+ c = '?';
+ }
*ln++ = c;
- lenRead = read(fd, &c, 1);
+ lenRead = read(fd, &c, 1);
}
*ln = '\0';
+
+ if(verbose)
+ fprintf(stderr, "end readLine, val read '%s'\n", orig);
}
@@ -133,8 +147,7 @@ tcpSend(char *buf, int lenBuf)
fprintf(stderr, "connect() failed\n");
return(1);
} else {
- fprintf(stderr, "connect() failed, retry %d\n", retries);
- usleep(100000); /* ms = 1000 us! */
+ usleep(100000); /* 0.1 sec, these are us! */
}
}
}
@@ -209,7 +222,6 @@ int openPipe(char *configFile, pid_t *pid, int *pfd)
"RSYSLOG_DEBUGLOG=log", NULL };
*/
-
sprintf(confFile, "-f%s/testsuites/%s.conf", srcdir,
(pszCustomConf == NULL) ? configFile : pszCustomConf);
newargv[1] = confFile;
diff --git a/tests/parsertest.sh b/tests/parsertest.sh
index 8e04b95e..ef33256e 100755
--- a/tests/parsertest.sh
+++ b/tests/parsertest.sh
@@ -1,13 +1,5 @@
-echo test parsertest via udp
-$srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason
-
-echo test parsertest via tcp
-./nettester -tparse1 -itcp
-if [ "$?" -ne "0" ]; then
- exit 1
-fi
-
-./nettester -tparse1 -iudp
-if [ "$?" -ne "0" ]; then
- exit 1
-fi
+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 init
diff --git a/tests/proprepltest.sh b/tests/proprepltest.sh
new file mode 100755
index 00000000..3c252e52
--- /dev/null
+++ b/tests/proprepltest.sh
@@ -0,0 +1,7 @@
+echo TEST: 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
+source $srcdir/diag.sh nettester nolimittag udp
+source $srcdir/diag.sh nettester nolimittag tcp
+source $srcdir/diag.sh init
diff --git a/tests/testsuites/master.nolimittag b/tests/testsuites/master.nolimittag
new file mode 100644
index 00000000..502d9d5d
--- /dev/null
+++ b/tests/testsuites/master.nolimittag
@@ -0,0 +1,11 @@
+<167>Mar 6 16:57:54 172.20.245.8 TAG: Rest of message...
++TAG:+
+# now one char, no colon
+<167>Mar 6 16:57:54 172.20.245.8 0 Rest of message...
++0+
+# Now exactly with 32 characters
+<167>Mar 6 16:57:54 172.20.245.8 01234567890123456789012345678901 Rest of message...
++01234567890123456789012345678901+
+# Now oversize, should be completely output with this config
+<167>Mar 6 16:57:54 172.20.245.8 01234567890123456789012345678901-toolong Rest of message...
++01234567890123456789012345678901-toolong+
diff --git a/tests/testsuites/master.rfctag b/tests/testsuites/master.rfctag
new file mode 100644
index 00000000..3f1e0c66
--- /dev/null
+++ b/tests/testsuites/master.rfctag
@@ -0,0 +1,11 @@
+<167>Mar 6 16:57:54 172.20.245.8 TAG: Rest of message...
++TAG:+
+# now one char, no colon
+<167>Mar 6 16:57:54 172.20.245.8 0 Rest of message...
++0+
+# Now exactly with 32 characters
+<167>Mar 6 16:57:54 172.20.245.8 01234567890123456789012345678901 Rest of message...
++01234567890123456789012345678901+
+# Now oversize, should be truncated with this config
+<167>Mar 6 16:57:54 172.20.245.8 01234567890123456789012345678901-toolong Rest of message...
++01234567890123456789012345678901+
diff --git a/tests/testsuites/nolimittag.conf b/tests/testsuites/nolimittag.conf
new file mode 100644
index 00000000..0b6ec387
--- /dev/null
+++ b/tests/testsuites/nolimittag.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
+$template fmt,"+%syslogtag%+\n"
+*.* :omstdout:;fmt
diff --git a/tests/testsuites/rfctag.conf b/tests/testsuites/rfctag.conf
new file mode 100644
index 00000000..8619e89e
--- /dev/null
+++ b/tests/testsuites/rfctag.conf
@@ -0,0 +1,9 @@
+$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
+# Note: the plus signs are necessary to detect truncated logs!
+$template fmt,"+%syslogtag:1:32%+\n"
+*.* :omstdout:;fmt