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

Merging coverage of different tests using the same executable #54

Closed
mgehre opened this issue Jan 27, 2015 · 5 comments
Closed

Merging coverage of different tests using the same executable #54

mgehre opened this issue Jan 27, 2015 · 5 comments

Comments

@mgehre
Copy link

mgehre commented Jan 27, 2015

Hi,

thanks again for fixing the shared library coverage. My current issue lies with the merging of coverage from multiple runs of the same executable.
If I run

kcov /tmp/kcov app -opt1
kcov /tmp/kcov app -opt2

then /tmp/kcov holds only the results of the last invocation of "app".

If I use different directories for each invocation and then use kcov-merge, I seem not to be able to look at individual source file coverage anymore.

Is there a way to aggregate coverage from multiple runs of the same executable (with different options?)

Best wishes,
Matthias

@SimonKagstrom
Copy link
Owner

That's actually something which should just work "out-of-the-box", and I also have regression tests for it in the test suite, which passes.

What kind of application are you running (Python, Bash or a compiled program)?

Does it work with a trivial test, such as a shell script which can be invoked with different parameters:

#!/bin/bash

if [ $1 -eq 1 ] ; then
   echo "first"
else
   echo "second"
fi

kcov-merge only outputs a summary, so individual sources are not present there. Something similar would be possible to add to kcov itself, but I haven't seen it as very important so far.

@SimonKagstrom
Copy link
Owner

Is this in a shared library by the way?

In that case, it might be caused by the library being loaded at a different base address the next time. If this is the case, the bug is caused by kcov storing collected data with actual addresses (which are not meaningful for libraries).

@mgehre
Copy link
Author

mgehre commented Jan 28, 2015

Yes, its in a shared library. I didn't check if it merges the actual exectuable coverage correctly, I was just looking at the library.

@SimonKagstrom
Copy link
Owner

OK. I didn't realize that this was a problem until now. I'll add a regression test and think of a solution.

SimonKagstrom added a commit that referenced this issue Jan 29, 2015
SimonKagstrom added a commit that referenced this issue Jan 29, 2015
Makes it easier to extend with other information.
SimonKagstrom added a commit that referenced this issue Jan 30, 2015
SimonKagstrom added a commit that referenced this issue Jan 30, 2015
Makes it possible to accumulate data for shared libraries.
@SimonKagstrom
Copy link
Owner

Fixed (but lightly tested!) via 96c6eeb.

The implementation remembers the address ranges when shared libraries are added, and stores rangeIndex,offset pairs in the database.

Closing, but feel free to reopen if it turns out to be buggy :-)

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