mirror of
https://github.com/samba-team/samba.git
synced 2025-03-22 02:50:28 +03:00
Test suite: add a -d option to the run_tests script.
This causes summary lines (when used with -s) to be pretty printed and include the test description. This is the 4th line of the test output - that is, immediately after the header. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 0e5cc2a58b0d38e10a2ef9e81dc887c20f3fbdcb)
This commit is contained in:
parent
82d59bbc8e
commit
eae91c959e
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user