test: new memleak test using valgrind
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
parent
0892914581
commit
47a980728a
@ -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 \
|
||||||
facility.sh notify.sh rotate_all.sh secure.sh
|
memleak.sh facility.sh notify.sh rotate_all.sh secure.sh
|
||||||
CLEANFILES = *~ *.trs *.log
|
CLEANFILES = *~ *.trs *.log
|
||||||
TEST_EXTENSIONS = .sh
|
TEST_EXTENSIONS = .sh
|
||||||
TESTS_ENVIRONMENT= unshare -mrun
|
TESTS_ENVIRONMENT= unshare -mrun
|
||||||
@ -18,6 +18,7 @@ TESTS += remote.sh
|
|||||||
TESTS += api.sh
|
TESTS += api.sh
|
||||||
TESTS += facility.sh
|
TESTS += facility.sh
|
||||||
TESTS += fwd.sh
|
TESTS += fwd.sh
|
||||||
|
TESTS += memleak.sh
|
||||||
TESTS += mark.sh
|
TESTS += mark.sh
|
||||||
TESTS += notify.sh
|
TESTS += notify.sh
|
||||||
TESTS += rotate_all.sh
|
TESTS += rotate_all.sh
|
||||||
|
@ -122,14 +122,20 @@ do_setup()
|
|||||||
ip link set lo up
|
ip link set lo up
|
||||||
|
|
||||||
print "Starting $order syslogd ..."
|
print "Starting $order syslogd ..."
|
||||||
|
if [ -z "$VALGRIND" ]; then
|
||||||
../src/syslogd -dKF ${opts} &
|
../src/syslogd -dKF ${opts} &
|
||||||
|
else
|
||||||
|
${VALGRIND} ../src/syslogd -KF ${opts} &
|
||||||
|
fi
|
||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
[ -f "${pidfn}" ] || FAIL "Failed starting $order syslogd"
|
[ -f "${pidfn}" ] || FAIL "Failed starting $order syslogd"
|
||||||
cat "${pidfn}" >> "$DIR/PIDs"
|
cat "${pidfn}" >> "$DIR/PIDs"
|
||||||
|
|
||||||
# Enable debugging ...
|
# Enable debugging ...
|
||||||
|
if [ -z "$VALGRIND" ]; then
|
||||||
kill -USR1 $(cat "${pidfn}")
|
kill -USR1 $(cat "${pidfn}")
|
||||||
|
fi
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
}
|
}
|
||||||
|
31
test/memleak.sh
Executable file
31
test/memleak.sh
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user