Revision: 5887 Author: [email protected] Date: Wed Aug 5 12:55:36 2009 Log: This patch adds emma code coverage statistics to the output of an ant test when emma.enabled is set.
Patch by: jlabanca Review by: fabbott http://code.google.com/p/google-web-toolkit/source/detail?r=5887 Modified: /trunk/build-tools/ant-gwt/build.xml /trunk/build.xml /trunk/common.ant.xml /trunk/dev/core/build.xml /trunk/tools/api-checker/build.xml /trunk/user/build.xml ======================================= --- /trunk/build-tools/ant-gwt/build.xml Sun Jul 26 17:35:05 2009 +++ /trunk/build-tools/ant-gwt/build.xml Wed Aug 5 12:55:36 2009 @@ -3,6 +3,9 @@ <property name="project.tail" value="build-tools/ant-gwt" /> <import file="${gwt.root}/common.ant.xml" /> + <property name="gwt.junit.testcase.antgwt.includes" value="**/*Test.class" /> + <property name="gwt.junit.testcase.antgwt.excludes" value="" /> + <target name="compile" description="Compiles this project"> <mkdir dir="${javac.out}" /> <gwt.javac> @@ -12,7 +15,7 @@ </gwt.javac> </target> - <target name="compile.tests" depends="build" description="Compiles the test code for this project"> + <target name="compile.tests" depends="build, compile.emma" description="Compiles the test code for this project"> <mkdir dir="${javac.junit.out}" /> <gwt.javac srcdir="test" destdir="${javac.junit.out}"> <classpath> @@ -33,32 +36,8 @@ </target> <target name="test" depends="build, compile.tests" description="Run unit tests for this project."> - <!-- TODO: refactor gwt.junit so it can be reused here --> - <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"> - <classpath> - <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" /> - <pathelement location="${gwt.tools.antlib}/ant-junit-1.6.5.jar" /> - </classpath> - </taskdef> - - <echo message="Writing test results to ${junit.out}/reports for ${test.cases}" /> - <mkdir dir="${junit.out}/reports" /> - - <echo message="${javac.out} ${javac.junit.out}" /> - <junit dir="${junit.out}" fork="yes" printsummary="yes" haltonfailure="true"> - <classpath> - <pathelement location="${javac.junit.out}" /> - <pathelement location="${javac.out}" /> - <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" /> - </classpath> - - <formatter type="plain" /> - <formatter type="xml" /> - - <batchtest todir="${junit.out}/reports"> - <fileset dir="${javac.junit.out}" includes="**/*Test.class" /> - </batchtest> - </junit> + <fileset id="tests.antgwt" dir="${javac.junit.out}" includes="${gwt.junit.testcase.antgwt.includes}" excludes="${gwt.junit.testcase.antgwt.excludes}" /> + <gwt.junit test.out="${junit.out}" test.cases="tests.antgwt" /> </target> <target name="checkstyle" description="Static analysis of source"> ======================================= --- /trunk/build.xml Sun Jul 26 17:35:05 2009 +++ /trunk/build.xml Wed Aug 5 12:55:36 2009 @@ -5,6 +5,7 @@ <!-- "build" is the default when subprojects are directly targetted --> <property name="target" value="build" /> + <property name="emma.merged.out" value="${project.build}/emma-coverage" /> <!-- Convenience for the lateral calls we make. Use gwt.ant to @@ -127,6 +128,39 @@ <call-subproject subproject="tools" subtarget="test" /> </target> + <path id="emma.classpath.src"> + <pathelement location="${gwt.root}/user/src" /> + <pathelement location="${gwt.root}/dev/**/src/com/google" /> + <pathelement location="${gwt.root}/build-tools/**/src/com/google" /> + <pathelement location="${gwt.root}/tools/**/src/com/google" /> + </path> + + <target name="emma.merge" description="Merges coverage data for all projects"> + <delete dir="${emma.merged.out}" /> + <mkdir dir="${emma.merged.out}" /> + <emma> + <merge outfile="${emma.merged.out}/merged.emma" > + <fileset dir="${project.build}"> + <include name="**/*.emma" /> + <exclude name="**/merged.emma" /> + </fileset> + </merge> + </emma> + <emma> + <report sourcepath="${emma.classpath.src}"> + <fileset dir="${project.build}"> + <patternset> + <include name="**/metadata.emma"/> + </patternset> + </fileset> + <fileset file="${emma.merged.out}/merged.emma" /> + <txt outfile="${emma.merged.out}/coverage.txt" /> + <html outfile="${emma.merged.out}/coverage.html" /> + <xml outfile="${emma.merged.out}/coverage.xml" /> + </report> + </emma> + </target> + <target name="clean" description="[action] Cleans the entire GWT build"> <delete dir="${gwt.build}" /> </target> ======================================= --- /trunk/common.ant.xml Sun Jul 26 17:35:05 2009 +++ /trunk/common.ant.xml Wed Aug 5 12:55:36 2009 @@ -49,6 +49,7 @@ <property name="project.jni" location="${gwt.build}/${project.tail}" /> <property name="javac.out" location="${project.build}/bin" /> <property name="javac.junit.out" location="${project.build}/bin-test" /> + <property name="javac.emma.out" location="${project.build}/bin-emma" /> <property name="javac.debug" value="true" /> <property name="javac.debuglevel" value="lines,vars,source" /> <property name="javac.encoding" value="utf-8" /> @@ -56,6 +57,8 @@ <property name="javac.target" value="1.5" /> <property name="javac.nowarn" value="true" /> <property name="junit.out" location="${project.build}/test" /> + <property name="emma.dir" value="${gwt.tools.redist}/emma" /> + <property name="emma.filter.exclude" value="" /> <!-- Sanity check --> <available file="${gwt.tools}" type="dir" property="gwt.tools.exists" /> @@ -119,6 +122,14 @@ </not> </condition> + <!-- Shared class paths --> + <path id="project.classpath.class"> + <pathelement location="${javac.out}" /> + </path> + <path id="project.classpath.src"> + <pathelement location="${gwt.root}/${project.tail}/src" /> + </path> + <!-- Pulls in tasks defined in ant-contrib, i.e. foreach --> <taskdef resource="net/sf/antcontrib/antlib.xml"> <classpath> @@ -133,6 +144,7 @@ <propertyref name="gwt.version" /> <propertyref name="gwt.junit.port" /> <propertyref name="gwt.remote.browsers" /> + <propertyref name="emma.enabled" /> </propertyset> </ant> </presetdef> @@ -163,6 +175,7 @@ <attribute name="test.args" default="" /> <attribute name="test.out" default="" /> <attribute name="test.reports" default="@{test.out}/reports" /> + <attribute name="test.emma.coverage" default="@{test.out}/emma-coverage" /> <attribute name="test.cases" default="" /> <element name="extraclasspaths" optional="true" /> <sequential> @@ -177,20 +190,32 @@ <echo message="Writing test results to @{test.reports} for @{test.cases}" /> <mkdir dir="@{test.reports}" /> + <antcall target="-create.emma.coverage"> + <param name="test.emma.coverage" value="@{test.emma.coverage}"/> + </antcall> + <condition property="emma.lib" value="${emma.dir}/emma-2.0.5312-patched.jar" else=""> + <isset property="emma.enabled" /> + </condition> + <echo message="${javac.out} ${javac.junit.out}" /> <junit dir="@{test.out}" fork="yes" printsummary="yes" failureproperty="junit.failure" tempdir="@{test.out}" > <jvmarg line="${junit.platform.args}" /> <jvmarg line="-Xmx768m" /> + <jvmarg value="-demma.coverage.out.fi...@{test.emma.coverage}/coverage.emma" /> + <jvmarg value="-Demma.coverage.out.merge=true" /> <sysproperty key="gwt.args" value="${junit.notheadless.arg} @{test.args}" /> <sysproperty key="java.awt.headless" value="${junit.headless}" /> <sysproperty key="gwt.devjar" value="${gwt.dev.staging.jar}" /> <classpath> - <pathelement location="${gwt.root}/${project.tail}/src" /> + <path refid="project.classpath.src" /> <pathelement location="${gwt.root}/${project.tail}/super" /> <pathelement location="${gwt.root}/${project.tail}/test" /> <pathelement location="${javac.junit.out}" /> - <pathelement location="${javac.out}" /> + <!-- javac.emma.out is empty unless emma is enabled. --> + <pathelement location="${javac.emma.out}" /> + <path refid="project.classpath.class" /> + <pathelement location="${emma.lib}" /> <pathelement location="${gwt.dev.staging.jar}" /> <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" /> <pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" /> @@ -206,6 +231,19 @@ <fileset refid="@{test.cases}" /> </batchtest> </junit> + + <emma enabled="${emma.enabled}"> + <report sourcepath="${project.classpath.src}"> + <fileset file="${javac.emma.out}/metadata.emma" /> + <fileset dir="@{test.emma.coverage}"> + <include name="*.emma" /> + </fileset> + <txt outfile="@{test.emma.coverage}/coverage.txt" /> + <html outfile="@{test.emma.coverage}/coverage.html" /> + <xml outfile="@{test.emma.coverage}/coverage.xml" /> + </report> + </emma> + <fail message="One or more junit tests failed" if="junit.failure" /> </sequential> </macrodef> @@ -303,6 +341,39 @@ </sequential> </macrodef> + <!-- Targets for emma support. To run tests with emma enabled, use + ant <test-target> -Demma.enabled=true --> + <path id="emma.taskdef.lib"> + <pathelement location="${emma.dir}/emma-2.0.5312-patched.jar" /> + <pathelement location="${emma.dir}/emma_ant-2.0.5312.jar" /> + </path> + + <taskdef resource="emma_ant.properties" classpathref="emma.taskdef.lib" /> + + <target name="compile.emma" description="Instruments emma classes" unless="emma.compiled"> + <delete dir="${javac.emma.out}" /> + <property name="emma.compiled" value="true" /> + <antcall target="-compile.emma.if.enabled" /> + </target> + + <target name="-compile.emma.if.enabled" description="Instruments emma classes" if="emma.enabled"> + <mkdir dir="${javac.emma.out}" /> + <path id="emma.classpath"> + <pathelement location="${javac.out}" /> + </path> + <emma enabled="${emma.enabled}" > + <instr instrpathref="emma.classpath" destdir="${javac.emma.out}" metadatafile="${javac.emma.out}/metadata.emma" merge="false"> + <filter includes="com.google.*" /> + <filter excludes="${emma.filter.exclude}" /> + </instr> + </emma> + </target> + + <target name="-create.emma.coverage" description="Create the emma coverage directory" if="emma.enabled"> + <delete dir="${test.emma.coverage}" /> + <mkdir dir="${test.emma.coverage}" /> + </target> + <!-- Default implementations of the required targets; projects should override the ones that matter --> <target name="all" depends="verify" /> ======================================= --- /trunk/dev/core/build.xml Tue Aug 4 13:38:44 2009 +++ /trunk/dev/core/build.xml Wed Aug 5 12:55:36 2009 @@ -4,12 +4,10 @@ <import file="${gwt.root}/common.ant.xml" /> <property name="alldeps.jar" location="${project.build}/alldeps.jar" /> - - <fileset id="default.tests" dir="${javac.junit.out}"> - <include name="**/com/google/**/*Test.class" /> - </fileset> - - <target name="compile.tests" depends="build" description="Compiles the test code for this project"> + <property name="gwt.junit.testcase.dev.core.includes" value="**/com/google/**/*Test.class" /> + <property name="gwt.junit.testcase.dev.core.excludes" value="" /> + + <target name="compile.tests" depends="build, compile.emma" description="Compiles the test code for this project"> <mkdir dir="${javac.junit.out}" /> <gwt.javac srcdir="test" destdir="${javac.junit.out}"> <classpath> @@ -190,38 +188,15 @@ </target> <target name="test" depends="build, compile.tests" description="Run unit tests for this project."> - <!-- TODO: refactor gwt.junit so it can be reused here --> - <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"> - <classpath> - <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" /> - <pathelement location="${gwt.tools.antlib}/ant-junit-1.6.5.jar" /> - </classpath> - </taskdef> - - <echo message="Writing test results to ${junit.out}/reports for ${test.cases}" /> - <mkdir dir="${junit.out}/reports" /> - - <echo message="${javac.out} ${javac.junit.out}" /> - <junit dir="${junit.out}" fork="yes" printsummary="yes" haltonfailure="true"> - <classpath> - <pathelement location="test" /> - <pathelement location="${javac.junit.out}" /> - <pathelement location="${javac.out}" /> + <fileset id="tests.dev.core" dir="${javac.junit.out}" includes="${gwt.junit.testcase.dev.core.includes}" excludes="${gwt.junit.testcase.dev.core.excludes}" /> + <gwt.junit test.out="${junit.out}" test.cases="tests.dev.core" > + <extraclasspaths> <pathelement location="${alldeps.jar}" /> - <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" /> <!-- Pull in gwt-dev and gwt-user sources for .gwt.xml files --> <pathelement location="${gwt.root}/user/src/" /> <pathelement location="${gwt.root}/user/super/" /> - <pathelement location="${gwt.root}/dev/core/super" /> - </classpath> - - <formatter type="plain" /> - <formatter type="xml" /> - - <batchtest todir="${junit.out}/reports"> - <fileset refid="default.tests" /> - </batchtest> - </junit> + </extraclasspaths> + </gwt.junit> </target> <target name="clean" description="Cleans this project's intermediate and output files"> ======================================= --- /trunk/tools/api-checker/build.xml Sun Jul 26 17:35:05 2009 +++ /trunk/tools/api-checker/build.xml Wed Aug 5 12:55:36 2009 @@ -1,10 +1,12 @@ <project name="api-checker" default="build" basedir="."> - <property name="gwt.root" location="../.." /> + <property name="gwt.root" location="../.." /> <property name="project.tail" value="tools/api-checker" /> <import file="${gwt.root}/common.ant.xml" /> - <property name="tools.build" value="${gwt.build.out}/${project.tail}" /> + <property name="tools.build" value="${gwt.build.out}/${project.tail}" /> + <property name="gwt.junit.testcase.apichecker.includes" value="**/*Test.class" /> + <property name="gwt.junit.testcase.apichecker.excludes" value="" /> <!-- Platform shouldn't matter here, just picking one --> <property.ensure name="gwt.dev.jar" location="${gwt.build.lib}/gwt-dev-${build.host.platform}.jar" /> @@ -20,7 +22,7 @@ </gwt.javac> </target> - <target name="compile.tests" description="Compiles the test code for this project"> + <target name="compile.tests" depends="compile.emma" description="Compiles the test code for this project"> <mkdir dir="${javac.junit.out}" /> <gwt.javac srcdir="test" destdir="${javac.junit.out}"> <classpath> @@ -42,33 +44,13 @@ </target> <target name="test" depends="build, compile.tests" description="Run unit tests for this project."> - <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"> - <classpath> - <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" /> - <pathelement location="${gwt.tools.antlib}/ant-junit-1.6.5.jar" /> - </classpath> - </taskdef> - - <echo message="Writing test results to ${junit.out}/reports" /> - <mkdir dir="${junit.out}/reports" /> - - <junit dir="${junit.out}" fork="yes" printsummary="yes" haltonfailure="true"> - <sysproperty key="gwt.devjar" value="${gwt.dev.staging.jar}" /> - <classpath> - <pathelement location="test" /> - <pathelement location="${javac.junit.out}" /> + <fileset id="tests.apichecker" dir="${javac.junit.out}" includes="${gwt.junit.testcase.apichecker.includes}" excludes="${gwt.junit.testcase.apichecker.excludes}" /> + <gwt.junit test.out="${junit.out}" test.cases="tests.apichecker" > + <extraclasspaths> <pathelement location="${gwt.build.out}/tools/api-checker/bin"/> <pathelement location="${gwt.dev.jar}" /> - <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" /> - </classpath> - - <formatter type="plain" /> - <formatter type="xml" /> - <batchtest todir="${junit.out}/reports"> - <fileset dir="${javac.junit.out}" - includes="**/*Test.class"/> - </batchtest> - </junit> + </extraclasspaths> + </gwt.junit> </target> <target name="checkstyle" description="Static analysis of source"> ======================================= --- /trunk/user/build.xml Sat Aug 1 18:34:33 2009 +++ /trunk/user/build.xml Wed Aug 5 12:55:36 2009 @@ -3,10 +3,23 @@ <property name="project.tail" value="user" /> <property name="test.args" value="" /> + <!-- BrowserManagerServer_Stub compiled using rmic, which doesn't generate full source code --> + <property name="emma.filter.exclude" value="*BrowserManagerServer_Stub*" /> + <import file="${gwt.root}/common.ant.xml" /> - <property name="gwt.junit.emmatestcase.includes" value="**/*Suite.class,com/google/gwt/dev/jjs/test/*Test.class"/> <property name="test.timeout" value="3" /> + <property name="emma.merged.out" value="${junit.out}/emma-coverage" /> + <property name="gwt.junit.testcase.web.includes" value="${gwt.junit.testcase.includes}" /> + <property name="gwt.junit.testcase.web.excludes" value="" /> + + <!-- CoverageTest.java fails due to a javac bug in sun/OpenJDK's Java. See the file contents for details --> + <property name="gwt.junit.testcase.hosted.emma.includes" value="**/*Suite.class,com/google/gwt/dev/jjs/test/*Test.class" /> + <property name="gwt.junit.testcase.hosted.emma.excludes" value="**/CoverageTest.class,**/CompilerSuite.class" /> + + <!-- Only IFrameLinker actually supports -noserver mode; run the other linker tests if and when they are supported --> + <property name="gwt.junit.testcase.noserver.includes" value="**/IFrameLinkerTest.class" /> + <property name="gwt.junit.testcase.noserver.excludes" value="" /> <!-- Whether I18NSuite should test e.g. Foo$InnerMsgs_fr.properties (if the @@ -14,28 +27,6 @@ --> <property name="gwt.i18n.test.InnerClassChar" value="dollar"/> - <!-- - Default hosted mode test cases - --> - <fileset id="default.hosted.tests" dir="${javac.junit.out}" - includes="${gwt.junit.testcase.includes}" /> - - <fileset id="default.emma.tests" dir="${javac.junit.out}" - includes="**/EmmaClassLoadingTest.class" /> - - <fileset id="default.hosted.emma.tests" dir="${javac.junit.out}" - excludes="**/CoverageTest.class,**/CompilerSuite.class" includes="${gwt.junit.emmatestcase.includes}" /> - <!-- everything succeeds except CoverageTest.java. It fails due to a javac bug in sun/OpenJDK's Java. See the file contents for details --> - - <fileset id="default.noserver.tests" dir="${javac.junit.out}" includes="**/IFrameLinkerTest.class" /> - <!-- Only IFrameLinker actually supports -noserver mode; run the other linker tests if and when they are supported --> - - <!-- - Default web mode test cases - --> - <fileset id="default.web.tests" dir="${javac.junit.out}" - includes="${gwt.junit.testcase.includes}" /> - <!-- Classpaths added for test cases --> @@ -96,7 +87,7 @@ <gwt.ant dir="../dev/core" target="compile.tests" /> </target> - <target name="compile.tests" depends="compile.dev.core.tests" description="Compiles the test code for this project"> + <target name="compile.tests" depends="compile.dev.core.tests, compile.emma" description="Compiles the test code for this project"> <mkdir dir="${javac.junit.out}" /> <gwt.javac srcdir="test" excludes="com/google/gwt/langtest/**" destdir="${javac.junit.out}"> <classpath> @@ -137,7 +128,8 @@ <target name="test.remoteweb" description="Run a remoteweb test at the given host and path" if="gwt.remote.browsers"> <echo message="Performing remote browser testing at ${gwt.remote.browsers}" /> - <gwt.junit test.args="${test.args} -out www -remoteweb ${gwt.remote.browsers} -batch module" test.out="${junit.out}/remoteweb" test.cases="default.web.tests" > + <fileset id="test.remoteweb.tests" dir="${javac.junit.out}" includes="${gwt.junit.testcase.web.includes}" excludes="${gwt.junit.testcase.web.excludes}" /> + <gwt.junit test.args="${test.args} -out www -remoteweb ${gwt.remote.browsers} -batch module" test.out="${junit.out}/remoteweb" test.cases="test.remoteweb.tests" > <extraclasspaths> <path refid="test.extraclasspath" /> </extraclasspaths> @@ -150,7 +142,8 @@ <target name="test.selenium" description="Run a remote test using Selenium RC test at the given host and path" if="gwt.selenium.hosts"> <echo message="Performing remote browser testing using Selenium RC at ${gwt.selenium.hosts}" /> - <gwt.junit test.args="${test.args} -out www -selenium ${gwt.selenium.hosts} -batch module" test.out="${junit.out}/selenium" test.cases="default.web.tests" > + <fileset id="test.selenium.tests" dir="${javac.junit.out}" includes="${gwt.junit.testcase.web.includes}" excludes="${gwt.junit.testcase.web.excludes}" /> + <gwt.junit test.args="${test.args} -out www -selenium ${gwt.selenium.hosts} -batch module" test.out="${junit.out}/selenium" test.cases="test.selenium.tests" > <extraclasspaths> <path refid="test.extraclasspath" /> </extraclasspaths> @@ -158,7 +151,8 @@ </target> <target name="test.hosted.emma" depends="compile, compile.tests" description="Run all hosted-mode tests in emma mode."> - <gwt.junit test.args="${test.args} -batch module" test.out="${junit.out}/${build.host.platform}-hosted-mode-emma" test.cases="default.hosted.emma.tests" > + <fileset id="test.hosted.emma.tests" dir="${javac.junit.out}" includes="${gwt.junit.testcase.hosted.emma.includes}" excludes="${gwt.junit.testcase.hosted.emma.excludes}" /> + <gwt.junit test.args="${test.args} -batch module" test.out="${junit.out}/${build.host.platform}-hosted-mode-emma" test.cases="test.hosted.emma.tests" > <extraclasspaths> <path refid="test.extraclasspath" /> <pathelement location="${gwt.tools.redist}/emma/emma.jar" /> @@ -166,16 +160,25 @@ </gwt.junit> </target> - <target name="test.hosted" depends="compile, compile.tests" description="Run only hosted-mode tests for this project."> - <gwt.junit test.args="${test.args} -batch module" test.out="${junit.out}/${build.host.platform}-hosted-mode" test.cases="default.hosted.tests" > + <target name="test.hosted" depends="compile, compile.tests, -test.hosted.includes" description="Run only hosted-mode tests for this project."> + <property name="gwt.junit.testcase.hosted.includes" value="${gwt.junit.testcase.includes}" /> + <property name="gwt.junit.testcase.hosted.excludes" value="${gwt.junit.testcase.excludes}" /> + <fileset id="test.hosted.tests" dir="${javac.junit.out}" includes="${gwt.junit.testcase.hosted.includes}" excludes="${gwt.junit.testcase.hosted.excludes}" /> + <gwt.junit test.args="${test.args} -batch module" test.out="${junit.out}/${build.host.platform}-hosted-mode" test.cases="test.hosted.tests" > <extraclasspaths> <path refid="test.extraclasspath" /> </extraclasspaths> </gwt.junit> </target> + <target name="-test.hosted.includes" if="emma.enabled"> + <property name="gwt.junit.testcase.hosted.includes" value="${gwt.junit.testcase.hosted.emma.includes}" /> + <property name="gwt.junit.testcase.hosted.excludes" value="${gwt.junit.testcase.hosted.emma.excludes}" /> + </target> + <target name="test.noserver" depends="compile, compile.tests" description="Run noserver hosted-mode tests for this project."> - <gwt.junit test.args="${test.args} -noserver -batch module" test.out="${junit.out}/${build.host.platform}-noserver-mode" test.cases="default.noserver.tests"> + <fileset id="test.noserver.tests" dir="${javac.junit.out}" includes="${gwt.junit.testcase.noserver.includes}" excludes="${gwt.junit.testcase.noserver.excludes}" /> + <gwt.junit test.args="${test.args} -noserver -batch module" test.out="${junit.out}/${build.host.platform}-noserver-mode" test.cases="test.noserver.tests"> <extraclasspaths> <path refid="test.extraclasspath" /> </extraclasspaths> @@ -183,7 +186,8 @@ </target> <target name="test.web" depends="compile, compile.tests" description="Run only web-mode tests for this project."> - <gwt.junit test.args="${test.args} -out www -web -batch module" test.out="${junit.out}/${build.host.platform}-web-mode" test.cases="default.web.tests"> + <fileset id="test.web.tests" dir="${javac.junit.out}" includes="${gwt.junit.testcase.web.includes}" excludes="${gwt.junit.testcase.web.excludes}" /> + <gwt.junit test.args="${test.args} -out www -web -batch module" test.out="${junit.out}/${build.host.platform}-web-mode" test.cases="test.web.tests"> <extraclasspaths> <path refid="test.extraclasspath" /> </extraclasspaths> @@ -201,7 +205,8 @@ </target> <target name="test.web.disableClassMetadata" depends="compile, compile.tests" description="Run only web-mode tests for this project."> - <gwt.junit test.args="${test.args} -XdisableClassMetadata -out www -web" test.out="${junit.out}/${build.host.platform}-web-mode-disableClassMetadata" test.cases="default.web.tests" > + <fileset id="test.web.disableClassMetadata.tests" dir="${javac.junit.out}" includes="${gwt.junit.testcase.web.includes}" excludes="${gwt.junit.testcase.web.excludes}" /> + <gwt.junit test.args="${test.args} -XdisableClassMetadata -out www -web" test.out="${junit.out}/${build.host.platform}-web-mode-disableClassMetadata" test.cases="test.web.disableClassMetadata.tests" > <extraclasspaths> <path refid="test.extraclasspath" /> </extraclasspaths> @@ -209,7 +214,8 @@ </target> <target name="test.web.draft" depends="compile, compile.tests" description="Run only web-mode tests for this project, not batching tests on purpose."> - <gwt.junit test.args="${test.args} -draftCompile -out www -web" test.out="${junit.out}/${build.host.platform}-web-mode-draft" test.cases="default.web.tests" > + <fileset id="test.web.draft.tests" dir="${javac.junit.out}" includes="${gwt.junit.testcase.web.includes}" excludes="${gwt.junit.testcase.web.excludes}" /> + <gwt.junit test.args="${test.args} -draftCompile -out www -web" test.out="${junit.out}/${build.host.platform}-web-mode-draft" test.cases="test.web.draft.tests" > <extraclasspaths> <path refid="test.extraclasspath" /> </extraclasspaths> @@ -218,6 +224,7 @@ <target name="test" depends="compile, compile.tests" description="Run hosted-mode, web-mode, remoteweb, and selenium tests for this project."> <property.ensure name="distro.built" location="${gwt.dev.staging.jar}" message="GWT must be built before performing any tests. This can be fixed by running ant in the ${gwt.root} directory." /> + <property name="emma.compiled" value="true" /> <!-- Run hosted and web mode tests for the platform on which this build @@ -241,6 +248,28 @@ </limit> </target> + <target name="emma.merge" description="Merges coverage data for the entire project"> + <delete dir="${emma.merged.out}" /> + <mkdir dir="${emma.merged.out}" /> + <emma> + <merge outfile="${emma.merged.out}/merged.emma" > + <fileset dir="${junit.out}" > + <include name="**/*.emma" /> + <exclude name="${emma.merged.out}/merged.emma" /> + </fileset> + </merge> + </emma> + <emma> + <report sourcepath="${project.classpath.src}"> + <fileset file="${javac.emma.out}/metadata.emma" /> + <fileset file="${emma.merged.out}/merged.emma" /> + <txt outfile="${emma.merged.out}/coverage.txt" /> + <html outfile="${emma.merged.out}/coverage.html" /> + <xml outfile="${emma.merged.out}/coverage.xml" /> + </report> + </emma> + </target> + <target name="clean" description="Cleans this project's intermediate and output files"> <delete dir="${project.build}" /> <delete file="${project.lib}" /> --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
