SOLR-479: Added clover test code coverage

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@629340 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Grant Ingersoll 2008-02-20 03:57:44 +00:00
parent 427cbbfb93
commit e1f97aff7e
2 changed files with 58 additions and 0 deletions

View File

@ -299,6 +299,9 @@ Build
apache-solr-solrj-1.3-dev.jar
apache-solr-1.3-dev.jar
2. SOLR-479: Added clover code coverage targets for committers and the nightly build. Requires the Clover library, as licensed to Apache and only available privately. To run:
ant -Drun.clover=true clean clover test generate-clover-reports
================== Release 1.2, 20070602 ==================
Upgrading from Solr 1.1

View File

@ -94,6 +94,20 @@
<property name="junit.reports" location="${dest}/test-results/reports"/>
<property name="junit.includes" value="**/Test*.java,**/*Test.java"/>
<property name="clover.db.dir" location="${dest}/tests/clover/db"/>
<property name="clover.report.dir" location="${dest}/tests/clover/reports"/>
<available
property="clover.present"
classname="com.cenqua.clover.tasks.CloverReportTask"
/>
<condition property="clover.enabled">
<and>
<isset property="run.clover"/>
<isset property="clover.present"/>
</and>
</condition>
<!-- Macro for compilation -->
<macrodef name="solr-javac">
<attribute name="destdir" />
@ -434,6 +448,8 @@
<!-- include the solrj classpath and jetty files included in example -->
<path refid="compile.classpath.solrj" />
<pathelement path="${java.class.path}"/>
</path>
<!-- Compile unit tests. -->
@ -492,6 +508,45 @@
</junitreport>
</target>
<target name="clover" depends="clover.setup, clover.info"
description="Instrument the Unit tests using Clover. Requires a Clover license and clover.jar in the ANT classpath. To use, specify -Drun.clover=true on the command line."/>
<target name="clover.setup" if="clover.enabled">
<taskdef resource="clovertasks"/>
<mkdir dir="${clover.db.dir}"/>
<clover-setup initString="${clover.db.dir}/solr_coverage.db">
<fileset dir="src/java"/>
<fileset dir="src/webapp/src"/>
</clover-setup>
</target>
<target name="clover.info" unless="clover.present">
<echo>
Clover not found. Code coverage reports disabled.
</echo>
</target>
<target name="clover.check">
<fail unless="clover.present">
##################################################################
Clover not found.
Please make sure clover.jar is in ANT_HOME/lib, or made available
to Ant using other mechanisms like -lib or CLASSPATH.
##################################################################
</fail>
</target>
<!--
Run after Junit tests.
-->
<target name="generate-clover-reports" depends="clover.check, clover">
<mkdir dir="${clover.report.dir}"/>
<clover-report>
<current outfile="${clover.report.dir}" title="${fullnamever}">
<format type="html"/>
</current>
</clover-report>
</target>
<!-- ========================================================================= -->
<!-- ===================== DISTRIBUTION-RELATED TASKS ======================== -->