Skip to content

Optionally make partial coverage "uncovered" #608

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

MichaelChirico
Copy link
Contributor

@MichaelChirico MichaelChirico commented May 9, 2025

Closes #604.

Not well tested yet -- my machine is some sort of borked & I haven't had time to fix it.

Checking in now since I think it's already in a good place for at least high-level review.

@MichaelChirico
Copy link
Contributor Author

MichaelChirico commented May 10, 2025

OK, looks like there's some version dependency problems where * is not supported. Would help to have some experts weigh in :)

For example, one approach would be to add a helper that compiles a trivial example to test for the feature. But maybe there's a simpler / already-known alternative.

I see this on the failing macos:

Apple LLVM version 15.0.0
  Optimized build.
  Default target: arm64-apple-darwin23.6.0
  Host CPU: apple-m1

This on the failing windows:

gcov (x86_64-posix-seh, Built by MinGW-W64 project) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.

And this on the passing linux:

gcov (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@MichaelChirico
Copy link
Contributor Author

It looks like -a can help and is present on all versions, it gives output like this on macos:

        1:   34:  if (REAL(x)[0] > 0) return Rf_ScalarLogical(TRUE);
        1:   34-block  0
    $$$$$:   34-block  1

And on ubuntu:

         1*:   34:  if (REAL(x)[0] > 0) return Rf_ScalarLogical(TRUE);
          1:   34-block  0
      %%%%%:   34-block  1

But that again is a bit of overkill -- requires refactoring how the gcov output is processed to involve aggregating from the (line, block) to the (line) level. I'm also not familiar enough with if there are other implications to work through.

For now, I'll orient on a has_partial_coverage() helper that we can aim to improve in the future, since the very small change "just works" for many users (and especially most default GHA runners).

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

Successfully merging this pull request may close these issues.

Strict mode for requiring full line coverage (in gcov)?
1 participant