Applied change for bug 330531: [releng] No test results when test fails
https://bugs.eclipse.org/bugs/show_bug.cgi?id=330531
diff --git a/releng/org.eclipse.rap.releng/runtime/customTargets.xml b/releng/org.eclipse.rap.releng/runtime/customTargets.xml
index 1c086a1..eb3f6b5 100755
--- a/releng/org.eclipse.rap.releng/runtime/customTargets.xml
+++ b/releng/org.eclipse.rap.releng/runtime/customTargets.xml
@@ -59,11 +59,7 @@
   <!-- Steps to do after the build is done. -->
   <!-- ===================================================================== -->
   <target name="postBuild">
-    <antcall target="gatherLogs" />
-    <antcall target="assembleTarget" />
-    <antcall target="test" />
-    <antcall target="publish" />
-    <antcall target="tidyup" />
+    <antcall target="finish" />
   </target>
 
   <target name="assembleTarget">
@@ -75,8 +71,7 @@
     <!-- checks if ICU base is available and fail otherwise -->
     <pathconvert property="icuBaseAvailable" setonempty="false" pathsep=" ">
       <path>
-        <fileset dir="${baseLocation}/plugins"
-          includes="com.ibm.icu.base*" />
+        <fileset dir="${baseLocation}/plugins" includes="com.ibm.icu.base*" />
       </path>
     </pathconvert>
     <fail unless="icuBaseAvailable" message="ICU base is not available in base platform." />
@@ -92,7 +87,7 @@
   <!-- ===================================================================== -->
   <!-- Steps to do to test the build results -->
   <!-- ===================================================================== -->
-  <target name="test">
+  <target name="runTests">
     <property name="src.tests" value="${buildDirectory}/plugins/org.eclipse.rap.rwt.test/" />
     <property name="host.tests" value="${buildDirectory}/plugins/org.eclipse.rap.rwt.test/@dot" />
     <property name="fragment.tests" value="${buildDirectory}/plugins/org.eclipse.rap.rwt.q07.test/@dot" />
@@ -106,7 +101,7 @@
       <pathelement location="${forms.tests}" />
       <pathelement location="${themes.tests}" />
       <fileset dir="${buildDirectory}/${buildLabel}/target/eclipse/plugins">
-        <include name="**/*.jar"/>
+        <include name="**/*.jar" />
       </fileset>
       <pathelement path="${buildDirectory}/plugins/org.eclipse.rap.rwt/lib/org.w3c.css.sac_1.3.jar" />
       <pathelement path="${buildDirectory}/plugins/org.eclipse.rap.rwt.testfixture/@dot" />
@@ -115,15 +110,15 @@
       <pathelement path="${buildDirectory}/plugins/org.eclipse.rap.design.example/@dot" />
       <pathelement path="${buildDirectory}/plugins/org.eclipse.rap.rwt.test/lib/resource_manager_test.jar" />
       <fileset dir="${baseLocation}/plugins">
-          <include name="org.junit_3*/junit.jar"/>
+        <include name="org.junit_3*/junit.jar" />
       </fileset>
       <pathelement path="${buildDirectory}/plugins/org.eclipse.rap.ui.forms/@dot" />
     </path>
+
     <!-- run rwt tests -->
-    <junit printsummary="yes" haltonfailure="yes" fork="yes" forkmode="perTest">
+    <junit printsummary="yes" failureproperty="test.failed" fork="yes" forkmode="perTest">
       <classpath refid="cp" />
       <formatter type="xml" />
-
       <batchtest fork="yes" todir="${reports.tests}">
         <fileset dir="${host.tests}">
           <include name="**/*_Test.class" />
@@ -134,21 +129,11 @@
         <fileset dir="${forms.tests}">
           <include name="**/*_Test.class" />
         </fileset>
-      	<fileset dir="${themes.tests}">
-      	  <include name="**/*_Test.class" />
-      	</fileset>
+        <fileset dir="${themes.tests}">
+          <include name="**/*_Test.class" />
+        </fileset>
       </batchtest>
     </junit>
-
-    <!-- create a report -->
-    <mkdir dir="${buildDirectory}/${buildLabel}/reports" />
-    <mkdir dir="${buildDirectory}/${buildLabel}/reports/html" />
-    <junitreport todir="${buildDirectory}/${buildLabel}/reports">
-      <fileset dir="${reports.tests}">
-        <include name="TEST-*.xml" />
-      </fileset>
-      <report format="frames" todir="${buildDirectory}/${buildLabel}/reports/html" />
-    </junitreport>
   </target>
 
   <!-- ===================================================================== -->
@@ -168,21 +153,20 @@
         <include name="*runtime*.zip" />
       </fileset>
     </copy>
-    
+
     <!-- copy test results -->
     <copy todir="${buildOuputDirectory}/tests">
-      <fileset dir="${fBuildLocation}/reports/html"></fileset>
-    </copy>
-
-    <!-- copy raw test results -->
-    <copy todir="${buildOuputDirectory}/testsraw">
-      <fileset dir="${reports.tests}"></fileset>
+      <fileset dir="${reports.tests}" />
     </copy>
   </target>
 
   <target name="tidyup">
-    <delete defaultexcludes="false" includeEmptyDirs="true" dir="${buildDirectory}" />
-    <echo>Deleting all working resources</echo>
+    <echo message="Deleting all working resources" />
+    <delete dir="${buildDirectory}" includeEmptyDirs="true" defaultexcludes="false" />
+  </target>
+
+  <target name="finish" depends="gatherLogs,assembleTarget,runTests,publish,tidyup">
+    <fail if="test.failed" message="Test failed" />
   </target>
 
   <!-- ===================================================================== -->