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

Branch coverage issue for SPDLOG in gcov #3181

Open
Saravanan1987 opened this issue Sep 11, 2024 · 4 comments
Open

Branch coverage issue for SPDLOG in gcov #3181

Saravanan1987 opened this issue Sep 11, 2024 · 4 comments

Comments

@Saravanan1987
Copy link

Saravanan1987 commented Sep 11, 2024

We are using spdlog in our code and generating coverage reports for our .cpp files. It appears that gcov is reporting some lines as partially covered:

Line 1: SPDLOG_INFO( "{} Config {}", std::string(20, '='), std::string(20, '=') ) shows branchesToCover="8" coveredBranches="4"

Line 2: SPDLOG_INFO( "Username: {}", username ) shows branchesToCover="4" coveredBranches="2"

We want to address these branch coverage issues without making significant changes to the codebase by using gcov exclude flags. Is there a way to configure gcov settings within spdlog to avoid these branch coverage issues?

@tt4g
Copy link
Contributor

tt4g commented Sep 11, 2024

Do you want coverage to be 100%? Some say that should not be the goal, but why would you want to do that?

@Saravanan1987
Copy link
Author

I don't aim for 100% coverage. Since we're using the library, I want to ensure the coverage isn't negatively impacted by it.

@tt4g
Copy link
Contributor

tt4g commented Sep 11, 2024

I think PR is acceptable if it does not change the behavior of spdlog.
Note that a PR that changes behavior for the motive of “for coverage” is unlikely to be acceptable.

@tt4g
Copy link
Contributor

tt4g commented Sep 11, 2024

FYI. due to the nature of the C++ language, coverage may not be high:
c++ - constexpr constructor won't show coverage data - Stack Overflow

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