summaryrefslogtreecommitdiffstats
path: root/run
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2014-10-03 09:14:36 +0200
committerPavel Raiskup <praiskup@redhat.com>2014-10-03 09:24:36 +0200
commit9656d604846e3a67e6e045fca0e2a04e96e93e93 (patch)
tree70ae34c8420d543378dc53bcedbdd3c2c2d8fbd5 /run
parent3a60df60e73c23730210f3706233d74597034148 (diff)
downloadpostgresql-setup-tests-9656d604846e3a67e6e045fca0e2a04e96e93e93.tar.gz
postgresql-setup-tests-9656d604846e3a67e6e045fca0e2a04e96e93e93.tar.xz
postgresql-setup-tests-9656d604846e3a67e6e045fca0e2a04e96e93e93.zip
library/run: structured output in xml
Generate xml output easily parse-able by xsltproc. * lib.sh (dtf_resultxml_init, dtf_resultxml_finish, dtf_resultxml_cache, dtf_die): New functions. * run.sh: Include lib.sh globally. * run.sh (run): Reuse new lib api. * tasks/initdb_old/config.sh: Typo: use DTF_TEST_DESCRIPTION.
Diffstat (limited to 'run')
-rwxr-xr-xrun22
1 files changed, 21 insertions, 1 deletions
diff --git a/run b/run
index ae97a5b..f4d8444 100755
--- a/run
+++ b/run
@@ -6,11 +6,15 @@ export dtf_resultdir=${dtf_resultdir_override-/var/tmp/dtf}
export dtf_srcdir=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
export dtf_testdir=${dtf_testdir-$dtf_srcdir}
+export dtf_resultxml_file=/var/tmp/dtf.xml
+
export dtf_option_verbose=0
export dtf_option_force=0
export dtf_option_testids=""
export dtf_option_listonly=0
+. $dtf_srcdir/lib.sh
+
## F.DEFS ##
info()
@@ -32,6 +36,15 @@ run()
export dtf_workdir=$1
export dtf_test_id=`basename $dtf_workdir`
+ dtf_resultxml_cache "$( cd $dtf_workdir
+ . ./config.sh
+ echo "<test>"
+ echo "<id>$DTF_TEST_ID</id>"
+ echo "<description>"
+ echo "$DTF_TEST_DESCRIPTION"
+ echo "</description>"
+ )"
+
( cd $dtf_workdir
outlog="$dtf_resultdir/$dtf_test_id.log"
@@ -41,7 +54,8 @@ run()
&& output_wrapper="tee $outlog"
test ! -e ./config.sh -o ! -e ./config.sh \
- && echo "can not find one of {config,runtest}.sh"
+ && echo "can not find one of {config,runtest}.sh" \
+ && exit 1
. ./config.sh
@@ -142,10 +156,16 @@ done
test $dtf_option_listonly -ne 1 && prepare_resultdir
+dtf_resultxml_init "$dtf_resultxml_file"
result=0
for i in `find $dtf_testdir -name runtest.sh`; do
testdir=`dirname $i`
run $testdir || result=1
+
+ test $result -eq 0 \
+ && dtf_resultxml_cache "<result>Success</result></test>" \
+ || dtf_resultxml_cache "<result>Fail</result></test>"
done
+dtf_resultxml_finish
exit $result