-
Notifications
You must be signed in to change notification settings - Fork 136
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
Patch: update instrumentation order to fix coverage #711
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
src/main/java/com/code_intelligence/jazzer/agent/RuntimeInstrumentor.kt
Outdated
Show resolved
Hide resolved
@fmeum Could you please merge? |
'Build all targets and run all tests / build_and_test (windows-2019, 8) (pull_request) ' |
@kmnls Yes, that's not due to this PR. I will keep trying. |
@kmnls The CI failure should be fixed, but there is a test that seems to fail for reasons related to this PR. Could you take a look? |
The test times out with:
It looks like you might just have to update the count in
|
Head branch was pushed to by a user without write access
…mentor.kt Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
Reason:
JaCoCo produces wrong coverage because the coverage instrumentation happens after the hooks are set.
This instrumentation should follow the JaCoCo algorithm but in fact they produce different results.
Both algorithms inject control points into the end of each BB where the INVOKE happens.
BBs where there are no INVOKEs are not marked.
Let's check the case: BBs originally did not have any INVOKE but hooks are injected traceCmp callback.
CoverageRecorder happily adds a control point into such a BB but JaCoCo will never know about this.
As the result, all points after the mentioned will be misplaced in JaCoCo coverage.
Sample for test:
package com.example;
import java.util.Random;
public class Junit5Example1 {
}
All the lines after if (earlyReturn) will be colored wrongly because this BB will have an additional coverage point after traceCmp.
wrong.Junit5Example1.java.zip
right.Junit5Example1.java.zip