diff options
-rw-r--r-- | lib.sh | 35 | ||||
-rwxr-xr-x | run | 22 | ||||
-rw-r--r-- | tasks/initdb_old/config.sh | 2 |
3 files changed, 57 insertions, 2 deletions
@@ -3,6 +3,8 @@ . `dirname $BASH_SOURCE`/lib_pgsql.sh +dtf_die() { echo >&2 "$@"; exit 1; } + dtf_generate_results_tarball() { local dir=$(dirname $1) @@ -19,3 +21,36 @@ dtf_generate_results_tarball() export DTF_RESULT_TARBALL=$tarball } + +dtf_resultxml_cache() +{ + ___dtf_resultxml_cache+="$@ +" +} + +dtf_resultxml_init() +{ + ___dtf_resultxml_cache="" + ___dtf_resultxml_file="$1" + dtf_resultxml_cache "<run><date>`date --rfc-3339=seconds`</date>" + + if test ! -f "$___dtf_resultxml_file"; then + echo '<?xml version="1.0" encoding="utf-8"?>' > "$___dtf_resultxml_file" \ + || dtf_die "can not create '$___dtf_resultxml_file'" + fi +} + +dtf_resultxml_task_result() +{ + local id="$1" + local desc="$2" + local result="$3" +} + +dtf_resultxml_finish() +{ + dtf_resultxml_cache "</run>" + + echo "$___dtf_resultxml_cache" >> "$___dtf_resultxml_file" \ + || dtf_die "can not write to $___dtf_resultxml_file" +} @@ -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 diff --git a/tasks/initdb_old/config.sh b/tasks/initdb_old/config.sh index f04f7ba..2386677 100644 --- a/tasks/initdb_old/config.sh +++ b/tasks/initdb_old/config.sh @@ -1,4 +1,4 @@ DTF_TEST_ID="initdb-old-syntax" -DESCRIPTION="\ +DTF_TEST_DESCRIPTION="\ Check that the old syntax 'postgresql-setup initdb' works together with following 'service start postgresql'." |