[libvirt PATCH v2 14/15] tests: mock virPCIDevice(BindTo|UnbindFrom)Stub with nop functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <laine@xxxxxxxxxx>
---
 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;
 }
 
-static int
+int
 virPCIDeviceUnbindFromStub(virPCIDevice *dev)
 {
     if (!dev->unbind_from_stub) {
@@ -1417,7 +1417,7 @@ virPCIDeviceUnbindFromStub(virPCIDevice *dev)
     return virPCIDeviceBindWithDriverOverride(dev, "\n");
 }
 
-static int
+int
 virPCIDeviceBindToStub(virPCIDevice *dev)
 {
     g_autofree char *stubDriverPath = 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);
 
+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 <fcntl.h>
 
 #define LIBVIRT_QEMU_MONITOR_PRIV_H_ALLOW
@@ -81,6 +82,20 @@ virFileExists(const char *path)
 }
 
 
+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)
 {
-- 
2.41.0
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux