]> git.ipfire.org Git - thirdparty/qemu.git/commit
tests: Fix test-qdev-global-props on anonymous qdev realize()
authorPeter Xu <peterx@redhat.com>
Thu, 21 Nov 2024 19:21:52 +0000 (14:21 -0500)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Fri, 20 Dec 2024 16:44:55 +0000 (17:44 +0100)
commitff18687db3baed91691c78b9338945b038f62392
tree16302baf644251ccee6e1f1c32f80d386f4bb6b5
parent6e1e04ef035cf687e868858ab6bd18a177e1b822
tests: Fix test-qdev-global-props on anonymous qdev realize()

test-qdev-global-props creates a few subprocesses and test things based on
qdev realize().  One thing was overlooked since the start, that anonymous
creations of qdev (then realize() the device) requires the machine object's
presence, as all these devices need to be attached to QOM tree, by default
to path "/machine/unattached".

The test didn't crash simply because container_get() has an implicit
semantic to silently create any missing container, hence what happened here
is container_get() (when running these tests) will try to create containers
at QOM path "/machine" on the fly.  That's probably unexpected by the test,
but worked like charm before.

We're going to fix device_set_realized() soon, but before that make the
test case prepared, by creating the machine object on its own.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-ID: <20241121192202.4155849-4-peterx@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
tests/unit/test-qdev-global-props.c