Skip to main content
This revision made September 21, 2013 17:40, by johnoliver

How to make Jacoco work with Java 8

Preliminary code coverage numbers from this method can be found at:

http://sticky.uwcs.co.uk/ojdk/coveragereport

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:

  1. Check out java 8 branch of the jacoco source at:
  2. Build and install
  3. Build JDK
  4. 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)
  1. This will produce a coverage jacoco.exec at /tmp/jacoco.exec
  2. Run a Jacoco report generator over the jacoco.exec file


Difference compared to previous revision
=How to make Jacoco work with Java 8= Preliminary code coverage numbers from this method can be found at: http://sticky.uwcs.co.uk/ojdk/coveragereport 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) # This will produce a coverage jacoco.exec at /tmp/jacoco.exec # Run a Jacoco report generator over the jacoco.exec file
 
 
Close
loading
Please Confirm
Close