-
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
LCOV_EXCL_LINE counting #385
Comments
I added an .lcovrc with
which suggests it's not omitting any lines. Why would this happen? |
lcov/2.0 is pretty old at this point (May 2023). Current release is 2.3 (about a week ago). If you happen to know perl (or want to learn), then you can execute the 'geninfo cmd' that you see in your log file via Or, see if you can create a small testcase which exhibits the issue. Incidentally: you don't need the |
Thanks @henry2cox, I will try to do some additional debugging. |
OK, I figured it out. Some tests were adding additional compiler checks as part of our test suite, FFLAGS += fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow --std f2008 And coverage reports for tests with these flags were including 0 hit reports for lines that should have been ignored (but that were often actually hit). When we aggregated our test suite these erroneous lines were being included in the report. I modified our build so when we're doing coverage testing, these extra compiler flags will never be added. Not sure whether this is a problem in gcc or lcov. For some reason, this was not a problem in our prior version of gcc/lcov. I will close this issue now. I think the lesson learned is that some of the compiler flags have negative interactions with the coverage flags. Thanks. |
Update compile logic to exclude debug flags when doing coverage testing. See linux-test-project/lcov#385.
That should not be happening, I think. How was the coverage data for those extra tests getting extracted? The other thing to mention is the filtering in newer lcov versions is more extensive and more flexible than in the past. The other thing to note is that your code might be easier to follow if you wrap the excluded region in |
Update derecho gnu to support code coverage testing Update to ncarenv/24.12 and gcc/12.4.0 Add coverage compiler flags Update lcov scripting as needed As part of the CICE port to the new coverage tools, a bug was found in the tools that requires debug flags to be disabled when compiling with coverage flags. This was not the case when coverage was running on cheyenne. See linux-test-project/lcov#385
Update derecho gnu to support code coverage testing Update to ncarenv/24.12 and gcc/12.4.0 Add coverage compiler flags Add parse_lcov.sh script to support manually parsing lcov info files (not used in production) Update lcov scripting as needed Change derecho gnu non-debug tests to -O2. This should have always been the case, but was not. This results in answers changes relative to main but only for derecho gnu with debug off. As part of the CICE port to the new coverage tools, a bug was found in the tools that requires debug flags to be disabled when compiling with coverage flags. This was not the case when coverage was running on cheyenne. See linux-test-project/lcov#385
We upgraded our software recently, now using
lcov: LCOV version 2.0-1
LCOV_EXCL_LINEs seems to be counted now incorrectly. An old coverage report is here,
https://apcraig.github.io/lcov_cice_231018-213830:8916b9ff2c:11:first,base,travis,decomp,reprosum,io,omp,perf,gridsys,quick,unittest/cicecore/cicedyn/general/ice_step_mod.F90.gcov.html
A new coverage report is
https://apcraig.github.io/lcov_cice_250114-025918:736c1771a8:6:first,base,travis,gridsys,quick,unittest/cicecore/cicedyn/general/ice_step_mod.F90.gcov.html
The code has changed a bit, but the coverage should be about the same. The old version reports 390 lines and 90% coverage. The new version reports 787 lines and 47% coverage. The main difference is that the new coverage reports are counting a bunch of the LCOV_EXCL_LINEs which were skipped before. The LCOV_EXCL_LINE comments are added by the coverage tool at compilation as they should be (they are continuation lines in Fortran), but then not being skipped properly. Our process is largely unchanged.
We are using gcc/12.4.0, GNU Fortran (Spack GCC) 12.4.0 and compiling with
FFLAGS += -O0 -g -fprofile-arcs -ftest-coverage
CFLAGS += -O0 -g -coverage
LDFLAGS += -g -ftest-coverage -fprofile-arcs
We generate aggregate coverage reports over multiple tests via
Any thoughts/suggestions?
The text was updated successfully, but these errors were encountered: