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

Eric Blake eblake at redhat.com
Sat Jul 9 14:55:36 UTC 2011


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

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110709/7e04506b/attachment-0001.sig>


More information about the libvir-list mailing list