diff options
author | Markus Armbruster <armbru@redhat.com> | 2021-03-23 10:40:04 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2021-03-23 22:29:37 +0100 |
commit | dbfe3c7c289c6b95a920b4e2a178e583c17c62a8 (patch) | |
tree | 6be7de08ba3bbd26d6fec0524ee6fc0933d2ae09 /tests | |
parent | 73c40b07c6fffcb2725f4c9d3f361967e39aef97 (diff) |
qapi: Fix to reject optional members with reserved names
check_type() fails to reject optional members with reserved names,
because it neglects to strip off the leading '*'. Fix that.
The stripping in check_name_str() is now useless. Drop.
Also drop the "no leading '*'" assertion, because valid_name.match()
ensures it can't fail.
Fixes: 9fb081e0b98409556d023c7193eeb68947cd1211
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210323094025.3569441-8-armbru@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qapi-schema/reserved-member-u.err | 2 | ||||
-rw-r--r-- | tests/qapi-schema/reserved-member-u.json | 1 | ||||
-rw-r--r-- | tests/qapi-schema/reserved-member-u.out | 14 |
3 files changed, 2 insertions, 15 deletions
diff --git a/tests/qapi-schema/reserved-member-u.err b/tests/qapi-schema/reserved-member-u.err index e69de29bb2..b58e599a00 100644 --- a/tests/qapi-schema/reserved-member-u.err +++ b/tests/qapi-schema/reserved-member-u.err @@ -0,0 +1,2 @@ +reserved-member-u.json: In struct 'Oops': +reserved-member-u.json:7: 'data' member '*u' uses reserved name diff --git a/tests/qapi-schema/reserved-member-u.json b/tests/qapi-schema/reserved-member-u.json index 15005abb09..2bfb8f59b6 100644 --- a/tests/qapi-schema/reserved-member-u.json +++ b/tests/qapi-schema/reserved-member-u.json @@ -4,5 +4,4 @@ # This is true even for non-unions, because it is possible to convert a # struct to flat union while remaining backwards compatible in QMP. # TODO - we could munge the member name to 'q_u' to avoid the collision -# BUG: not rejected { 'struct': 'Oops', 'data': { '*u': 'str' } } diff --git a/tests/qapi-schema/reserved-member-u.out b/tests/qapi-schema/reserved-member-u.out index 6a3705518b..e69de29bb2 100644 --- a/tests/qapi-schema/reserved-member-u.out +++ b/tests/qapi-schema/reserved-member-u.out @@ -1,14 +0,0 @@ -module ./builtin -object q_empty -enum QType - prefix QTYPE - member none - member qnull - member qnum - member qstring - member qdict - member qlist - member qbool -module reserved-member-u.json -object Oops - member u: str optional=True |