[
https://issues.apache.org/jira/browse/ZOOKEEPER-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15179290#comment-15179290
]
Patrick Hunt commented on ZOOKEEPER-2266:
-----------------------------------------
I think you mean to have jacoco enabled=false by default? See how we run the
"clover" target by passing an argument (it's in the clover build.xml xml doc
string)
I'm not familiar with jacoco I'm afraid. However it looks like it differs from
clover in that it does (prefers) online instrumentation (clover does offline
class file instrumentation). As a result you needed to update the junit.run-
targets to add jacoco-init as a dependency. This will result in pulling the
jacoco jars when running the unit tests. I think what you want to do is add a
dependency in between junit and jacoco-init that checks whether jacoco is
enabled. If it's not you shouldn't run the init code. If it is you should. I
believe this will result in jacoco jars not being pulled when jacoco is not
enabled, but you'll need to try it and verify.
can you replace stuff like this
<classpath
path="${ivy.test.lib}/org.jacoco.agent-0.7.6.201602180812.jar"/>
<classpath
path="${ivy.test.lib}/org.jacoco.ant-0.7.6.201602180812.jar"/>
<classpath
path="${ivy.test.lib}/org.jacoco.core-0.7.6.201602180812.jar"/>
<classpath
path="${ivy.test.lib}/org.jacoco.report-0.7.6.201602180812.jar"/>
<classpath path="${ivy.test.lib}/asm-debug-all-5.0.4.jar"/>
with a fileset? (see other examples in the build.xml file) or at least move the
version to a property if that's not possible
PS: you need to replace the tabs with spaces and fix the indentation. (we don't
allow tabs for indentation)
> Integrate JaCoCo Coverage Library
> ---------------------------------
>
> Key: ZOOKEEPER-2266
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2266
> Project: ZooKeeper
> Issue Type: Improvement
> Components: tests
> Reporter: Akihiro Suda
> Assignee: Akihiro Suda
> Priority: Minor
> Attachments: ZOOKEEPER-2266-v1.patch, ZOOKEEPER-2266-v2.patch,
> ZOOKEEPER-2266-v3.patch, jacoco-report-example.zip
>
>
> I would like to propose integration of
> [JaCoCo|http://www.eclemma.org/jacoco/] coverage library with ZooKeeper.
> h4. Purposes
> - To find poorly covered methods, and improve JUnit testcases to cover them
> - To estimate causes of flaky testcases (e.g. ZOOKEEPER-2080,
> ZOOKEEPER-2252, ZOOKEEPER-1868) by comparing reports from succeeded
> experiments and failed ones (I'm recently interested in how we can
> systematically realize this.)
> h4. Advantages of JaCoCo
> - Support recent JDKs (including JDK 8)
> - Low overhead
> - Released under EPL
> -- Note: cobertura has been removed from the code base because it is
> released under GPL ( ZOOKEEPER-75,
> http://www.apache.org/legal/resolved.html#category-x )
> h4. Usage
> {panel}
> $ ant test #(plus optionally, -Dtestcase=.. -Dtest.method=..)
> $ ant jacoco-report
> $ x-www-browser build/test/jacoco/reports/index.html &
> {panel}
> Example: jacoco-report-example.zip
> h4. Possible Future Work
> - Integrate to Jenkins buildbot so that we can check coverage after each of
> builds
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)