-
Notifications
You must be signed in to change notification settings - Fork 162
Make Lifecycle.PER_EXECUTION more realistic
#867
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
|
eb20d6e to
0f1d72a
Compare
|
|
1794ad3 to
a0982aa
Compare
bertschneider
approved these changes
Oct 17, 2023
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.
Puh, what a PR! Great additions and simplifications, thx.
Just some minor remarks, feel free to merge.
examples/junit/src/test/java/com/example/PerTestLifecycleFuzzTest.java
Outdated
Show resolved
Hide resolved
src/main/java/com/code_intelligence/jazzer/mutation/ArgumentsMutator.java
Show resolved
Hide resolved
src/main/java/com/code_intelligence/jazzer/driver/FuzzTargetRunner.java
Outdated
Show resolved
Hide resolved
src/main/java/com/code_intelligence/jazzer/junit/JUnitLifecycleMethodsInvoker.java
Outdated
Show resolved
Hide resolved
src/main/java/com/code_intelligence/jazzer/junit/JUnitLifecycleMethodsInvoker.java
Outdated
Show resolved
Hide resolved
a0982aa to
e907dff
Compare
If a target doesn't expect a finding, it doesn't have to disable this check manually.
We also track the instance on which a given method is invoked and verify that the `ExtensionContext` contains consistent information. This prepares for future changes to `Lifecycle.PER_EXECUTION`.
Previously, `dumpReproducer` was called for `@FuzzTest`s using Autofuzz, which is implemented as a static fuzz target method.
Each execution uses its own dedicated test class instance and also runs preprocessors. See the comment in `JUnitLifecycleMethodsInvoker#beforeFirstExecution` for an explanation of how this still falls short of emulating default JUnit behavior.
The check generates a warning for essentially all our tests and doesn't seem to be easy to make more precise.
Previously, IDE executions of JUnit fuzz tests registered a `findingHandler` in `FuzzTargetRunner` whereas CLI executions did not. This lead to inconsistent behavior that was hard to reason about and a lack of feature parity between the two modes (e.g. `--keep_going` was only supported on the CLI). Instead, we now use a `findingHandler` to report the last, "fatal", finding in structured form to `FuzzTestExecutor`, with all other findings having their stack traces printed. `JUnitRunner` now handles findings from lifecycle methods correctly, including for the exit code.
e907dff to
03ba60d
Compare
03ba60d to
df43aae
Compare
bertschneider
approved these changes
Oct 18, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.