Initial import of binutils 2.22 on the new vendor branch
[dragonfly.git] / contrib / lvm2 / dist / test / harness.sh
1 #!/bin/sh
2
3 tests="$@"
4 test -z "$tests" && tests=`echo t-*.sh`
5
6 for 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
26 done
27
28 if 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
38 else
39     echo "All tests passed."
40 fi