Skip to main content
Last updated September 21, 2013 17:55, by johnoliver
=How to make Jacoco work with Java 8= Preliminary code coverage numbers from this method can be found at: These are known to be inaccurate, I believe this is due to the jacoco agent not being able to re-transform classes that have already been loaded at the time the agent is attached, in the case of JTREG testing this may include the class under test. Steps used to produce this report: # Check out java 8 branch of the jacoco source at: # Build and install # Build JDK # Modify jdk/test/Makefile to add the jacoco agent to the build class path. I added the following JTREG_JACOCO_OPTION = -vmoption:-javaagent:/home/joliver/.m2/repository/org/jacoco/org.jacoco.agent/0.6.4-SNAPSHOT/org.jacoco.agent-0.6.4-SNAPSHOT-runtime.jar=destfile=/tmp/jacoco.exec,excludes="",exclclassloader="",includes="*" JTREG_TEST_OPTIONS += $(JTREG_JACOCO_OPTION) # Run make inside jdk/test # This will produce a coverage jacoco.exec at /tmp/jacoco.exec # Run a Jacoco report generator over the jacoco.exec file. Example report generator at: Can be run with: java jo.jdk.jacoco_test.ReportGenerator -d "/tmp/jacoco.exec" -c "/home/joliver/workspace/jdk8/build/linux-x86_64-normal-server-release/jdk/classes" -s "/home/joliver/workspace/jdk8/jdk/src/share/classes" -o "/tmp/coveragereport" I am looking an alternative method of building which sofar is having issues. This general approach is: # Build JDK # Extract rt.jar of jdk under test # Statically instrument classes with jacoco offline mode # Repackage up into rt.jar # Run tests
Please Confirm