[libvirt] 1/3 testsuite formatting bugs [was: [PATCH] Skip some xen tests if xend is not running]

Matthias Bolte matthias.bolte at googlemail.com
Sat Jul 9 08:44:37 UTC 2011


2011/7/9 Eric Blake <eblake at redhat.com>:
> On 07/08/2011 07:40 PM, Eric Blake wrote:
>>>
>>> Instead count from 0 to 39 to fix this.
>>> ---
>>>  tests/test-lib.sh |    6 +++---
>>>  1 files changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/tests/test-lib.sh b/tests/test-lib.sh
>>> index 768f96b..9eb6864 100644
>>> --- a/tests/test-lib.sh
>>> +++ b/tests/test-lib.sh
>>> @@ -54,9 +54,9 @@ test_final()
>>>    status=$2
>>>
>>>    if test "$verbose" = "0" ; then
>>> -    mod=`expr \( $counter + 1 \) % 40`
>>> -    if test "$mod" != "0" && test "$mod" != "1" ; then
>>> -      for i in `seq $mod 40`
>>> +    mod=`expr $counter % 40`
>>> +    if test "$mod" != "0" ; then
>>> +      for i in `seq $mod 39`
>>
>> seq is a GNU-ism, but this is no less portable than what it was before.
>>  (To be portable to platforms that lack seq, this should really be
>> written as:
>>
>> for i in 0 1 2 3 4 ... 39
>
> Why iterate in the first place?
>
> +    if test "$mod" != "0" ; then
> +      for i in `seq $mod 39`
>       do
>         printf " "
>
> can portably be replaced by:
>
> printf "%${len}s" ""
>
> with len computed via expr.

Yes, that approach is nicer and also the logic it a bit simpler. Here's a v2.

-- 
Matthias Bolte
http://photron.blogspot.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-tests-Fix-compressed-test-output-padding-logic_v2.patch
Type: text/x-diff
Size: 1387 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110709/152b1aaa/attachment-0001.bin>


More information about the libvir-list mailing list