[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 01/25] qapi: Tighten QAPISchemaFOO.check() assertions
From: |
Eric Blake |
Subject: |
Re: [PATCH 01/25] qapi: Tighten QAPISchemaFOO.check() assertions |
Date: |
Tue, 24 Sep 2019 09:39:31 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 9/24/19 8:28 AM, Markus Armbruster wrote:
> When we introduced the QAPISchema intermediate representation (commit
> ac88219a6c7), we took a shortcut: we left check_exprs() & friends
> alone instead of moving semantic checks into the
> QAPISchemaFOO.check(). check_exprs() still checks and reports errors,
> and the .check() assert check_exprs() did the job. There are a few
> gaps, though.
>
> QAPISchemaArrayType.check() neglects to assert the element type is not
> an array. Add the assertion.
>
> QAPISchemaObjectTypeVariants.check() neglects to assert the tag member
> is not optional. Add the assertion.
>
> It neglects to assert the tag member is not conditional. Add the
> assertion.
>
> It neglects to assert we actually have variants. Add the assertion.
>
> It asserts the variants are object types, but neglects to assert they
> don't have variants. Tighten the assertion.
>
> QAPISchemaObjectTypeVariants.check_clash() has the same issue.
> However, it can run only after .check(). Delete the assertion instead
> of tightening it.
>
> QAPISchemaAlternateType.check() neglects to assert the branch types
> don't conflict. Fixing that isn't trivial, so add just a TODO comment
> for now. It'll be resolved later in this series.
I'm guessing you found these by deleting check_exprs() and seeing what
failed due to inadequate .check()
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> scripts/qapi/common.py | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [PATCH 00/25] qapi: Pay back some frontend technical debt, Markus Armbruster, 2019/09/24
- [PATCH 01/25] qapi: Tighten QAPISchemaFOO.check() assertions, Markus Armbruster, 2019/09/24
- Re: [PATCH 01/25] qapi: Tighten QAPISchemaFOO.check() assertions,
Eric Blake <=
- [PATCH 03/25] qapi: New QAPISourceInfo, replacing dict, Markus Armbruster, 2019/09/24
- [PATCH 02/25] qapi: Rename .owner to .defined_in, Markus Armbruster, 2019/09/24
- [PATCH 10/25] qapi: Use check_name_str() where it suffices, Markus Armbruster, 2019/09/24