diff --git a/test/Makefile.am b/test/Makefile.am index 805f984..89231c6 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -13,6 +13,7 @@ TESTS = start.sh TESTS += local.sh TESTS += remote.sh TESTS += api.sh +TESTS += fwd.sh TESTS += stop.sh programs: $(check_PROGRAMS) diff --git a/test/fwd.sh b/test/fwd.sh new file mode 100755 index 0000000..cf510cb --- /dev/null +++ b/test/fwd.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# Test FWD between two syslogd, second binds 127.0.0.2:4444 +set -ex +if [ x"${srcdir}" = x ]; then + srcdir=. +fi +. ${srcdir}/test.rc + +export MSG="fwd and allow" + +cat <${CONFD}/fwd.conf +ntp.* @127.0.0.2:${PORT2} ;RFC5424 +EOF + +cat <${CONFD2}/50-default.conf +*.* ${LOG2} ;RFC5424 +EOF + +../src/syslogd -a 127.0.0.2:${PORT} -b :${PORT2} -d -F -f ${CONF2} -p ${SOCK2} & +echo "$!" > ${PID2} + +kill -HUP `cat ${PID}` +sleep 2 + +# Enable debug for second syslogd +kill -USR1 `cat ${PID2}` + +../src/logger -t fwd -p ntp.notice -u ${SOCK} -m "NTP123" ${MSG} +sleep 3 +grep "fwd - NTP123 - ${MSG}" ${LOG2} diff --git a/test/start.sh b/test/start.sh index 5f023e8..2cdf38b 100755 --- a/test/start.sh +++ b/test/start.sh @@ -10,6 +10,12 @@ cat < ${CONF} include ${CONFD}/*.conf EOF +mkdir -p ${CONFD2} +cat < ${CONF2} +# Nothing here yo +include ${CONFD2}/*.conf +EOF + cat < ${CONFD}/foo.conf # Local log file, avoid sync to disk *.* -${LOG} diff --git a/test/stop.sh b/test/stop.sh index efd23bf..5f5772b 100755 --- a/test/stop.sh +++ b/test/stop.sh @@ -17,3 +17,4 @@ rm -f ${CAP} rm -f ${SOCK} rm -f ${CONF} rm -rf ${CONFD} +rm -rf ${CONFD2} diff --git a/test/test.rc b/test/test.rc index 67dc3e4..532f6ae 100644 --- a/test/test.rc +++ b/test/test.rc @@ -1,13 +1,20 @@ NM=syslog-test +NM2=syslog-test2 LOG=/tmp/${NM}.log +LOG2=/tmp/${NM2}.log LOGV1=/tmp/${NM}-v1.log LOGCONS=/tmp/${NM}-cons.log PID=/tmp/${NM}.pid +PID2=/tmp/${NM2}.pid CAP=/tmp/${NM}.pcapng CONF=/tmp/${NM}.conf +CONF2=/tmp/${NM2}.conf CONFD=/tmp/${NM}.d +CONFD2=/tmp/${NM2}.d SOCK=/tmp/${NM}.sock +SOCK2=/tmp/${NM2}.sock ALTSOCK=/tmp/${NM}-alt.sock PORT=5514 +PORT2=5555 export SYSLOG_UNIX_PATH=${SOCK}