Apache Lucene open-source search software
LUCENE-4445: Fix clover to correcty instrument all packages, improve permgen
Uwe Schindler09720113f8be
diff --git a/lucene/build.xml b/lucene/build.xmlindex 23740cc07e2..81efb896432 100644--- a/lucene/build.xml+++ b/lucene/build.xml@@ -51,7 +51,8 @@</ant></target>- <target name="test" depends="test-core, test-modules, test-backwards"+ <!-- "-clover.load" is *not* a useless dependency. do not remove -->+ <target name="test" depends="-clover.load, test-core, test-modules, test-backwards"description="Runs all unit tests (core, modules and back-compat)"/>diff --git a/lucene/common-build.xml b/lucene/common-build.xmlindex fc351361ebe..bc54c963a04 100644--- a/lucene/common-build.xml+++ b/lucene/common-build.xml@@ -1138,7 +1138,7 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites<!-- note: order here is important, the taskdef depends on test-frameworkjars so we just order it after compile-test to ensure that -->- <target name="test" depends="compile-test,install-junit4-taskdef,clover,validate" description="Runs unit tests">+ <target name="test" depends="clover,compile-test,install-junit4-taskdef,validate" description="Runs unit tests"><mkdir dir="${junit.output.dir}"/><test-macro threadNum="${tests.jvms}" /></target>@@ -1146,9 +1146,9 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites<!--See http://issues.apache.org/jira/browse/LUCENE-721-->- <target name="clover" depends="-clover.disable,-clover.setup" description="Instrument the Unit tests using Clover. To use, specify -Drun.clover=true on the command line."/>+ <target name="clover" depends="-clover.disable,-clover.load,-clover.classpath,-clover.setup" description="Instrument the Unit tests using Clover. To use, specify -Drun.clover=true on the command line."/>- <target name="-clover.setup" if="run.clover" unless="clover.loaded">+ <target name="-clover.load" if="run.clover" unless="clover.loaded"><available file="${clover.license.path}" property="clover.license.available" /><fail unless="clover.license.available"><![CDATA[.@@ -1173,6 +1173,18 @@ ${tests-output}/junit4-*.suites - per-JVM executed suitesinline="true" conf="master" type="jar" pathid="clover.classpath"/><taskdef resource="cloverlib.xml" classpathref="clover.classpath" /><mkdir dir="${clover.db.dir}"/>+ <!-- This is a hack, instead of setting "clover.loaded" to "true", we set it+ to the stringified classpath. So it can be passed down to subants,+ and reloaded by "-clover.classpath" task (see below): -->+ <pathconvert property="clover.loaded" refid="clover.classpath"/>+ </target>++ <target name="-clover.classpath" if="run.clover">+ <!-- redefine the clover classpath refid for tests by using the hack above: -->+ <path id="clover.classpath" path="${clover.loaded}"/>+ </target>++ <target name="-clover.setup" if="run.clover"><clover-setup initString="${clover.db.dir}/coverage.db" encoding="${build.encoding}"><fileset dir="${src.dir}" erroronmissingdir="no"><include name="org/apache/**/*.java" />@@ -1181,7 +1193,6 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites<include name="org/apache/**/*.java" /></testsources></clover-setup>- <property name="clover.loaded" value="true"/></target><target name="-clover.disable" unless="run.clover">diff --git a/lucene/test-framework/build.xml b/lucene/test-framework/build.xmlindex e240a8606fc..d966dfbfa0d 100644--- a/lucene/test-framework/build.xml+++ b/lucene/test-framework/build.xml@@ -32,19 +32,13 @@</path><!--- Specialize compile-core to depend on lucene-core compilation,- and *not* to depend on clover; clover already includes the- test-framework sources in each module's test instrumentation.+ Specialize compile-core to depend on lucene-core and lucene-codecs compilation.-->- <target name="compile-core" depends="init,compile-lucene-core,compile-codecs"- description="Compiles test-framework classes">- <compile srcdir="${src.dir}" destdir="${build.dir}/classes/java">- <classpath refid="classpath"/>- </compile>- <copy todir="${build.dir}/classes/java">- <fileset dir="${src.dir}/../resources" erroronmissingdir="no"/>- </copy>- </target>+ <target name="compile-core" depends="init,compile-lucene-core,compile-codecs,common.compile-core"+ description="Compiles test-framework classes"/>++ <!-- redefine the clover setup, because we dont want to run clover for the test-framework -->+ <target name="-clover.setup" if="run.clover"/><target name="javadocs-core" depends="javadocs"/><target name="javadocs" depends="init,javadocs-lucene-core,javadocs-lucene-codecs">diff --git a/solr/build.xml b/solr/build.xmlindex 701a07d4e88..482776a2957 100644--- a/solr/build.xml+++ b/solr/build.xml@@ -131,8 +131,9 @@depends="compile-core, compile-contrib"/><target name="test" description="Validate, then run core, solrj, and contrib unit tests."depends="test-core, test-contrib"/>+ <!-- "-clover.load" is *not* a useless dependency. do not remove --><target name="test-core" description="Runs the core and solrj unit tests."- depends="test-solr-core, test-solrj"/>+ depends="-clover.load, test-solr-core, test-solrj"/><target name="pitest" description="Validate, then run core, solrj, and contrib unit tests."depends="pitest-core, pitest-contrib"/><target name="compile-test" description="Compile unit tests."diff --git a/solr/test-framework/build.xml b/solr/test-framework/build.xmlindex d9c3ea52411..61036faf1f4 100644--- a/solr/test-framework/build.xml+++ b/solr/test-framework/build.xml@@ -43,6 +43,9 @@</compile></target>+ <!-- redefine the clover setup, because we dont want to run clover for the test-framework -->+ <target name="-clover.setup" if="run.clover"/>+<!-- Override common-solr.javadocs to include JUnit links --><!-- and to copy the built javadocs to ${dest}/docs/api/test-framework --><target name="javadocs"