]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Omit spurious string from unit test debugging efforts enhance_unit_test_debugging
authorMichal Nowak <mnowak@isc.org>
Wed, 8 Jan 2020 14:07:43 +0000 (15:07 +0100)
committerMichal Nowak <mnowak@isc.org>
Wed, 8 Jan 2020 14:20:26 +0000 (15:20 +0100)
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.

unit/unittest.sh.in

index b7b5ca06a4c60b500ddcb88a17d49c1f588d00db..3ba45e48385a511a740edc399bbe2f913e0fbc37 100755 (executable)
@@ -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