Changeset 7068 in josm for trunk/build.xml


Ignore:
Timestamp:
2014-05-06T01:24:41+02:00 (5 years ago)
Author:
Don-vip
Message:

test cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r7063 r7068  
    199199    </target>
    200200    <target name="compile" depends="init,javacc">
    201         <!-- COTS -->
     201        <!-- COTS -->
    202202        <javac srcdir="src" includes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**" nowarn="on"
    203                 destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="iso-8859-1">
     203            destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="iso-8859-1">
    204204            <!-- get rid of "internal proprietary API" warning -->
    205                 <compilerarg value="-XDignore.symbol.file"/>
     205            <compilerarg value="-XDignore.symbol.file"/>
    206206        </javac>
    207207        <!-- JMapViewer/JOSM -->
    208208        <javac srcdir="src" excludes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java"
    209                 destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
     209            destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
    210210            <compilerarg value="-Xlint:cast"/>
    211211            <compilerarg value="-Xlint:deprecation"/>
     
    261261        <pathelement path="tools/groovy-all-2.2.2.jar"/>
    262262    </path>
     263    <macrodef name="init-test-preferences">
     264        <attribute name="testfamily"/>
     265        <sequential>
     266            <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
     267            <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
     268            <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
     269                <!-- Works only on Windows, does nothing on Unix -->
     270                <attrib file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" readonly="true"/>
     271            <!-- Works only on Unix, does nothing on Windows -->
     272                <chmod file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" perm="a-w"/>
     273        </sequential>
     274    </macrodef>
    263275    <target name="test-init">
    264276        <mkdir dir="${test.dir}/build"/>
     277        <mkdir dir="${test.dir}/build/unit"/>
     278        <mkdir dir="${test.dir}/build/functional"/>
     279        <mkdir dir="${test.dir}/build/performance"/>
    265280        <mkdir dir="${test.dir}/report"/>
     281        <init-test-preferences testfamily="unit"/>
     282        <init-test-preferences testfamily="functional"/>
     283        <init-test-preferences testfamily="performance"/>
    266284    </target>
    267285    <target name="test-clean">
     
    269287        <delete dir="${test.dir}/report"/>
    270288        <delete file="${test.dir}/jacoco.exec" />
    271     </target>
     289        <delete file="${test.dir}/config/unit-josm.home/preferences.xml" />
     290        <delete file="${test.dir}/config/functional-josm.home/preferences.xml" />
     291        <delete file="${test.dir}/config/performance-josm.home/preferences.xml" />
     292        <delete dir="${test.dir}/config/unit-josm.home/cache" failonerror="false"/>
     293        <delete dir="${test.dir}/config/functional-josm.home/cache" failonerror="false"/>
     294        <delete dir="${test.dir}/config/performance-josm.home/cache" failonerror="false"/>
     295    </target>
     296    <macrodef name="call-groovyc">
     297        <attribute name="testfamily"/>
     298        <element name="cp-elements"/>
     299        <sequential>
     300            <groovyc srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}" encoding="UTF-8">
     301                <classpath>
     302                    <cp-elements/>
     303                </classpath>
     304                <javac target="1.7" source="1.7" debug="on">
     305                    <compilerarg value="-Xlint:all"/>
     306                    <compilerarg value="-Xlint:-serial"/>
     307                </javac>
     308            </groovyc>
     309        </sequential>
     310    </macrodef>
    272311    <target name="test-compile" depends="test-init,dist">
    273312        <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="tools/groovy-all-2.2.2.jar"/>
    274         <groovyc classpathref="test.classpath" destdir="${test.dir}/build" encoding="UTF-8">
    275                 <src path="${test.dir}/unit"/>
    276             <src path="${test.dir}/functional"/>
    277             <src path="${test.dir}/performance"/>
    278                 <javac target="1.7" source="1.7" debug="on">
    279                 <compilerarg value="-Xlint:all"/>
    280                 <compilerarg value="-Xlint:-serial"/>
    281                 </javac>
    282         </groovyc>
    283     </target>
    284     <target name="test" depends="test-compile">
     313        <call-groovyc testfamily="unit">
     314            <cp-elements>
     315                <path refid="test.classpath"/>
     316            </cp-elements>
     317        </call-groovyc>
     318        <call-groovyc testfamily="functional">
     319            <cp-elements>
     320                <path refid="test.classpath"/>
     321                <pathelement path="${test.dir}/build/unit"/>
     322            </cp-elements>
     323        </call-groovyc>
     324        <call-groovyc testfamily="performance">
     325            <cp-elements>
     326                <path refid="test.classpath"/>
     327                <pathelement path="${test.dir}/build/unit"/>
     328            </cp-elements>
     329        </call-groovyc>
     330    </target>
     331    <macrodef name="call-junit">
     332        <attribute name="testfamily"/>
     333        <sequential>
     334            <echo message="Running @{testfamily} tests with JUnit"/>
     335            <jacoco:coverage destfile="${test.dir}/jacoco.exec">
     336                <junit printsummary="yes" fork="true" forkmode="once">
     337                    <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
     338                    <sysproperty key="josm.test.data" value="${test.dir}/data"/>
     339                    <sysproperty key="java.awt.headless" value="true"/>
     340                    <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
     341                    <classpath>
     342                        <path refid="test.classpath"/>
     343                        <pathelement path="${test.dir}/build/unit"/>
     344                        <pathelement path="${test.dir}/build/@{testfamily}"/>
     345                        <pathelement path="${test.dir}/config"/>
     346                    </classpath>
     347                    <formatter type="plain"/>
     348                    <formatter type="xml"/>
     349                    <batchtest fork="yes" todir="${test.dir}/report">
     350                        <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test.class"/>
     351                    </batchtest>
     352                </junit>
     353            </jacoco:coverage>
     354        </sequential>
     355    </macrodef>
     356    <target name="test" depends="test-compile"
     357        description="Run unit, functional and performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
    285358        <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="tools/jacocoant.jar" />
    286         <jacoco:coverage destfile="${test.dir}/jacoco.exec">
    287             <junit printsummary="yes" fork="true" forkmode="once">
    288                 <sysproperty key="josm.home" value="${test.dir}/config/unit-josm.home"/>
    289                 <sysproperty key="josm.test.data" value="${test.dir}/data"/>
    290                 <sysproperty key="java.awt.headless" value="true"/>
    291                 <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
    292                 <classpath>
    293                     <path refid="test.classpath"/>
    294                     <pathelement path="${test.dir}/build"/>
    295                     <pathelement path="${test.dir}/config"/>
    296                 </classpath>
    297                 <formatter type="plain"/>
    298                 <formatter type="xml"/>
    299                 <batchtest fork="yes" todir="${test.dir}/report">
    300                     <fileset dir="${test.dir}/build" includes="**/*Test.class"/>
    301                 </batchtest>
    302             </junit>
    303         </jacoco:coverage>
     359        <call-junit testfamily="unit"/>
     360        <call-junit testfamily="functional"/>
     361        <call-junit testfamily="performance"/>
    304362    </target>
    305363    <target name="test-html" depends="test" description="Generate HTML test reports">
Note: See TracChangeset for help on using the changeset viewer.