From: Michal Privoznik <[email protected]>

In one of my previous commits, I've introduced
"interface-hostdev" attach and detach test cases to
qemuhotplugtest. And they work flawlessly, on Linux. But on
anything else they fail because our virpci.c module is basically
just a bunch of stub functions that do nothing but report an
error, rendering my changes to virpcimock futile.

BTW: this is similar to what I had done in v12.1.0-rc1~199.

Fixes: f9bb819fc4841dbdff801629bf58f9fd6d7d93eb
Signed-off-by: Michal Privoznik <[email protected]>
---

Verified in my FreeBSD VM.

 tests/qemuhotplugtest.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 6cb616c59b..146e9e33c1 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -697,10 +697,18 @@ mymain(void)
     DO_TEST_DETACH("ppc64", "pseries-base-live", "hostdev-pci", false, false,
                    "device_del", QMP_DEVICE_DELETED("hostdev0") QMP_OK);
 
+#ifdef __linux__
+    /* While <interface type='hostdev'/> is nearly the same as <hostdev/>,
+     * there are subtle differences, e.g. checking that PCI device specified in
+     * <interface/> is a VF. Checks like these are done by walking sysfs which
+     * is limited to Linux, obviously. And while our virpcimock creates
+     * necessary structure, on non-Linux the virpci.c is compiled with stubs
+     * that do nothing but report an error. */
     DO_TEST_ATTACH("x86_64", "base-live", "interface-hostdev", false, true,
                    "device_add", QMP_OK);
     DO_TEST_DETACH("x86_64", "base-live", "interface-hostdev", false, false,
                    "device_del", QMP_DEVICE_DELETED("hostdev0") QMP_OK);
+#endif
     DO_TEST_ATTACH("x86_64", "base-live", "interface-vdpa", false, true,
                    "query-fdsets", "{\"return\":[{\"fdset-id\":99999}]}",
                    "add-fd", "{ \"return\": { \"fdset-id\": 1, \"fd\": 95 }}",
-- 
2.52.0

Reply via email to