qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v8 05/26] tests/qapi-schema: Convert test harnes


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v8 05/26] tests/qapi-schema: Convert test harness to QAPISchemaVisitor
Date: Thu, 17 Sep 2015 09:49:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Eric Blake <address@hidden> writes:

> On 09/16/2015 05:06 AM, Markus Armbruster wrote:
>> The old code prints the result of parsing (list of expression
>> dictionaries), and partial results of semantic analysis (list of enum
>> dictionaries, list of struct dictionaries).
>> 
>> The new code prints a trace of a schema visit, i.e. what the back-ends
>> are going to use.  Built-in and array types are omitted, because
>> they're boring.
>> 
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>
>> +class QAPISchemaTestVisitor(QAPISchemaVisitor):
>> +    def visit_enum_type(self, name, info, values, prefix):
>> +        print 'enum %s %s prefix=%s' % (name, values, prefix)
>> +
>> +    def visit_object_type(self, name, info, base, members, variants):
>> +        print 'object %s' % name
>> +        if base:
>> +            print '    base %s' % base.name
>
> For consistency with other visitors, I might have done:
>
> if prefix:
>     print '    prefix %s' % prefix
>
> instead of printing prefix=None for most enums.  In particular,
>
>> +enum EnumOne ['value1', 'value2', 'value3'] prefix=None
>> +object EventStructOne
>> + member struct1: UserDefOne optional=False
>> + member string: str optional=False
>> + member enum2: EnumOne optional=True
>> +object NestedEnumsOne
>> + member enum1: EnumOne optional=False
>> + member enum2: EnumOne optional=True
>> + member enum3: EnumOne optional=False
>> + member enum4: EnumOne optional=True
>> +enum QEnumTwo ['value1', 'value2'] prefix=QENUM_TWO
>
> the fact that prefix=None and prefix=QENUM_TWO doesn't offer any visual
> clues on whether the string was user-supplied, means that the following
> would result in ambiguous output:
>  { 'enum':'Foo', 'prefix':'None', 'data':[] }

No big deal.  But avoiding it is no big deal, either.  I'll give it a
try.

> But it's not necessarily a strong enough reason for a respin.
>
> Reviewed-by: Eric Blake <address@hidden>

Thanks!



reply via email to

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