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
<mkdir dir="${code-coverage-reports}" />
360360

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

381383
<target name="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
<mkdir dir="${code-coverage-reports}" />
9999

100100
<jacoco:coverage destfile="${code-coverage-reports}/jacoco.exec" xmlns:jacoco="antlib:org.jacoco.ant" exclclassloader="sun.reflect.DelegatingClassLoader:javassist.Loader" >
101-
<junit haltonfailure="false" fork="true" forkmode="once">
101+
<junit haltonfailure="false" failureproperty="test.failed" errorproperty="test.failed" fork="true" forkmode="once">
102102
<jvmarg value="-Xms128m" />
103103
<jvmarg value="-Xmx2048m" />
104104
<!-- https://stackoverflow.com/questions/54205486 -->
@@ -115,5 +115,7 @@
115115
</batchtest>
116116
</junit>
117117
</jacoco:coverage>
118+
119+
<fail if="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
<mkdir dir="${code-coverage-reports}" />
9898

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

119121
<target name="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
<mkdir dir="${junit-html}" />
13181318

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

13611363
<target name="remove-classes" depends="init">

0 commit comments

Comments
 (0)