diff --git a/test/Makefile.am b/test/Makefile.am index 1088de4..65b4fa8 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,6 +1,6 @@ EXTRA_DIST = lib.sh opts.sh EXTRA_DIST += api.sh local.sh unicode.sh remote.sh fwd.sh mark.sh \ - facility.sh notify.sh rotate_all.sh secure.sh + memleak.sh facility.sh notify.sh rotate_all.sh secure.sh CLEANFILES = *~ *.trs *.log TEST_EXTENSIONS = .sh TESTS_ENVIRONMENT= unshare -mrun @@ -18,6 +18,7 @@ TESTS += remote.sh TESTS += api.sh TESTS += facility.sh TESTS += fwd.sh +TESTS += memleak.sh TESTS += mark.sh TESTS += notify.sh TESTS += rotate_all.sh diff --git a/test/lib.sh b/test/lib.sh index ab8f7a8..5717c70 100755 --- a/test/lib.sh +++ b/test/lib.sh @@ -122,14 +122,20 @@ do_setup() ip link set lo up print "Starting $order syslogd ..." - ../src/syslogd -dKF ${opts} & + if [ -z "$VALGRIND" ]; then + ../src/syslogd -dKF ${opts} & + else + ${VALGRIND} ../src/syslogd -KF ${opts} & + fi sleep 2 [ -f "${pidfn}" ] || FAIL "Failed starting $order syslogd" cat "${pidfn}" >> "$DIR/PIDs" # Enable debugging ... - kill -USR1 $(cat "${pidfn}") + if [ -z "$VALGRIND" ]; then + kill -USR1 $(cat "${pidfn}") + fi sleep 1 } diff --git a/test/memleak.sh b/test/memleak.sh new file mode 100755 index 0000000..24e12a4 --- /dev/null +++ b/test/memleak.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# Start, SIGHUP, and log a run of syslogd under Valgrind +# shellcheck disable=SC1090 +set -x + +if [ x"${srcdir}" = x ]; then + srcdir=. +fi + +# shellcheck disable=SC2034 +VALGRIND="valgrind --leak-check=full --show-leak-kinds=all" +. ${srcdir}/lib.sh + +# Only needed for verifying correct RFC3164 parsing +cat <<-EOF >"${CONFD}/99-wall.conf" + *.=emerg * + EOF +setup + + +print "TEST: Starting" + +#../src/logger -u "${SOCK}" ${MSG} + +# Wait for any OS delays +#sleep 1 + +reload +sleep 1 + +OK