Closed ohank closed 2 years ago
Do the actual non-merged reports contain proper coverage data?
I tried it locally, and that seems to work:
kcov /tmp/kcov1 tests/bash/dollar-one-question.sh 5
kcov /tmp/kcov2 tests/python/second.py
kcov --merge /tmp/kcov3 /tmp/kcov2 /tmp/kcov1
and here kcov3 contains the merged report.
Maybe it has to do with the globbing? What happens if you manually (for testing) replaces ../kcovtest* with the directories one by one?
First, run in a folder named kcov_test_1661350478 Second, run in a folder kcov_test_1661350517
The non-merged report looks good to me.
I tried this:
kcov --debug=31 --merge ../kcov_merge ../kcov_test_1661350478 ../kcov_test_1661350517
And did get the same output
Can't symlink readable name
The different i see are that i run kcov with --include-pattern=/home/ubuntu/workspace/ccs_shell/ccs/. I need to do this otherwise I get an error that c++ header files are not compiled.
I can't really say why this happens. One thing you could try is to add debug printouts where the "Can't symlink readable name" is output (output-handler.cc). Not sure if that's the root cause, but something is strange if it fails.
Also, if you're collecting coverage for the same binary, kcov will automatically accumulate multiple runs (with the same output directory). So if that's what you're aiming for, simply run it with the same output directory multiple times.
Merging is meant to be used if there are multiple binaries with overlapping source code.
The "Can't symlink readable name" is not blocking as I test with a simple python script and the merge work with this error:
And when I try to do the same on the c++ application:
I have tried to save the cov result in the same folder and it writes of others for each time the binary is started. But the python script merges the cov result if I use the same folder.
I have looked in the code and found out that I didn't get a metadata file. That is why the merges are not working.
As of now, I am looking into why the metadata file is not created when running kcov on the binary. When I run it on the python program I talk about I the last comment I get a metadata file.
Good debugging!
The metadata file should be written out when kcov exits, so it's strange that it doesn't show up. Still, I think it sounds like the symlink issue can have something to do with it. It's not that disk space (where the kcov output is placed) runs out?
We did find out why the metadata files were not created. As we start more than one binary file to start a simulator we added the kcov command before starting the simulator's binary files. And when we stop the simulator all the processes are kill at the same time and the included the kcov prosses and the onStop function did have time to run and did not create the metadata files. When we kill the binary first and the kcov process we get the metadata files and the merge for fine.
So I look into how to kill the prosses so kcov has time to create the files.
Ah! Good that you found out the issue!
I have a problem with the merge tool. I run the kcov like this:
And after I have run this more than once I try to merge the result into one folder like this:
Output from the command:
The result of the merge:
I have tried to add the include-patten to the merge command but still the same. Not user what to do next.