Skip to content
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

Get covered lines from coverage. #186

Closed
Adian12138 opened this issue Apr 21, 2022 · 3 comments
Closed

Get covered lines from coverage. #186

Adian12138 opened this issue Apr 21, 2022 · 3 comments

Comments

@Adian12138
Copy link

Adian12138 commented Apr 21, 2022

Hi here,

I have read PR #78 and #171. I used to think JQF-implementation is faster than jacoco but it turns to be that jqf-instrumentation record more informations. Does it mean I can get information like the covered line (in format <classname, methodname, linenumber>) using jqf-instrument? If so, what should I do to implement this? It seems that I should implement a TraceEventVisitor to implement this.

@sohah
Copy link

sohah commented May 20, 2022

Hi, could we get an answer to this question? I am new to JQF and fuzzing in general. What is the best strategy to collect exact coverage of lines of codes? Thanks!

@rohanpadhye
Copy link
Owner

Yes, there are a number of ways to get this, depending on what format you are looking for:

  1. Using mvn jqf:repro with -DlogCoverage=<file>. You can repro any saved inputs given in the -Dinput= argument. The format of this is JQF's own, so you will figure out how to get the info you are looking for.
  2. Run a regular repro test but use your coverage tool, e.g. JaCoCo. If you are already used to collecting coverage from JUnit tests (e.g. via mvn test or in an IDE like IntelliJ), then you can simply hardcode the tests to repro using the @Fuzz(repro=...) annotation for the fuzz test methods; simply point to the input files or directories which you want to rerun deterministically via mvn test or by clicking the "Run" button in IntelliJ.
  3. If you want to do this programmatically, then you can extend the Guidance (e.g. ZestGuidance or ReproGuidance) to override the generateCallback method, which lets you specify a callback that handles TraceEvents. See the implementation in ReproGuidance for an example. If you do this, make sure to still dispatch the callback of the superclass so that you can don't break existing functionality.

@sohah
Copy link

sohah commented May 20, 2022

Great pointers! many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants