[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [qemu-s390x] [PATCH v2 4/6] tests/device-plug: Add CCW unplug test f
From: |
Thomas Huth |
Subject: |
Re: [qemu-s390x] [PATCH v2 4/6] tests/device-plug: Add CCW unplug test for s390x |
Date: |
Fri, 15 Feb 2019 16:29:08 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 |
On 15/02/2019 14.30, David Hildenbrand wrote:
> As CCW unplugs are surprise removals without asking the guest first,
> we can test this without any guest interaction.
>
> Signed-off-by: David Hildenbrand <address@hidden>
> ---
> tests/device-plug-test.c | 41 +++++++++++++++++++++++++++++++++++-----
> 1 file changed, 36 insertions(+), 5 deletions(-)
>
> diff --git a/tests/device-plug-test.c b/tests/device-plug-test.c
> index 066433ebf5..6f7255552a 100644
> --- a/tests/device-plug-test.c
> +++ b/tests/device-plug-test.c
> @@ -15,17 +15,26 @@
> #include "qapi/qmp/qdict.h"
> #include "qapi/qmp/qstring.h"
>
> -static void device_del_request(QTestState *qtest, const char *id)
> +static void device_del_start(QTestState *qtest, const char *id)
> {
> - QDict *resp;
> + qtest_qmp_send(qtest,
> + "{'execute': 'device_del', 'arguments': { 'id': %s } }",
> id);
> +}
> +
> +static void device_del_finish(QTestState *qtest)
> +{
> + QDict *resp = qtest_qmp_receive(qtest);
>
> - resp = qtest_qmp(qtest,
> - "{'execute': 'device_del', 'arguments': { 'id': %s } }",
> - id);
> g_assert(qdict_haskey(resp, "return"));
> qobject_unref(resp);
> }
>
> +static void device_del_request(QTestState *qtest, const char *id)
> +{
> + device_del_start(qtest, id);
> + device_del_finish(qtest);
> +}
> +
> static void system_reset(QTestState *qtest)
> {
> QDict *resp;
> @@ -77,8 +86,25 @@ static void test_pci_unplug_request(void)
> qtest_quit(qtest);
> }
>
> +static void test_ccw_unplug(void)
> +{
> + QTestState *qtest = qtest_initf("-device virtio-balloon-ccw,id=dev0");
> +
> + /*
> + * The DEVICE_DELETED events will be sent before the command
> + * completes.
> + */
> + device_del_start(qtest, "dev0");
> + wait_device_deleted_event(qtest, "dev0");
> + device_del_finish(qtest);
> +
> + qtest_quit(qtest);
> +}
> +
> int main(int argc, char **argv)
> {
> + const char *arch = qtest_get_arch();
> +
> g_test_init(&argc, &argv, NULL);
>
> /*
> @@ -89,5 +115,10 @@ int main(int argc, char **argv)
> qtest_add_func("/device-plug/pci_unplug_request",
> test_pci_unplug_request);
>
> + if (!strcmp(arch, "s390x")) {
> + qtest_add_func("/device-plug/ccw_unplug",
> + test_ccw_unplug);
> + }
Nit: Most of the other qtests rather use "-" instead of "_" in their
names. Apart from that:
Reviewed-by: Thomas Huth <address@hidden>
- [qemu-s390x] [PATCH v2 2/6] spapr: support memory unplug for qtest, (continued)
- [qemu-s390x] [PATCH v2 2/6] spapr: support memory unplug for qtest, David Hildenbrand, 2019/02/15
- [qemu-s390x] [PATCH v2 3/6] tests/device-plug: Add a simple PCI unplug request test, David Hildenbrand, 2019/02/15
- [qemu-s390x] [PATCH v2 4/6] tests/device-plug: Add CCW unplug test for s390x, David Hildenbrand, 2019/02/15
- Re: [qemu-s390x] [PATCH v2 4/6] tests/device-plug: Add CCW unplug test for s390x,
Thomas Huth <=
- [qemu-s390x] [PATCH v2 6/6] tests/device-plug: Add memory unplug request test for spapr, David Hildenbrand, 2019/02/15
- [qemu-s390x] [PATCH v2 5/6] tests/device-plug: Add CPU core unplug request test for spapr, David Hildenbrand, 2019/02/15