Kcov is a code coverage tester for compiled programs, Python scripts and shell scripts. It allows collecting code coverage information from executables without special command-line arguments, and continuosly produces output from long-running applications.
Questions tagged [kcov]
14 questions
13
votes
2 answers
Why does kcov calculate incorrect code coverage statistics for Rust programs?
I've tried to use kcov to get code coverage for a Rust library. I've followed this tutorial to build and use kcov. The coverage seems to work, however I'm facing a strange high coverage. Some files in the project gets a 100% coverage, even if they…

mbrt
- 1,958
- 1
- 17
- 33
9
votes
1 answer
Measure code coverage of an executed shell script with kcov/shunit2
Is it possible to measure the code coverage of an executed shell script instead of a sourced one?
I have a shell script with a couple of switches, options. I have added a few tests and I want to measure the test suite's coverage.
Sources:
The…

Lajos Veres
- 13,595
- 7
- 43
- 56
8
votes
3 answers
How I can get coverage for cargo test?
When I want to test C++ coverage, I can build my program with -fprofile-arcs -ftest-coverage, run all tests, and run gcov to get coverages.
However, when it comes to Rust, I get totally lost. What I want to do is run the following tests(on my Mac),…

calvin
- 2,125
- 2
- 21
- 38
7
votes
1 answer
Rust coverage using kcov does not appear correct
When I record code coverage of my Rust project using codecov.io, the coverage does not appear correct.
The unwrap() function and the end bracket are not covered
The function declaration is not covered
This is very strange.
I cannot provide the…

mrLSD
- 688
- 1
- 5
- 14
7
votes
1 answer
Does rustdoc generate runnable binaries?
I'm trying to run kcov on a Rust project. This works really well for usual tests, but I haven't been able to figure out how to make it find doc tests.
Does rustdoc create any binaries that I can pass to kcov to run coverage on?

dragostis
- 2,574
- 2
- 20
- 39
5
votes
1 answer
Kcov is reporting 100% for Rust lib even though some methods are not covered
I'm trying to add code coverage to my rust library. It's reporting that it is covered 100%, but when I look at the report a lot of lines are not counted:…

JelteF
- 3,021
- 2
- 27
- 35
5
votes
1 answer
How do I exclude test functions from code coverage when using kcov?
By default, kcov includes all sources files, including test functions, in its code coverage results. This skews the reported coverage rate. How do I tell kcov to exclude test functions?
For example:
#[test]
fn foo() {
...
}
kcov reports…

redtankd
- 53
- 4
3
votes
0 answers
Why does kcov show 0% code covered if I use gtest library?
This is my cmake files, which create binary, which have only Unit tests:
cmake_minimum_required(VERSION 3.2)
set(MODULE_NAME UnitTests)
set (CMAKE_CXX_STANDARD 11)
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS}…

Dasd
- 111
- 1
- 3
- 7
3
votes
1 answer
kcov vs lcov vs raw performance?
Anyone able to give me some info on the relative performance of code running under following conditions,
Just compiled
Compiled with --coverage
Running under kcov
Am I going to need twice a long to run my test suite if I integrated code coverage…

Paul D Smith
- 639
- 5
- 16
2
votes
0 answers
How to collect Rust code coverage when running remote tests?
I found couple of tools that generate code coverage report (like grcov, tarpaulin, llvm-cov & kcov) for Rust code when running unit tests or when triggered by cargo.
But in our case we have remote python tests that are interacting with the remote…

Guy Korland
- 9,139
- 14
- 59
- 106
1
vote
1 answer
why is my outdir from my kcov command always empty?
so, i need to integrate kcov in my gitlab-ci to see code coverage on a test executable executable. the documentation from kcov states that i need to run "kcov /path/to/outdir ./myexec" to generate a report in an html file. however, even if the…

mintchilli
- 13
- 4
1
vote
1 answer
kcov not showing any code coverage
I'm trying to run kcov on my executable and whenever I run it I only get code coverage for standard c++ code like iostream. If I exclude that then I get "Code covered: NaN%" with 0 lines executed.
I'm trying to run on linux by using
${kcovExe}…

Chris
- 155
- 6
0
votes
2 answers
How to config GCOV for coverage Testing for a Driver(Ethernet Driver)?
I am trying to use GCOV to test a Device Driver eg: Ethernet Driver wrote in C language.
This driver is in Userspace and has a lot of Kernelspace calls.
Using a Linux Ubuntu machine Ubuntu 20.04.3 LTS (GNU/Linux 5.4.0-96-generic x86_64)
On compiling…

Vinay Kumar
- 9
- 2
0
votes
0 answers
kcov is running as expected exept that it never finishes
Hi I want to calculate my coverage using kcov (for rust) but when I run the following:
kcov target/cov target/debug/foo-9685a754b64cd612
Kcov right the result in target/cov but it never return and
I am having to kill the prosses with signal…

julia
- 139
- 3
- 11