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

Linear BIG_CONST macros and try lcov-excl #1086

Closed
wants to merge 6 commits into from

Conversation

ckormanyos
Copy link
Member

The purpose of this PR is to streamline/linearize macros sich as BOOST_MATH_BIG_CONSTANT and subsequently check if line-by-line lcov-exclude makes sense.

Copy link

codecov bot commented Feb 12, 2024

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (61a03e0) 88.61% compared to head (12ee031) 89.82%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1086      +/-   ##
===========================================
+ Coverage    88.61%   89.82%   +1.21%     
===========================================
  Files          768      768              
  Lines        64669    63722     -947     
===========================================
- Hits         57306    57241      -65     
+ Misses        7363     6481     -882     
Files Coverage Δ
include/boost/math/quadrature/gauss.hpp 93.04% <ø> (ø)
include/boost/math/quadrature/gauss_kronrod.hpp 95.45% <ø> (ø)
...de/boost/math/special_functions/detail/erf_inv.hpp 95.04% <ø> (ø)
...ost/math/special_functions/detail/igamma_large.hpp 97.77% <ø> (+64.66%) ⬆️
...ost/math/special_functions/detail/lgamma_small.hpp 91.72% <ø> (+32.36%) ⬆️
include/boost/math/special_functions/expm1.hpp 76.92% <100.00%> (+11.32%) ⬆️
include/boost/math/special_functions/lanczos.hpp 87.86% <ø> (+50.92%) ⬆️
include/boost/math/tools/big_constant.hpp 100.00% <ø> (ø)
test/test_1F1.hpp 100.00% <ø> (ø)
test/test_gamma_edge.cpp 100.00% <100.00%> (ø)
... and 1 more

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61a03e0...12ee031. Read the comment docs.

@ckormanyos
Copy link
Member Author

Hi @jzmaddock and @mborland and @NAThompson this work might seem ugly/controversial/hurried. But I looked into simplifying the big-constant macros such that they can be neatly expressed as single-line macros. This allows for simple line-by-line LCOV_EXCL_LINE on lines that (should be) rather well-known to be covered but which lcov seems to be missing (maybe due to optimization settings).

Anyway, it is a method, but might be controversial. Comments? Thoughts?

@ckormanyos
Copy link
Member Author

I've tried (but not yet succeeded) to directly put the code annotation into the macros themselves.

@ckormanyos
Copy link
Member Author

One thing I did notice is that when the couple hundred annotations are in place, it really draws focus to the several hundred remaining specfun missed lines that are actually much more, let's say, interesting and content-rich. So feedback would be appreciated, ...

Cc: @jzmaddock and @mborland and @NAThompson

Copy link
Member

@mborland mborland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. 200+ lines removed does help.

@ckormanyos
Copy link
Member Author

Looks good to me. 200+ lines removed does help.

Thanks Matt. It ended up being closer to 1,000 lines. I could not find any other large, missed tables in specfun. But some were, in fact, covered. I annotated the ones I found must have been covered but were seemingly mistakenly marked by lcov as uncovered.

@ckormanyos
Copy link
Member Author

Here are the remaining trouble spots:

  • specfun
  • distributions
  • octonion.hpp

This is a really great achievement so far in Math!

grafik

@mborland
Copy link
Member

Here are the remaining trouble spots:

  • octonion.hpp

The one test file doesn't have real testing in it: https://github.com/boostorg/math/blob/develop/test/octonion_test.cpp.

@ckormanyos
Copy link
Member Author

ckormanyos commented Feb 12, 2024

The one test file doesn't have real testing in it:

I suppose we might as well just exclude it from the lcov analysis at the command_line-level?

@ckormanyos
Copy link
Member Author

The one test file doesn't have real testing in it:

I suppose we might as well just exclude it from the lcov analysis at the command_line-level?

On second thought, that is too hasty. This is our one-time chance to actually get some octernion testing. Or notice that they fail. I think we should try for tests. I can give this one a crack in another branch later, ...

@jzmaddock
Copy link
Collaborator

Forgive me, late night last night... but BOOST_MATH_BIG_CONSTANT is now being called with 2 arguments, but still defined with 3? I know I'm missing something... !

BTW the basic issue is that multi-line statements are badly handled by lcov, so there are quite a few function calls that look like:

foo(
   a, 
   b,
   c);

especially when the arguments are long error messages... and these are marked as uncovered except for the last line. The issue with the arrays are the same, it's not the macros as such that cause the issue, just that we have dynamic initialization spread over several lines. For the functions I've been collapsing down to one line where possible, and using LCOV_EXCL_LINE when not. For the arrays, I've topped and tailed the list of initializers with LCOV_EXCL_START/LCOV_EXCL_STOP.

BTW I have just started on coverage for beta, hoping to get to erf or so in the next tranche, I am going to be super busy this week though unfortunately :(

@ckormanyos
Copy link
Member Author

Hi John, thanks for those explanations.

but BOOST_MATH_BIG_CONSTANT is now being called with 2 arguments, but still defined with 3?

Not exaclty, but there are such changes in this PR. That's me, messing with stuff.

I left the number of parameters of BOOST_MATH_BIG_CONSTANTto be 3. And it is still called in the PR with 3.

The other mega-macro, BOOST_MATH_HUGE_CONSTANT originally had 3 parameters, but the digits parameter was used nowhere. So I removed it.

For the arrays, I've topped and tailed the list of initializers with LCOV_EXCL_START/LCOV_EXCL_STOP

I can do that and eliminate the thousand or so single-line annotations in this PR. I did, however, diligently look if I felt that they were covered prior to x-ing them out. So I'm good with that.

Also, I kind of like the way I refactored BOOST_MATH_BIG_CONSTANT and BOOST_MATH_HUGE_CONSTANT, as I think the intermediary inline function add clarity. Sorry about silently going from 3 to 2 params on _HUGE, but the unused param was in my mind simply confusing.

@ckormanyos
Copy link
Member Author

oops. I did mess up some of the calls to BOOST_MATH_BIG_CONSTANT. My bad. I will repair all these.

@ckormanyos
Copy link
Member Author

oops. I did mess up some of the calls to BOOST_MATH_BIG_CONSTANT. My bad. I will repair all these.

I'll finish this up (whatever I started) but just let it sit there, as it seems like it was a bit hurried.

@jzmaddock if you want some, none, or all of it, pls let me know. It was/is a good exercise.

@ckormanyos
Copy link
Member Author

I'll finish this up (whatever I started) but just let it sit there, as it seems like it was a bit hurried.

I do, in fact, like the single-line expression(s) of BOOST_MATH_BIG_CONSTANT/BOOST_MATH_HUGE_CONSTANT. This allows these to be lcov-excluded on single-line-annotations.

The three-parameters of _HUGE are controversial. But if any part of this is cool, it's that work. Or any part of it.

Anyway, I'll let this one bake for a while.

@ckormanyos ckormanyos marked this pull request as draft February 17, 2024 13:49
@ckormanyos
Copy link
Member Author

I converted this PR to a draft. I'm not going to really dive into this any time soon, but I synchronized with Develop and it now shows some of the tabble/macro work that subjectively seemed to make sense to me.

@ckormanyos ckormanyos closed this Mar 2, 2024
@ckormanyos ckormanyos deleted the more_specfun_cover branch March 2, 2024 07:25
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.

3 participants