Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coverage data file is overwritten when kcov run with --report-only option #330

Open
nailgo opened this issue Jun 29, 2020 · 1 comment
Open

Comments

@nailgo
Copy link

nailgo commented Jun 29, 2020

on release 38,centos,
As it is written in --help:
first run:
kcov --collect-only /tmp/kcov ./main.sh
the size of coverage.db file is 8208 byte
then run:
kcov --report-only /tmp/kcov ./main.sh
the size of coverage.db file is 16 byte
and the numbers in html report are all 0
5933983753453

@SimonKagstrom
Copy link
Owner

Sorry for the very late reply!

I can reproduce your problem, but I think it's limited to bash (and probably Python). It works for compiled code still. The collect-only/report-only is sort of a performance optimization, which is relevant for compiled programs, where the program execution is lightning fast compared to kcov. For bash, when running with PS4/debug trap set, the program executes at a nice slow pace anyhow, so the overhead of reporting is less.

I'm not quite sure what causes the problem for bash, but I'm inclined to think that the collect-only option can be forbidden (i.e., a nop) with the bash "engine".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants