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