diff options
Diffstat (limited to 'ctdb/tests/scripts')
| -rwxr-xr-x | ctdb/tests/scripts/run_tests | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/ctdb/tests/scripts/run_tests b/ctdb/tests/scripts/run_tests index 8a87859352..5906c42814 100755 --- a/ctdb/tests/scripts/run_tests +++ b/ctdb/tests/scripts/run_tests @@ -18,8 +18,9 @@ EOF ###################################################################### with_summary=false +with_desc=false -temp=$(getopt -n "$prog" -o "xhs" -l help -- "$@") +temp=$(getopt -n "$prog" -o "xdhs" -l help -- "$@") [ $? != 0 ] && usage @@ -28,6 +29,7 @@ eval set -- "$temp" while true ; do case "$1" in -x) set -x; shift ;; + -d) with_desc=true ; shift ;; # 4th line of output is description -s) with_summary=true ; shift ;; --) shift ; break ;; *) usage ;; @@ -43,18 +45,31 @@ summary="" rows=$(if tty -s ; then stty size ; else echo x 80 ; fi | sed -e 's@.* @@' -e 's@^0$@80@') ww=$((rows - 7)) +tf=$(mktemp) + +set -o pipefail + for f; do [ -x $f ] || fail "test \"$f\" is not executable" tests_total=$(($tests_total + 1)) - if ctdb_test_run "$f" ; then + ctdb_test_run "$f" | tee "$tf" + status=$? + if [ $status -eq 0 ] ; then tests_passed=$(($tests_passed + 1)) t="PASSED" else t="FAILED" fi + if $with_desc ; then + f="${f#./}" ; f="${f%%[./]*}" + desc=$(tail -n +4 $tf | head -n 1) + f="${f} ${desc}" + fi summary=$(printf "%s\n%-${ww}s%s" "$summary" "$f" "$t") done +rm -f "$tf" + if $with_summary ; then echo "$summary" echo |
