Author: gkesavan
Date: Mon Apr 27 11:04:03 2009
New Revision: 768923

URL: http://svn.apache.org/viewvc?rev=768923&view=rev
Log:
to implement clover (gkesavan)

Modified:
    hadoop/pig/trunk/CHANGES.txt
    hadoop/pig/trunk/build.xml

Modified: hadoop/pig/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/CHANGES.txt?rev=768923&r1=768922&r2=768923&view=diff
==============================================================================
--- hadoop/pig/trunk/CHANGES.txt (original)
+++ hadoop/pig/trunk/CHANGES.txt Mon Apr 27 11:04:03 2009
@@ -34,6 +34,8 @@
 PIG-775: PORelationToExprProject should create a NonSpillableDataBag to create
 empty bags (pradeepkth)
 
+PIG-743: To implement clover (gkesavan)
+
 BUG FIXES
 
 PIG-733: Order by sampling dumps entire sample to hdfs which causes dfs

Modified: hadoop/pig/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/build.xml?rev=768923&r1=768922&r2=768923&view=diff
==============================================================================
--- hadoop/pig/trunk/build.xml (original)
+++ hadoop/pig/trunk/build.xml Mon Apr 27 11:04:03 2009
@@ -108,6 +108,18 @@
     <property name="make.cmd" value="make"/>
     <property name="test_patch_sh" value="${test.src.dir}/bin/test-patch.sh"/>
 
+    <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.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>
+
     <!-- ====================================================== -->
     <!-- Stuff needed by all targets                            -->
     <!-- ====================================================== -->
@@ -396,6 +408,7 @@
                 <pathelement location="${output.jarfile}" />
                 <pathelement location="${test.build.classes}" />
                 <pathelement location="${junit.hadoop.conf}" />
+               <pathelement path="${clover.jar}"/>
                 <path refid="classpath"/>
             </classpath>
             <formatter type="${test.junit.output.format}" />
@@ -638,4 +651,45 @@
                <arg value="${ant.project.name}"/>
        </exec>
      </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>
 </project>


Reply via email to