Files
libguestfs/tests/run-xml-to-junit.sh
Pino Toscano 38fbda9d37 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.
2014-03-14 13:52:09 +01:00

25 lines
414 B
Bash
Executable File

#!/bin/sh
if [ $# -lt 2 ]; then
echo "$0: output-of-run destination-xml"
exit 1
fi
set -e
infile=$1
outfile=$2
owndir=`dirname $0`
ownname=`basename $0`
tmpfile=`mktemp --tmpdir $ownname.XXXXXXXXXX`
(
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<tests>';
cat $infile;
echo '</tests>'
) > $tmpfile
xsltproc --encoding UTF-8 $owndir/run-xml-to-junit.xsl $tmpfile > $outfile
unlink $tmpfile