[libvirt] [PATCH 14/21] tests: qemuxml2argv: use varargs for CAPS flags

Andrea Bolognani abologna at redhat.com
Tue Mar 19 13:55:26 UTC 2019


On Thu, 2019-03-14 at 10:44 -0400, Cole Robinson wrote:
[...]
> +# define DO_TEST_CAPS_INTERNAL(name, suffix, \
> +                               arch, capsfile, stripmachinealiases, ...) \
>      do { \
>          static struct testInfo info = { \
> -            name, "." suffix, NULL, NULL, -1,\
> -            (flags | FLAG_REAL_CAPS), parseFlags, \
> +            name, "." suffix, NULL, NULL, -1, 0, 0, \
>          }; \
>          if (!(info.qemuCaps = qemuTestParseCapabilitiesArch(virArchFromString(arch), \
>                                                              capsfile))) \
>              return EXIT_FAILURE; \
>          if (stripmachinealiases) \
>              virQEMUCapsStripMachineAliases(info.qemuCaps); \
> +        if (testInfoSetArgs(&info, __VA_ARGS__, ARG_END) < 0) \
> +            return EXIT_FAILURE; \

Since you already have an explicit ARG_END here, it's kinda ugly
that you need another one...

[...]
> +# define DO_TEST_CAPS_ARCH_VER_FULL(name, arch, ver, ...) \
> +    DO_TEST_CAPS_INTERNAL(name, arch "-" ver, \
> +                          arch, TEST_CAPS_PATH ver "." arch ".xml", false, \
> +                          __VA_ARGS__)
>  
>  # define DO_TEST_CAPS_ARCH_VER(name, arch, ver) \
> -    DO_TEST_CAPS_ARCH_VER_FULL(name, 0, 0, arch, ver)
> +    DO_TEST_CAPS_ARCH_VER_FULL(name, arch, ver, ARG_END)

... both here...

[...]
> +# define DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ...) \
> +    DO_TEST_CAPS_INTERNAL(name, arch "-latest", arch, \
> +                          virHashLookup(capslatest, arch), true, \
> +                          __VA_ARGS__)
>  
>  # define DO_TEST_CAPS_ARCH_LATEST(name, arch) \
> -    DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, 0, 0)
> +    DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ARG_END)

... and here, but the underlying macro can't take zero variadic
arguments so there's no way around it I guess...

Reviewed-by: Andrea Bolognani <abologna at redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list