summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2011-02-23 11:27:02 +0100
committerMichael Biebl <biebl@debian.org>2011-02-23 11:27:02 +0100
commit0116bd2a5f70ce1065933c47903a3bb4cd4fe9e0 (patch)
treeedc0fcff16e528fed98fe3bf77d566c32552835b /tests
parent4d8f0c039c4fa44bb43d3cdbb0674cde8bb66de4 (diff)
downloadrsyslog-0116bd2a5f70ce1065933c47903a3bb4cd4fe9e0.tar.gz
Imported Upstream version 5.7.5upstream/5.7.5
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am17
-rw-r--r--tests/Makefile.in39
-rwxr-xr-xtests/imuxsock_ccmiddle_root.sh18
-rwxr-xr-xtests/imuxsock_logger_root.sh18
-rwxr-xr-xtests/imuxsock_traillf_root.sh18
-rw-r--r--tests/resultdata/imuxsock_ccmiddle.log1
-rw-r--r--tests/resultdata/imuxsock_logger.log1
-rw-r--r--tests/resultdata/imuxsock_traillf.log1
-rw-r--r--tests/syslog_inject.c28
-rw-r--r--tests/testsuites/imuxsock_ccmiddle_root.conf7
-rw-r--r--tests/testsuites/imuxsock_logger_root.conf7
-rw-r--r--tests/testsuites/imuxsock_traillf_root.conf7
12 files changed, 153 insertions, 9 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 25d972d..f66270a 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 syslog_caller
+check_PROGRAMS = $(TESTRUNS) ourtail nettester tcpflood chkseq msleep randomgen diagtalker uxsockrcvr syslog_caller syslog_inject
TESTS = $(TESTRUNS) cfg.sh \
arrayqueue.sh \
linkedlistqueue.sh \
@@ -46,6 +46,9 @@ TESTS = $(TESTRUNS) cfg.sh \
pipe_noreader.sh \
dircreate_dflt.sh \
dircreate_off.sh \
+ imuxsock_logger_root.sh \
+ imuxsock_traillf_root.sh \
+ imuxsock_ccmiddle_root.sh \
queue-persist.sh
if ENABLE_IMPTCP
@@ -316,6 +319,15 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/dircreate_dflt.conf \
dircreate_off.sh \
testsuites/dircreate_off.conf \
+ imuxsock_logger_root.sh \
+ testsuites/imuxsock_logger_root.conf \
+ resultdata/imuxsock_logger.log \
+ imuxsock_traillf_root.sh \
+ testsuites/imuxsock_traillf_root.conf \
+ resultdata/imuxsock_traillf.log \
+ imuxsock_ccmiddle_root.sh \
+ testsuites/imuxsock_ccmiddle_root.conf \
+ resultdata/imuxsock_ccmiddle.log \
cfg.sh
ourtail_SOURCES = ourtail.c
@@ -331,6 +343,9 @@ tcpflood_LDADD = $(SOL_LIBS)
syslog_caller_SOURCES = syslog_caller.c
syslog_caller_LDADD = $(SOL_LIBS)
+syslog_inject_SOURCES = syslog_inject.c
+syslog_inject_LDADD = $(SOL_LIBS)
+
diagtalker_SOURCES = diagtalker.c
diagtalker_LDADD = $(SOL_LIBS)
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 4c39fd4..fcac8d8 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -38,7 +38,8 @@ host_triplet = @host@
@ENABLE_TESTBENCH_TRUE@ tcpflood$(EXEEXT) chkseq$(EXEEXT) \
@ENABLE_TESTBENCH_TRUE@ msleep$(EXEEXT) randomgen$(EXEEXT) \
@ENABLE_TESTBENCH_TRUE@ diagtalker$(EXEEXT) uxsockrcvr$(EXEEXT) \
-@ENABLE_TESTBENCH_TRUE@ syslog_caller$(EXEEXT)
+@ENABLE_TESTBENCH_TRUE@ syslog_caller$(EXEEXT) \
+@ENABLE_TESTBENCH_TRUE@ syslog_inject$(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 \
@@ -64,10 +65,13 @@ host_triplet = @host@
@ENABLE_TESTBENCH_TRUE@ execonlywhenprevsuspended3.sh \
@ENABLE_TESTBENCH_TRUE@ execonlywhenprevsuspended4.sh \
@ENABLE_TESTBENCH_TRUE@ pipe_noreader.sh dircreate_dflt.sh \
-@ENABLE_TESTBENCH_TRUE@ dircreate_off.sh queue-persist.sh \
-@ENABLE_TESTBENCH_TRUE@ $(am__append_1) $(am__append_2) \
-@ENABLE_TESTBENCH_TRUE@ $(am__append_3) $(am__append_4) \
-@ENABLE_TESTBENCH_TRUE@ $(am__append_5)
+@ENABLE_TESTBENCH_TRUE@ dircreate_off.sh \
+@ENABLE_TESTBENCH_TRUE@ imuxsock_logger_root.sh \
+@ENABLE_TESTBENCH_TRUE@ imuxsock_traillf_root.sh \
+@ENABLE_TESTBENCH_TRUE@ imuxsock_ccmiddle_root.sh \
+@ENABLE_TESTBENCH_TRUE@ queue-persist.sh $(am__append_1) \
+@ENABLE_TESTBENCH_TRUE@ $(am__append_2) $(am__append_3) \
+@ENABLE_TESTBENCH_TRUE@ $(am__append_4) $(am__append_5)
@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_1 = \
@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ imptcp_large.sh \
@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ imptcp_addtlframedelim.sh \
@@ -152,6 +156,9 @@ rt_init_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
am_syslog_caller_OBJECTS = syslog_caller.$(OBJEXT)
syslog_caller_OBJECTS = $(am_syslog_caller_OBJECTS)
syslog_caller_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_syslog_inject_OBJECTS = syslog_inject.$(OBJEXT)
+syslog_inject_OBJECTS = $(am_syslog_inject_OBJECTS)
+syslog_inject_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_tcpflood_OBJECTS = tcpflood.$(OBJEXT)
tcpflood_OBJECTS = $(am_tcpflood_OBJECTS)
tcpflood_DEPENDENCIES = $(am__DEPENDENCIES_1)
@@ -187,12 +194,13 @@ am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(chkseq_SOURCES) $(diagtalker_SOURCES) $(msleep_SOURCES) \
$(nettester_SOURCES) $(ourtail_SOURCES) $(randomgen_SOURCES) \
$(rscript_SOURCES) $(rt_init_SOURCES) $(syslog_caller_SOURCES) \
- $(tcpflood_SOURCES) $(uxsockrcvr_SOURCES)
+ $(syslog_inject_SOURCES) $(tcpflood_SOURCES) \
+ $(uxsockrcvr_SOURCES)
DIST_SOURCES = $(chkseq_SOURCES) $(diagtalker_SOURCES) \
$(msleep_SOURCES) $(nettester_SOURCES) $(ourtail_SOURCES) \
$(randomgen_SOURCES) $(rscript_SOURCES) $(rt_init_SOURCES) \
- $(syslog_caller_SOURCES) $(tcpflood_SOURCES) \
- $(uxsockrcvr_SOURCES)
+ $(syslog_caller_SOURCES) $(syslog_inject_SOURCES) \
+ $(tcpflood_SOURCES) $(uxsockrcvr_SOURCES)
ETAGS = etags
CTAGS = ctags
am__tty_colors = \
@@ -575,6 +583,15 @@ EXTRA_DIST = 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/dircreate_dflt.conf \
dircreate_off.sh \
testsuites/dircreate_off.conf \
+ imuxsock_logger_root.sh \
+ testsuites/imuxsock_logger_root.conf \
+ resultdata/imuxsock_logger.log \
+ imuxsock_traillf_root.sh \
+ testsuites/imuxsock_traillf_root.conf \
+ resultdata/imuxsock_traillf.log \
+ imuxsock_ccmiddle_root.sh \
+ testsuites/imuxsock_ccmiddle_root.conf \
+ resultdata/imuxsock_ccmiddle.log \
cfg.sh
ourtail_SOURCES = ourtail.c
@@ -586,6 +603,8 @@ tcpflood_SOURCES = tcpflood.c
tcpflood_LDADD = $(SOL_LIBS)
syslog_caller_SOURCES = syslog_caller.c
syslog_caller_LDADD = $(SOL_LIBS)
+syslog_inject_SOURCES = syslog_inject.c
+syslog_inject_LDADD = $(SOL_LIBS)
diagtalker_SOURCES = diagtalker.c
diagtalker_LDADD = $(SOL_LIBS)
randomgen_SOURCES = randomgen.c
@@ -670,6 +689,9 @@ rt_init$(EXEEXT): $(rt_init_OBJECTS) $(rt_init_DEPENDENCIES)
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)
+syslog_inject$(EXEEXT): $(syslog_inject_OBJECTS) $(syslog_inject_DEPENDENCIES)
+ @rm -f syslog_inject$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(syslog_inject_OBJECTS) $(syslog_inject_LDADD) $(LIBS)
tcpflood$(EXEEXT): $(tcpflood_OBJECTS) $(tcpflood_DEPENDENCIES)
@rm -f tcpflood$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(tcpflood_OBJECTS) $(tcpflood_LDADD) $(LIBS)
@@ -696,6 +718,7 @@ distclean-compile:
@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)/syslog_inject.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/imuxsock_ccmiddle_root.sh b/tests/imuxsock_ccmiddle_root.sh
new file mode 100755
index 0000000..b487611
--- /dev/null
+++ b/tests/imuxsock_ccmiddle_root.sh
@@ -0,0 +1,18 @@
+# note: we must be root and no other syslogd running in order to
+# carry out this test
+echo \[imuxsock_ccmiddle_root.sh\]: test trailing LF handling in imuxsock
+echo This test must be run as root with no other active syslogd
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup imuxsock_ccmiddle_root.conf
+# send a message with trailing LF
+./syslog_inject -c
+# the sleep below is needed to prevent too-early termination of rsyslogd
+./msleep 100
+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!
+cmp rsyslog.out.log $srcdir/resultdata/imuxsock_ccmiddle.log
+if [ ! $? -eq 0 ]; then
+echo "imuxsock_ccmiddle_root.sh failed"
+exit 1
+fi;
+source $srcdir/diag.sh exit
diff --git a/tests/imuxsock_logger_root.sh b/tests/imuxsock_logger_root.sh
new file mode 100755
index 0000000..377999f
--- /dev/null
+++ b/tests/imuxsock_logger_root.sh
@@ -0,0 +1,18 @@
+# note: we must be root and no other syslogd running in order to
+# carry out this test.
+echo \[imuxsock_logger_root.sh\]: test trailing LF handling in imuxsock
+echo This test must be run as root with no other active syslogd
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup imuxsock_logger_root.conf
+# send a message with trailing LF
+logger test
+# the sleep below is needed to prevent too-early termination of rsyslogd
+./msleep 100
+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!
+cmp rsyslog.out.log $srcdir/resultdata/imuxsock_logger.log
+if [ ! $? -eq 0 ]; then
+echo "imuxsock_logger.sh failed"
+exit 1
+fi;
+source $srcdir/diag.sh exit
diff --git a/tests/imuxsock_traillf_root.sh b/tests/imuxsock_traillf_root.sh
new file mode 100755
index 0000000..1b821ee
--- /dev/null
+++ b/tests/imuxsock_traillf_root.sh
@@ -0,0 +1,18 @@
+# note: we must be root and no other syslogd running in order to
+# carry out this test
+echo \[imuxsock_traillf_root.sh\]: test trailing LF handling in imuxsock
+echo This test must be run as root with no other active syslogd
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup imuxsock_traillf_root.conf
+# send a message with trailing LF
+./syslog_inject -l
+# the sleep below is needed to prevent too-early termination of rsyslogd
+./msleep 100
+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!
+cmp rsyslog.out.log $srcdir/resultdata/imuxsock_traillf.log
+if [ ! $? -eq 0 ]; then
+echo "imuxsock_traillf_root.sh failed"
+exit 1
+fi;
+source $srcdir/diag.sh exit
diff --git a/tests/resultdata/imuxsock_ccmiddle.log b/tests/resultdata/imuxsock_ccmiddle.log
new file mode 100644
index 0000000..d2531f9
--- /dev/null
+++ b/tests/resultdata/imuxsock_ccmiddle.log
@@ -0,0 +1 @@
+ test 1#0112
diff --git a/tests/resultdata/imuxsock_logger.log b/tests/resultdata/imuxsock_logger.log
new file mode 100644
index 0000000..883dabd
--- /dev/null
+++ b/tests/resultdata/imuxsock_logger.log
@@ -0,0 +1 @@
+ test
diff --git a/tests/resultdata/imuxsock_traillf.log b/tests/resultdata/imuxsock_traillf.log
new file mode 100644
index 0000000..883dabd
--- /dev/null
+++ b/tests/resultdata/imuxsock_traillf.log
@@ -0,0 +1 @@
+ test
diff --git a/tests/syslog_inject.c b/tests/syslog_inject.c
new file mode 100644
index 0000000..a5d77b1
--- /dev/null
+++ b/tests/syslog_inject.c
@@ -0,0 +1,28 @@
+/* This tool deliberately logs a message with the a trailing LF */
+/* Options:
+ * -l: inject linefeed at end of message
+ * -c: inject control character in middle of message
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <syslog.h>
+#include <string.h>
+
+static inline void usage(void) {
+ fprintf(stderr, "Usage: syslog_inject [-l] [-c]\n");
+ exit(1);
+}
+
+int main(int argc, char *argv[])
+{
+ if(argc != 2)
+ usage();
+ if(!strcmp(argv[1], "-l"))
+ syslog(LOG_NOTICE, "test\n");
+ else if(!strcmp(argv[1], "-c"))
+ syslog(LOG_NOTICE, "test 1\t2");
+ else
+ usage();
+
+ return 0;
+}
diff --git a/tests/testsuites/imuxsock_ccmiddle_root.conf b/tests/testsuites/imuxsock_ccmiddle_root.conf
new file mode 100644
index 0000000..8336ecf
--- /dev/null
+++ b/tests/testsuites/imuxsock_ccmiddle_root.conf
@@ -0,0 +1,7 @@
+# rgerhards, 2011-02-21
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imuxsock/.libs/imuxsock
+
+$template outfmt,"%msg:%\n"
+*.notice ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/imuxsock_logger_root.conf b/tests/testsuites/imuxsock_logger_root.conf
new file mode 100644
index 0000000..8336ecf
--- /dev/null
+++ b/tests/testsuites/imuxsock_logger_root.conf
@@ -0,0 +1,7 @@
+# rgerhards, 2011-02-21
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imuxsock/.libs/imuxsock
+
+$template outfmt,"%msg:%\n"
+*.notice ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/imuxsock_traillf_root.conf b/tests/testsuites/imuxsock_traillf_root.conf
new file mode 100644
index 0000000..8336ecf
--- /dev/null
+++ b/tests/testsuites/imuxsock_traillf_root.conf
@@ -0,0 +1,7 @@
+# rgerhards, 2011-02-21
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imuxsock/.libs/imuxsock
+
+$template outfmt,"%msg:%\n"
+*.notice ./rsyslog.out.log;outfmt