From f0e3aae770431b243403d74cf4d90bd7b673f319 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Mon, 27 Oct 2014 14:03:24 +0100 Subject: tester/run: fix exit status handling * tester/run: Define 0, 1 and 2 exit status. Also handle SKIP test-case exit status. --- tester/run | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tester/run b/tester/run index eab6b90..2aa9835 100755 --- a/tester/run +++ b/tester/run @@ -1,5 +1,8 @@ #!/bin/bash +# This script exits with exit status 0 (success), 1 (failure), 2 (cant finish +# testing). + ### test case return codes ### # basic error codes @@ -23,6 +26,7 @@ srcdir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) || exit $DTF_RESULT_TS_CONFIG export DTF_LIBDIR=${DTF_LIBDIR-$srcdir/libdtf} export DTF_TASKS=${DTF_TASKS-$srcdir/tasks} export DTF_RESULTDIR=${DTF_RESULTDIR-/var/tmp/dtf} +export DTF_RESULTS_YML=${DTF_RESULTDIR}/result.yml # when exists per-testsuite config.sh, source it here test -r "$srcdir/config.sh" && . "$srcdir/config.sh" @@ -46,7 +50,8 @@ info() die() { echo "$@" >&2 - exit $DTF_RESULT_TS_CONFIG + echo "exit_status: 2" >> "$DTF_RESULTS_YML" + exit 2 } dist() @@ -200,6 +205,8 @@ done test $dtf_option_listonly -ne 1 && prepare_resultdir + +date -u "+date: \"%Y%m%d_%H%M%S_UTC\"" > "$DTF_RESULTS_YML" result=0 while read i; do testdir=$(dirname "$i") @@ -208,6 +215,9 @@ while read i; do $DTF_RESULT_SUCCES) echo "[ OK ]" ;; + $DTF_RESULT_EXP_FAILURE) + echo "[ EXP_FAIL ]" + ;; $DTF_RESULT_TS_SKIP) ;; $DTF_RESULT_SKIP) @@ -223,4 +233,6 @@ while read i; do esac done <<<"$(find "$DTF_TASKS" -name runtest.sh)" +echo "exit_status: $result" >> "$DTF_RESULTS_YML" + exit $result -- cgit