Add unit test to check syslog.conf rule option parsing

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2020-01-19 10:46:59 +01:00
parent d22f7168e0
commit d94163d721
2 changed files with 24 additions and 2 deletions

View File

@ -1,4 +1,4 @@
EXTRA_DIST = test.rc start.sh stop.sh
EXTRA_DIST = test.rc opts.sh start.sh stop.sh
EXTRA_DIST += api.sh local.sh remote.sh fwd.sh mark.sh
CLEANFILES = *~ *.trs *.log
TEST_EXTENSIONS = .sh
@ -9,7 +9,8 @@ api_CFLAGS = -I$(srcdir)/../src
api_LDFLAGS = -static
api_LDADD = ../src/libsyslog.la
TESTS = start.sh
TESTS = opts.sh
TESTS += start.sh
TESTS += local.sh
TESTS += remote.sh
TESTS += api.sh

21
test/opts.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
set -x
if [ x"${srcdir}" = x ]; then
srcdir=.
fi
. ${srcdir}/test.rc
mkdir -p ${CONFD}
cat <<EOF > ${CONF}
# Match all log messages, store in RC5424 format and rotate every 10 MiB
*.* -${LOG} ;rotate=10M:5,RFC5424
EOF
../src/syslogd -m1 -b :${PORT} -d -sF -f ${CONF} -p ${SOCK} -p ${ALTSOCK} >${LOG2} &
echo "$!" > ${PID}
sleep 1
kill -9 ${PID}
grep ';RFC5424,rotate=10000000:5' ${LOG2}