-
Notifications
You must be signed in to change notification settings - Fork 241
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
geninfo: preserve-paths makes gcov to fail for long pathnames #60
Conversation
I wasn't able to find any reasons why '--preserve-paths' might be needed, so I decided to remove it. If there are cases where it helps, we can make it opt-out or opt-in. |
I don't think this will work. Take the following example: File int fn()
{
return 0;
} File #include "subdir/test.c"
int main()
{
return fn();
} To get coverage data: $ gcc test.c -o test --coverage
$ ./test
$ gcov test.gcda
File 'test.c'
Lines executed:100.00% of 2
Creating 'test.c.gcov'
File 'subdir/test.c'
Lines executed:100.00% of 2
Creating 'test.c.gcov'
$ ls *.gcov
test.c.gcov Note how the second data file has overwritten the first one due to the same basename. Without Even when your proposed change is made optional, there's no way to detect a situation where a gcov file was overwritten, resulting in silently lost coverage data. |
right, now I see why |
Related paragraph from
So maybe you want to just enable this option (always?). |
@xaizek, good suggestion. I think |
geninfo uses '--preserve-paths' gcov option whenever gcov supports it, this forces gcov to use a whole pathname as a filename for .gcov files. So in cases of quite large pathnames, gcov isn't able to create .gcov files and hence geninfo can't get any data. The fix replaces usage '--preserve-paths' with '--hash-filenames' when it is available. Signed-off-by: Igor Ignatev <igor.v.ignatiev@gmail.com>
Applied as 42b55f5 with some whitespace-fixes. Thank you for your contribution! |
Is this already fixed? Is it possible to do something at lcov level to tell gcov to use hash-filenames option? |
@ejbrenes the related commit 42b55f5 mentioned above is included in LCOV >=1.14 with regard to Git history. If you're still experiencing issues despite of that, please check back with latest Git PS: The last sentence of #390 (comment) should also be noted, with regard to expectations on a time line, I'm not a maintainer here, just helping out a bit. |
As @hartwork notes, above: newer versions of lcov (2.1 and newer) use a somewhat different |
geninfo uses '--preserve-paths' gcov option whenever gcov supports it, this
forces gcov to use a whole pathname as a filename for .gcov files. So in cases
of quite large pathnames, gcov isn't able to create .gcov files and hence
geninfo can't get any data. The fix removes '--preserve-paths'.
Signed-off-by: Igor Ignatev igor.v.ignatiev@gmail.com