-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
test coverage false negative in #lang htdp/bsl #200
Comments
Sadly this is a problem with the general coverage checker, which doesn't specialize to the specified #lang. I don't think the *SL maintainers can help here. |
I think the macros that make up the definition of bsl are a good place to start looking. That is, the way the test coverage works is to expand the program and record the source location of each subexpression. When one is evaluated, that source location is marked as covered. Then, when the program is done, all unmarked source locations are lit up. In this example, it looks like maybe what's going on is the source location for the [ EDIT: the code used to be searching for the
|
My thinking is that, assuming my guess above is correct, it should be straightforward for someone to change the expansion of |
There is in fact code that explicitly does this, with a note about how it's for test case coverage. See https://github.com/racket/htdp/blob/master/htdp-lib/lang/private/teach.rkt#L1062-L1067 |
For reasons that I don't understand, moving the |
I do think this indicates a problem with the coverage tool, though. I haven't managed to reproduce it with a simpler program, unfortunately. |
So maybe we should figure out to make a unit test for test coverage?
Robby
…On Mon, Sep 18, 2023 at 4:13 PM Sam Tobin-Hochstadt < ***@***.***> wrote:
For reasons that I don't understand, moving the (void)s around fixes the
problem. #201 <#201> does that.
—
Reply to this email directly, view it on GitHub
<#200 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADBNMES5RT3TBSNPDPOIKTX3C2QPANCNFSM6AAAAAA4436GB4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Argh. I added these lines based on a prompt from John way back and Mike put them back in place. (Robby and I had a brief side-conversation. We can fix this issue here but it really is a problem of the coverage tool. Similar -- but not the same -- false negatives show up in |
@rfindler Should we merge Sam's PR for now? |
I'm not sure. When I fixed my little script above, I do see a |
There is definitely something fishy going on here. When I change line 1066 from
to
I do see the printf so I'm thinking that the fix probably does belong elsewhere. |
It looks like this worked in 7.9 (blog post on nov 2, 202) but not in 8.0 (blog post on feb 13, 2021). I'm not sure the history is helpful, tho, since a lot of things changed. It looks like, between 7.9 and 8.0, there were some changes to signatures that led to this commit which is what introduced the I don't see any commits in the errortrace repo from the time period in question that seem relevant. |
I've created a gist that distills down what DrRacket is doing when it invokes errortrace's test coverage and it reports the same wrong results as we see in the htdp program. https://gist.github.com/rfindler/12eedd4aef298e84d56f0f70784c36f8 |
What is DrRacket doing differently for the "Beginning Student" test coverage vs the "#lang htdp/bsl" test coverage? |
Here's one weird thing: if I reverse |
It looks like the difference is in the syntax property That is, changing this call to I'm not sure why the property isn't being added; if this is the function that's adding the property, it sure seems like it should be showing up. |
Ah. This is probably the right fix:
|
I think that's expected. Sometimes a region is marked as covered because it is, say, a function definition. That'll give us a large region. Then, when the function isn't called, there will be smaller regions, inside that region, that will be marked as uncovered. We want those smaller regions get priority, which is what the sorting is doing here. |
I still think moving the extra voids out of that location is the right thing to do, combined with your use of |
@samth do you want to do the honors? It sounds like no objects to that fix. |
Also copy properties appropriately to support `'errortrace-annotate`. Fixes racket#200.
I've pushed that revised change to #201, then I'll look into the test failure there. |
Also copy properties appropriately to support `'errortrace-annotate`. Fixes racket#200.
Also copy properties appropriately to support `'errortrace-annotate`. Fixes racket#200.
Also copy properties appropriately to support `'errortrace-annotate`. Fixes racket#200.
In the following example pred is shown as uncovered (tested in DrRacket 8.8 and 8.10).
If I manually select the language (and delete #lang), DrRacket indicates full coverage. Interestingly whatever emacs racket-mode is doing, it also indicates full coverage for the #lang version
The text was updated successfully, but these errors were encountered: