test: use new logger() function in all tests

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg 2022-05-21 15:43:12 +02:00
parent 7e1d7bcb06
commit 577d20b8da
6 changed files with 25 additions and 19 deletions

View File

@ -1,10 +1,12 @@
#!/bin/sh
# Test FWD between two syslogd, second binds 127.0.0.2:5555
# shellcheck disable=SC1090
if [ x"${srcdir}" = x ]; then
srcdir=.
fi
. ${srcdir}/lib.sh
. ${srcdir}/lib.sh
setup -m0
MSG="fwd and allow"
@ -25,7 +27,7 @@ setup2 -m0 -a 127.0.0.2:* -b ":${PORT2}"
print "TEST: Starting"
../src/logger -t fwd -p ntp.notice -u "${SOCK}" -m "NTP123" "${MSG}"
logger -t fwd -p ntp.notice -m "NTP123" "${MSG}"
sleep 3 # Allow message to be received, processed, and forwarded
grep "fwd - NTP123 - ${MSG}" "${LOG2}" || FAIL "Nothing forwarded."

View File

@ -1,7 +1,10 @@
#!/bin/sh
# shellcheck disable=SC1090
if [ x"${srcdir}" = x ]; then
srcdir=.
fi
. ${srcdir}/lib.sh
setup
@ -10,10 +13,10 @@ print "TEST: Starting"
MSG="foobar"
MSG2="xyzzy"
../src/logger -u "${SOCK}" ${MSG}
logger "${MSG}"
grep ${MSG} "${LOG}" || FAIL "Cannot find: ${MSG}"
../src/logger -u "${ALTSOCK}" ${MSG2}
logger "${ALTSOCK}" ${MSG2}
grep ${MSG2} "${LOG}" || FAIL "Cannot find: ${MSG2}"
OK

View File

@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC1090
set -x
if [ x"${srcdir}" = x ]; then
@ -6,8 +7,6 @@ if [ x"${srcdir}" = x ]; then
fi
. ${srcdir}/lib.sh
[ -x ../src/logger ] || SKIP 'logger missing'
NOT1=${DIR}/${NM}-1.sh
NOT1STAMP=${DIR}/${NM}-1.stamp
NOT2=${DIR}/${NM}-2.sh
@ -28,13 +27,13 @@ setup
MSG=01234567890123456789012345678901234567890123456789
MSG=$MSG$MSG$MSG$MSG$MSG$MSG$MSG$MSG$MSG$MSG
../src/logger -u ${SOCK} ${MSG}
../src/logger -u ${SOCK} 1${MSG}
../src/logger -u ${SOCK} 2${MSG}
logger ${MSG}
logger 1${MSG}
logger 2${MSG}
if [ -f ${LOG}.0 ] &&
grep 'script 1' ${NOT1STAMP} &&
grep 'script 2' ${NOT2STAMP}; then
if [ -f "${LOG}.0" ] &&
grep 'script 1' "${NOT1STAMP}" &&
grep 'script 2' "${NOT2STAMP}"; then
OK
else
FAIL 'Notifier did not run.'

View File

@ -30,7 +30,7 @@ echo "$TPID" >> "$DIR/PIDs"
# Wait for tshark to start up properly
sleep 3
../src/logger -u "${SOCK}" ${MSG}
logger ${MSG}
# Wait for any OS delays, in particular on Travis
sleep 1
@ -41,6 +41,6 @@ wait ${TPID}
# Analyze content, should have $MSG now ...
#tshark -d udp.port==${PORT},syslog -r ${CAP} | grep ${MSG}
tshark -r "${CAP}" 2>/dev/null | grep ${MSG} || FAIL "Cannot find: ${MSG}"
tshark -r "${CAP}" 2>/dev/null | grep "${MSG}" || FAIL "Cannot find: ${MSG}"
OK

View File

@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC1090
set -x
if [ x"${srcdir}" = x ]; then
@ -26,7 +27,7 @@ EOF
setup
rm -f ${NOT1STAMP}
../src/logger -u ${SOCK} notrotall-1
logger notrotall-1
kill -USR2 `cat ${PID}`
sleep 3
@ -45,7 +46,7 @@ else
fi
rm -f ${NOT1STAMP}
../src/logger -u ${SOCK} notrotall-2
logger notrotall-2
kill -USR2 `cat ${PID}`
sleep 3
@ -68,7 +69,7 @@ fi
cp $NOT1STAMP /tmp/
rm -f ${NOT1STAMP}
../src/logger -u ${SOCK} notrotall-3
logger notrotall-3
kill -USR2 `cat ${PID}`
sleep 3

View File

@ -5,16 +5,17 @@
if [ x"${srcdir}" = x ]; then
srcdir=.
fi
. ${srcdir}/lib.sh
setup -8
MSG="öäüÖÄÜ߀¢§"
MSG2="…‘’•"
../src/logger -u "${SOCK}" ${MSG}
logger ${MSG}
grep ${MSG} "${LOG}" || FAIL "Cannot find: ${MSG}"
../src/logger -u "${ALTSOCK}" ${MSG2}
logger "${ALTSOCK}" ${MSG2}
grep ${MSG2} "${LOG}" || FAIL "Cannot find: ${MSG2}"
OK