1 # Common helper routines for test shell scripts
2 # -- intended to be sourced by them
7 echo "Test $0 SKIP ($WHY)"
11 # portable implementation of 'which' utility
22 if [ -f "$D/$PROG" ] && [ -x "$D/$PROG" ]; then
23 printf '%s\n' "$D/$PROG"
32 if [ -z "$(findprog $1)" ]; then
33 test_skip "missing $1"
37 # Some stuff for doing silly progress indicators
40 test -t 1 || return 0 # supress progress meter if non-interactive
44 RANGE="$(expr $LAST - $FIRST ||:)"
45 PROG="$(expr $THIS - $FIRST ||:)"
46 # this automatically rounds to nearest integer
47 PERC="$(expr 100 \* $PROG / $RANGE ||:)"
48 # note \r so next update will overwrite
49 printf "%3d%%\r" $PERC
54 test -t 1 || return 0 # supress progress meter if non-interactive