qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 07/28] qapi: Simplify tests of simple unions


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v5 07/28] qapi: Simplify tests of simple unions
Date: Thu, 26 Mar 2015 14:41:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Eric Blake <address@hidden> writes:

> None of the existing QMP or QGA interfaces uses a union with a
> base type but no discriminator; it is easier to avoid this in
> the generator to save room for other future extensions more likely
> to be useful (the previous commit added the test
> union-base-no-discriminator to ensure that we eventually give an
> error message).  Meanwhile, the tests of UserDefNativeListUnion
> serve to validate code generation of simple unions, except that it
> did not have full coverage in the strict test.
>
> Fix some indentation and long lines while at it.
>
> Signed-off-by: Eric Blake <address@hidden>

I figure I'd split this commit into two or three parts

* kill the undocumented "base in simple union" feature

* add the missing tests for UserDefNativeListUnion

* style cleanup, possibly squashed into previous

Your choice.

[...]
> diff --git a/tests/test-qmp-input-strict.c b/tests/test-qmp-input-strict.c
> index d5360c6..53134a1 100644
> --- a/tests/test-qmp-input-strict.c
> +++ b/tests/test-qmp-input-strict.c
[...]
> @@ -232,18 +232,19 @@ static void 
> test_validate_fail_list(TestInputVisitorData *data,
>      qapi_free_UserDefOneList(head);
>  }
>
> -static void test_validate_fail_union(TestInputVisitorData *data,
> -                                      const void *unused)
> +static void test_validate_fail_union_native_list(TestInputVisitorData *data,
> +                                                 const void *unused)
>  {
> -    UserDefUnion *tmp = NULL;
> +    UserDefNativeListUnion *tmp = NULL;
>      Error *err = NULL;
>      Visitor *v;
>
> -    v = validate_test_init(data, "{ 'type': 'b', 'data' : { 'integer': 42 } 
> }");
> +    v = validate_test_init(data,
> +                           "{ 'type': 'integer', 'data' : [ \"string\" ] }");

Everywhere else we use ' instead of \".  Not worth a respin on its own,
clean up on top then.

>
> -    visit_type_UserDefUnion(v, &tmp, NULL, &err);
> +    visit_type_UserDefNativeListUnion(v, &tmp, NULL, &err);
>      g_assert(err);
> -    qapi_free_UserDefUnion(tmp);
> +    qapi_free_UserDefNativeListUnion(tmp);
>  }
>
>  static void test_validate_fail_union_flat(TestInputVisitorData *data,
[...]

Reviewed-by: Markus Armbruster <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]