ASF Bugzilla – Attachment 30996 Details for
Bug 52323
Cobertura test code coverage support for build.xml and build.properties.default
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
updated patch
cobertura.patch (text/plain), 6.60 KB, created by
Violeta Georgieva
on 2013-11-02 12:51:59 UTC
(
hide
)
Description:
updated patch
Filename:
MIME Type:
Creator:
Violeta Georgieva
Created:
2013-11-02 12:51:59 UTC
Size:
6.60 KB
patch
obsolete
>Index: build.properties.default >=================================================================== >--- build.properties.default (revision 1537907) >+++ build.properties.default (working copy) >@@ -61,6 +61,8 @@ > compile.target=1.7 > compile.debug=true > >+cobertura.enabled=false >+ > base-apache.loc.1=http://www.apache.org/dist > base-apache.loc.2=http://archive.apache.org/dist > base-commons.loc.1=${base-apache.loc.1}/commons >@@ -239,5 +241,12 @@ > dojo-js.loc=http://download.dojotoolkit.org/release-1.1.1/dojo-release-1.1.1.tar.gz > dojo-js.jar=${dojo-js.home}/dojo/dojo.js > >+# ----- Cobertura code coverage tool ----- >+cobertura.version=2.0.3 >+cobertura.home=${base.path}/cobertura-${cobertura.version} >+cobertura.jar=${cobertura.home}/cobertura-${cobertura.version}.jar >+cobertura.lib=${cobertura.home}/lib >+cobertura.loc=${base-sf.loc}/cobertura/cobertura-2.0.3-bin.tar.gz >+ > # ----- JVM settings for unit tests > java.net.preferIPv4Stack=false >\ No newline at end of file >Index: build.xml >=================================================================== >--- build.xml (revision 1537907) >+++ build.xml (working copy) >@@ -185,6 +185,13 @@ > <pathelement location="${tomcat.classes}"/> > </path> > >+ <path id="cobertura.classpath"> >+ <fileset dir="${cobertura.home}"> >+ <include name="cobertura-${cobertura.version}.jar" /> >+ <include name="lib/**/*.jar" /> >+ </fileset> >+ </path> >+ > <path id="tomcat.test.classpath"> > <pathelement location="${tomcat.build}/webapps/examples/WEB-INF/classes"/> > <pathelement location="${test.classes}"/> >@@ -1268,19 +1275,19 @@ > </target> > > <target name="test-bio" description="Runs the JUnit test cases for BIO. Does not stop on errors." >- depends="test-compile,deploy" if="${execute.test.bio}"> >+ depends="test-compile,deploy,cobertura-instrument" if="${execute.test.bio}"> > <runtests protocol="org.apache.coyote.http11.Http11Protocol" > extension=".BIO" /> > </target> > > <target name="test-nio" description="Runs the JUnit test cases for NIO. Does not stop on errors." >- depends="test-compile,deploy" if="${execute.test.nio}"> >+ depends="test-compile,deploy,cobertura-instrument" if="${execute.test.nio}"> > <runtests protocol="org.apache.coyote.http11.Http11NioProtocol" > extension=".NIO" /> > </target> > > <target name="test-apr" description="Runs the JUnit test cases for APR. Does not stop on errors." >- depends="test-compile,deploy,test-apr-exists" >+ depends="test-compile,deploy,test-apr-exists,cobertura-instrument" > if="${apr.exists}"> > <runtests protocol="org.apache.coyote.http11.Http11AprProtocol" > extension=".APR" /> >@@ -1300,7 +1307,7 @@ > description="The extension to use to distinguish the output"/> > > <sequential> >- <junit printsummary="yes" fork="yes" dir="." showoutput="yes" >+ <junit printsummary="yes" fork="yes" forkmode="once" dir="." showoutput="yes" > errorproperty="test.result.error" > failureproperty="test.result.failure" > haltonfailure="${test.haltonfailure}" > >@@ -1311,12 +1318,17 @@ > <jvmarg value="-Djava.net.preferIPv4Stack=${java.net.preferIPv4Stack}"/> > <jvmarg value="-Dorg.apache.tomcat.util.net.NioSelectorShared=${org.apache.tomcat.util.net.NioSelectorShared}"/> > >+ <!-- The instrumented classes must appear first on the classpath --> >+ <classpath location="${tomcat.classes.instrumented}" /> > <classpath refid="tomcat.test.classpath" /> >+ <classpath refid="cobertura.classpath"/> > > <sysproperty key="tomcat.test.temp" value="${test.temp}" /> > <sysproperty key="tomcat.test.tomcatbuild" value="${tomcat.build}" /> > <sysproperty key="tomcat.test.protocol" value="@{protocol}" /> > <sysproperty key="tomcat.test.accesslog" value="${test.accesslog}" /> >+ <!-- File for Cobertura to write coverage results to --> >+ <sysproperty key="net.sourceforge.cobertura.datafile" file="${cobertura.datafile}" /> > > <formatter type="${junit.formatter.type}" > usefile="${junit.formatter.usefile}" >@@ -1338,6 +1350,47 @@ > </sequential> > </macrodef> > >+ <target name="cobertura-enable" if="cobertura.enabled" >+ depends="download-cobertura" >+ description="Enables the Cobertura code coverage tool"> >+ >+ <taskdef classpathref="cobertura.classpath" resource="tasks.properties" /> >+ <property name="cobertura.out" value="${tomcat.build}/coverage"/> >+ <property name="cobertura.datafile" value="${cobertura.out}/cobertura.ser"/> >+ <property name="tomcat.classes.instrumented" value="${tomcat.classes}-instrumented"/> >+ >+ </target> >+ >+ <target name="cobertura-instrument" >+ depends="cobertura-enable,compile" if="cobertura.enabled" >+ description="Adds Cobertura instrumentation to the compiled bytecode"> >+ >+ <cobertura-instrument datafile="${cobertura.datafile}" todir="${tomcat.classes.instrumented}"> >+ <fileset dir="${tomcat.classes}"> >+ <include name="**/*.class"/> >+ <exclude name="**/*ClassLoaderLogManager*.class"/> >+ <exclude name="**/FileHandler.class"/> >+ <exclude name="**/*AsyncFileHandler*.class"/> >+ <exclude name="**/*OneLineFormatter*.class"/> >+ <exclude name="**/*DateFormatCache*.class"/> >+ </fileset> >+ <auxClasspath path="${jdt.jar}" /> >+ </cobertura-instrument> >+ >+ </target> >+ >+ <!-- Default Cobertura report format --> >+ <property name="cobertura.report.format" value="html"/> >+ >+ <target name="cobertura-report" depends="cobertura-enable" >+ description="Creates report from gathered Cobertura results"> >+ >+ <cobertura-report srcdir="${basedir}/java" destdir="${cobertura.out}" >+ datafile="${cobertura.datafile}" >+ format="${cobertura.report.format}"/> >+ >+ </target> >+ > <target name="extras-prepare" > > <mkdir dir="${tomcat.extras}"/> > <mkdir dir="${tomcat.extras.sources}"/> >@@ -2595,7 +2648,21 @@ > > </target> > >+ <target name="download-cobertura" >+ description="Download the Cobertura code coverage tool" > > >+ <antcall target="downloadgz"> >+ <param name="sourcefile" value="${cobertura.loc}"/> >+ <param name="destfile" value="${cobertura.jar}"/> >+ </antcall> >+ >+ <antcall target="downloadgz"> >+ <param name="sourcefile" value="${cobertura.loc}"/> >+ <param name="destfile" value="${cobertura.lib}"/> >+ </antcall> >+ >+ </target> >+ > <!-- =============== Targets for dependencies that need to =============== --> > <!-- ================ be built rather than used directly ================ --> >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 52323
:
28069
| 30996