target: Improve error reporting for CpuModelInfo member @props
commit8934643a0e2631d468940b05ae2332f219631d17
authorMarkus Armbruster <armbru@redhat.com>
Tue, 5 Mar 2024 14:59:17 +0000 (5 15:59 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Tue, 12 Mar 2024 13:03:00 +0000 (12 14:03 +0100)
treef8dc1da4c75f2d12e56e72f13c64bc5d5a66f8dc
parent68192a5ffd00e4b5123b86fe93986d03ff066c68
target: Improve error reporting for CpuModelInfo member @props

query-cpu-model-comparison, query-cpu-model-baseline, and
query-cpu-model-expansion take CpuModelInfo arguments.  Errors in
@props members of these arguments are reported for 'props', without
further context.  For instance, s390x rejects

    {"execute": "query-cpu-model-comparison", "arguments": {"modela": {"name": "z13", "props": {}}, "modelb": {"name": "z14", "props": []}}}

with

    {"error": {"class": "GenericError", "desc": "Invalid parameter type for 'props', expected: object"}}

This is unusual; the common QAPI unmarshaling machinery would complain
about 'modelb.props'.  Our hand-written code to visit the @props
member neglects to provide the context.

Tweak it so it provides it.  The command above now fails with

    {"error": {"class": "GenericError", "desc": "Invalid parameter type for 'modelb.props', expected: dict"}}

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240305145919.2186971-4-armbru@redhat.com>
Acked-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
target/arm/arm-qmp-cmds.c
target/i386/cpu-sysemu.c
target/riscv/riscv-qmp-cmds.c
target/s390x/cpu_models_sysemu.c
tests/qtest/arm-cpu-features.c