tests: provide a simple way to extract the tests data from run

If the RUN_OUTPUT_FILE environment variable is set, "run" will output
to the file indicated by that snippets of XML with the results and
outputs of the tests run.

Together with the run-xml-to-junit.sh (and its associated
run-xml-to-junit.xsl style sheet) it is possible to convert that output
file to a jUnit-like XML file, which could be used in CI systems.
This commit is contained in:
Pino Toscano
2014-03-14 10:37:36 +01:00
parent accf1b66aa
commit 38fbda9d37
3 changed files with 73 additions and 0 deletions

8
run.in
View File

@@ -260,5 +260,13 @@ else
cat $tmpout
echo "$b/run: command failed with exit code $fail"
fi
if [ -n "$RUN_OUTPUT_FILE" ]; then
testname=`echo "$1" | sed -e 's,^./,,g'`
echo "<test rescode=\"$fail\" name=\"$testname\" time=\"$(($end_t - $start_t))\">" >> $RUN_OUTPUT_FILE
echo "<![CDATA[" >> $RUN_OUTPUT_FILE
cat $tmpout >> $RUN_OUTPUT_FILE
echo "]]>" >> $RUN_OUTPUT_FILE
echo "</test>" >> $RUN_OUTPUT_FILE
fi
rm -f $tmpout
exit $fail