]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
networkxmlconftest: Expect success for "hostdev" case only on Linux
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 30 Jan 2026 09:39:37 +0000 (10:39 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 30 Jan 2026 14:23:52 +0000 (15:23 +0100)
Our network has multiple means of forwarding the traffic and
'hostdev' is one of them. This mode means that the network is
configured to use a set of PCI devices which are then assigned to
individual domains to use (PCI device assignment). Now, as of
v12.0.0-61-gecb2e06bdf our test runners
(testCompareXMLToXMLFiles() and testCompareXMLToConfFiles()) call
networkValidateTests(). For aforementioned type of network this
means checking that the specified set of devices contains only
VFs (see v3.2.0-rc1~24 for more info). It is true that our
virpcimock is preloaded which mimics VFs, but our utils module
(virpci.c specifically) talks to sysfs to check various PCI
device attributes, including whether it's a VF.

This obviously works on Linux and doesn't work anywhere else.
Therefore, until our utils module is taught how to check PCI
attribs on other systems, make the "hostdev" test case expect
validation failure on non-Linux systems.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
tests/networkxmlconftest.c

index b32a39c5532bc4f9c0a682356dd5dec3988b5db6..b74d5b14f5c20ea8d39bc6c73a7a59d8eabe3997 100644 (file)
@@ -313,7 +313,16 @@ mymain(void)
     DO_TEST("bandwidth-network");
     DO_TEST("openvswitch-net");
     DO_TEST_VALIDATE_ERROR("passthrough-pf");
+#ifdef __linux__
     DO_TEST("hostdev");
+#else
+    /* Our test runners call networkValidateTests() which for
+     * <forward mode='hostdev'/> means validating that PCI
+     * devices are VFs. It's done so by querying sysfs which
+     * obviously works on Linux only. Thus, expect a validation
+     * error elsewhere. */
+    DO_TEST_VALIDATE_ERROR("hostdev");
+#endif
     DO_TEST_FLAGS("hostdev-pf", VIR_NETWORK_XML_INACTIVE);
     DO_TEST_FLAGS("hostdev-pf-driver-model", VIR_NETWORK_XML_INACTIVE);
     DO_TEST("ptr-domains-auto");