From nobody Mon Feb 9 11:47:04 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1699257605994592.6692662009817; Mon, 6 Nov 2023 00:00:05 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 3784018F8; Mon, 6 Nov 2023 03:00:04 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 34AD51985; Mon, 6 Nov 2023 02:40:22 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id C49BE18AF; Mon, 6 Nov 2023 02:39:12 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id DB92018B7 for ; Mon, 6 Nov 2023 02:39:09 -0500 (EST) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-347-mgsEY5IfNZ6dekwS_r0Hqw-1; Mon, 06 Nov 2023 02:39:06 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 029273821569; Mon, 6 Nov 2023 07:39:06 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.32.79]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5BDF492BE0; Mon, 6 Nov 2023 07:39:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: mgsEY5IfNZ6dekwS_r0Hqw-1 From: Laine Stump To: devel@lists.libvirt.org, libvir-list@redhat.com Subject: [libvirt PATCH v2 14/15] tests: mock virPCIDevice(BindTo|UnbindFrom)Stub with nop functions Date: Mon, 6 Nov 2023 02:38:59 -0500 Message-ID: <20231106073901.735582-15-laine@redhat.com> In-Reply-To: <20231106073901.735582-1-laine@redhat.com> References: <20231106073901.735582-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 67JD3E77XL7TKDXKA5MGE2R2IZJ3QCGG X-Message-ID-Hash: 67JD3E77XL7TKDXKA5MGE2R2IZJ3QCGG X-MailFrom: laine@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Joao Martins , Jason Gunthorpe , Cedric Le Goater X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1699257607487100001 Only in qemuhotplug test, in order to not fail when running the test on macOS. This is a temporary measure until I decice how best to make a mock environment that allows virPCIDeviceFindBestVariant() to succeed on non-Linux platforms (which is a bit nonsensical, since none of that code will ever run on non-Linux anyway). Signed-off-by: Laine Stump Reviewed-by: Peter Krempa --- src/libvirt_private.syms | 2 ++ src/util/virpci.c | 4 ++-- src/util/virpci.h | 3 +++ tests/qemuhotplugmock.c | 15 +++++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 3e8eded81e..0e8353cc22 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3072,6 +3072,7 @@ virPCIDeviceAddressIOMMUGroupIterate; virPCIDeviceAddressIsEmpty; virPCIDeviceAddressIsValid; virPCIDeviceAddressParse; +virPCIDeviceBindToStub; virPCIDeviceCopy; virPCIDeviceDetach; virPCIDeviceExists; @@ -3120,6 +3121,7 @@ virPCIDeviceSetStubDriverType; virPCIDeviceSetUnbindFromStub; virPCIDeviceSetUsedBy; virPCIDeviceUnbind; +virPCIDeviceUnbindFromStub; virPCIEDeviceInfoFree; virPCIELinkSpeedTypeFromString; virPCIELinkSpeedTypeToString; diff --git a/src/util/virpci.c b/src/util/virpci.c index dfc97dc981..885958eb99 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -1406,7 +1406,7 @@ virPCIDeviceBindWithDriverOverride(virPCIDevice *dev, return 0; } =20 -static int +int virPCIDeviceUnbindFromStub(virPCIDevice *dev) { if (!dev->unbind_from_stub) { @@ -1417,7 +1417,7 @@ virPCIDeviceUnbindFromStub(virPCIDevice *dev) return virPCIDeviceBindWithDriverOverride(dev, "\n"); } =20 -static int +int virPCIDeviceBindToStub(virPCIDevice *dev) { g_autofree char *stubDriverPath =3D NULL; diff --git a/src/util/virpci.h b/src/util/virpci.h index faca6cf6f9..4fbace7f67 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -131,6 +131,9 @@ int virPCIDeviceReset(virPCIDevice *dev, virPCIDeviceList *activeDevs, virPCIDeviceList *inactiveDevs); =20 +int virPCIDeviceUnbindFromStub(virPCIDevice *dev); +int virPCIDeviceBindToStub(virPCIDevice *dev); + void virPCIDeviceSetManaged(virPCIDevice *dev, bool managed); bool virPCIDeviceGetManaged(virPCIDevice *dev); diff --git a/tests/qemuhotplugmock.c b/tests/qemuhotplugmock.c index dd7e2c67e0..e578046e0d 100644 --- a/tests/qemuhotplugmock.c +++ b/tests/qemuhotplugmock.c @@ -25,6 +25,7 @@ #include "conf/domain_conf.h" #include "virdevmapper.h" #include "virmock.h" +#include "virpci.h" #include =20 #define LIBVIRT_QEMU_MONITOR_PRIV_H_ALLOW @@ -81,6 +82,20 @@ virFileExists(const char *path) } =20 =20 +int +virPCIDeviceBindToStub(virPCIDevice *dev G_GNUC_UNUSED) +{ + return 0; +} + + +int +virPCIDeviceUnbindFromStub(virPCIDevice *dev G_GNUC_UNUSED) +{ + return 0; +} + + int qemuProcessStartManagedPRDaemon(virDomainObj *vm G_GNUC_UNUSED) { --=20 2.41.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org