summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-03-11 10:58:07 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2011-03-11 10:58:07 +0100
commit4195f9cb08cddaeae37dc88c5e879d84391b4359 (patch)
tree5f24c7d497e68b7f348d43d40546d1e2d7234a5d
parent765317d54ec5658dd0c598170d0fc0824f751265 (diff)
downloadrsyslog-4195f9cb08cddaeae37dc88c5e879d84391b4359.tar.gz
rsyslog-4195f9cb08cddaeae37dc88c5e879d84391b4359.tar.xz
rsyslog-4195f9cb08cddaeae37dc88c5e879d84391b4359.zip
added new test for imfile to testbench
-rw-r--r--tests/Makefile.am11
-rwxr-xr-xtests/diag.sh2
-rwxr-xr-xtests/imfile-basic.sh14
-rw-r--r--tests/inputfilegen.c23
-rwxr-xr-xtests/random.sh4
-rw-r--r--tests/testsuites/imfile-basic.conf12
6 files changed, 62 insertions, 4 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0045f00a..a438a926 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,6 @@
if ENABLE_TESTBENCH
TESTRUNS = rt_init rscript
-check_PROGRAMS = $(TESTRUNS) ourtail nettester tcpflood chkseq randomgen
+check_PROGRAMS = $(TESTRUNS) ourtail nettester tcpflood chkseq randomgen inputfilegen
TESTS = $(TESTRUNS) cfg.sh \
validation-run.sh \
imtcp-multiport.sh \
@@ -44,6 +44,10 @@ if ENABLE_EXTENDED_TESTS
TESTS += random.sh
endif
+if ENABLE_IMFILE
+TESTS += imfile-basic.sh
+endif
+
check_JAVA = DiagTalker.java
endif # if ENABLE_TESTBENCH
@@ -187,6 +191,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/complex1.conf \
random.sh \
testsuites/random.conf \
+ imfile-basic.sh \
+ testsuites/imfile-basic.conf \
dynfile_invld_async.sh \
dynfile_invld_sync.sh \
dynfile_cachemiss.sh \
@@ -213,6 +219,9 @@ tcpflood_LDADD = $(SOL_LIBS)
randomgen_SOURCES = randomgen.c
randomgen_LDADD = $(SOL_LIBS)
+inputfilegen_SOURCES = inputfilegen.c
+inputfilegen_LDADD = $(SOL_LIBS)
+
nettester_SOURCES = nettester.c getline.c
nettester_LDADD = $(SOL_LIBS)
diff --git a/tests/diag.sh b/tests/diag.sh
index 51ad5f6a..806edf80 100755
--- a/tests/diag.sh
+++ b/tests/diag.sh
@@ -22,6 +22,7 @@ case $1 in
rm -f work rsyslog.out.log rsyslog.out.log.save # common work files
rm -f rsyslog.out.*.log work-presort
rm -rf test-spool
+ rm -f rsyslog.input
rm -f core.* vgcore.*
mkdir test-spool
;;
@@ -30,6 +31,7 @@ case $1 in
rm -f work rsyslog.out.log rsyslog.out.log.save # common work files
rm -f rsyslog.out.*.log rsyslog.random.data work-presort
rm -rf test-spool
+ rm -f rsyslog.input
;;
'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!)
diff --git a/tests/imfile-basic.sh b/tests/imfile-basic.sh
new file mode 100755
index 00000000..ca6a5d3a
--- /dev/null
+++ b/tests/imfile-basic.sh
@@ -0,0 +1,14 @@
+# This is part of the rsyslog testbench, licensed under GPLv3
+echo [imfile-basic.sh]
+source $srcdir/diag.sh init
+# generate input file first. Note that rsyslog processes it as
+# soon as it start up (so the file should exist at that point).
+./inputfilegen 50000 > rsyslog.input
+ls -l rsyslog.input
+source $srcdir/diag.sh startup imfile-basic.conf
+# sleep a little to give rsyslog a chance to begin processing
+sleep 1
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown # we need to wait until rsyslogd is finished!
+source $srcdir/diag.sh seq-check 0 49999
+source $srcdir/diag.sh exit
diff --git a/tests/inputfilegen.c b/tests/inputfilegen.c
new file mode 100644
index 00000000..26fb79af
--- /dev/null
+++ b/tests/inputfilegen.c
@@ -0,0 +1,23 @@
+/* generate an input file suitable for use by the testbench
+ * Copyright (C) 2011 by Rainer Gerhards and Adiscon GmbH.
+ * Part of rsyslog, licensed under GPLv3
+ */
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char* argv[])
+{
+ int nmsgs;
+ int i;
+
+ if(argc != 2) {
+ fprintf(stderr, "usage: inputfilegen num-messages\n");
+ return 1;
+ }
+
+ nmsgs = atoi(argv[1]);
+ for(i = 0 ; i < nmsgs ; ++i) {
+ printf("msgnum:%8.8d:\n", i);
+ }
+ return 0;
+}
diff --git a/tests/random.sh b/tests/random.sh
index d1f392d3..969d720c 100755
--- a/tests/random.sh
+++ b/tests/random.sh
@@ -5,9 +5,6 @@
echo ===============================================================================
echo TEST: \[random.sh\]: testing random data
source $srcdir/diag.sh init
-# uncomment for debugging support:
-#export RSYSLOG_DEBUG="debug nostdout noprintmutexaction"
-#export RSYSLOG_DEBUGLOG="log"
source $srcdir/diag.sh startup random.conf
# generate random data
./randomgen -f rsyslog.random.data -s 100000
@@ -17,4 +14,5 @@ source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done proces
source $srcdir/diag.sh wait-shutdown # and wait for it to terminate
# we do not check anything yet, the point is if rsyslog survived ;)
# TODO: check for exit message, but we'll notice an abort anyhow, so not that important
+rm -f random.data
source $srcdir/diag.sh exit
diff --git a/tests/testsuites/imfile-basic.conf b/tests/testsuites/imfile-basic.conf
new file mode 100644
index 00000000..9fb9b5ca
--- /dev/null
+++ b/tests/testsuites/imfile-basic.conf
@@ -0,0 +1,12 @@
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imfile/.libs/imfile
+$InputFileName ./rsyslog.input
+$InputFileTag file:
+$InputFileStateFile stat-file1
+$InputFileSeverity error
+$InputFileFacility local7
+$InputRunFileMonitor
+
+$template outfmt,"%msg:F,58:2%\n"
+:msg, contains, "msgnum:" ./rsyslog.out.log;outfmt