CodeIntelligenceTesting / jazzer

Coverage-guided, in-process fuzzing for the JVM
https://code-intelligence.com
Other
1.03k stars 137 forks source link

Change junit integration to look use different directories for each test method #710

Closed br-lewis closed 1 year ago

br-lewis commented 1 year ago

This changes jazzer to create and look for crash files in different directories for each tested method. It adds a new <test name> directory to the searched resources/<classpath>/<class name>Inputs and .cifuzz-corpus/<class name>/<test name> paths so each test has its own separated crash files.

Now inputs are gathered from:

Classes can share common test cases between tests while allowing each test to have its own individual inputs. The inputs under .cifuzz-corpus do not have this shared vs non-shared inputs behavior because libfuzzer doesn't support that.

I also wrote up some docs on how jazzer works with junit which could use a look over since there are some parts that I'm not sure about it which should be clear in the text. I'm also not sure if it should be in a separate markdown file or as part of the FuzzTest javadoc comment.

br-lewis commented 1 year ago

Something to note here is that this change could be considered breaking in that previously generated corpora will not be used by in fuzzing mode. They will still be used as test cases in regression mode but fuzzing will start from scratch unless the test cases are copied/symlinked into the new test-specific directories.