[libvirt] [PATCH v2 7/7] tests: Use virBitmap for qemu command line caps

Eric Blake eblake at redhat.com
Tue Feb 22 17:50:53 UTC 2011


On 02/22/2011 09:48 AM, Jiri Denemark wrote:
> This needs to be squashed into the previous patch but is provided
> separately for easier review.
> 
> ---
> Notes:
>     Version 2:
>     - rebased to current master
> 
>  src/qemu/qemu_capabilities.c |   14 +
>  src/qemu/qemu_capabilities.h |    2 +
>  tests/qemuhelptest.c         |  729 +++++++++++++++++++++---------------------
>  tests/qemuxml2argvtest.c     |  470 ++++++++++++++--------------
>  4 files changed, 619 insertions(+), 596 deletions(-)

Agree that this should be squashed in with the previous patch, but the
separation did make for a nicer review.

> +static void printMismatchedFlags(virBitmapPtr got,
> +                                 virBitmapPtr expect)
>  {
>      int i;
>  
> -    for (i = 0 ; i < (sizeof(got)*CHAR_BIT) ; i++) {
> -        unsigned long long gotFlag = (got & (1LL << i));
> -        unsigned long long expectFlag = (expect & (1LL << i));
> +    for (i = 0 ; i < QEMU_CAPS_LAST ; i++) {
> +        bool gotFlag = qemuCapsGet(got, i);
> +        bool expectFlag = qemuCapsGet(expect, i);
>          if (gotFlag && !expectFlag)
>              fprintf(stderr, "Extra flag %i\n", i);

Hmm - debugging this will now be slightly harder.  Before, "extra flag
37" meant looking for (1LL << 37) in qemu_capabilities.h, but now we
need to count 37 lines.  Perhaps you should amend the change in
qemu_capabilities.h to preserve the integer numbering of each capability:

+    QEMU_CAPS_KQEMU = 0,          /* Whether KQEMU is compiled in */
+    QEMU_CAPS_VNC_COLON = 1,      /* Does the VNC take just port, or
address + display */

ACK with that nit fixed.

-- 
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/20110222/d2f3a7df/attachment-0001.sig>


More information about the libvir-list mailing list