sysklogd/test/start.sh
Joachim Wiberg 523926a07d test: initial refactor to support running in parallel in an unshare
The release suite fails with no permissions to dump loopback, so let's
run tests in an unshare, one per test, with and start as many syslogd as
needed for each test -- also easier to debug since all are then fully
stand-alone.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-11-22 04:59:23 +01:00

82 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
if [ x"${srcdir}" = x ]; then
srcdir=.
fi
. ${srcdir}/test.rc
# Print heading for test phases
print()
{
printf "\e[7m>> %-76s\e[0m\n" "$1"
}
dprint()
{
printf "\e[2m%-76s\e[0m\n" "$1"
}
SKIP()
{
print "TEST: SKIP"
[ $# -gt 0 ] && echo "$*"
exit 77
}
FAIL()
{
print "TEST: FAIL"
[ $# -gt 0 ] && echo "$*"
exit 99
}
OK()
{
print "TEST: OK"
[ $# -gt 0 ] && echo "$*"
exit 0
}
# shellcheck disable=SC2068
tenacious()
{
timeout=$1
shift
while [ $timeout -gt 0 ]; do
$@ && return
timeout=$((timeout - 1))
done
FAIL "Timeed out $*"
}
ip link set lo up
mkdir -p ${CONFD}
cat <<EOF > ${CONF}
# Nothing here yo
include ${CONFD}/*.conf
EOF
mkdir -p ${CONFD2}
cat <<EOF > ${CONF2}
# Nothing here yo
include ${CONFD2}/*.conf
EOF
cat <<EOF > ${CONFD}/foo.conf
# Local log file, avoid sync to disk
*.* -${LOG}
EOF
cat <<EOF > ${CONFD}/bar.conf
# For remote logging
*.* @127.0.0.2
EOF
../src/syslogd -m1 -b :${PORT} -d -sF -f ${CONF} -p ${SOCK} -p ${ALTSOCK} -C ${CACHE} -P ${PID} &
sleep 2
kill -USR1 `cat ${PID}`
sleep 1