[virt-tools-list] [virt-manager PATCH 2/3] tests: Add test for vhostuser

Cole Robinson crobinso at redhat.com
Thu Oct 26 10:01:12 UTC 2017


On 10/20/2017 11:08 AM, Lin Ma wrote:
> Signed-off-by: Lin Ma <lma at suse.com>
> ---
>  tests/xmlparse-xml/add-devices-out.xml |  5 +++++
>  tests/xmlparse.py                      | 12 ++++++++++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/tests/xmlparse-xml/add-devices-out.xml b/tests/xmlparse-xml/add-devices-out.xml
> index e7e153b..563c8da 100644
> --- a/tests/xmlparse-xml/add-devices-out.xml
> +++ b/tests/xmlparse-xml/add-devices-out.xml
> @@ -44,6 +44,11 @@
>        <mac address="1A:2A:3A:4A:5A:6A"/>
>        <address type="spapr-vio"/>
>      </interface>
> +    <interface type="vhostuser">
> +      <source type="unix" path="/tmp/vhost1.sock" mode="server"/>
> +      <mac address="00:11:22:33:44:66"/>
> +      <model type="virtio"/>
> +    </interface>
>      <watchdog model="i6300esb" action="reset"/>
>    </devices>
>    <seclabel type="static" model="selinux">
> diff --git a/tests/xmlparse.py b/tests/xmlparse.py
> index 1cceebc..90e399a 100644
> --- a/tests/xmlparse.py
> +++ b/tests/xmlparse.py
> @@ -968,6 +968,18 @@ class XMLParseTest(unittest.TestCase):
>          guest.remove_device(adddev)
>          guest.add_device(adddev)
>  
> +        adddev1 = virtinst.VirtualNetworkInterface(conn=conn)
> +        adddev1.type = "vhostuser"
> +        adddev1.source_type = "unix"
> +        adddev1.source_mode = "server"
> +        adddev1.source_path = "/tmp/vhost1.sock"
> +        adddev1.model = "virtio"
> +        adddev1.macaddr = "00:11:22:33:44:66"
> +
> +        guest.add_device(adddev1)
> +        guest.remove_device(adddev1)
> +        guest.add_device(adddev1)
> +
>          guest.add_device(virtinst.VirtualAudio(conn,
>              parsexml="""<sound model='pcspk'/>"""))
>  
> 

This doesn't really add any code coverage; XML building for vhostuser is
already tested via clitest, and there isn't anything special about
adding/removing the device here. This patch isn't needed IMO

(I pushed a patch with comments explaining the particular bits that
AddRemoveDevice are actually testing which hopefully explains things better)

Thanks,
Cole




More information about the virt-tools-list mailing list