From nobody Tue Feb 10 04:17:29 2026 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