-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Question on out-edge instrumentation of if-then-else and match cases #434
Comments
Bisect does not post-instrument tail calls, because that would break tail call optimization, which is critical for many functional prorgams. In the cases shown first, the
The post-instrumentation shows whether the function completes evaluation normally, so it is separate from the branch instrumentation, which shows whether the branch is entered. I believe in your case you should suppress instrumentation of the out-edge with |
Thank you for the explanation. I now understand how post-instrumentation For example: let f _ = { x = invalid_arg "fail" ; y = 42 } would be instrumented as something like this: let f _ = { x = __bisect_post_visit__ 1 (invalid_arg "fail") ; y = 42 } and your coverage would show a miss for position 1, indicating dead code in your However, I'm still unclear about the benefit of this approach in branches In line with TDD, I've added new test cases related to these scenarios in #435. I've also tried suppressing instrumentation of the out-edge with [@coverage off] Looking at the test cases, something doesn't quite feel right to me. Do you feel |
The post-instrumentation of application expressions is orthogonal to whether they are in
I'm not sure what you mean, but I've commented in #435. Perhaps you could point out what is wrong by commenting on a specific line in the PR, except, of course, that I agree that it is suboptimal that |
I am currently integrating
bisect_ppx
into a code base to monitor coverage as Iadd more tests. During this process, I've noticed some instances where
bisect_ppx
reports lines as uncovered, even though I believe they should notbe. I'm hoping to gain a better understanding of the instrumentation strategy
and consider whether a slight modification to the instrumentation heuristic
might be warranted.
The specific scenario I'm focusing on involves the out-edge instrumentation of
if-then-else and match cases, which I understand is handled by the
___bisect_post_visit___
construct.In the
bisect_ppx
tests, I found these examples:test/instrumentation/control/if.t
:test/instrumentation/control/match.t
:Both examples include a case where the branches are post-instrumented (shown
first) and a case where they are not (shown second).
Could we discuss examples where post-instrumentation is beneficial in these
scenarios? I'm unsure. When the expression in the case is a
Pexp_apply
, andthe function raises an exception, I don't believe this should be considered as
uncovered.
The specific case that led me to investigate this is as follows1:
src/status_line/ml
:I examined the instrumented code using
dune describe
:which shows:
From my understanding, this code will never
visit
the point29
, by design.This matches the misses that I see in the report2.
Tangentially, I noticed that there's special handling for the
raise
function,which is identified as a
trivial_function
. If the function wasraise
insteadof
raise_s
, this would resolve the issue. However, before suggesting thatraise_s
be added to the trivial list, I'd like to understand the strategy morethoroughly.
Based on the information I currently have, I'm inclined to think that when an
expression in a
then
,else
, ormatch
case is aPexp_apply
, it is alreadypre-instrumented, and thus does not need to be post-instrumented.
I would appreciate your thoughts on this matter. Thank you!
Environment
dune 3.13.1, bisect_ppx 2.8.3, ocaml 5.1.1.
Footnotes
https://github.com/mbarbin/catch-the-bunny/tree/main ↩
https://coveralls.io/builds/65621176/source?filename=src%2Fstatus_line.ml ↩
The text was updated successfully, but these errors were encountered: