[libvirt] [PATCH 5/8] tests: Move code from DO_TEST() to doCapsTest()

Peter Krempa pkrempa at redhat.com
Wed Mar 13 08:49:01 UTC 2019


On Thu, Mar 07, 2019 at 16:44:34 +0100, Andrea Bolognani wrote:
> This removes the awkard escaping and will allow us to perform
> some interesting refactoring later on.
> 
> Signed-off-by: Andrea Bolognani <abologna at redhat.com>
> ---
>  tests/qemucapabilitiestest.c | 40 +++++++++++++++++++++++++-----------
>  tests/qemucaps2xmltest.c     | 28 ++++++++++++++++++-------
>  2 files changed, 49 insertions(+), 19 deletions(-)
> 
> diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c
> index 222ac05d79..b4ed081d3e 100644
> --- a/tests/qemucapabilitiestest.c
> +++ b/tests/qemucapabilitiestest.c
> @@ -176,6 +176,32 @@ testQemuCapsCopy(const void *opaque)
>  }
>  
>  
> +static int
> +doCapsTest(const char *base,
> +           const char *archName,
> +           testQemuDataPtr data)
> +{
> +    VIR_AUTOFREE(char *) title = NULL;
> +    VIR_AUTOFREE(char *) copyTitle = NULL;
> +
> +    if (virAsprintf(&title, "%s (%s)", base, archName) < 0 ||
> +        virAsprintf(&copyTitle, "copy %s (%s)", base, archName) < 0) {
> +        return -1;
> +    }

Single line body.

> +
> +    data->base = base;
> +    data->archName = archName;
> +
> +    if (virTestRun(title, testQemuCaps, data) < 0)
> +        data->ret = -1;
> +
> +    if (virTestRun(copyTitle, testQemuCapsCopy, data) < 0)
> +        data->ret = -1;
> +
> +    return 0;
> +}

ACK

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190313/f8f1c6f6/attachment-0001.sig>


More information about the libvir-list mailing list