Run JQF with JaCoCo
manobaneru opened this issue · 2 comments
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.
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:
-
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. -
Run
bin/jqf-repro
with JaCoCo's javaagent inJVM_OPTS
. -
Use
MAVEN_OPTS=-javaagent <...>
withmvn 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.
Thank you for your answer! I'm going to try it all