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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/7/9 Eric Blake <eblake@xxxxxxxxxx>:
> On 07/09/2011 07:27 AM, Eric Blake wrote:
>>>
>>> Also seq isn't portable. Therefore, calculate the correct padding
>>> length directly and use printf to output it at once.
>>> ---
>>>  tests/test-lib.sh |    9 ++-------
>>>  1 files changed, 2 insertions(+), 7 deletions(-)
>>
>> ACK.
>
> On second thought, for the case where ($counter % 40 == 0), we want 40
> spaces if $counter is 0, but 0 spaces if $counter is positive.  I think
> we need a slight tweak.  Rather than:
>
> +    len=`expr 40 - \( $counter % 40 \)`
>
> how about:
>
> if test $counter = 0; then
>  len=40
> else
>  len=`expr 39 - \( \( $counter - 1 \) % 40 \)`
> fi

True, the current expression doesn't work for counter = 40. You're
expression fixed this, but no reason for special casing 0 here, as
modulo on negative values is perfectly fine and yields the right
result here

  expr 39 - \( \( 0 - 1 \) % 40 \) is 40

ACK, to you're equation (but without special casing 0) as I already
pushed my patch.

-- 
Matthias Bolte
http://photron.blogspot.com

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]