test: new test to verify facility sorting to custom log file

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg 2022-04-08 18:51:06 +02:00
parent 7825c453c4
commit 5b48dac64e
2 changed files with 45 additions and 1 deletions

View File

@ -1,6 +1,6 @@
EXTRA_DIST = lib.sh opts.sh EXTRA_DIST = lib.sh opts.sh
EXTRA_DIST += api.sh local.sh unicode.sh remote.sh fwd.sh mark.sh \ EXTRA_DIST += api.sh local.sh unicode.sh remote.sh fwd.sh mark.sh \
notify.sh rotate_all.sh facility.sh notify.sh rotate_all.sh
CLEANFILES = *~ *.trs *.log CLEANFILES = *~ *.trs *.log
TEST_EXTENSIONS = .sh TEST_EXTENSIONS = .sh
TESTS_ENVIRONMENT= unshare -mrun TESTS_ENVIRONMENT= unshare -mrun
@ -16,6 +16,7 @@ TESTS += local.sh
TESTS += unicode.sh TESTS += unicode.sh
TESTS += remote.sh TESTS += remote.sh
TESTS += api.sh TESTS += api.sh
TESTS += facility.sh
TESTS += fwd.sh TESTS += fwd.sh
TESTS += mark.sh TESTS += mark.sh
TESTS += notify.sh TESTS += notify.sh

43
test/facility.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/sh
# Test message to various facilities
if [ x"${srcdir}" = x ]; then
srcdir=.
fi
. ${srcdir}/lib.sh
setup -m0
MSG="hey ho here we go"
cat <<EOF >"${CONFD}/facility.conf"
auth,authpriv.* ${DIR}/auth.log
*.*;auth,authpriv.none;local7.!=notice -${DIR}/syslog
daemon.* -${DIR}/daemon.log
kern.* -${DIR}/kern.log
lpr.* -${DIR}/lpr.log
mail.* -${DIR}/mail.log
user.* -${DIR}/user.log
mail.info -${DIR}/mail.info
mail.warn -${DIR}/mail.warn
mail.err ${DIR}/mail.err
*.=debug;\
auth,authpriv.none;\
news.none;mail.none -${DIR}/debug
*.=info;*.=notice;*.=warn;\
auth,authpriv.none;\
cron,daemon.none;\
local7.!=notice;\
mail,news.none -${DIR}/messages
*.emerg :omusrmsg:*
local7.=notice ${DIR}/sudo.log
EOF
reload
print "TEST: Starting"
../src/logger -t facility -p local7.notice -u "${SOCK}" "${MSG}"
sleep 1
grep "${MSG}" "${DIR}/sudo.log" || FAIL ""
OK