blob: b7b5ca06a4c60b500ddcb88a17d49c1f588d00db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#!/bin/sh
# Find the top of the BIND9 tree.
export TOP=@abs_top_builddir@
KYUA=@KYUA@
UNITTESTS=@UNITTESTS@
CMOCKA_MESSAGE_OUTPUT=TAP
export CMOCKA_MESSAGE_OUTPUT
GDB="$(command -v gdb)"
kyua_report() {
${KYUA} --logfile /dev/null report --results-file "${KYUA_RESULT:-LATEST}"
}
status=0
if [ -n "${UNITTESTS}" ] && [ -f Kyuafile ]
then
echo "S:unit:$(date)"
echo "T:unit:1:A"
echo "I: unit tests (using kyua)"
${KYUA} -v parallelism="${TEST_PARALLEL_JOBS:-1}" --logfile kyua.log --loglevel debug test --results-file "${KYUA_RESULT:-NEW}"
status=$?
kyua_report
if command -v sysctl >/dev/null; then
if [ "$(uname -s)" = "Linux" ] && [ "$(sysctl -n kernel.core_uses_pid)" -ne 1 ]; then
echo "kernel.core_uses_pid is not set on the Linux host"
echo "kyua may not find core file of broken tests"
fi
else
echo "sysctl command is not present, can't check kernel.core_uses_pid."
echo "kyua may not find core file of broken tests"
fi
# Use kyua-debug(1) facility to gather additional data on failed tests.
# Some runs will just show verbose information from the run, some will
# show backtrace via gdb(1).
broken_tests="$(kyua_report | awk '/Broken tests/ { flag=1; next } /Summary/ { flag=0 } flag' | awk '{ print $1 }')"
if [ -n "${CI}" ] && [ "$(id -u)" -eq 0 ] && [ -n "${broken_tests}" ] && [ -n "${GDB}" ]; then
if grep '^#define USE_LIBTOOL 1$' "${TOP}/config.h" >/dev/null; then
# kyua debug command misidentifies broken binary when libtool is used
# to configure BIND (see https://github.com/jmmv/kyua/issues/207).
# Here we try "trick" kyua use our custom gdb script instead
# of using gdb(1) directly. That's why this part needs to be run as root
# and, for safety reasons, only in the CI.
mv "${GDB}" "${GDB}.orig"
cp "${TOP}/unit/gdb" "${GDB}"
for test in ${broken_tests}; do
echo
${KYUA} debug "${test}"
done
mv "${GDB}.orig" "${GDB}"
else
for test in ${broken_tests}; do
echo
${KYUA} debug "${test}"
done
fi
fi
if [ "${status}" -eq 0 ]
then
rm -f kyua.log
echo "R:PASS"
else
echo "R:FAIL:status:${status}"
fi
echo "E:unit:$(date)"
fi
exit ${status}
|