[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 15:42:18 UTC 2011
2011/7/9 Eric Blake <eblake at redhat.com>:
> 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
More information about the libvir-list
mailing list