-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix always FULLY COVERED #4
base: master
Are you sure you want to change the base?
Conversation
Thanks for the pull request. I apologies that we weren't clear with the repository in the first place, but this is actually a clone from http://stef.thewalter.net/git-coverage-useful-code-coverage.html It's not clear to me how to make a pull request to the repository listed above, so I'll accept the pull request here for completeness. Thanks for fixing the C paths - we're using only the python path for the coverage, which is why we didn't spot it :) |
My reading is that gcov output should give lines like: In this case, "covered" will fail to convert to an integer where ##### is present. As such, it will skip to the ValueError clause, and only add the line to 'coverage' if I think the code follows that logic currently, so I'm not convinced by this change - can you explain why it works? |
Okay it seems to be a bit more tricky....
If I add a print(line) to the coverage function I get following output:
So seems my fix was fixing the wrong place. gcovs prints (and thats what the script parses wrong):
|
The latest fix seems to be at the right place, but still maybe not the final one. If I have some more time I will try to look for a real fix. Or maybe you have an idea? |
OK, so I don't know what the right fix is ATM but it seems that the gcov output is covering multiple files. I therefore assume that the fix that is needed is to make _gcov_lines_for_files to actually only return the gcov lines for the given file. |
I don't really understand how to use gcov, but I think from my playing around that the following change might fix it: I think that the _gcov_lines_for_files is listing all files from the single gcno file, and it's not actually filtering a single gcno file based on the input filename, despite what the function claims to do.
|
Just what I am looking at, I added just two print statements:
And toggeld this comment:
And got this output:
So it looks for me the os.path.exists(gcov) is giving a wrong true for the string with "#". |
Hi, please see my suggested fix on #4 (comment) os.path.exists works; the file does exist at the time the call is made. It is deleted at the end of _gcov_lines_for_files. Your comment makes me realise that my suggested patch is not complete because it does not delete files which are deemed irrelevant. |
Okay thanks! Shame on me to blame os.path.exists ;) Thanks for the fix. |
Okay, looked into it and it seems it still has a problem for includes in the main.c |
The latest fix looks good to me - what problems are showing up with includes from main.c? |
So I really had problem with coverage of includes. GIT DIFF
BEFORE CHANGE
AFTER CHANGE
|
@@ -399,6 +399,9 @@ class GccCoverage: | |||
if not match: | |||
continue | |||
gcov = match.group(1) | |||
if gcov != "*.gcov": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a string match against *.gcov; this shouldn't work.
It needs to be:
if gcov != "%s.gcov"%filename:
os.unlink(gcov)
continue
First of all, very cool tool! 👍
I just tried it with a little gcov example today and always got the message FULLY COVERED. I tried my best and guess I found the bug:
BEFORE CHANGE
AFTER CHANGE
GCOV VERSION