From: Michal Nowak Date: Wed, 8 Jan 2020 14:07:43 +0000 (+0100) Subject: Omit spurious string from unit test debugging efforts X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6ded8ed5b7ffdf576d116ab9d1e52bd3bda79c9;p=thirdparty%2Fbind9.git Omit spurious string from unit test debugging efforts When both 'broken' and 'failed' test cases appear in unit test output ... ===> Broken tests lib/isc/tests/socket_test:main -> broken: Test case timed out [300.022s] ===> Failed tests lib/isc/tests/time_test:main -> failed: 2 of 6 tests failed [0.006s] ===> Summary ... spurious '===>' string gets matched, that results in the following error: Usage error for command debug: '===>' is not a test case identifier (missing ':'?). Following change makes sure the string is omitted. I checked on FreeBSD and OpenBSD that the AWK construct is supported. --- diff --git a/unit/unittest.sh.in b/unit/unittest.sh.in index b7b5ca06a4c..3ba45e48385 100755 --- a/unit/unittest.sh.in +++ b/unit/unittest.sh.in @@ -9,7 +9,7 @@ export CMOCKA_MESSAGE_OUTPUT GDB="$(command -v gdb)" kyua_report() { - ${KYUA} --logfile /dev/null report --results-file "${KYUA_RESULT:-LATEST}" + ${KYUA} --logfile /dev/null report --verbose --results-file "${KYUA_RESULT:-LATEST}" } status=0 @@ -36,7 +36,7 @@ then # 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 }')" + broken_tests=$(kyua_report | awk '$2 == "->" && $0 !~ "skipped" { 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