From f7abd0d10a976d42e22fb890442dfacc368cee63 Mon Sep 17 00:00:00 2001 From: Steffen Nurpmeso Date: Sat, 12 Mar 2022 17:21:43 +0100 Subject: [PATCH] test/notify.sh: address Joachim Wiberg's comments (pull/45) --- test/notify.sh | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/test/notify.sh b/test/notify.sh index 7670259..5c6b554 100755 --- a/test/notify.sh +++ b/test/notify.sh @@ -6,6 +6,8 @@ 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 @@ -15,44 +17,25 @@ printf '#!/bin/sh -\necho script 1: $* > '${NOT1STAMP}'\n' > ${NOT1} printf '#!/bin/sh -\necho script 2: $* > '${NOT2STAMP}'\n' > ${NOT2} chmod 0755 ${NOT1} ${NOT2} -cat < ${CONF} -notify ${NOT1} +cat < ${CONFD}/notifier.conf +notify ${NOT1} # Match all log messages, store in RC5424 format and rotate every 1 KiB *.* -${LOG} ;rotate=1k:2,RFC5424 notify ${NOT2} EOF -../src/syslogd -m1 -b :${PORT2} -d -sF -f ${CONF} -p ${SOCK2} -p ${ALTSOCK} -P ${PID2} >${LOG2} & -sleep 3 -cat ${PID2} >> "$DIR/PIDs" - -if grep 'notify '${NOT1} ${LOG2} && grep 'notify '${NOT2} ${LOG2}; then - : -else - exit $? -fi - -if [ -x ../src/logger ]; then - : -else - exit 0 -fi - -kill -USR1 `cat ${PID2}` +setup MSG=01234567890123456789012345678901234567890123456789 MSG=$MSG$MSG$MSG$MSG$MSG$MSG$MSG$MSG$MSG$MSG -../src/logger -u ${SOCK2} ${MSG} -../src/logger -u ${SOCK2} 1${MSG} -../src/logger -u ${SOCK2} 2${MSG} +../src/logger -u ${SOCK} ${MSG} +../src/logger -u ${SOCK} 1${MSG} +../src/logger -u ${SOCK} 2${MSG} -kill -9 `cat ${PID2}` - -sleep 1 # XXX synchronization of async process? if [ -f ${LOG}.0 ] && grep 'script 1' ${NOT1STAMP} && grep 'script 2' ${NOT2STAMP}; then - : + OK else - exit 1 + FAIL 'Notifier did not run.' fi