diff options
Diffstat (limited to 'tests/qapi-schema/test-qapi.py')
-rw-r--r-- | tests/qapi-schema/test-qapi.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py index ac43d3458e..67e417e298 100644 --- a/tests/qapi-schema/test-qapi.py +++ b/tests/qapi-schema/test-qapi.py @@ -11,13 +11,18 @@ # from __future__ import print_function -from qapi import * -from pprint import pprint -import os import sys +from qapi.common import QAPIError, QAPISchema, QAPISchemaVisitor class QAPISchemaTestVisitor(QAPISchemaVisitor): + + def visit_module(self, name): + print('module %s' % name) + + def visit_include(self, name, info): + print('include %s' % name) + def visit_enum_type(self, name, info, values, prefix): print('enum %s %s' % (name, values)) if prefix: @@ -54,7 +59,13 @@ class QAPISchemaTestVisitor(QAPISchemaVisitor): for v in variants.variants: print(' case %s: %s' % (v.name, v.type.name)) -schema = QAPISchema(sys.argv[1]) + +try: + schema = QAPISchema(sys.argv[1]) +except QAPIError as err: + print(err, file=sys.stderr) + exit(1) + schema.visit(QAPISchemaTestVisitor()) for doc in schema.docs: |