After #207, I tried tweaking kcov settings further on, to understand how they work. I was running kcov on my local machine, using perf stat ./kcov-script.sh.
--{include,exclude}-{path,pattern}= options are used for filtering source files. Per kcov man page, they take comma-separated list of patterns. When no such options are present, all files are used (that includes dependencies downloaded in $HOME/.cargo). Include and exclude are filtering list of files kcov finds in DWARF informations. They kinda work like this (Rust pseudocode):
{include,exclude}_path are much slower than {include,exclude}_pattern. --include_path=components adds 60 seconds to kcov process on my machine, and it would probably be more on Travis.
Since we use include_pattern=components, only files which path contains components are picked. If any dependency of offst ever happens to have components directory, its test coverage would influence ours. That's why --exclude-path=/usr,~/.cargo may be a good idea. --exclude-pattern=/usr/,/.cargo/ may be an even better one (see paragraph above), as long as we don't create folder called "usr" in offst codebase.
-j0 means "spawn as many threads as there are CPUs". This was not a good idea - kcov crashes a lot when multiple processes try to access target/kcov at once.
So, given these pieces of information, I would suggest trying:
for exe in ${exes}; do
${HOME}/install/kcov-${TARGET}/bin/kcov \
--exclude-pattern=/usr/,/.cargo/ \
--include-pattern=/components/ \
target/kcov \
${exe}
done
Or maybe --exclude-pattern=/.cargo/ in case we ever create usr directory. Or maybe just --exclude-path=/usr --exclude-pattern=/.cargo/, it is costly, but it still should be better than what we have now, especially without --verify.
For now I'm just writing what I know, asking for opinion.
After #207, I tried tweaking kcov settings further on, to understand how they work. I was running kcov on my local machine, using
perf stat ./kcov-script.sh
.--{include,exclude}-{path,pattern}=
options are used for filtering source files. Per kcov man page, they take comma-separated list of patterns. When no such options are present, all files are used (that includes dependencies downloaded in$HOME/.cargo
). Include and exclude are filtering list of files kcov finds in DWARF informations. They kinda work like this (Rust pseudocode):{include,exclude}_path
are much slower than{include,exclude}_pattern
.--include_path=components
adds 60 seconds to kcov process on my machine, and it would probably be more on Travis.Since we use
include_pattern=components
, only files which path containscomponents
are picked. If any dependency of offst ever happens to havecomponents
directory, its test coverage would influence ours. That's why--exclude-path=/usr,~/.cargo
may be a good idea.--exclude-pattern=/usr/,/.cargo/
may be an even better one (see paragraph above), as long as we don't create folder called "usr" in offst codebase.--verify
flag makes kcov 3-4 times slower, but it was needed to prevent it from segfaulting when working with Rust binaries. I tried removing it and nothing broke. I'm using the latest version of kcov (CI is not). This may be worth investigating.kcov runs single-threaded. I tried using GNU parallel like this:
-j0
means "spawn as many threads as there are CPUs". This was not a good idea - kcov crashes a lot when multiple processes try to accesstarget/kcov
at once.So, given these pieces of information, I would suggest trying:
Or maybe
--exclude-pattern=/.cargo/
in case we ever createusr
directory. Or maybe just--exclude-path=/usr --exclude-pattern=/.cargo/
, it is costly, but it still should be better than what we have now, especially without--verify
.For now I'm just writing what I know, asking for opinion.