Skip to content

Commit 2ae0d61

Browse files
committed
lib/kcov-ubuntu: Use kcov v35 to fix test coverage
I noticed during the build for #227 that test coverage dropped precipitously for no apparent reason: https://coveralls.io/builds/14508796 The coverage dropped because SimonKagstrom/kcov@0dd22bd added the ability for kcov to automatically discover all scripts residing in the same directory of the script under test. In this case, it unfortunately discovered all the scripts in ./git and tests/kcov, as well as various *.md and *.yml files that happened to have "bash" in the first line regardless of the presence of a #!. The interim fix for this was to add the --bash-dont-parse-binary-dir and to update the tests accordingly. Also, since a bit of time elapsed since I returned to the problem, I realized the latest tip of kcov's master branch exhibited the hanging bug I helped squash in SimonKagstrom/kcov#211. The bug was reintroduced in SimonKagstrom/kcov@ad17136, which tried to fix a bug reported in SimonKagstrom/kcov#248 whereby kcov would hang on output that didn't contain newlines. SimonKagstrom/kcov#249 attempted to resolve the bug, but didn't quite work and was abandoned. I may take a stab at fixing it one day, but in the meanwhile, kcov v35 with --bash-dont-parse-binary-dir works to get this project's test coverage back in shape.
1 parent b8d7140 commit 2ae0d61

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/kcov-ubuntu

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ __KCOV_DEV_PACKAGES=(
2020
)
2121
readonly __KCOV_DEV_PACKAGES
2222
readonly __KCOV_URL='https://github.com/SimonKagstrom/kcov'
23-
readonly __KCOV_VERSION='master'
23+
readonly __KCOV_VERSION='v35'
2424

2525
# Downloads and compiles kcov if necessary, then runs tests under kcov
2626
#
@@ -63,7 +63,8 @@ run_kcov() {
6363
return 1
6464
fi
6565

66-
local kcov_flags=("--include-pattern=$include_pattern"
66+
local kcov_flags=('--bash-dont-parse-binary-dir'
67+
"--include-pattern=$include_pattern"
6768
"--exclude-pattern=$exclude_pattern")
6869
local send_to_coveralls='false'
6970

tests/kcov.bats

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ RUN_KCOV_ARGV=(
1616
KCOV_PATH="$KCOV_DIR/src/kcov"
1717
KCOV_ARGV_START=(
1818
"$KCOV_PATH"
19+
'--bash-dont-parse-binary-dir'
1920
"--include-pattern=$KCOV_INCLUDE_PATTERNS"
2021
"--exclude-pattern=$KCOV_EXCLUDE_PATTERNS"
2122
)

0 commit comments

Comments
 (0)