Bläddra i källkod

ZOOKEEPER-2682: Make it optional to fail build on test failure

Author: Mohammad Arshad <arshad@apache.org>

Reviewers: Rakesh Radhakrishnan <rakeshr@apache.org>

Closes #163 from arshadmohammad/ZOOKEEPER-2682-master-branch-3.5
Mohammad Arshad 8 år sedan
förälder
incheckning
ee5615d31f
1 ändrade filer med 7 tillägg och 2 borttagningar
  1. 7 2
      build.xml

+ 7 - 2
build.xml

@@ -89,6 +89,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
     <property name="test.junit.threads" value="1" />
     <property name="test.junit.threads" value="1" />
     <property name="test.junit.printsummary" value="yes" />
     <property name="test.junit.printsummary" value="yes" />
     <property name="test.junit.haltonfailure" value="no" />
     <property name="test.junit.haltonfailure" value="no" />
+    <property name="test.junit.failbuild.ontestfailure" value="true" />
     <property name="config.dir" value="${src.dir}/java/test/config" />
     <property name="config.dir" value="${src.dir}/java/test/config" />
     <property name="test.junit.maxmem" value="512m" />
     <property name="test.junit.maxmem" value="512m" />
     <property name="test.quick" value="no" />
     <property name="test.quick" value="no" />
@@ -1208,6 +1209,10 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
             <fileset refid="testcase.files" />
             <fileset refid="testcase.files" />
           </batchtest>
           </batchtest>
         </junit>
         </junit>
+        <antcall target="fail.build.on.test.failure"/>
+    </target>
+
+    <target name="fail.build.on.test.failure" if="${test.junit.failbuild.ontestfailure}" >
         <fail if="tests.failed">Tests failed!</fail>
         <fail if="tests.failed">Tests failed!</fail>
     </target>
     </target>
 
 
@@ -1234,7 +1239,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
             <fileset refid="testcase.files" />
             <fileset refid="testcase.files" />
           </batchtest>
           </batchtest>
         </junit>
         </junit>
-        <fail if="tests.failed">Tests failed!</fail>
+        <antcall target="fail.build.on.test.failure"/>
     </target>
     </target>
 
 
     <target name="check-cppunit-configure" depends="init" >
     <target name="check-cppunit-configure" depends="init" >
@@ -1477,7 +1482,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
                 <fileset dir="${test.src.dir}" includes="**/${testcase}.java"/>
                 <fileset dir="${test.src.dir}" includes="**/${testcase}.java"/>
             </batchtest>
             </batchtest>
         </junit>
         </junit>
-        <fail if="tests.failed">Tests failed!</fail>
+        <antcall target="fail.build.on.test.failure"/>
     </target>
     </target>
 
 
     <target name="cobertura-report" depends="cobertura-test">
     <target name="cobertura-report" depends="cobertura-test">