mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Provide unit test driver
This adds a unit test driver for BIND with Automake. It runs the unit test program provided as its sole command line argument and then looks for a core dump generated by that test program. If one is found, the driver prints the backtrace into the test log.
This commit is contained in:
parent
ea5515d292
commit
bfa6ecb796
9 changed files with 50 additions and 0 deletions
|
|
@ -1637,6 +1637,9 @@ AC_CONFIG_FILES([lib/isc/tests/Makefile
|
|||
lib/isccc/tests/Makefile
|
||||
lib/isccfg/tests/Makefile])
|
||||
|
||||
AC_CONFIG_FILES([lib/unit-test-driver.sh],
|
||||
[chmod +x lib/unit-test-driver.sh])
|
||||
|
||||
# System Tests
|
||||
|
||||
AC_CONFIG_FILES([bin/tests/Makefile
|
||||
|
|
|
|||
1
lib/.gitignore
vendored
1
lib/.gitignore
vendored
|
|
@ -1,3 +1,4 @@
|
|||
platform.h
|
||||
netdb.h
|
||||
gen
|
||||
/unit-test-driver.sh
|
||||
|
|
|
|||
|
|
@ -108,3 +108,5 @@ rsa_test_CPPFLAGS = \
|
|||
$(OPENSSL_CFLAGS)
|
||||
|
||||
unit-local: check
|
||||
|
||||
LOG_COMPILER = $(builddir)/../../unit-test-driver.sh
|
||||
|
|
|
|||
|
|
@ -15,3 +15,5 @@ check_PROGRAMS = \
|
|||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
unit-local: check
|
||||
|
||||
LOG_COMPILER = $(builddir)/../../unit-test-driver.sh
|
||||
|
|
|
|||
|
|
@ -65,3 +65,5 @@ random_test_LDADD = \
|
|||
-lm
|
||||
|
||||
unit-local: check
|
||||
|
||||
LOG_COMPILER = $(builddir)/../../unit-test-driver.sh
|
||||
|
|
|
|||
|
|
@ -15,3 +15,5 @@ check_PROGRAMS = \
|
|||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
unit-local: check
|
||||
|
||||
LOG_COMPILER = $(builddir)/../../unit-test-driver.sh
|
||||
|
|
|
|||
|
|
@ -17,3 +17,5 @@ check_PROGRAMS = \
|
|||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
unit-local: check
|
||||
|
||||
LOG_COMPILER = $(builddir)/../../unit-test-driver.sh
|
||||
|
|
|
|||
|
|
@ -45,3 +45,5 @@ query_test_LDFLAGS = \
|
|||
endif
|
||||
|
||||
unit-local: check
|
||||
|
||||
LOG_COMPILER = $(builddir)/../../unit-test-driver.sh
|
||||
|
|
|
|||
34
lib/unit-test-driver.sh.in
Normal file
34
lib/unit-test-driver.sh.in
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
|
||||
TOP_BUILDDIR=@abs_top_builddir@
|
||||
TOP_SRCDIR=@abs_top_srcdir@
|
||||
|
||||
if [ -z "${1}" ]; then
|
||||
echo "Usage: ${0} test_program" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TEST_PROGRAM="${1}"
|
||||
|
||||
"${TEST_PROGRAM}"
|
||||
STATUS=${?}
|
||||
|
||||
TEST_PROGRAM_NAME=$(basename "${TEST_PROGRAM}")
|
||||
TEST_PROGRAM_WORK_DIR=$(dirname "${TEST_PROGRAM}")
|
||||
find "${TEST_PROGRAM_WORK_DIR}" -name 'core*' -or -name '*.core' | while read -r CORE_DUMP; do
|
||||
BINARY=$(gdb --batch --core="${CORE_DUMP}" 2>/dev/null | sed -n "s/^Core was generated by \`\(.*\)'\.\$/\1/p")
|
||||
if ! echo "${BINARY}" | grep -q "${TEST_PROGRAM_NAME}\$"; then
|
||||
continue
|
||||
fi
|
||||
echo "I:${TEST_PROGRAM_NAME}:Core dump found: ${CORE_DUMP}"
|
||||
echo "D:${TEST_PROGRAM_NAME}:backtrace from ${CORE_DUMP} start"
|
||||
"${TOP_BUILDDIR}/libtool" --mode=execute gdb \
|
||||
--batch \
|
||||
--command="${TOP_SRCDIR}/bin/tests/system/run.gdb" \
|
||||
--core="${CORE_DUMP}" \
|
||||
-- \
|
||||
"${BINARY}"
|
||||
echo "D:${TEST_PROGRAM_NAME}:backtrace from ${CORE_DUMP} end"
|
||||
done
|
||||
|
||||
exit ${STATUS}
|
||||
Loading…
Reference in a new issue