[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC v4 05/32] tests/qapi-schema: Convert test ha
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH RFC v4 05/32] tests/qapi-schema: Convert test harness to QAPISchemaVisitor |
Date: |
Mon, 07 Sep 2015 09:10:27 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Eric Blake <address@hidden> writes:
> On 09/03/2015 08:29 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>
>> Reviewed-by: Eric Blake <address@hidden>
>> ---
>
>> +++ b/tests/qapi-schema/test-qapi.py
>> @@ -15,11 +15,35 @@ from pprint import pprint
>> import os
>> import sys
>>
>> -try:
>> - exprs = QAPISchema(sys.argv[1]).get_exprs()
>> -except SystemExit:
>> - raise
>
> Don't we still need a try wrapped around...
>
>> +schema = QAPISchema(sys.argv[1])
>> +schema.visit(QAPISchemaTestVisitor())
>
> ...this, to guarantee non-zero exit status if an exception caused by
> refactoring breaks the pretty-printing? (It happened to me when I tried
> to rename to _tag_name, and my only indication that something was wrong
> was that qapi-tests/qapi-schema-test.out was truncated due to this
> script aborting early after trying to access the old spelling tag_name).
The new version doesn't catch exceptions, and uncaught exceptions
terminate the program unsucsessfully. Anything wrong with that?
The old version hides exceptions other than SystemExit. Why? I believe
it's mostly historical accident. Accidents mostly cause by me.
I created the file in commit 9862657. I wrapped parse_schema() in a
misguided attempt to keep the .err files concise:
try:
exprs = parse_schema(sys.stdin)
except:
print >>sys.stderr, "Crashed:", sys.exc_info()[0]
exit(1)
This misreported errors as crashes, so I amended it in commit 2caba36:
try:
exprs = parse_schema(sys.stdin)
except SystemExit:
raise
except:
print >>sys.stderr, "Crashed:", sys.exc_info()[0]
exit(1)
LluĂs then ripped out the original misguided blanket exception catching,
but left in the amend (commit 98c1200):
try:
exprs = parse_schema(sys.stdin)
except SystemExit:
raise
- [Qemu-devel] [PATCH RFC v4 31/32] qapi-introspect: Map all integer types to 'int', (continued)
- [Qemu-devel] [PATCH RFC v4 31/32] qapi-introspect: Map all integer types to 'int', Markus Armbruster, 2015/09/03
- [Qemu-devel] [PATCH RFC v4 25/32] qapi: Improve built-in type documentation, Markus Armbruster, 2015/09/03
- [Qemu-devel] [PATCH RFC v4 28/32] qapi-schema: Fix up misleading specification of netdev_add, Markus Armbruster, 2015/09/03
- [Qemu-devel] [PATCH RFC v4 17/32] Revert "qapi: Generate comments to simplify splitting for review", Markus Armbruster, 2015/09/03
- [Qemu-devel] [PATCH RFC v4 16/32] qapi: Generate comments to simplify splitting for review, Markus Armbruster, 2015/09/03
- [Qemu-devel] [PATCH RFC v4 05/32] tests/qapi-schema: Convert test harness to QAPISchemaVisitor, Markus Armbruster, 2015/09/03
- [Qemu-devel] [PATCH RFC v4 21/32] qapi-commands: Rearrange code, Markus Armbruster, 2015/09/03
- [Qemu-devel] [PATCH RFC v4 26/32] qapi: Introduce a first class 'any' type, Markus Armbruster, 2015/09/03
- [Qemu-devel] [PATCH RFC v4 24/32] qapi-commands: De-duplicate output marshaling functions, Markus Armbruster, 2015/09/03
- [Qemu-devel] [PATCH RFC v4 32/32] qapi-introspect: Hide type names, Markus Armbruster, 2015/09/03
- [Qemu-devel] [PATCH RFC v4 27/32] qom: Don't use 'gen': false for qom-get, qom-set, object-add, Markus Armbruster, 2015/09/03
- [Qemu-devel] [PATCH RFC v4 22/32] qapi: Rename qmp_marshal_input_FOO() to qmp_marshal_FOO(), Markus Armbruster, 2015/09/03
- [Qemu-devel] [PATCH RFC v4 29/32] qapi: Pseudo-type '**' is now unused, drop it, Markus Armbruster, 2015/09/03