qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: marcandre.lureau@redhat.com, qemu-devel@nongnu.org,
	ehabkost@redhat.com, Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v7 05/18] qapi: Test for various name collisions
Date: Thu, 1 Oct 2015 07:10:33 -0600	[thread overview]
Message-ID: <560D30C9.1000209@redhat.com> (raw)
In-Reply-To: <87twqa24e5.fsf@blackfin.pond.sub.org>

[-- Attachment #1: Type: text/plain, Size: 3018 bytes --]

On 10/01/2015 05:51 AM, Markus Armbruster wrote:

>> +++ b/tests/qapi-schema/alternate-clash.json
>> @@ -1,3 +1,8 @@
>> -# we detect C enum collisions in an alternate
>> +# Alternate branch name collision
>> +# Reject an alternate that would result in a collision in generated C
>> +# names (this would try to generate two enum values 'ALT1_KIND_A_B').
>> +# TODO: In the future, if alternates are simplified to not generate
>> +# the implicit Alt1Kind enum, we would still have a collision with the
>> +# resulting C union trying to have two members named 'a_b'.
>>  { 'alternate': 'Alt1',
>> -  'data': { 'one': 'str', 'ONE': 'int' } }
>> +  'data': { 'a-b': 'str', 'a_b': 'int' } }
> 
> Ah, you're making the test slightly more robust.  Works for me.

I just noticed we lack coverage for:

{ 'alternate': 'Alt', 'data': { 'type': 'int', 'other': 'str' } }

(tries to create a C struct with two members named 'type', even after my
v5 patches change to a simpler 'qtype_code type'). Can be done in my
later patches that simplify alternates if we don't want a v8 spin of
this part of the series.


>> +++ b/tests/qapi-schema/flat-union-clash-type.json
>> @@ -0,0 +1,15 @@
>> +# Flat union branch 'type'
>> +# FIXME: this triggers an assertion failure. But even with that fixed, we
>> +# would have a clash in generated C, between the outer tag 'type' and
> 
> "outer tag"?  I guess you mean the member type we inherit from Base.

Yes.


>> +++ b/tests/qapi-schema/flat-union-cycle.json
>> @@ -0,0 +1,8 @@
>> +# Ensure that we have a sane error message for attempts at self-inheritance
>> +# This test currently fails because we don't permit a union base, but
>> +# even if we relax things to allow that in the future (see
>> +# flat-union-base-union), self-inheritance should still fail.
> 
> Do we have a test for the simpler case of a struct inheriting from
> itself?

Not here, but in v5 16/46. That's because it asserts, but while it was
easy to fix up in the QAPISchema.check(), I did not find it worth the
churn to fix it up in the ad hoc parse code just to rip it back out
later, and the QAPISchema.check() code requires several scaffolding
patches (so it wasn't as easy as fixing the union 'type' clash asserts).
 Tracking an assertion failure for any more than one patch at a time is
horrible (as any other change to qapi.py changes line numbers that
affect the assertion failure).

> 
> I believe us merging struct and union types into a single object type is
> more likely than us implementing union bases.  If I'm correct, we won't
> need this test.

Maybe, but even then, we still have to decide if a base object can have
variants.

> 
> Found nothing that couldn't be touched up on commit.

Your suggestions for wording tweaks are fine; I'm okay if you want to
tweak it for your pull request instead of asking me for a v8.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2015-10-01 13:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-29 22:20 [Qemu-devel] [PATCH v7 00/18] post-introspection cleanups, subset A Eric Blake
2015-09-29 22:20 ` [Qemu-devel] [PATCH v7 01/18] qapi: Sort qapi-schema tests Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 02/18] qapi: Improve 'include' error message Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 03/18] qapi: Invoke exception superclass initializer Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 04/18] qapi: Clean up qapi.py per pep8 Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 05/18] qapi: Test for various name collisions Eric Blake
2015-10-01  3:30   ` Eric Blake
2015-10-01 12:57     ` Markus Armbruster
2015-10-01 11:51   ` Markus Armbruster
2015-10-01 13:10     ` Eric Blake [this message]
2015-10-01 15:34       ` Markus Armbruster
2015-10-01 15:41         ` Eric Blake
2015-10-01 17:39           ` Markus Armbruster
2015-10-01 18:51             ` Eric Blake
2015-10-01 20:27               ` Markus Armbruster
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 06/18] qapi: Avoid assertion failure on union 'type' collision Eric Blake
2015-10-01 12:10   ` Markus Armbruster
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 07/18] qapi: Add tests for empty unions Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 08/18] qapi: Test use of 'number' within alternates Eric Blake
2015-10-05 22:45   ` Eric Blake
2015-10-06  7:24     ` Markus Armbruster
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 09/18] qapi: Reuse code for flat union base validation Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 10/18] qapi: Consistent generated code: prefer error 'err' Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 11/18] qapi: Consistent generated code: prefer visitor 'v' Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 12/18] qapi: Consistent generated code: prefer common labels Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 13/18] qapi: Consistent generated code: prefer common indentation Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 14/18] qapi: Consistent generated code: minimize push_indent() usage Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 15/18] qapi: Share gen_err_check() Eric Blake
2015-10-01 12:40   ` Markus Armbruster
2015-10-01 13:01     ` Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 16/18] qapi: Share gen_visit_fields() Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [RFC PATCH v7 17/18] qapi: Simplify gen_visit_fields() error handling Eric Blake
2015-10-01 12:49   ` Markus Armbruster
2015-09-29 22:21 ` [Qemu-devel] [RFC PATCH v7 18/18] qapi: Use gen_err_check() in more places Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=560D30C9.1000209@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).