liblinphone_tester: do not retrieve xml result file if crash occured

This commit is contained in:
Gautier Pelloux-Prayer 2015-02-23 09:30:00 +01:00
parent e66022b1dc
commit 375eec05ac

View file

@ -12,21 +12,20 @@
</exec> </exec>
</target> </target>
<target name="test"> <target name="test">
<property name="output.file" value="./tests.output" /> <property name="output.file" value="./tests.output" />
<tstamp> <tstamp>
<format property="archive.name" <format property="archive.name" pattern="'liblinphonetester_'yyyyMMdd_HHmmss" />
pattern="'liblinphonetester_'yyyyMMdd_HHmmss" /> </tstamp>
</tstamp> <echo>Adb log files are put in ${archive.name}.zip</echo>
<echo>Adb log files are put in ${archive.name}.zip</echo>
<exec executable="adb" > <exec executable="adb" >
<arg value="logcat" /> <arg value="logcat" />
<arg value="-c" /> <arg value="-c" />
</exec> </exec>
<exec executable="./adb-log-start.sh" > <exec executable="./adb-log-start.sh" >
<arg value=" ${archive.name}" /> <arg value=" ${archive.name}" />
</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 on 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 while second
@ -37,25 +36,29 @@
<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" >
<or>
<resourcecontains resource="${output.file}" substring="Process crashed" />
<resourcecontains resource="${output.file}" substring="Native crash" />
</or>
</condition>
<exec executable="bash" unless:set="has.crashed">
<arg value="-c"/> <arg value="-c"/>
<arg value="adb shell run-as org.linphone.tester cat /data/data/org.linphone.tester/files/junit-report.xml > liblinphone-junit-report.xml"/> <arg value="adb shell run-as org.linphone.tester cat /data/data/org.linphone.tester/files/junit-report.xml > liblinphone-junit-report.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" >
<or>
<resourcecontains resource="${output.file}" substring="Process crashed" />
<resourcecontains resource="${output.file}" substring="Native crash" />
</or>
</condition>
<antcall target="check-for-crash"/>
<delete file="${archive.name}"/> <delete file="${archive.name}"/>
<delete file="${output.file}"/> <delete file="${output.file}"/>
</target> </target>