Re: [PATCH v2 2/5] virpcitest: Test virPCIDeviceDetach

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

 



On Thu, Oct 31, 2013 at 11:23:39AM +0000, Michal Privoznik wrote:
> This commit introduces yet another test under virpcitest:
> virPCIDeviceDetach. However, in order to be able to do this, the
> virpcimock needs to be extended to model the kernel behavior on PCI
> device binding and unbinding (create 'driver' symlinks under the device
> tree, check for device ID in driver's ID table, etc.)
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  cfg.mk             |   2 +-
>  tests/Makefile.am  |  10 +-
>  tests/virpcimock.c | 603 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  tests/virpcitest.c |  42 ++++
>  4 files changed, 652 insertions(+), 5 deletions(-)
> 
[...]
> diff --git a/tests/virpcimock.c b/tests/virpcimock.c
> index d545361..2adc337 100644
> --- a/tests/virpcimock.c
> +++ b/tests/virpcimock.c
[...]
> +static int
> +pci_driver_handle_unbind(const char *path)
> +{
> +    int ret = -1;
> +    struct pciDevice *dev = pci_device_find_by_content(path);
> +
> +    if (!dev || !dev->driver) {
> +        /* This should never happen (TM) */
> +        errno = ENODEV;
> +        goto cleanup;
> +    }
> +

I spoke too soon, this function might check whether the driver is what
the device is really binded to and error out if not.

> +    ret = pci_driver_unbind(dev->driver, dev);

than this one can be called only with 'dev'.

But since we are not testing/emulating faulty kernel behaviour, this
is not necesarily needed.  However it would be nice to have cleaned up
so it's easier to read for others when adding more tests.

Martin

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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]