[libvirt] [PATCH 1/8] tests: Introduce testQemuDataInit() and testQemuDataReset()

Peter Krempa pkrempa at redhat.com
Wed Mar 13 08:44:10 UTC 2019


On Thu, Mar 07, 2019 at 16:44:30 +0100, Andrea Bolognani wrote:
> These functions don't do anything too interesting right now,
> but will be extended significantly later on.

The state after all patches applied does not really look "significant"

> 
> Signed-off-by: Andrea Bolognani <abologna at redhat.com>
> ---
>  tests/qemucapabilitiestest.c | 25 ++++++++++++++++++++++---
>  tests/qemucaps2xmltest.c     | 16 ++++++++++++++++
>  2 files changed, 38 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c
> index 8d47133e6f..882fa57485 100644
> --- a/tests/qemucapabilitiestest.c
> +++ b/tests/qemucapabilitiestest.c
> @@ -40,6 +40,23 @@ struct _testQemuData {
>  };
>  
>  
> +static int
> +testQemuDataInit(testQemuDataPtr data)
> +{
> +    if (qemuTestDriverInit(&data->driver) < 0)
> +        return -1;
> +
> +    return 0;
> +}
> +
> +
> +static void
> +testQemuDataReset(testQemuDataPtr data)
> +{
> +    qemuTestDriverFree(&data->driver);
> +}
> +
> +
>  static int
>  testQemuCaps(const void *opaque)
>  {
> @@ -164,12 +181,14 @@ mymain(void)
>      return EXIT_AM_SKIP;
>  #endif
>  
> -    if (virThreadInitialize() < 0 ||
> -        qemuTestDriverInit(&data.driver) < 0)
> +    if (virThreadInitialize() < 0)
>          return EXIT_FAILURE;
>  
>      virEventRegisterDefaultImpl();
>  
> +    if (testQemuDataInit(&data) < 0)
> +        return EXIT_FAILURE;
> +
>  #define DO_TEST(arch, name) \
>      do { \
>          data.archName = arch; \
> @@ -227,7 +246,7 @@ mymain(void)
>       * "tests/qemucapsfixreplies foo.replies" to fix the replies ids.
>       */
>  
> -    qemuTestDriverFree(&data.driver);
> +    testQemuDataReset(&data);
>  
>      return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
>  }
> diff --git a/tests/qemucaps2xmltest.c b/tests/qemucaps2xmltest.c
> index 0d9b4e679a..5cc9fb635b 100644
> --- a/tests/qemucaps2xmltest.c
> +++ b/tests/qemucaps2xmltest.c
> @@ -32,6 +32,17 @@ struct _testQemuData {
>      const char *archName;
>  };
>  
> +static int
> +testQemuDataInit(testQemuDataPtr data ATTRIBUTE_UNUSED)
> +{
> +    return 0;
> +}
> +
> +static void
> +testQemuDataReset(testQemuDataPtr data ATTRIBUTE_UNUSED)
> +{
> +}

This function is never touched again in this series.

> +
>  static virQEMUCapsPtr
>  testQemuGetCaps(char *caps)
>  {
> @@ -176,6 +187,9 @@ mymain(void)
>  
>      virEventRegisterDefaultImpl();
>  
> +    if (testQemuDataInit(&data) < 0)
> +        return EXIT_FAILURE;
> +
>  #define DO_TEST(arch, name) \
>      data.archName = arch; \
>      data.base = name; \
> @@ -220,6 +234,8 @@ mymain(void)
>      DO_TEST("riscv64", "caps_3.0.0");
>      DO_TEST("riscv64", "caps_4.0.0");
>  
> +    testQemuDataReset(&data);
> +
>      return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
>  }
>  
> -- 
> 2.20.1
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- 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/25fab172/attachment-0001.sig>


More information about the libvir-list mailing list