Skip to content

Commit 41858d4

Browse files
committed
build: fail build if tests fail
This will allow all tests for a given sub-project to finish, but will abort the rest of the build. Previously the build would finish successfully even if there were test failures. Issue: #144 Signed-off-by: Tony Germano <tony@germano.name>
1 parent 8e1bf74 commit 41858d4

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎client/ant-build.xml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@
359359
<mkdirdir="${code-coverage-reports}" />
360360

361361
<jacoco:coveragedestfile="${code-coverage-reports}/jacoco.exec"xmlns:jacoco="antlib:org.jacoco.ant"exclclassloader="sun.reflect.DelegatingClassLoader:javassist.Loader" >
362-
<junithaltonfailure="false"fork="true"forkmode="once">
362+
<junithaltonfailure="false"failureproperty="test.failed"errorproperty="test.failed"fork="true"forkmode="once">
363363
<jvmargvalue="-Xms128m" />
364364
<jvmargvalue="-Xmx2048m" />
365365
<!-- https://stackoverflow.com/questions/54205486 -->
@@ -376,6 +376,8 @@
376376
</batchtest>
377377
</junit>
378378
</jacoco:coverage>
379+
380+
<failif="test.failed"message="Unit tests failed. Check reports for details."/>
379381
</target>
380382

381383
<targetname="remove-classes"depends="init">

‎command/build.xml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
<mkdirdir="${code-coverage-reports}" />
9999

100100
<jacoco:coveragedestfile="${code-coverage-reports}/jacoco.exec"xmlns:jacoco="antlib:org.jacoco.ant"exclclassloader="sun.reflect.DelegatingClassLoader:javassist.Loader" >
101-
<junithaltonfailure="false"fork="true"forkmode="once">
101+
<junithaltonfailure="false"failureproperty="test.failed"errorproperty="test.failed"fork="true"forkmode="once">
102102
<jvmargvalue="-Xms128m" />
103103
<jvmargvalue="-Xmx2048m" />
104104
<!-- https://stackoverflow.com/questions/54205486 -->
@@ -115,5 +115,7 @@
115115
</batchtest>
116116
</junit>
117117
</jacoco:coverage>
118+
119+
<failif="test.failed"message="Unit tests failed. Check reports for details."/>
118120
</target>
119121
</project>

‎donkey/build.xml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
<mkdirdir="${code-coverage-reports}" />
9898

9999
<jacoco:coveragedestfile="${code-coverage-reports}/jacoco.exec"xmlns:jacoco="antlib:org.jacoco.ant"exclclassloader="sun.reflect.DelegatingClassLoader:javassist.Loader" >
100-
<junithaltonfailure="false"fork="true"forkmode="once">
100+
<junithaltonfailure="false"failureproperty="test.failed"errorproperty="test.failed"fork="true"forkmode="once">
101101
<jvmargvalue="-Xms128m" />
102102
<jvmargvalue="-Xmx2048m" />
103103
<!-- https://stackoverflow.com/questions/54205486 -->
@@ -114,6 +114,8 @@
114114
</batchtest>
115115
</junit>
116116
</jacoco:coverage>
117+
118+
<failif="test.failed"message="Unit tests failed. Check reports for details."/>
117119
</target>
118120

119121
<targetname="remove-classes"depends="init">

‎server/build.xml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,7 @@
13171317
<mkdirdir="${junit-html}" />
13181318

13191319
<jacoco:coveragedestfile="${code-coverage-reports}/jacoco.exec"xmlns:jacoco="antlib:org.jacoco.ant"exclclassloader="sun.reflect.DelegatingClassLoader:javassist.Loader" >
1320-
<junithaltonfailure="false"fork="true"forkmode="once">
1320+
<junithaltonfailure="false"failureproperty="test.failed"errorproperty="test.failed"fork="true"forkmode="once">
13211321
<jvmargvalue="-Xms128m" />
13221322
<jvmargvalue="-Xmx2048m" />
13231323
<!-- https://stackoverflow.com/questions/54205486 -->
@@ -1356,6 +1356,8 @@
13561356
</fileset>
13571357
<reportformat="frames"todir="${junit-html}" />
13581358
</junitreport>
1359+
1360+
<failif="test.failed"message="Unit tests failed. Check reports for details."/>
13591361
</target>
13601362

13611363
<targetname="remove-classes"depends="init">

0 commit comments

Comments
 (0)