Changeset 14141 in josm


Ignore:
Timestamp:
2018-08-12T13:43:24+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #16601 - test targets: add "-hardfail" variants which will abort with an error code on failure (patch by ris)

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/.travis.yml

    r14052 r14141  
    11language: java
    2 script: (eval "$ANT_INVOCATION $(test $TRAVIS_JDK_VERSION = openjdk8 && echo -DnoJavaFX=true) test")
     2script: (eval "$ANT_INVOCATION $(test $TRAVIS_JDK_VERSION = openjdk8 && echo -DnoJavaFX=true) test-unit-hardfail")
    33os: linux
    44dist: trusty
  • trunk/build.xml

    r14136 r14141  
    507507            <jacoco:coverage destfile="${test.dir}/jacoco@{testITsuffix}.exec" enabled="@{coverage}" includes="${jacoco.includes}"
    508508                inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}">
    509                 <junit printsummary="yes" fork="true" forkmode="once">
     509                <junit printsummary="yes" fork="true" forkmode="once" failureproperty="test.@{testfamily}@{testITsuffix}.failed">
    510510                    <jvmarg value="-Dfile.encoding=UTF-8"/>
    511511                    <jvmarg value="-javaagent:${test.dir}/lib/jmockit-1.41.jar"/>
     
    559559        <call-junit testfamily="functional"/>
    560560    </target>
     561    <target name="test-hardfail" depends="test" description="Run 'test' target but abort if tests failed">
     562        <fail message="'test' failed">
     563            <condition>
     564                <or>
     565                    <isset property="test.unit.failed"/>
     566                    <isset property="test.functional.failed"/>
     567                </or>
     568            </condition>
     569        </fail>
     570    </target>
     571    <target name="test-unit" depends="test-compile" unless="test-unit.notRequired"
     572        description="Run unit tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
     573        <call-junit testfamily="unit"/>
     574    </target>
     575    <target name="test-unit-hardfail" depends="test-unit" description="Run 'test-unit' target but abort if tests failed">
     576        <fail message="'test-unit' failed" if="test.unit.failed"/>
     577    </target>
    561578    <target name="test-it" depends="test-compile" unless="test-it.notRequired"
    562579        description="Run integration tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
     
    564581        <call-junit testfamily="functional" testITsuffix="IT"/>
    565582    </target>
     583    <target name="test-it-hardfail" depends="test-it" description="Run 'test-it' target but abort if tests failed">
     584        <fail message="'test-it' failed">
     585            <condition>
     586                <or>
     587                    <isset property="test.unitIT.failed"/>
     588                    <isset property="test.functionalIT.failed"/>
     589                </or>
     590            </condition>
     591        </fail>
     592    </target>
    566593    <target name="test-perf" depends="test-compile" unless="test-perf.notRequired"
    567594        description="Run performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
    568595        <call-junit testfamily="performance" coverage="false"/>
     596    </target>
     597    <target name="test-perf-hardfail" depends="test-perf" description="Run 'test-perf' target but abort if tests failed">
     598        <fail message="'test-perf' failed" if="test.performance.failed"/>
    569599    </target>
    570600    <target name="test-html" depends="test, test-it, test-perf" description="Generate HTML test reports">
Note: See TracChangeset for help on using the changeset viewer.