From nobody Mon Feb 9 17:25:07 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=1663682389; cv=none; d=zohomail.com; s=zohoarc; b=c8agDN7FWpn0jyPZvZ0txuLijjdHrmAs2T1sJgaq2PeIjY2ja+4Oym8udkzrjL7yLb2RSMrBCcMSU0wN1NMP4XgPrC2GWV0rgc9Uax0Rj704i3XofQL7k7h/57i98nhHYs6eAxmfq/PlJogni4BN5docPDt5Ba7TquKpd5bRDoc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663682389; 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=lV8UB/UtOw5OSkGY6vR/gLUSXvau5CG9NAv5Twii2Yg=; b=UvSnkJET+S+DegpYgmwYZyKzDCfDlD7wnTOivESCXx0ue4t7Iuuqkha1Wg43myqAX2i4sqNXopTUXhS2SQkgXS/hPia+HLjsahu93kPYzjHlzNsPUDU4cug+nGeSXfK1G7ni2xBnR0cZhYAjel9+ZIF8I8a1uw88bX+0A85amYo= 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 1663682388484485.22248447825825; Tue, 20 Sep 2022 06:59:48 -0700 (PDT) Received: from localhost ([::1]:42468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oadms-0001aD-7P for importer@patchew.org; Tue, 20 Sep 2022 09:59:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaaoO-0003zm-54 for qemu-devel@nongnu.org; Tue, 20 Sep 2022 06:49:09 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:52142) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaaoG-0007zQ-OT for qemu-devel@nongnu.org; Tue, 20 Sep 2022 06:49:03 -0400 Received: from [192.168.16.178] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oaalj-004fUv-LR; Tue, 20 Sep 2022 12:48:36 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v4 1/7] tests/x86: Move common code to function in device-plug-test Date: Tue, 20 Sep 2022 13:48:36 +0300 Message-Id: <20220920104842.605530-2-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220920104842.605530-1-michael.labiuk@virtuozzo.com> References: <20220920104842.605530-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: 1663682389764100001 Content-Type: text/plain; charset="utf-8" Move common code for device removing to function. Signed-off-by: Michael Labiuk Reviewed-by: Thomas Huth --- tests/qtest/device-plug-test.c | 42 ++++++++++++++-------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c index a1fb99c8ff..e595b45b66 100644 --- a/tests/qtest/device-plug-test.c +++ b/tests/qtest/device-plug-test.c @@ -61,6 +61,18 @@ static void wait_device_deleted_event(QTestState *qtest,= const char *id) } } =20 +static void process_device_remove(QTestState *qtest, const char *id) +{ + /* + * Request device removal. As the guest is not running, the request wo= n't + * be processed. However during system reset, the removal will be + * handled, removing the device. + */ + device_del(qtest, id); + system_reset(qtest); + wait_device_deleted_event(qtest, id); +} + static void test_pci_unplug_request(void) { const char *arch =3D qtest_get_arch(); @@ -73,14 +85,7 @@ static void test_pci_unplug_request(void) QTestState *qtest =3D qtest_initf("%s -device virtio-mouse-pci,id=3Dde= v0", machine_addition); =20 - /* - * Request device removal. As the guest is not running, the request wo= n't - * be processed. However during system reset, the removal will be - * handled, removing the device. - */ - device_del(qtest, "dev0"); - system_reset(qtest); - wait_device_deleted_event(qtest, "dev0"); + process_device_remove(qtest, "dev0"); =20 qtest_quit(qtest); } @@ -98,14 +103,7 @@ static void test_pci_unplug_json_request(void) "%s -device \"{'driver': 'virtio-mouse-pci', 'id': 'dev0'}\"", machine_addition); =20 - /* - * Request device removal. As the guest is not running, the request wo= n't - * be processed. However during system reset, the removal will be - * handled, removing the device. - */ - device_del(qtest, "dev0"); - system_reset(qtest); - wait_device_deleted_event(qtest, "dev0"); + process_device_remove(qtest, "dev0"); =20 qtest_quit(qtest); } @@ -128,9 +126,7 @@ static void test_spapr_cpu_unplug_request(void) "-device power9_v2.0-spapr-cpu-core,core-id=3D1,id= =3Ddev0"); =20 /* similar to test_pci_unplug_request */ - device_del(qtest, "dev0"); - system_reset(qtest); - wait_device_deleted_event(qtest, "dev0"); + process_device_remove(qtest, "dev0"); =20 qtest_quit(qtest); } @@ -144,9 +140,7 @@ static void test_spapr_memory_unplug_request(void) "-device pc-dimm,id=3Ddev0,memdev=3Dmem0"); =20 /* similar to test_pci_unplug_request */ - device_del(qtest, "dev0"); - system_reset(qtest); - wait_device_deleted_event(qtest, "dev0"); + process_device_remove(qtest, "dev0"); =20 qtest_quit(qtest); } @@ -158,9 +152,7 @@ static void test_spapr_phb_unplug_request(void) qtest =3D qtest_initf("-device spapr-pci-host-bridge,index=3D1,id=3Dde= v0"); =20 /* similar to test_pci_unplug_request */ - device_del(qtest, "dev0"); - system_reset(qtest); - wait_device_deleted_event(qtest, "dev0"); + process_device_remove(qtest, "dev0"); =20 qtest_quit(qtest); } --=20 2.34.1