Retrieve tests XML file only if tests did not crash

This commit is contained in:
Gautier Pelloux-Prayer 2015-02-04 14:40:02 +01:00
parent 5600abf72e
commit d6faa507eb

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="linphone-tester">
<project name="linphone-tester" xmlns:unless="ant:unless">
<target name="test">
<property name="output.file" value="./tests.output" />
<!-- Possible values for test.size are small or large -->
@ -17,32 +17,35 @@
</exec>
<exec executable="bash">
<arg value="-c"/>
<!-- use 'tee' command to write in file AND on stdout.
First is used below to check if tests failed or not while second
is used to get output in real time -->
<!-- use 'tee' command to write in file AND to stdout.
First is used below to check if tests failed or not
while second is used to get output in real time -->
<arg value="adb shell am instrument -r -w -e size ${test.size} org.linphone.test/com.zutubi.android.junitreport.JUnitReportTestRunner | tee ${output.file}"/>
</exec>
<exec executable="bash" >
<arg value="-c" />
<arg value="kill `cat adb.pid`" />
</exec>
<exec executable="bash">
<condition property="has.crashed" >
<resourcecontains resource="${output.file}" substring="Process crashed" />
</condition>
<exec executable="bash" unless:set="has.crashed">
<arg value="-c"/>
<arg value="adb shell run-as org.linphone cat /data/data/org.linphone/files/junit-report.xml > linphone-junit-report-${test.size}.xml"/>
</exec>
<zip destfile="${archive.name}.zip">
<fileset dir="." includes="${archive.name}"/>
</zip>
<antcall target="check-for-crash"/>
<fail message="Tests failed">
<condition>
<resourcecontains resource="${output.file}" substring="FAILURES" />
</condition>
</fail>
<condition property="has.crashed" >
<resourcecontains resource="${output.file}" substring="Process crashed" />
</condition>
<antcall target="check-for-crash"/>
<delete file="${archive.name}"/>
<delete file="${output.file}"/>
</target>