xref: /dragonfly/contrib/lvm2/dist/test/harness.sh (revision c37c9ab3)
1#!/bin/sh
2
3tests="$@"
4test -z "$tests" && tests=`echo t-*.sh`
5
6for t in $tests; do
7    printf "Running %-40s" "$t ..."
8    out=`bash ./$t 2>&1`
9    ret=$?
10    if test $ret = 0; then
11	echo " passed."
12    elif test $ret = 200; then
13        skipped="$skipped $t"
14	echo " skipped."
15    else
16	echo " FAILED!"
17	len=`echo $t | wc -c`
18	# fancy formatting...
19	printf -- "--- Output: $t -"
20	for i in `seq $(($len + 14)) 78`; do echo -n "-"; done; echo
21	printf "%s\n" "$out"
22	printf -- "--- End: $t ----"
23	for i in `seq $(($len + 14)) 78`; do echo -n "-"; done; echo
24	failed="$failed $t"
25    fi
26done
27
28if test -n "$failed"; then
29    echo "Tests skipped:"
30    for t in $skipped; do
31	printf "\t%s\n" $t
32    done
33    echo "TESTS FAILED:"
34    for t in $failed; do
35	printf "\t%s\n" $t
36    done
37    exit 1
38else
39    echo "All tests passed."
40fi
41