[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>
- [Qemu-devel] [PATCH v5 10/28] qapi: Segregate anonymous unions into alternates in generator, (continued)
- [Qemu-devel] [PATCH v5 08/28] qapi: Better error messages for bad unions, Eric Blake, 2015/03/24
- [Qemu-devel] [PATCH v5 04/28] qapi: Add some enum tests, Eric Blake, 2015/03/24
- [Qemu-devel] [PATCH v5 07/28] qapi: Simplify tests of simple unions, Eric Blake, 2015/03/24
- Re: [Qemu-devel] [PATCH v5 07/28] qapi: Simplify tests of simple unions,
Markus Armbruster <=
- [Qemu-devel] [PATCH v5 09/28] qapi: Prepare for catching more semantic parse errors, Eric Blake, 2015/03/24
- [Qemu-devel] [PATCH v5 12/28] qapi: Introduce 'alternate' to replace anonymous union, Eric Blake, 2015/03/24
- [Qemu-devel] [PATCH v5 13/28] qapi: Add some expr tests, Eric Blake, 2015/03/24