You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hcatalog-commits@incubator.apache.org by ga...@apache.org on 2012/04/25 18:11:35 UTC

svn commit: r1330456 - in /incubator/hcatalog/trunk: CHANGES.txt build.xml

Author: gates
Date: Wed Apr 25 18:11:35 2012
New Revision: 1330456

URL: http://svn.apache.org/viewvc?rev=1330456&view=rev
Log:
HCATALOG-383 Add clover to build.xml

Modified:
    incubator/hcatalog/trunk/CHANGES.txt
    incubator/hcatalog/trunk/build.xml

Modified: incubator/hcatalog/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/CHANGES.txt?rev=1330456&r1=1330455&r2=1330456&view=diff
==============================================================================
--- incubator/hcatalog/trunk/CHANGES.txt (original)
+++ incubator/hcatalog/trunk/CHANGES.txt Wed Apr 25 18:11:35 2012
@@ -87,6 +87,8 @@ Release 0.4.0 - Unreleased
   HCAT-2 Support nested schema conversion between Hive an Pig (julienledem via hashutosh)
 
   IMPROVEMENTS
+  HCAT-383 Add clover to build.xml (gates)
+
   HCAT-372 Add filter information to Load/Store and Input/Output docs (lefty via gates)
 
   HCAT-379 Fix mapred.out.dir hack in FileOutputCommitterContainer (toffer)

Modified: incubator/hcatalog/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/build.xml?rev=1330456&r1=1330455&r2=1330456&view=diff
==============================================================================
--- incubator/hcatalog/trunk/build.xml (original)
+++ incubator/hcatalog/trunk/build.xml Wed Apr 25 18:11:35 2012
@@ -71,6 +71,23 @@
   <property name="test.warehouse.dir" value="/tmp/hcat_junit_warehouse"/>
   <property name="test.excludes" value="e2e/**"/>
 
+  <property name="clover.db.dir" location="${build.dir}/test/clover/db"/>
+  <property name="clover.report.dir" location="${build.dir}/test/clover/reports"/>
+  <property name="clover.pdf.report.dir" location="${build.dir}/test/clover/pdf/reports"/>
+  <property name="clover.jar" location="${clover.home}/lib/clover.jar"/>
+  <available property="clover.present" file="${clover.jar}" />
+
+  <!-- check if clover reports should be generated -->
+  <condition property="clover.enabled">
+    <and>
+      <isset property="run.clover"/>
+      <isset property="clover.present"/>
+    </and>
+  </condition>
+  <condition property="staging">
+    <equals arg1="${repo}" arg2="staging"/>
+  </condition>
+
   <!-- e2e test properties -->
   <property name="test.e2e.dir" value="${basedir}/src/test/e2e/hcatalog"/>
 
@@ -339,6 +356,7 @@
         <classpath>
           <pathelement location="${test.build.classes}" />
           <pathelement location="." />
+          <pathelement path="${clover.jar}"/>
           <path refid="test.classpath"/>
         </classpath>
         <formatter type="${test.junit.output.format}" />
@@ -367,6 +385,54 @@
     <antcall target="test-storage-handlers"/>
   </target>
 
+  <target name="clover" depends="clover.setup, clover.info"
+      description="Instrument the Unit tests using Clover.  To use, specify 
+      -Dclover.home=&lt;base of clover installation&gt; -Drun.clover=true on
+      the command line."/>
+
+  <target name="clover.setup" if="clover.enabled">
+    <taskdef resource="cloverlib.xml" classpath="${clover.jar}"/>
+    <mkdir dir="${clover.db.dir}"/>
+    <clover-setup initString="${clover.db.dir}/pig_coverage.db">
+      <fileset dir="src" includes="**/*.java"/>
+    </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 specify -Dclover.home=&lt;base of clover installation&gt;
+        on the command line.
+       ##################################################################
+    </fail>
+  </target>
+
+  <target name="generate-clover-reports" depends="clover.check, clover">
+    <mkdir dir="${clover.report.dir}"/>
+      <clover-report>
+      <current outfile="${clover.report.dir}" title="${final.name}">
+        <format type="html"/>
+      </current>
+      </clover-report>
+    <clover-report>
+      <current outfile="${clover.report.dir}/clover.xml" title="${final.name}">
+        <format type="xml"/>
+      </current>
+    </clover-report>
+  </target>
+
+  <target name="generate-pdf-clover-reports" depends="clover.check, clover">
+    <mkdir dir="${clover.pdf.report.dir}"/>
+    <clover-pdf-report outfile="${clover.pdf.report.dir}/clover_coverage.pdf" />
+  </target>
+
   <!--
   ================================================================================
   Clean Section