test: refactor and generalize setup(), adding a setup2()

This patch refactors the way the primary and secondary syslogd is
started by the test framework.  The generalizations not only make the
code more readable, it hopefully also makes it easier to add new tests
in the future.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2022-03-06 00:56:03 +01:00
parent 7707715c78
commit f29f31340c
6 changed files with 78 additions and 45 deletions

View File

@@ -5,7 +5,7 @@ if [ x"${srcdir}" = x ]; then
fi
. ${srcdir}/lib.sh
setup
setup -m0
MSG="fwd and allow"
@@ -14,19 +14,16 @@ kern.* /dev/null
ntp.* @127.0.0.2:${PORT2} ;RFC5424
EOF
reload
cat <<EOF >${CONFD2}/50-default.conf
kern.* /dev/null
*.*;kern.none ${LOG2} ;RFC5424
EOF
../src/syslogd -K -a 127.0.0.2:* -b :${PORT2} -d -F -f ${CONF2} -p ${SOCK2} -m1 -C ${CACHE2} -P ${PID2} &
setup2 -m0 -a 127.0.0.2:* -b ":${PORT2}"
kill -HUP `cat ${PID}`
sleep 2
# Enable debug for second syslogd
cat ${PID2} >> "$DIR/PIDs"
kill -USR1 `cat ${PID2}`
../src/logger -t fwd -p ntp.notice -u ${SOCK} -m "NTP123" ${MSG}
sleep 3