diff options
Diffstat (limited to 'lib.sh')
-rw-r--r-- | lib.sh | 35 |
1 files changed, 35 insertions, 0 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" +} |