diff options
author | Jim Meyering <meyering@redhat.com> | 2010-03-24 09:05:27 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-03-24 09:23:01 +0100 |
commit | ca7db6cb8000cc283fcee7899140d2fc892b0296 (patch) | |
tree | d260953db3d8f737687ea424ea38d3675c5361b0 /tests/test-lib.sh | |
parent | tests: Don't add extra padding if counter mod 40 is 0 (diff) | |
download | libvirt-ca7db6cb8000cc283fcee7899140d2fc892b0296.tar.gz libvirt-ca7db6cb8000cc283fcee7899140d2fc892b0296.tar.bz2 libvirt-ca7db6cb8000cc283fcee7899140d2fc892b0296.zip |
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.
Diffstat (limited to 'tests/test-lib.sh')
-rw-r--r-- | tests/test-lib.sh | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/test-lib.sh b/tests/test-lib.sh index 57fd43893..28b830eb3 100644 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -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 |