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

Run JQF with JaCoCo #237

Closed
manobaneru opened this issue Aug 31, 2023 · 2 comments
Closed

Run JQF with JaCoCo #237

manobaneru opened this issue Aug 31, 2023 · 2 comments

Comments

@manobaneru
Copy link

Good evening!

I have read the issues #186, #78 and #171 and in one of them you have write about using JaCoCo agent in ZestPaper but how did you do it? If I run mvn jqf:fuzz command, I cannot just add -javaagent and I can't just use it as a plugin.

I've also seen #219 where you wrote about MAVEN_OPTS and tested some variations:
1
MAVEN_OPTS="-javaagent:/usr/local/lib/jacoco/lib/jacocoagent.jar=destfile=/path/to/myexec/test.exec" mvn jqf:fuzz -Dclass=pack.ClassName -Dmethod=MethodName -Dtime=5m
2
export MAVEN_OPTS="-noverify -javaagent:/usr/local/lib/jacoco/lib/jacocoagent.jar=destfile=/path/to/myexec/test.exec"
mvn jqf:fuzz -Dclass=pack.ClassName -Dmethod=MethodName -Dtime=1m -P jacocoagent
3
mvn jqf:fuzz -Dclass=ru.algont.bioxid.server.CalendarTest -Dmethod=testLeapYear -Dtime=1m -P -javaagent:/usr/local/lib/jacoco/lib/jacocoagent.jar=destfile=/home/victoria/Desktop/8.0-src/bioxid-server/html/more2.exec

And I was getting this in return could not be activated because it does not exist or file with 0% coverage.

@rohanpadhye
Copy link
Owner

I don't recall exactly how we did it for the Zest paper (but you should be able to download the artifact and reproduce the scripts).

The two ways I can think of running JaCoCo with JQF repro are:

  1. Use the jacoco-maven-plugin and just run mvn test -Dtest=<filter> with a @Fuzz(repro=<file_or_dir>) annotation on the JQF test driver. This requires changing the source code though, so is a manual process.

  2. Run bin/jqf-repro with JaCoCo's javaagent in JVM_OPTS.

  3. Use MAVEN_OPTS=-javaagent <...> with mvn jqf:repro, but this will collect coverage of all the Maven classes too.

Either way, JaCoCo is to be used with mvn jqf:repro and not with mvn jqf:fuzz. The coverage report is generated for files saved by the fuzzer, not during fuzzing itself. The fuzzing session uses custom instrumentation for collecting coverage efficiently.

@manobaneru
Copy link
Author

Thank you for your answer! I'm going to try it all

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

2 participants