tests: shell script portability and clean-up

* tests/test-lib.sh: "echo -n" is not portable.  Use printf instead.
Remove unnecessary uses of "eval-in-subshell" (subshell is sufficient).
Remove uses of tests' -a operator; it is not portable.
Instead, use "test cond && test cond2".
* tests/schematestutils.sh: Replace use of test's -a.
This commit is contained in:
Jim Meyering 2010-03-24 09:05:27 +01:00
parent 8a7783c163
commit ca7db6cb80
2 changed files with 11 additions and 11 deletions

View File

@ -21,7 +21,7 @@ do
ret=$?
test_result $n $(basename $(dirname $xml))"/"$(basename $xml) $ret
if test "$verbose" = "1" -a $ret != 0 ; then
if test "$verbose" = "1" && test $ret != 0 ; then
echo -e "$cmd\n$result"
fi
if test "$ret" != 0 ; then

View File

@ -19,7 +19,7 @@ test_intro()
name=$1
if test "$verbose" = "0" ; then
echo "TEST: $name"
echo -n " "
printf " "
fi
}
@ -29,15 +29,15 @@ test_result()
name=$2
status=$3
if test "$verbose" = "0" ; then
mod=`eval "expr \( $counter - 1 \) % 40"`
if test "$counter" != 1 -a "$mod" = 0 ; then
printf " %-3d\n" `eval "expr $counter - 1"`
echo -n " "
mod=`expr \( $counter + 40 - 1 \) % 40`
if test "$counter" != 1 && test "$mod" = 0 ; then
printf " %-3d\n" `expr $counter - 1`
printf " "
fi
if test "$status" = "0" ; then
echo -n "."
printf "."
else
echo -n "!"
printf "!"
fi
else
if test "$status" = "0" ; then
@ -54,11 +54,11 @@ test_final()
status=$2
if test "$verbose" = "0" ; then
mod=`eval "expr \( $counter + 1 \) % 40"`
if test "$mod" != "0" -a "$mod" != "1" ; then
mod=`expr \( $counter + 1 \) % 40`
if test "$mod" != "0" && test "$mod" != "1" ; then
for i in `seq $mod 40`
do
echo -n " "
printf " "
done
fi
if test "$status" = "0" ; then