mirror of
https://github.com/libvirt/libvirt.git
synced 2026-10-02 12:20:06 -05:00
tests: properly mock VFIO and IOMMU checks
Fixes: 63434db800
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
1 parent
63434db800
commit
75db232f90
5 files changed
+13
-17
No files matched your search
+1
-1
@@ -141,7 +141,7 @@ unsigned long long virMemoryLimitTruncate(unsigned long long value);
|
||||
bool virMemoryLimitIsSet(unsigned long long value);
|
||||
unsigned long long virMemoryMaxValue(bool ulong) ATTRIBUTE_MOCKABLE;
|
||||
|
||||
bool virHostHasIOMMU(void);
|
||||
bool virHostHasIOMMU(void) ATTRIBUTE_MOCKABLE;
|
||||
|
||||
char *virHostGetDRMRenderNode(void) ATTRIBUTE_MOCKABLE;
|
||||
|
||||
|
||||
@@ -86,10 +86,7 @@
|
||||
<value>scsi</value>
|
||||
</enum>
|
||||
<enum name='capsType'/>
|
||||
<enum name='pciBackend'>
|
||||
<value>default</value>
|
||||
<value>vfio</value>
|
||||
</enum>
|
||||
<enum name='pciBackend'/>
|
||||
<enum name='iommufd'>
|
||||
<value>no</value>
|
||||
</enum>
|
||||
|
||||
@@ -147,10 +147,7 @@
|
||||
<value>scsi</value>
|
||||
</enum>
|
||||
<enum name='capsType'/>
|
||||
<enum name='pciBackend'>
|
||||
<value>default</value>
|
||||
<value>vfio</value>
|
||||
</enum>
|
||||
<enum name='pciBackend'/>
|
||||
<enum name='iommufd'>
|
||||
<value>no</value>
|
||||
</enum>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "virhostmem.h"
|
||||
#include "viriommufd.h"
|
||||
#include "virmock.h"
|
||||
#include "virutil.h"
|
||||
|
||||
#if WITH_QEMU
|
||||
# include "qemu/qemu_capabilities.h"
|
||||
@@ -91,5 +92,14 @@ virFileExists(const char *path)
|
||||
if (STREQ(path, VIR_IOMMU_DEV_PATH))
|
||||
return true;
|
||||
|
||||
if (STREQ(path, "/dev/vfio/vfio"))
|
||||
return true;
|
||||
|
||||
return real_virFileExists(path);
|
||||
}
|
||||
|
||||
bool
|
||||
virHostHasIOMMU(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -104,14 +104,6 @@ fillQemuCaps(virDomainCaps *domCaps,
|
||||
false) < 0)
|
||||
return -1;
|
||||
|
||||
/* The function above tries to query host's VFIO capabilities by calling
|
||||
* virHostdevHostSupportsPassthroughVFIO() which, however, can't be
|
||||
* successfully mocked as they are not exposed as internal APIs. Therefore,
|
||||
* instead of mocking set the expected values here by hand. */
|
||||
VIR_DOMAIN_CAPS_ENUM_SET(domCaps->hostdev.pciBackend,
|
||||
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT,
|
||||
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO);
|
||||
|
||||
/* As of f05b6a918e28 we are expecting to see OVMF_CODE.fd file which
|
||||
* may not exists everywhere. */
|
||||
while (loader->values.nvalues)
|
||||
|
||||
Reference in new issue
Block a user