-
Notifications
You must be signed in to change notification settings - Fork 280
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
--exclude
behavior is inconsistent
#915
Comments
Can you explain a little bit more? The |
I don't know what else there is to explain.
So, the gcovr report was actually correct, but codecov was adding the missing files in anyway. I know the |
Please can you check the log of the upload? |
I do see some For some reason on Windows, it's using the I can move any additional findings to that issue though. Thanks! |
And codecov doesn't finde the provided coverage.xml file. Can it be a output path issue? What is if you remove the instrumentation files before running the upload? |
It does find it, because I have one project that But here are logs for a rather simple project. macOS: https://github.com/LizardByte/tray/actions/runs/8696957670/job/23851261476#step:11:44 I think codecov is using what's provided by the It looks like they have a |
We also use this option in our own tests, see gcovr/.github/workflows/test.yml Lines 198 to 210 in 0574ae5
|
I can confirm that disabling the search indeed changes the results. I don't know whether the results are accurate or not. I get a lot of partials, on lines that I don't see how they could be partial at all. One example being: I definitely have a test for when the file is missing. -> https://github.com/LizardByte/Sunshine/blob/ff1341c9edefaa1642fde3f53f783060ec07ae67/tests/unit/test_file_handler.cpp#L18 Maybe I need to use |
In C++ there are branches generated by the compiler for e.g. exception handling. Please try the options |
Thank you for the response. I really appreciate the support! Unfortunately, that also doesn't seem to provide what I would expect to be covered. The behavior is also different between Windows, Linux, and macOS. Looking at the Linux is showing some lines as not covered at all, Windows is showing as fully covered, and macOS is showing as partial. Linux: Did you mean to list |
Sorry, the third one is |
Hmm... the results are the same. https://github.com/LizardByte/Sunshine/pull/2335/files Links above are the same and show the same coverage. |
Can you check on the raw gcov files? |
Sorry for the delay. I am pretty new to testing in C++, so could you elaborate how I am supposed to check them and what I should be checking for? |
You can run gcovr with the option |
Closing because of no response. |
I spent entirely way too long trying to figure this out and it ended up being a configuration issue on codecov. So posting here for anyone who might find it in a search.
I have the following code, which I run for Windows, Linux, and macOS inside of GitHub runners. For all 3 OSes a bash shell is used.
cd build python -m gcovr -r .. \ --exclude ../tests/ \ --exclude ../third-party/ \ --json-pretty \ -o coverage.json
The exclude worked for Windows, but didn't for macOS or Linux.
tests
is contained in both my repository root, as well as my build directory.I've tried many combinations from various posts, with no luck getting consistent behavior. Other combinations I have tried
(.*/)?tests/
tests/
.*tests/.*
.*/tests/
$(realpath -- ../tests/)
(but this isn't available on macOS... and still didn't work for Linux)They all work on regex101... https://regex101.com/r/LNtRyx/1
I noticed that I didn't actually see any coverage data on codecov for
third-party
, perhaps because everything there is a submodule and not actually part of my repo? In any event, this led to me to investigate the issue on codecov's side... and I found that when I actually looked at the json report created by gcovr, that there were no files fromtests
orthird-party
... and that codecov was actually added them to their generated report.To solve you can add ignore paths to codecov's config file. https://docs.codecov.com/docs/ignoring-paths
They support regex as well, but I just used the directory names, like so:
Hope this helps someone else.
The text was updated successfully, but these errors were encountered: