From nobody Tue May 7 13:49:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1664491465; cv=none; d=zohomail.com; s=zohoarc; b=WQBkzHPchua7DkxICc/aftBjkwcM0H0GS21unmnwv9vc9+gaoz5h2gjr0h90RxNj88UrsUaIEwX+6eIyDHp/FbGJe+Pr3bnPRZ5WJAMD+sZEVBcqzq3NCiRP7uWtX1NZCJge4cAIyPInCPhJZ56x3k/loCO8brvv55PRZEqtIqI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664491465; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=GStAxvOcezSCbU7Fz5VUYdaLQpdgw3tkFq4wyOw3xHk=; b=GdkP+dem5Eo2LfuEe1IbVv/lnvqGZrxUiff0onY313v5hJ3yhL4idMgyP1koIoeVwZ5z2ENOUeJ48aUbv44MPil3fcH2gKoUysW3o/leGSsJBSt1u3c5KrCeas16CCHro74l3tTL+yZCUo/xip8xqScpvY70OYtfgppCmStpGqM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1664491465384658.4627560665385; Thu, 29 Sep 2022 15:44:25 -0700 (PDT) Received: from localhost ([::1]:59556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oe2GW-0001jW-Bg for importer@patchew.org; Thu, 29 Sep 2022 18:44:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28p-0006Bl-Us for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:27 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:42750) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28j-0001xh-Fh for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:27 -0400 Received: from [192.168.16.158] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oe25f-0071e8-AS; Fri, 30 Sep 2022 00:35:36 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v5 1/9] tests/x86: add helper qtest_qmp_device_del_send() Date: Fri, 30 Sep 2022 01:35:39 +0300 Message-Id: <20220929223547.1429580-2-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> References: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=130.117.225.111; envelope-from=michael.labiuk@virtuozzo.com; helo=relay.virtuozzo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Michael Labiuk From: Michael Labiuk via X-ZM-MESSAGEID: 1664491466524100001 Content-Type: text/plain; charset="utf-8" Move sending 'device_del' command to separate function. Function can be used in case of addition action is needed to start actual removing device after sending command. Signed-off-by: Michael Labiuk Reviewed-by: Thomas Huth --- tests/qtest/device-plug-test.c | 15 ++------------- tests/qtest/drive_del-test.c | 6 +----- tests/qtest/libqos/pci-pc.c | 8 +------- tests/qtest/libqtest.c | 16 ++++++++++------ tests/qtest/libqtest.h | 10 ++++++++++ 5 files changed, 24 insertions(+), 31 deletions(-) diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c index e595b45b66..3841de1b8c 100644 --- a/tests/qtest/device-plug-test.c +++ b/tests/qtest/device-plug-test.c @@ -15,17 +15,6 @@ #include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" =20 -static void device_del(QTestState *qtest, const char *id) -{ - QDict *resp; - - resp =3D qtest_qmp(qtest, - "{'execute': 'device_del', 'arguments': { 'id': %s } = }", id); - - g_assert(qdict_haskey(resp, "return")); - qobject_unref(resp); -} - static void system_reset(QTestState *qtest) { QDict *resp; @@ -68,7 +57,7 @@ static void process_device_remove(QTestState *qtest, cons= t char *id) * be processed. However during system reset, the removal will be * handled, removing the device. */ - device_del(qtest, id); + qtest_qmp_device_del_send(qtest, id); system_reset(qtest); wait_device_deleted_event(qtest, id); } @@ -112,7 +101,7 @@ static void test_ccw_unplug(void) { QTestState *qtest =3D qtest_initf("-device virtio-balloon-ccw,id=3Ddev= 0"); =20 - device_del(qtest, "dev0"); + qtest_qmp_device_del_send(qtest, "dev0"); wait_device_deleted_event(qtest, "dev0"); =20 qtest_quit(qtest); diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c index 5e6d58b4dd..467e752b0d 100644 --- a/tests/qtest/drive_del-test.c +++ b/tests/qtest/drive_del-test.c @@ -143,11 +143,7 @@ static void device_del(QTestState *qts, bool and_reset) { QDict *response; =20 - response =3D qtest_qmp(qts, "{'execute': 'device_del'," - " 'arguments': { 'id': 'dev0' } }"); - g_assert(response); - g_assert(qdict_haskey(response, "return")); - qobject_unref(response); + qtest_qmp_device_del_send(qts, "dev0"); =20 if (and_reset) { response =3D qtest_qmp(qts, "{'execute': 'system_reset' }"); diff --git a/tests/qtest/libqos/pci-pc.c b/tests/qtest/libqos/pci-pc.c index 81c2c055ca..96046287ac 100644 --- a/tests/qtest/libqos/pci-pc.c +++ b/tests/qtest/libqos/pci-pc.c @@ -179,13 +179,7 @@ void qpci_free_pc(QPCIBus *bus) =20 void qpci_unplug_acpi_device_test(QTestState *qts, const char *id, uint8_t= slot) { - QDict *response; - - response =3D qtest_qmp(qts, "{'execute': 'device_del'," - " 'arguments': {'id': %s}}", id); - g_assert(response); - g_assert(!qdict_haskey(response, "error")); - qobject_unref(response); + qtest_qmp_device_del_send(qts, id); =20 qtest_outl(qts, ACPI_PCIHP_ADDR + PCI_EJ_BASE, 1 << slot); =20 diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 4f4b2d6477..7b6152807b 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -1371,15 +1371,19 @@ void qtest_qmp_add_client(QTestState *qts, const ch= ar *protocol, int fd) * * {"return": {}} */ -void qtest_qmp_device_del(QTestState *qts, const char *id) +void qtest_qmp_device_del_send(QTestState *qts, const char *id) { - QDict *rsp; - - rsp =3D qtest_qmp(qts, "{'execute': 'device_del', 'arguments': {'id': = %s}}", - id); - + QDict *rsp =3D qtest_qmp(qts, "{'execute': 'device_del', " + "'arguments': {'id': %s}}", id); + g_assert(rsp); g_assert(qdict_haskey(rsp, "return")); + g_assert(!qdict_haskey(rsp, "error")); qobject_unref(rsp); +} + +void qtest_qmp_device_del(QTestState *qts, const char *id) +{ + qtest_qmp_device_del_send(qts, id); qtest_qmp_eventwait(qts, "DEVICE_DELETED"); } =20 diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h index 3abc75964d..29ea9c697d 100644 --- a/tests/qtest/libqtest.h +++ b/tests/qtest/libqtest.h @@ -761,12 +761,22 @@ void qtest_qmp_device_add(QTestState *qts, const char= *driver, const char *id, void qtest_qmp_add_client(QTestState *qts, const char *protocol, int fd); #endif /* _WIN32 */ =20 +/** + * qtest_qmp_device_del_send: + * @qts: QTestState instance to operate on + * @id: Identification string + * + * Generic hot-unplugging test via the device_del QMP command. + */ +void qtest_qmp_device_del_send(QTestState *qts, const char *id); + /** * qtest_qmp_device_del: * @qts: QTestState instance to operate on * @id: Identification string * * Generic hot-unplugging test via the device_del QMP command. + * Waiting for command comlition event. */ void qtest_qmp_device_del(QTestState *qts, const char *id); =20 --=20 2.34.1 From nobody Tue May 7 13:49:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1664491289; cv=none; d=zohomail.com; s=zohoarc; b=BCAx96ohLiqbNMGCk6W1ReYdDR8umKl24YFSha9UvyAloZVg2glq1F+Hp6cFm/rplhXlt8us7aFr0wViQhc/afoNJTnZkTJR2uWvbSVLcgFCZbR8ag/RROwuhrQgdDhyBJJReVF0vxcnHNQKV8xJgPSQ7yo/YRz9lats01HDiak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664491289; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=69MW22AotxMXDVxTE3QUomGyhJ240FDAQTPvpi8TztM=; b=Yefc6W1aug9ipUGKX1eeuRG1/d0+qzm+yuZibWrpZr/0hyzUfeCb50miSSlU2xlkCKNX6UO0p7j5TEs5n8DQEjGJNL+nok/8hBpyZSQ4Nu0oxfzKKM+FkeZN9Lu5Z2agdDiKTDo4nvUlp/t5YX3JWws0P21/ZMLWZDDknf2C8hA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1664491289216929.2382725475118; Thu, 29 Sep 2022 15:41:29 -0700 (PDT) Received: from localhost ([::1]:37812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oe2Dg-0005LG-8z for importer@patchew.org; Thu, 29 Sep 2022 18:41:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28o-00065f-3N for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:26 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:42752) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28j-0001xf-N1 for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:25 -0400 Received: from [192.168.16.158] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oe25g-0071e8-2z; Fri, 30 Sep 2022 00:35:36 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v5 2/9] tests/x86: Add subtest with 'q35' machine type to device-plug-test Date: Fri, 30 Sep 2022 01:35:40 +0300 Message-Id: <20220929223547.1429580-3-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> References: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=130.117.225.111; envelope-from=michael.labiuk@virtuozzo.com; helo=relay.virtuozzo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Michael Labiuk From: Michael Labiuk via X-ZM-MESSAGEID: 1664491289521100001 Content-Type: text/plain; charset="utf-8" Configure pci bridge setting to plug pci device and unplug. Signed-off-by: Michael Labiuk Reviewed-by: Thomas Huth --- tests/qtest/device-plug-test.c | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c index 3841de1b8c..3f44f731d1 100644 --- a/tests/qtest/device-plug-test.c +++ b/tests/qtest/device-plug-test.c @@ -79,6 +79,19 @@ static void test_pci_unplug_request(void) qtest_quit(qtest); } =20 +static void test_q35_pci_unplug_request(void) +{ + + QTestState *qtest =3D qtest_initf("-machine q35 " + "-device pcie-root-port,id=3Dp1 " + "-device pcie-pci-bridge,bus=3Dp1,id= =3Db1 " + "-device virtio-mouse-pci,bus=3Db1,id= =3Ddev0"); + + process_device_remove(qtest, "dev0"); + + qtest_quit(qtest); +} + static void test_pci_unplug_json_request(void) { const char *arch =3D qtest_get_arch(); @@ -97,6 +110,27 @@ static void test_pci_unplug_json_request(void) qtest_quit(qtest); } =20 +static void test_q35_pci_unplug_json_request(void) +{ + const char *port =3D "-device '{\"driver\": \"pcie-root-port\", " + "\"id\": \"p1\"}'"; + + const char *bridge =3D "-device '{\"driver\": \"pcie-pci-bridge\", " + "\"id\": \"b1\", " + "\"bus\": \"p1\"}'"; + + const char *device =3D "-device '{\"driver\": \"virtio-mouse-pci\", " + "\"bus\": \"b1\", " + "\"id\": \"dev0\"}'"; + + QTestState *qtest =3D qtest_initf("-machine q35 %s %s %s", + port, bridge, device); + + process_device_remove(qtest, "dev0"); + + qtest_quit(qtest); +} + static void test_ccw_unplug(void) { QTestState *qtest =3D qtest_initf("-device virtio-balloon-ccw,id=3Ddev= 0"); @@ -176,5 +210,12 @@ int main(int argc, char **argv) test_spapr_phb_unplug_request); } =20 + if (!strcmp(arch, "x86_64") && qtest_has_machine("q35")) { + qtest_add_func("/device-plug/q35-pci-unplug-request", + test_q35_pci_unplug_request); + qtest_add_func("/device-plug/q35-pci-unplug-json-request", + test_q35_pci_unplug_json_request); + } + return g_test_run(); } --=20 2.34.1 From nobody Tue May 7 13:49:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1664491127; cv=none; d=zohomail.com; s=zohoarc; b=C+t0RF6lLyGM3FG1vdiohJwFR9sehQ5sBR52j2wK0WuDL3nAQkleKLDRUWU/phYUusuC+5VeBXrG1Q3ThR9FEQCYLJElgaus7drAKXFS9sYROrMbkDkYWfFbBzgPkqWKC41IWxxJxZAOl6QitQT38Lwzad7YTUVxH8j7jvTRcT4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664491127; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=itCYwZDdUt650BqdJClltD4RftvjuFrmuPlv9SOlutI=; b=SboVGaaI3xzfFGBPeMGvqY1VgjWtjFP+fZ5YQT0pKKLm/3e/CYN8XOQXa+vph0bPYs9loPzN7PAZ/xdn8kSWXkyxaBiWwn4oYLBPRIQz+sfdyHBhgTg1yqY5JjslBIhPdvNq8Y2cSHwmRrHVbiLxd/hPuoSGQZppn6cAagsbsrM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1664491127083613.0394162496347; Thu, 29 Sep 2022 15:38:47 -0700 (PDT) Received: from localhost ([::1]:38156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oe2B3-0000Lg-1P for importer@patchew.org; Thu, 29 Sep 2022 18:38:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58240) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28m-00064W-Tb for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:24 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:42766) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28j-0001xj-8t for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:24 -0400 Received: from [192.168.16.158] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oe25g-0071e8-RY; Fri, 30 Sep 2022 00:35:37 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v5 3/9] tests/x86: Refactor hot unplug hd-geo-test Date: Fri, 30 Sep 2022 01:35:41 +0300 Message-Id: <20220929223547.1429580-4-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> References: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=130.117.225.111; envelope-from=michael.labiuk@virtuozzo.com; helo=relay.virtuozzo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Michael Labiuk From: Michael Labiuk via X-ZM-MESSAGEID: 1664491128825100002 Content-Type: text/plain; charset="utf-8" Moving common code to function. Signed-off-by: Michael Labiuk Reviewed-by: Thomas Huth --- tests/qtest/hd-geo-test.c | 144 +++++++++++++++----------------------- 1 file changed, 57 insertions(+), 87 deletions(-) diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c index ba772f4d7a..61f4c24b81 100644 --- a/tests/qtest/hd-geo-test.c +++ b/tests/qtest/hd-geo-test.c @@ -691,7 +691,8 @@ static void add_virtio_disk(TestArgs *args, args->n_virtio_disks++; } =20 -static void test_override(TestArgs *args, CHSResult expected[]) +static void test_override(TestArgs *args, const char *arch, + CHSResult expected[]) { QTestState *qts; char *joined_args; @@ -700,7 +701,7 @@ static void test_override(TestArgs *args, CHSResult exp= ected[]) =20 joined_args =3D g_strjoinv(" ", args->argv); =20 - qts =3D qtest_initf("-machine pc %s", joined_args); + qts =3D qtest_initf("-machine %s %s", arch, joined_args); fw_cfg =3D pc_fw_cfg_init(qts); =20 read_bootdevices(fw_cfg, expected); @@ -737,7 +738,7 @@ static void test_override_ide(void) add_ide_disk(args, 1, 0, 1, 9000, 120, 30); add_ide_disk(args, 2, 1, 0, 0, 1, 1); add_ide_disk(args, 3, 1, 1, 1, 0, 0); - test_override(args, expected); + test_override(args, "pc", expected); } =20 static void test_override_scsi(void) @@ -759,7 +760,7 @@ static void test_override_scsi(void) add_scsi_disk(args, 1, 0, 0, 1, 0, 9000, 120, 30); add_scsi_disk(args, 2, 0, 0, 2, 0, 1, 0, 0); add_scsi_disk(args, 3, 0, 0, 3, 0, 0, 1, 0); - test_override(args, expected); + test_override(args, "pc", expected); } =20 static void test_override_scsi_2_controllers(void) @@ -782,7 +783,7 @@ static void test_override_scsi_2_controllers(void) add_scsi_disk(args, 1, 0, 0, 1, 0, 9000, 120, 30); add_scsi_disk(args, 2, 1, 0, 0, 1, 1, 0, 0); add_scsi_disk(args, 3, 1, 0, 1, 2, 0, 1, 0); - test_override(args, expected); + test_override(args, "pc", expected); } =20 static void test_override_virtio_blk(void) @@ -797,7 +798,7 @@ static void test_override_virtio_blk(void) add_drive_with_mbr(args, empty_mbr, 1); add_virtio_disk(args, 0, "pci.0", 3, 10000, 120, 30); add_virtio_disk(args, 1, "pci.0", 4, 9000, 120, 30); - test_override(args, expected); + test_override(args, "pc", expected); } =20 static void test_override_zero_chs(void) @@ -808,16 +809,54 @@ static void test_override_zero_chs(void) }; add_drive_with_mbr(args, empty_mbr, 1); add_ide_disk(args, 0, 1, 1, 0, 0, 0); - test_override(args, expected); + test_override(args, "pc", expected); +} + +static void test_override_hot_unplug(TestArgs *args, const char *devid, + CHSResult expected[], CHSResult expec= ted2[]) +{ + QTestState *qts; + char *joined_args; + QFWCFG *fw_cfg; + QDict *response; + int i; + + joined_args =3D g_strjoinv(" ", args->argv); + + qts =3D qtest_initf("%s", joined_args); + fw_cfg =3D pc_fw_cfg_init(qts); + + read_bootdevices(fw_cfg, expected); + + /* unplug device an restart */ + qtest_qmp_device_del_send(qts, devid); + + response =3D qtest_qmp(qts, + "{ 'execute': 'system_reset', 'arguments': { }}"); + g_assert(response); + g_assert(!qdict_haskey(response, "error")); + qobject_unref(response); + + qtest_qmp_eventwait(qts, "RESET"); + + read_bootdevices(fw_cfg, expected2); + + g_free(joined_args); + qtest_quit(qts); + + g_free(fw_cfg); + + for (i =3D 0; i < args->n_drives; i++) { + unlink(args->drives[i]); + g_free(args->drives[i]); + } + g_free(args->drives); + g_strfreev(args->argv); + g_free(args); } =20 static void test_override_scsi_hot_unplug(void) { - QTestState *qts; - char *joined_args; - QFWCFG *fw_cfg; - QDict *response; - int i; TestArgs *args =3D create_args(); CHSResult expected[] =3D { {"/pci@i0cf8/scsi@2/channel@0/disk@0,0", {10000, 120, 30} }, @@ -834,51 +873,14 @@ static void test_override_scsi_hot_unplug(void) add_scsi_disk(args, 0, 0, 0, 0, 0, 10000, 120, 30); add_scsi_disk(args, 1, 0, 0, 1, 0, 20, 20, 20); =20 - joined_args =3D g_strjoinv(" ", args->argv); + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, + g_strdup("-machine pc")); =20 - qts =3D qtest_initf("-machine pc %s", joined_args); - fw_cfg =3D pc_fw_cfg_init(qts); - - read_bootdevices(fw_cfg, expected); - - /* unplug device an restart */ - response =3D qtest_qmp(qts, - "{ 'execute': 'device_del'," - " 'arguments': {'id': 'scsi-disk0' }}"); - g_assert(response); - g_assert(!qdict_haskey(response, "error")); - qobject_unref(response); - response =3D qtest_qmp(qts, - "{ 'execute': 'system_reset', 'arguments': { }}"); - g_assert(response); - g_assert(!qdict_haskey(response, "error")); - qobject_unref(response); - - qtest_qmp_eventwait(qts, "RESET"); - - read_bootdevices(fw_cfg, expected2); - - g_free(joined_args); - qtest_quit(qts); - - g_free(fw_cfg); - - for (i =3D 0; i < args->n_drives; i++) { - unlink(args->drives[i]); - g_free(args->drives[i]); - } - g_free(args->drives); - g_strfreev(args->argv); - g_free(args); + test_override_hot_unplug(args, "scsi-disk0", expected, expected2); } =20 static void test_override_virtio_hot_unplug(void) { - QTestState *qts; - char *joined_args; - QFWCFG *fw_cfg; - QDict *response; - int i; TestArgs *args =3D create_args(); CHSResult expected[] =3D { {"/pci@i0cf8/scsi@2/disk@0,0", {10000, 120, 30} }, @@ -894,42 +896,10 @@ static void test_override_virtio_hot_unplug(void) add_virtio_disk(args, 0, "pci.0", 2, 10000, 120, 30); add_virtio_disk(args, 1, "pci.0", 3, 20, 20, 20); =20 - joined_args =3D g_strjoinv(" ", args->argv); + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, + g_strdup("-machine pc")); =20 - qts =3D qtest_initf("-machine pc %s", joined_args); - fw_cfg =3D pc_fw_cfg_init(qts); - - read_bootdevices(fw_cfg, expected); - - /* unplug device an restart */ - response =3D qtest_qmp(qts, - "{ 'execute': 'device_del'," - " 'arguments': {'id': 'virtio-disk0' }}"); - g_assert(response); - g_assert(!qdict_haskey(response, "error")); - qobject_unref(response); - response =3D qtest_qmp(qts, - "{ 'execute': 'system_reset', 'arguments': { }}"); - g_assert(response); - g_assert(!qdict_haskey(response, "error")); - qobject_unref(response); - - qtest_qmp_eventwait(qts, "RESET"); - - read_bootdevices(fw_cfg, expected2); - - g_free(joined_args); - qtest_quit(qts); - - g_free(fw_cfg); - - for (i =3D 0; i < args->n_drives; i++) { - unlink(args->drives[i]); - g_free(args->drives[i]); - } - g_free(args->drives); - g_strfreev(args->argv); - g_free(args); + test_override_hot_unplug(args, "virtio-disk0", expected, expected2); } =20 int main(int argc, char **argv) --=20 2.34.1 From nobody Tue May 7 13:49:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1664491599; cv=none; d=zohomail.com; s=zohoarc; b=BTv5BmN1pMT1NkbMKAi0gp5+SY0R7w17S1ks6SlQWqNwHbm2okFHgrLLZkg+SpVo87zRIRxauSUQkbg8+4bWORMTzRTWvhxgrRBBgCnuohzsLTzOiMTMAmgpHoIf37jkJFjZL7zVgQDMwIr7cj0sq2L1H4ttoFw5YPO0vUPL03g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664491599; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=CFaBgYn6NcTAMH7JDGVzHkTrl8yZs0NxxHG+YYBXvQw=; b=d/G1ESOUJRRfxkVh2odsZeVlsCkJS6VI62k/xd5t3Wd8OoKTPxLSfizTkwjpiKYA9I+7YRfma3FMYeid7anVeOqncQI13F5AJ/HlEWlIb278RvAI0ApSCzfAUX20SnFTH6CmZvMWfNUYBbp20r8rGyWPQ+W+vhMOFyt2Vw646I8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 166449159968071.89172356789709; Thu, 29 Sep 2022 15:46:39 -0700 (PDT) Received: from localhost ([::1]:48918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oe2Ig-0004Rb-Nv for importer@patchew.org; Thu, 29 Sep 2022 18:46:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28p-0006Bt-VT for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:28 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:42760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28j-0001xd-Ev for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:27 -0400 Received: from [192.168.16.158] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oe25h-0071e8-K4; Fri, 30 Sep 2022 00:35:38 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v5 4/9] tests/x86: Add 'q35' machine type to override-tests in hd-geo-test Date: Fri, 30 Sep 2022 01:35:42 +0300 Message-Id: <20220929223547.1429580-5-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> References: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=130.117.225.111; envelope-from=michael.labiuk@virtuozzo.com; helo=relay.virtuozzo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Michael Labiuk From: Michael Labiuk via X-ZM-MESSAGEID: 1664491601165100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Michael Labiuk Acked-by: Thomas Huth --- tests/qtest/hd-geo-test.c | 97 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c index 61f4c24b81..278464c379 100644 --- a/tests/qtest/hd-geo-test.c +++ b/tests/qtest/hd-geo-test.c @@ -741,6 +741,27 @@ static void test_override_ide(void) test_override(args, "pc", expected); } =20 +static void test_override_sata(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + {"/pci@i0cf8/pci8086,2922@1f,2/drive@0/disk@0", {10000, 120, 30} }, + {"/pci@i0cf8/pci8086,2922@1f,2/drive@1/disk@0", {9000, 120, 30} }, + {"/pci@i0cf8/pci8086,2922@1f,2/drive@2/disk@0", {0, 1, 1} }, + {"/pci@i0cf8/pci8086,2922@1f,2/drive@3/disk@0", {1, 0, 0} }, + {NULL, {0, 0, 0} } + }; + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_ide_disk(args, 0, 0, 0, 10000, 120, 30); + add_ide_disk(args, 1, 1, 0, 9000, 120, 30); + add_ide_disk(args, 2, 2, 0, 0, 1, 1); + add_ide_disk(args, 3, 3, 0, 1, 0, 0); + test_override(args, "q35", expected); +} + static void test_override_scsi(void) { TestArgs *args =3D create_args(); @@ -763,6 +784,42 @@ static void test_override_scsi(void) test_override(args, "pc", expected); } =20 +static void setup_pci_bridge(TestArgs *args, const char *id, const char *r= ootid) +{ + + char *root, *br; + root =3D g_strdup_printf("-device pcie-root-port,id=3D%s", rootid); + br =3D g_strdup_printf("-device pcie-pci-bridge,bus=3D%s,id=3D%s", roo= tid, id); + + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, root); + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, br); +} + +static void test_override_scsi_q35(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + { "/pci@i0cf8/pci-bridge@1/scsi@3/channel@0/disk@0,0", + {10000, 120, 30} + }, + {"/pci@i0cf8/pci-bridge@1/scsi@3/channel@0/disk@1,0", {9000, 120, = 30} }, + {"/pci@i0cf8/pci-bridge@1/scsi@3/channel@0/disk@2,0", {1, 0, 0} }, + {"/pci@i0cf8/pci-bridge@1/scsi@3/channel@0/disk@3,0", {0, 1, 0} }, + {NULL, {0, 0, 0} } + }; + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + setup_pci_bridge(args, "pcie.0", "br"); + add_scsi_controller(args, "lsi53c895a", "br", 3); + add_scsi_disk(args, 0, 0, 0, 0, 0, 10000, 120, 30); + add_scsi_disk(args, 1, 0, 0, 1, 0, 9000, 120, 30); + add_scsi_disk(args, 2, 0, 0, 2, 0, 1, 0, 0); + add_scsi_disk(args, 3, 0, 0, 3, 0, 0, 1, 0); + test_override(args, "q35", expected); +} + static void test_override_scsi_2_controllers(void) { TestArgs *args =3D create_args(); @@ -801,6 +858,22 @@ static void test_override_virtio_blk(void) test_override(args, "pc", expected); } =20 +static void test_override_virtio_blk_q35(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + {"/pci@i0cf8/pci-bridge@1/scsi@3/disk@0,0", {10000, 120, 30} }, + {"/pci@i0cf8/pci-bridge@1/scsi@4/disk@0,0", {9000, 120, 30} }, + {NULL, {0, 0, 0} } + }; + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + setup_pci_bridge(args, "pcie.0", "br"); + add_virtio_disk(args, 0, "br", 3, 10000, 120, 30); + add_virtio_disk(args, 1, "br", 4, 9000, 120, 30); + test_override(args, "q35", expected); +} + static void test_override_zero_chs(void) { TestArgs *args =3D create_args(); @@ -812,6 +885,17 @@ static void test_override_zero_chs(void) test_override(args, "pc", expected); } =20 +static void test_override_zero_chs_q35(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + {NULL, {0, 0, 0} } + }; + add_drive_with_mbr(args, empty_mbr, 1); + add_ide_disk(args, 0, 0, 0, 0, 0, 0); + test_override(args, "q35", expected); +} + static void test_override_hot_unplug(TestArgs *args, const char *devid, CHSResult expected[], CHSResult expec= ted2[]) { @@ -944,6 +1028,19 @@ int main(int argc, char **argv) test_override_scsi_hot_unplug); qtest_add_func("hd-geo/override/virtio_hot_unplug", test_override_virtio_hot_unplug); + + if (qtest_has_machine("q35")) { + qtest_add_func("hd-geo/override/sata", test_override_sata); + qtest_add_func("hd-geo/override/virtio_blk_q35", + test_override_virtio_blk_q35); + qtest_add_func("hd-geo/override/zero_chs_q35", + test_override_zero_chs_q35); + + if (qtest_has_device("lsi53c895a")) { + qtest_add_func("hd-geo/override/scsi_q35", + test_override_scsi_q35); + } + } } else { g_test_message("QTEST_QEMU_IMG not set or qemu-img missing; " "skipping hd-geo/override/* tests"); --=20 2.34.1 From nobody Tue May 7 13:49:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1664491127; cv=none; d=zohomail.com; s=zohoarc; b=SoXEeiex285+vpMIVVBCYRUwmMI+LKizXOMueVS3/YMMxTSLfTfsmwiijFkqCjS1zNkW0jY/miKMWc3GPK1ZOTgj5cXHBDy0U75YFrBFTH/bnY2CXmE4BW/NeE7eC0yOI6GjPBRithBHVcJwcMLOxvOyRYfMFwfrT2X5LMz+PwE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664491127; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=TvVpZ6oYYEEdY8AnGDD0RnOH9vIkzMekp7DNOApXUTA=; b=XW4Dd0Y7vX9xMPM/zx4LfobRDv/S6ClqCx1aAGkt92EsZ5N9uSldorAVAiHINATjSwPFZ2IV9gaLfuVVGtGFLKIco/c3fyb8fIGtcSQDjH/XpELoKifVFnNPL7yvBDkE9Ntx8K3bqJdv9te1XxRZJ+1/+IlQENUOp+pjrJxHdSM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1664491127465468.6566006010743; Thu, 29 Sep 2022 15:38:47 -0700 (PDT) Received: from localhost ([::1]:38158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oe2B4-0000Pz-Dr for importer@patchew.org; Thu, 29 Sep 2022 18:38:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28m-00064U-RS for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:24 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:42767) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28j-0001xk-Fz for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:24 -0400 Received: from [192.168.16.158] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oe25i-0071e8-Ca; Fri, 30 Sep 2022 00:35:39 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v5 5/9] tests/x86: Add 'q35' machine type to hotplug hd-geo-test Date: Fri, 30 Sep 2022 01:35:43 +0300 Message-Id: <20220929223547.1429580-6-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> References: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=130.117.225.111; envelope-from=michael.labiuk@virtuozzo.com; helo=relay.virtuozzo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Michael Labiuk From: Michael Labiuk via X-ZM-MESSAGEID: 1664491128792100001 Content-Type: text/plain; charset="utf-8" Add pci bridge setting to test hotplug. Duplicate tests for plugging scsi and virtio devices for q35 machine type. Signed-off-by: Michael Labiuk Acked-by: Thomas Huth --- tests/qtest/hd-geo-test.c | 76 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c index 278464c379..4a7628077b 100644 --- a/tests/qtest/hd-geo-test.c +++ b/tests/qtest/hd-geo-test.c @@ -963,6 +963,42 @@ static void test_override_scsi_hot_unplug(void) test_override_hot_unplug(args, "scsi-disk0", expected, expected2); } =20 +static void test_override_scsi_hot_unplug_q35(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + { + "/pci@i0cf8/pci-bridge@1/pci-bridge@0/scsi@2/channel@0/disk@0,= 0", + {10000, 120, 30} + }, + { + "/pci@i0cf8/pci-bridge@1/pci-bridge@0/scsi@2/channel@0/disk@1,= 0", + {20, 20, 20} + }, + {NULL, {0, 0, 0} } + }; + CHSResult expected2[] =3D { + { + "/pci@i0cf8/pci-bridge@1/pci-bridge@0/scsi@2/channel@0/disk@1,= 0", + {20, 20, 20} + }, + {NULL, {0, 0, 0} } + }; + + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, + g_strdup("-device pcie-root-port,id=3Dp0 " + "-device pcie-pci-bridge,bus=3Dp0,id= =3Db1 " + "-machine q35")); + + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_scsi_controller(args, "virtio-scsi-pci", "b1", 2); + add_scsi_disk(args, 0, 0, 0, 0, 0, 10000, 120, 30); + add_scsi_disk(args, 1, 0, 0, 1, 0, 20, 20, 20); + + test_override_hot_unplug(args, "scsi-disk0", expected, expected2); +} + static void test_override_virtio_hot_unplug(void) { TestArgs *args =3D create_args(); @@ -986,6 +1022,41 @@ static void test_override_virtio_hot_unplug(void) test_override_hot_unplug(args, "virtio-disk0", expected, expected2); } =20 +static void test_override_virtio_hot_unplug_q35(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + { + "/pci@i0cf8/pci-bridge@1/pci-bridge@0/scsi@2/disk@0,0", + {10000, 120, 30} + }, + { + "/pci@i0cf8/pci-bridge@1/pci-bridge@0/scsi@3/disk@0,0", + {20, 20, 20} + }, + {NULL, {0, 0, 0} } + }; + CHSResult expected2[] =3D { + { + "/pci@i0cf8/pci-bridge@1/pci-bridge@0/scsi@3/disk@0,0", + {20, 20, 20} + }, + {NULL, {0, 0, 0} } + }; + + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, + g_strdup("-device pcie-root-port,id=3Dp0 " + "-device pcie-pci-bridge,bus=3Dp0,id= =3Db1 " + "-machine q35")); + + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_virtio_disk(args, 0, "b1", 2, 10000, 120, 30); + add_virtio_disk(args, 1, "b1", 3, 20, 20, 20); + + test_override_hot_unplug(args, "virtio-disk0", expected, expected2); +} + int main(int argc, char **argv) { Backend i; @@ -1035,11 +1106,14 @@ int main(int argc, char **argv) test_override_virtio_blk_q35); qtest_add_func("hd-geo/override/zero_chs_q35", test_override_zero_chs_q35); - if (qtest_has_device("lsi53c895a")) { qtest_add_func("hd-geo/override/scsi_q35", test_override_scsi_q35); } + qtest_add_func("hd-geo/override/scsi_hot_unplug_q35", + test_override_scsi_hot_unplug_q35); + qtest_add_func("hd-geo/override/virtio_hot_unplug_q35", + test_override_virtio_hot_unplug_q35); } } else { g_test_message("QTEST_QEMU_IMG not set or qemu-img missing; " --=20 2.34.1 From nobody Tue May 7 13:49:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1664491433; cv=none; d=zohomail.com; s=zohoarc; b=iGsIziEdUmGze6CJWhv6PW7aEDTs4xYfWPdO/0TYO+nU8LAT9bLLvMQ/Y3SS3IrRc91BfE3//ZcIJ0jbphe7/AwRqitB5rgug4X9Ffwv+2iLFTSJGm33RXKpDJHp6cFSUfMWcAqR9ruv5IK5hFsbCGsYAZueNed0qn5i/cIbC3c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664491433; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=GDjTBD+GKs0tS24CYagS7HsSbioXDHq26lSUSqh/O2I=; b=BX2XVt812UgoIBa1+SrUdeV52YaXQp+/ifdp4WKJ1GPEVaaiIC6EDKrPh9+VCFmqHcOTxXFe7TvTBxxmyPKonBus28sRs1U6NRhb8dgEUWvTBrFoJZEVT8k+Km7Cj1sSYzTcYWvQ0zv7WWqg2YCIicQWHZ4Fwc1Om7md4y/c/JU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1664491433131820.532291983831; Thu, 29 Sep 2022 15:43:53 -0700 (PDT) Received: from localhost ([::1]:48652 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oe2Fy-0000i7-Ud for importer@patchew.org; Thu, 29 Sep 2022 18:43:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28p-00069r-BJ for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:27 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:42756) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28j-0001xi-NP for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:27 -0400 Received: from [192.168.16.158] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oe25j-0071e8-4x; Fri, 30 Sep 2022 00:35:40 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v5 6/9] tests/x86: Fix comment typo in drive_del-test Date: Fri, 30 Sep 2022 01:35:44 +0300 Message-Id: <20220929223547.1429580-7-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> References: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=130.117.225.111; envelope-from=michael.labiuk@virtuozzo.com; helo=relay.virtuozzo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Michael Labiuk From: Michael Labiuk via X-ZM-MESSAGEID: 1664491435211100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Michael Labiuk Reviewed-by: Thomas Huth --- tests/qtest/drive_del-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c index 467e752b0d..44b9578801 100644 --- a/tests/qtest/drive_del-test.c +++ b/tests/qtest/drive_del-test.c @@ -327,7 +327,7 @@ static void test_blockdev_add_device_add_and_del(void) qts =3D qtest_init(machine_addition); =20 /* - * blockdev_add/device_add and device_del. The it drive is used by a + * blockdev_add/device_add and device_del. The drive is used by a * device that unplugs after reset, but it doesn't go away. */ blockdev_add_with_media(qts); --=20 2.34.1 From nobody Tue May 7 13:49:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1664491130; cv=none; d=zohomail.com; s=zohoarc; b=bs3WCidYgZ6pER50heXqOZcARlVLSfpW+6LGgeUo/lxG1zzSHR8uppAUbtNs8iYB5Bri0tJ7Vd8CR3xk+u1cQw3Mrvwe2FJ7YBODDYIQ0ShnkqM85jO2U0hgKx/JEvAmdyjlVn61RfHZaqkTF/76Dk6mv+UUDNqy96/axKsbLEg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664491130; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=X650jS1xD3bxP0rG+MDdT14xtj11UhIgqy55QoKuScE=; b=cMjVCPNz7AIQi6Etsso7s1w4Z2IhtPR/nLrLiTzixx1nwPPpdHZ9ejVoNz0NHtsbdAzk8ZtYN/NC5WyipTzd6NB/1I/hGLtxGvZMoj4+NQcXMZURUIYz9dKlTLfap9IPgjO/qmATrmNUtINwotIrVXN3XOEtAO9p7G6caw89V6g= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1664491130745253.13083822466012; Thu, 29 Sep 2022 15:38:50 -0700 (PDT) Received: from localhost ([::1]:38160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oe2B6-0000Yn-Ge for importer@patchew.org; Thu, 29 Sep 2022 18:38:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28m-00064T-RJ for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:24 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:42754) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28j-0001xg-IV for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:24 -0400 Received: from [192.168.16.158] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oe25j-0071e8-Uq; Fri, 30 Sep 2022 00:35:40 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v5 7/9] tests/x86: replace snprint() by g_strdup_printf() in drive_del-test Date: Fri, 30 Sep 2022 01:35:45 +0300 Message-Id: <20220929223547.1429580-8-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> References: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=130.117.225.111; envelope-from=michael.labiuk@virtuozzo.com; helo=relay.virtuozzo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Michael Labiuk From: Michael Labiuk via X-ZM-MESSAGEID: 1664491132742100003 Content-Type: text/plain; charset="utf-8" Using g_autofree char* and g_strdup_printf(...) instead of ugly snprintf on stack array. Signed-off-by: Michael Labiuk Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth --- tests/qtest/drive_del-test.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c index 44b9578801..106c613f4f 100644 --- a/tests/qtest/drive_del-test.c +++ b/tests/qtest/drive_del-test.c @@ -123,12 +123,10 @@ static const char *qvirtio_get_dev_type(void) =20 static void device_add(QTestState *qts) { - QDict *response; - char driver[32]; - snprintf(driver, sizeof(driver), "virtio-blk-%s", - qvirtio_get_dev_type()); - - response =3D qtest_qmp(qts, "{'execute': 'device_add'," + g_autofree char *driver =3D g_strdup_printf("virtio-blk-%s", + qvirtio_get_dev_type()); + QDict *response =3D + qtest_qmp(qts, "{'execute': 'device_add'," " 'arguments': {" " 'driver': %s," " 'drive': 'drive0'," --=20 2.34.1 From nobody Tue May 7 13:49:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1664491343; cv=none; d=zohomail.com; s=zohoarc; b=VDYVkp6L+oFfWiZ9oNo10JTOn7rQqj/SPVGj+Bk/LJs5BK1sjvyuhMrytHKoR87jDhDp6kLLIBtHt38O9F4SZ2IXqJ/dGVcG/D0iZWW0/i+rrrNS6p9nI1NcWQ6wBX/LcyeaEialFNFQZqSkNs20iciORIQGCpbOqYN4cQZMNXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664491343; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=cBXOrVQEVFCVHcwihQKAcgNklqaQCZDbi9tijk6/QAI=; b=NOBOG3DeWe4Hhp76yHeVKeP1VVCXp2cKaNQiEk2i33IoUbBowLDDBRZSMRmH0J8NB2SWLBDgjcx8OR98uy53EEirQ10TIFuHD3532sh/IVIrURSk1JV4Nf8Op2dowVPTzLN+vV3I66ksQCmX9Ja7MAEJp+Du3ALxd9eY6ADe24k= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1664491343253353.22583388359965; Thu, 29 Sep 2022 15:42:23 -0700 (PDT) Received: from localhost ([::1]:34816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oe2EY-0006xV-AN for importer@patchew.org; Thu, 29 Sep 2022 18:42:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28o-00066B-9B for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:26 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:42746) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28j-0001xc-IV for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:25 -0400 Received: from [192.168.16.158] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oe25k-0071e8-OK; Fri, 30 Sep 2022 00:35:41 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v5 8/9] tests/x86: Add 'q35' machine type to drive_del-test Date: Fri, 30 Sep 2022 01:35:46 +0300 Message-Id: <20220929223547.1429580-9-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> References: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=130.117.225.111; envelope-from=michael.labiuk@virtuozzo.com; helo=relay.virtuozzo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Michael Labiuk From: Michael Labiuk via X-ZM-MESSAGEID: 1664491343853100001 Content-Type: text/plain; charset="utf-8" Configure pci bridge setting to run tests on 'q35' machine type. Signed-off-by: Michael Labiuk Reviewed-by: Thomas Huth --- tests/qtest/drive_del-test.c | 107 +++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c index 106c613f4f..9a750395a9 100644 --- a/tests/qtest/drive_del-test.c +++ b/tests/qtest/drive_del-test.c @@ -252,6 +252,27 @@ static void test_cli_device_del(void) qtest_quit(qts); } =20 +static void test_cli_device_del_q35(void) +{ + QTestState *qts; + + /* + * -drive/-device and device_del. Start with a drive used by a + * device that unplugs after reset. + */ + qts =3D qtest_initf("-drive if=3Dnone,id=3Ddrive0,file=3Dnull-co://," + "file.read-zeroes=3Don,format=3Draw " + "-machine q35 -device pcie-root-port,id=3Dp1 " + "-device pcie-pci-bridge,bus=3Dp1,id=3Db1 " + "-device virtio-blk-%s,drive=3Ddrive0,bus=3Db1,id=3D= dev0", + qvirtio_get_dev_type()); + + device_del(qts, true); + g_assert(!has_drive(qts)); + + qtest_quit(qts); +} + static void test_empty_device_del(void) { QTestState *qts; @@ -288,6 +309,43 @@ static void test_device_add_and_del(void) qtest_quit(qts); } =20 +static void device_add_q35(QTestState *qts) +{ + g_autofree char *driver =3D g_strdup_printf("virtio-blk-%s", + qvirtio_get_dev_type()); + QDict *response =3D + qtest_qmp(qts, "{'execute': 'device_add'," + " 'arguments': {" + " 'driver': %s," + " 'drive': 'drive0'," + " 'id': 'dev0'," + " 'bus': 'b1'" + "}}", driver); + g_assert(response); + g_assert(qdict_haskey(response, "return")); + qobject_unref(response); +} + +static void test_device_add_and_del_q35(void) +{ + QTestState *qts; + + /* + * -drive/device_add and device_del. Start with a drive used by a + * device that unplugs after reset. + */ + qts =3D qtest_initf("-machine q35 -device pcie-root-port,id=3Dp1 " + "-device pcie-pci-bridge,bus=3Dp1,id=3Db1 " + "-drive if=3Dnone,id=3Ddrive0,file=3Dnull-co://," + "file.read-zeroes=3Don,format=3Draw"); + + device_add_q35(qts); + device_del(qts, true); + g_assert(!has_drive(qts)); + + qtest_quit(qts); +} + static void test_drive_add_device_add_and_del(void) { QTestState *qts; @@ -312,6 +370,25 @@ static void test_drive_add_device_add_and_del(void) qtest_quit(qts); } =20 +static void test_drive_add_device_add_and_del_q35(void) +{ + QTestState *qts; + + qts =3D qtest_init("-machine q35 -device pcie-root-port,id=3Dp1 " + "-device pcie-pci-bridge,bus=3Dp1,id=3Db1"); + + /* + * drive_add/device_add and device_del. The drive is used by a + * device that unplugs after reset. + */ + drive_add_with_media(qts); + device_add_q35(qts); + device_del(qts, true); + g_assert(!has_drive(qts)); + + qtest_quit(qts); +} + static void test_blockdev_add_device_add_and_del(void) { QTestState *qts; @@ -336,6 +413,25 @@ static void test_blockdev_add_device_add_and_del(void) qtest_quit(qts); } =20 +static void test_blockdev_add_device_add_and_del_q35(void) +{ + QTestState *qts; + + qts =3D qtest_init("-machine q35 -device pcie-root-port,id=3Dp1 " + "-device pcie-pci-bridge,bus=3Dp1,id=3Db1"); + + /* + * blockdev_add/device_add and device_del. The drive is used by a + * device that unplugs after reset, but it doesn't go away. + */ + blockdev_add_with_media(qts); + device_add_q35(qts); + device_del(qts, true); + g_assert(has_blockdev(qts)); + + qtest_quit(qts); +} + int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); @@ -357,6 +453,17 @@ int main(int argc, char **argv) test_empty_device_del); qtest_add_func("/device_del/blockdev", test_blockdev_add_device_add_and_del); + + if (qtest_has_machine("q35")) { + qtest_add_func("/device_del/drive/cli_device_q35", + test_cli_device_del_q35); + qtest_add_func("/device_del/drive/device_add_q35", + test_device_add_and_del_q35); + qtest_add_func("/device_del/drive/drive_add_device_add_q35", + test_drive_add_device_add_and_del_q35); + qtest_add_func("/device_del/blockdev_q35", + test_blockdev_add_device_add_and_del_q35); + } } =20 return g_test_run(); --=20 2.34.1 From nobody Tue May 7 13:49:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1664491124; cv=none; d=zohomail.com; s=zohoarc; b=GzpR1Db2KTnLzhbNpCjLAlnxRnPz2hIVbUUrsaaUej9ukdmNnzx4PVxDhizJjyJNywKZD0FJGBwFDEq6dfRdX40s5LY27GZmGYiDg6kw9l4J/VQsB3fLdLqazKw2m59osw/7uzWIymnQSnAxlLS+522YUJFKyxdNp4BPRrn693w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664491124; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=kKWXqS0ZFFYwiP/ycnYDzJbNE/7SvRu2V1a/LaKARMs=; b=a6PGyI8yIExQsRA2FxRdGDineTHlMcA9NQ0mUqJqmHsjVs6TyHvBOb+bbg7RaPGV0elvq7ZGSn4IOXeNIVFW5HXCNsi1Zs8KwRCxiH0voz5r735lPSlEutz77PbNbajTdHWazYEIEWQaoqsOXsPPL34GCpHKoXcw9gmeTNIjiZY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1664491124137412.3499693928669; Thu, 29 Sep 2022 15:38:44 -0700 (PDT) Received: from localhost ([::1]:38154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oe2B0-0000Jg-EM for importer@patchew.org; Thu, 29 Sep 2022 18:38:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28l-000632-JU for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:23 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:42772) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe28j-0001xe-6V for qemu-devel@nongnu.org; Thu, 29 Sep 2022 18:36:23 -0400 Received: from [192.168.16.158] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oe25l-0071e8-Gk; Fri, 30 Sep 2022 00:35:42 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v5 9/9] tests/x86: Add 'q35' machine type to ivshmem-test Date: Fri, 30 Sep 2022 01:35:47 +0300 Message-Id: <20220929223547.1429580-10-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> References: <20220929223547.1429580-1-michael.labiuk@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=130.117.225.111; envelope-from=michael.labiuk@virtuozzo.com; helo=relay.virtuozzo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Michael Labiuk From: Michael Labiuk via X-ZM-MESSAGEID: 1664491125775100001 Content-Type: text/plain; charset="utf-8" Configure pci bridge setting to test ivshmem on 'q35'. Signed-off-by: Michael Labiuk Reviewed-by: Thomas Huth --- tests/qtest/ivshmem-test.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/qtest/ivshmem-test.c b/tests/qtest/ivshmem-test.c index 9611d05eb5..cd550c8935 100644 --- a/tests/qtest/ivshmem-test.c +++ b/tests/qtest/ivshmem-test.c @@ -378,6 +378,20 @@ static void test_ivshmem_server(void) close(thread.pipe[0]); } =20 +static void test_ivshmem_hotplug_q35(void) +{ + QTestState *qts =3D qtest_init("-object memory-backend-ram,size=3D1M,i= d=3Dmb1 " + "-device pcie-root-port,id=3Dp1 " + "-device pcie-pci-bridge,bus=3Dp1,id=3Db1= " + "-machine q35"); + + qtest_qmp_device_add(qts, "ivshmem-plain", "iv1", + "{'memdev': 'mb1', 'bus': 'b1'}"); + qtest_qmp_device_del_send(qts, "iv1"); + + qtest_quit(qts); +} + #define PCI_SLOT_HP 0x06 =20 static void test_ivshmem_hotplug(void) @@ -469,6 +483,7 @@ int main(int argc, char **argv) { int ret, fd; gchar dir[] =3D "/tmp/ivshmem-test.XXXXXX"; + const char *arch =3D qtest_get_arch(); =20 g_test_init(&argc, &argv, NULL); =20 @@ -494,6 +509,9 @@ int main(int argc, char **argv) qtest_add_func("/ivshmem/pair", test_ivshmem_pair); qtest_add_func("/ivshmem/server", test_ivshmem_server); } + if (!strcmp(arch, "x86_64") && qtest_has_machine("q35")) { + qtest_add_func("/ivshmem/hotplug-q35", test_ivshmem_hotplug_q35); + } =20 out: ret =3D g_test_run(); --=20 2.34.1