summaryrefslogtreecommitdiff
path: root/tests/virhostdevtest.c
diff options
context:
space:
mode:
authorDaniel Henrique Barboza <danielhb413@gmail.com>2019-05-02 09:51:52 -0300
committerMichal Privoznik <mprivozn@redhat.com>2019-05-04 23:39:35 +0200
commit39d4f78a8eee6db065752204cc6a76afcf9d5745 (patch)
tree30ba1a75c2a2b2b56648f47f5dbd0bac155ae041 /tests/virhostdevtest.c
parentf0f1e79bf5271835fb6367d8f44ba5a5ad8cfc83 (diff)
downloadlibvirt-39d4f78a8eee6db065752204cc6a76afcf9d5745.tar.gz
tests/virhostdevtest: remove virHostdevHostSupportsPassthroughKVM
virhostdevtest is using pci mock to emulate all PCI attach/detach operations. This means that that this test does not rely on KVM support of the host anymore and the tests in this file shouldn't be affected by it. Suggested-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Diffstat (limited to 'tests/virhostdevtest.c')
-rw-r--r--tests/virhostdevtest.c61
1 files changed, 12 insertions, 49 deletions
diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index 4e067b10d1..20eaca82e0 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -126,37 +126,6 @@ myInit(void)
return -1;
}
-# if HAVE_LINUX_KVM_H
-# include <linux/kvm.h>
-static bool
-virHostdevHostSupportsPassthroughKVM(void)
-{
- int kvmfd = -1;
- bool ret = false;
-
- if ((kvmfd = open("/dev/kvm", O_RDONLY)) < 0)
- goto cleanup;
-
-# ifdef KVM_CAP_IOMMU
- if ((ioctl(kvmfd, KVM_CHECK_EXTENSION, KVM_CAP_IOMMU)) <= 0)
- goto cleanup;
-
- ret = true;
-# endif
-
- cleanup:
- VIR_FORCE_CLOSE(kvmfd);
-
- return ret;
-}
-# else
-static bool
-virHostdevHostSupportsPassthroughKVM(void)
-{
- return false;
-}
-# endif
-
static int
testVirHostdevPreparePCIHostdevs_unmanaged(void)
{
@@ -483,12 +452,10 @@ testVirHostdevRoundtripUnmanaged(const void *opaque ATTRIBUTE_UNUSED)
if (testVirHostdevDetachPCINodeDevice() < 0)
goto out;
- if (virHostdevHostSupportsPassthroughKVM()) {
- if (testVirHostdevPreparePCIHostdevs_unmanaged() < 0)
- goto out;
- if (testVirHostdevReAttachPCIHostdevs_unmanaged() < 0)
- goto out;
- }
+ if (testVirHostdevPreparePCIHostdevs_unmanaged() < 0)
+ goto out;
+ if (testVirHostdevReAttachPCIHostdevs_unmanaged() < 0)
+ goto out;
if (testVirHostdevReAttachPCINodeDevice() < 0)
goto out;
@@ -512,12 +479,10 @@ testVirHostdevRoundtripManaged(const void *opaque ATTRIBUTE_UNUSED)
{
int ret = -1;
- if (virHostdevHostSupportsPassthroughKVM()) {
- if (testVirHostdevPreparePCIHostdevs_managed(false) < 0)
- goto out;
- if (testVirHostdevReAttachPCIHostdevs_managed(false) < 0)
- goto out;
- }
+ if (testVirHostdevPreparePCIHostdevs_managed(false) < 0)
+ goto out;
+ if (testVirHostdevReAttachPCIHostdevs_managed(false) < 0)
+ goto out;
ret = 0;
@@ -544,12 +509,10 @@ testVirHostdevRoundtripMixed(const void *opaque ATTRIBUTE_UNUSED)
if (testVirHostdevDetachPCINodeDevice() < 0)
goto out;
- if (virHostdevHostSupportsPassthroughKVM()) {
- if (testVirHostdevPreparePCIHostdevs_managed(true) < 0)
- goto out;
- if (testVirHostdevReAttachPCIHostdevs_managed(true) < 0)
- goto out;
- }
+ if (testVirHostdevPreparePCIHostdevs_managed(true) < 0)
+ goto out;
+ if (testVirHostdevReAttachPCIHostdevs_managed(true) < 0)
+ goto out;
if (testVirHostdevReAttachPCINodeDevice() < 0)
goto out;