Commit 6f576b2c authored by Michal Nowak's avatar Michal Nowak

Merge branch 'mnowak/automake-unit-tests' into 'master'

Provide unit test driver

Closes #1722

See merge request !3554
parents ea5515d2 bfa6ecb7
Pipeline #42507 failed with stages
in 45 minutes and 21 seconds
......@@ -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
......
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
#!/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}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment