diff options
author | Michael Biebl <biebl@debian.org> | 2010-10-05 17:28:41 +0200 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2010-10-05 17:28:41 +0200 |
commit | 7e2b1add5ffd1d726801b5f3806c7e26f493c3e9 (patch) | |
tree | f904f13dfdb0a339afd6f461c71315fd5ab63050 /tests | |
parent | 017fb92bd811ce1083504eafda4e2080d9520a31 (diff) | |
download | rsyslog-7e2b1add5ffd1d726801b5f3806c7e26f493c3e9.tar.gz |
Imported Upstream version 5.7.1upstream/5.7.1
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 5 | ||||
-rw-r--r-- | tests/Makefile.in | 20 | ||||
-rw-r--r-- | tests/syslog_caller.c | 75 |
3 files changed, 95 insertions, 5 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 8538140..62d4522 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 syslog_caller TESTS = $(TESTRUNS) cfg.sh \ arrayqueue.sh \ linkedlistqueue.sh \ @@ -322,6 +322,9 @@ chkseq_SOURCES = chkseq.c tcpflood_SOURCES = tcpflood.c tcpflood_LDADD = $(SOL_LIBS) +syslog_caller_SOURCES = syslog_caller.c +syslog_caller_LDADD = $(SOL_LIBS) + diagtalker_SOURCES = diagtalker.c diagtalker_LDADD = $(SOL_LIBS) diff --git a/tests/Makefile.in b/tests/Makefile.in index 2ee0445..2b09841 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -37,7 +37,8 @@ host_triplet = @host@ @ENABLE_TESTBENCH_TRUE@ ourtail$(EXEEXT) nettester$(EXEEXT) \ @ENABLE_TESTBENCH_TRUE@ tcpflood$(EXEEXT) chkseq$(EXEEXT) \ @ENABLE_TESTBENCH_TRUE@ msleep$(EXEEXT) randomgen$(EXEEXT) \ -@ENABLE_TESTBENCH_TRUE@ diagtalker$(EXEEXT) uxsockrcvr$(EXEEXT) +@ENABLE_TESTBENCH_TRUE@ diagtalker$(EXEEXT) uxsockrcvr$(EXEEXT) \ +@ENABLE_TESTBENCH_TRUE@ syslog_caller$(EXEEXT) @ENABLE_TESTBENCH_TRUE@TESTS = $(am__EXEEXT_1) cfg.sh arrayqueue.sh \ @ENABLE_TESTBENCH_TRUE@ linkedlistqueue.sh da-mainmsg-q.sh \ @ENABLE_TESTBENCH_TRUE@ validation-run.sh imtcp-multiport.sh \ @@ -144,6 +145,9 @@ rt_init_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ rt_init_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(rt_init_LDFLAGS) $(LDFLAGS) -o $@ +am_syslog_caller_OBJECTS = syslog_caller.$(OBJEXT) +syslog_caller_OBJECTS = $(am_syslog_caller_OBJECTS) +syslog_caller_DEPENDENCIES = $(am__DEPENDENCIES_1) am_tcpflood_OBJECTS = tcpflood.$(OBJEXT) tcpflood_OBJECTS = $(am_tcpflood_OBJECTS) tcpflood_DEPENDENCIES = $(am__DEPENDENCIES_1) @@ -178,12 +182,13 @@ am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(chkseq_SOURCES) $(diagtalker_SOURCES) $(msleep_SOURCES) \ $(nettester_SOURCES) $(ourtail_SOURCES) $(randomgen_SOURCES) \ - $(rscript_SOURCES) $(rt_init_SOURCES) $(tcpflood_SOURCES) \ - $(uxsockrcvr_SOURCES) + $(rscript_SOURCES) $(rt_init_SOURCES) $(syslog_caller_SOURCES) \ + $(tcpflood_SOURCES) $(uxsockrcvr_SOURCES) DIST_SOURCES = $(chkseq_SOURCES) $(diagtalker_SOURCES) \ $(msleep_SOURCES) $(nettester_SOURCES) $(ourtail_SOURCES) \ $(randomgen_SOURCES) $(rscript_SOURCES) $(rt_init_SOURCES) \ - $(tcpflood_SOURCES) $(uxsockrcvr_SOURCES) + $(syslog_caller_SOURCES) $(tcpflood_SOURCES) \ + $(uxsockrcvr_SOURCES) ETAGS = etags CTAGS = ctags am__tty_colors = \ @@ -330,6 +335,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ +systemdsystemunitdir = @systemdsystemunitdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ @@ -572,6 +578,8 @@ msleep_SOURCES = msleep.c chkseq_SOURCES = chkseq.c tcpflood_SOURCES = tcpflood.c tcpflood_LDADD = $(SOL_LIBS) +syslog_caller_SOURCES = syslog_caller.c +syslog_caller_LDADD = $(SOL_LIBS) diagtalker_SOURCES = diagtalker.c diagtalker_LDADD = $(SOL_LIBS) randomgen_SOURCES = randomgen.c @@ -653,6 +661,9 @@ rscript$(EXEEXT): $(rscript_OBJECTS) $(rscript_DEPENDENCIES) rt_init$(EXEEXT): $(rt_init_OBJECTS) $(rt_init_DEPENDENCIES) @rm -f rt_init$(EXEEXT) $(AM_V_CCLD)$(rt_init_LINK) $(rt_init_OBJECTS) $(rt_init_LDADD) $(LIBS) +syslog_caller$(EXEEXT): $(syslog_caller_OBJECTS) $(syslog_caller_DEPENDENCIES) + @rm -f syslog_caller$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(syslog_caller_OBJECTS) $(syslog_caller_LDADD) $(LIBS) tcpflood$(EXEEXT): $(tcpflood_OBJECTS) $(tcpflood_DEPENDENCIES) @rm -f tcpflood$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tcpflood_OBJECTS) $(tcpflood_LDADD) $(LIBS) @@ -678,6 +689,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rscript-runtime-dummy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_init-rt-init.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_init-runtime-dummy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syslog_caller.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpflood.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uxsockrcvr.Po@am__quote@ diff --git a/tests/syslog_caller.c b/tests/syslog_caller.c new file mode 100644 index 0000000..3f2702a --- /dev/null +++ b/tests/syslog_caller.c @@ -0,0 +1,75 @@ +/* A very primitive testing tool that just emits a number of + * messages to the system log socket. Currently sufficient, but + * obviously room for improvement. + * + * It is highly suggested NOT to "base" any derivative work + * on this tool ;) + * + * Options + * + * -s severity (0..7 accoding to syslog spec, r "rolling", default 6) + * -m number of messages to generate (default 500) + * + * Part of the testbench for rsyslog. + * + * Copyright 2010 Rainer Gerhards and Adiscon GmbH. + * + * This file is part of rsyslog. + * + * Rsyslog is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Rsyslog is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Rsyslog. If not, see <http://www.gnu.org/licenses/>. + * + * A copy of the GPL can be found in the file "COPYING" in this distribution. + */ +#include <stdio.h> +#include <stdlib.h> +#include <getopt.h> +#include <syslog.h> + +static void usage(void) +{ + fprintf(stderr, "usage: syslog_caller num-messages\n"); + exit(1); +} + + +int main(int argc, char *argv[]) +{ + int i; + int opt; + int bRollingSev = 0; + int sev = 6; + int msgs = 500; + + while((opt = getopt(argc, argv, "m:s:")) != -1) { + switch (opt) { + case 's': if(*optarg == 'r') { + bRollingSev = 1; + sev = 0; + } else + sev = atoi(optarg); + break; + case 'm': msgs = atoi(optarg); + break; + default: usage(); + break; + } + } + + for(i = 0 ; i < msgs ; ++i) { + syslog(sev % 8, "test message nbr %d, severity=%d", i, sev % 8); + if(bRollingSev) + sev++; + } + return(0); +} |