test: refactor test.rc + start.sh + stop.sh -> lib.sh

Refactor test.rc, start.sh, and stop.sh into lib.sh that each test
sources and uses independently of each other.

More simplfication and cleanup needed.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-11-22 15:16:05 +01:00
parent 2d95e0ccf0
commit aad76ad03b
11 changed files with 189 additions and 168 deletions

View File

@@ -3,7 +3,9 @@
if [ x"${srcdir}" = x ]; then
srcdir=.
fi
. ${srcdir}/start.sh
. ${srcdir}/lib.sh
setup
MSG="fwd and allow"
@@ -23,10 +25,9 @@ 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
grep "fwd - NTP123 - ${MSG}" ${LOG2}
. ./stop.sh
grep "fwd - NTP123 - ${MSG}" ${LOG2} || FAIL "Nothing forwarded."