diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-03-11 11:16:41 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-03-11 11:16:41 +0100 |
commit | 9a53ec419e9d9e25a81b26a01ce5b035631e321a (patch) | |
tree | 5e32a26ee0ef04c9683221dae1146f10e43d0c33 | |
parent | dffb2bab8cb52599626b82587da09df39b16e7aa (diff) | |
parent | 4195f9cb08cddaeae37dc88c5e879d84391b4359 (diff) | |
download | rsyslog-9a53ec419e9d9e25a81b26a01ce5b035631e321a.tar.gz rsyslog-9a53ec419e9d9e25a81b26a01ce5b035631e321a.tar.xz rsyslog-9a53ec419e9d9e25a81b26a01ce5b035631e321a.zip |
Merge branch 'v4-stable' into v5-stable
Conflicts:
tests/Makefile.am
tests/diag.sh
tests/tcpflood.c
-rw-r--r-- | tests/Makefile.am | 11 | ||||
-rwxr-xr-x | tests/diag.sh | 2 | ||||
-rwxr-xr-x | tests/imfile-basic.sh | 14 | ||||
-rw-r--r-- | tests/inputfilegen.c | 23 | ||||
-rwxr-xr-x | tests/random.sh | 4 | ||||
-rw-r--r-- | tests/tcpflood.c | 4 | ||||
-rw-r--r-- | tests/testsuites/imfile-basic.conf | 12 |
7 files changed, 66 insertions, 4 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 3f703fcb..03a4985a 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 msleep randomgen diagtalker uxsockrcvr +check_PROGRAMS = $(TESTRUNS) ourtail nettester tcpflood chkseq msleep randomgen diagtalker uxsockrcvr inputfilegen TESTS = $(TESTRUNS) cfg.sh \ arrayqueue.sh \ linkedlistqueue.sh \ @@ -85,6 +85,10 @@ if ENABLE_EXTENDED_TESTS TESTS += random.sh endif +if ENABLE_IMFILE +TESTS += imfile-basic.sh +endif + endif # if ENABLE_TESTBENCH TESTS_ENVIRONMENT = RSYSLOG_MODDIR='$(abs_top_builddir)'/runtime/.libs/ @@ -278,6 +282,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 \ @@ -337,6 +343,9 @@ diagtalker_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 2f307750..bf12fbda 100755 --- a/tests/diag.sh +++ b/tests/diag.sh @@ -22,6 +22,7 @@ case $1 in rm -f work rsyslog.out.log rsyslog2.out.log rsyslog.out.log.save # common work files rm -rf test-spool test-logdir rm -f rsyslog.out.*.log work-presort rsyslog.pipe + rm -f rsyslog.input rm -f core.* vgcore.* mkdir test-spool ;; @@ -30,6 +31,7 @@ case $1 in rm -f work rsyslog.out.log rsyslog2.out.log rsyslog.out.log.save # common work files rm -rf test-spool test-logdir rm -f rsyslog.out.*.log rsyslog.random.data work-presort rsyslog.pipe + rm -f rsyslog.input echo ------------------------------------------------------------------------------- ;; 'startup') # start rsyslogd with default params. $2 is the config file name to use 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/tcpflood.c b/tests/tcpflood.c index 0efbef4e..3b1ef708 100644 --- a/tests/tcpflood.c +++ b/tests/tcpflood.c @@ -355,6 +355,7 @@ int main(int argc, char *argv[]) int ret = 0; int opt; struct sigaction sigAct; + struct rlimit maxFiles; static char buf[1024]; srand(time(NULL)); /* seed is good enough for our needs */ @@ -431,6 +432,9 @@ int main(int argc, char *argv[]) maxFiles.rlim_max = numConnections + 20; if(setrlimit(RLIMIT_NOFILE, &maxFiles) < 0) { perror("setrlimit to increase file handles failed"); + fprintf(stderr, + "could net set sufficiently large number of " + "open files for required connection count!\n"); exit(1); } } 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 |