Skip to content

Apache Lucene open-source search software

LUCENE-8170: Improve OpenClover reports (separate test from production code); enable coverage reports inside test-frameworks

Uwe Schindler95e94ab9d961
diff --git a/build.xml b/build.xml
index 00360527f26..a5f09e48711 100755
--- a/build.xml
+++ b/build.xml
@@ -524,14 +524,21 @@ File | Project Structure | Platform Settings | SDKs):
<fileset dir="." id="clover.test.result.files">
<include name="*/build/**/test/TEST-*.xml"/>
</fileset>
+ <fileset dir="." id="clover.test.src.files">
+ <include name="**/src/test/**/*.java"/>
+ <!-- test framework source files are all test code: -->
+ <include name="*/test-framework/src/**/*.java"/>
+ </fileset>
<clover-report projectName="Apache Lucene/Solr">
<current outfile="${clover.report.dir}" title="Apache Lucene/Solr ${version}" numThreads="0">
<format type="html" filter="assert"/>
<testresults refid="clover.test.result.files"/>
+ <testsources refid="clover.test.src.files"/>
</current>
<current outfile="${clover.report.dir}/clover.xml" title="Apache Lucene/Solr ${version}">
<format type="xml" filter="assert"/>
<testresults refid="clover.test.result.files"/>
+ <testsources refid="clover.test.src.files"/>
</current>
</clover-report>
<echo>You can find the merged Lucene/Solr Clover report in '${clover.report.dir}'.</echo>
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 2ae89e56499..a17f1ac3deb 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -192,6 +192,9 @@ Other
* LUCENE-8169: Migrated build to use OpenClover 4.2.1 for checking code coverage.
(Uwe Schindler)
+* LUCENE-8170: Improve OpenClover reports (separate test from production code);
+ enable coverage reports inside test-frameworks. (Uwe Schindler)
+
Build
* LUCENE-8168: Moved Groovy scripts in build files to separate files.
diff --git a/lucene/tools/build.xml b/lucene/tools/build.xml
index 4f4ed51b247..4736ea59cb2 100644
--- a/lucene/tools/build.xml
+++ b/lucene/tools/build.xml
@@ -40,6 +40,9 @@
<target name="-check-forbidden-tests"/>
<target name="-check-forbidden-sysout"/>
+ <!-- disable clover -->
+ <target name="-clover.setup" if="run.clover"/>
+
<!--
Specialize compile-core to not depend on clover, to exclude a
classpath reference when compiling, and to not attempt to copy
diff --git a/solr/test-framework/build.xml b/solr/test-framework/build.xml
index baea9969f35..1e275f2688d 100644
--- a/solr/test-framework/build.xml
+++ b/solr/test-framework/build.xml
@@ -37,7 +37,7 @@
</ant>
</target>
- <target name="compile-core" depends="resolve, compile-solr-core, compile-test-framework">
+ <target name="compile-core" depends="resolve, clover, compile-solr-core, compile-test-framework">
<!-- TODO: why does test-framework override compile-core to use this special classpath? -->
<compile srcdir="${src.dir}" destdir="${build.dir}/classes/java">
<classpath refid="test.base.classpath"/>
@@ -49,9 +49,6 @@
</copy>
</target>
- <!-- redefine the clover setup, because we dont want to run clover for the test-framework -->
- <target name="-clover.setup" if="run.clover"/>
-
<!-- redefine the forbidden apis for tests, as we check ourselves -->
<target name="-check-forbidden-tests" depends="-init-forbidden-apis,compile-core">
<forbidden-apis suppressAnnotation="**.SuppressForbidden" signaturesFile="${common.dir}/tools/forbiddenApis/tests.txt" classpathref="forbidden-apis.allclasses.classpath">