Re: [libvirt] [PATCH v4 6/6] Add test for GVirConfigDomainHostdevPci API

2016-04-26 Thread Christophe Fergeau
On Tue, Apr 26, 2016 at 04:47:58PM +0100, Zeeshan Ali (Khattak) wrote:
> On Thu, Apr 21, 2016 at 3:14 PM, Christophe Fergeau  
> wrote:
> > And one more.
> 
> Yours? AFAIK it's mine.

Yes, you're right, sorry, I was too eager to get to the end of that
series ;)

Acked-by: Christophe Fergeau 

> 
> > On Fri, Apr 15, 2016 at 02:38:24PM +0100, Zeeshan Ali (Khattak) wrote:
> >> ---
> >>  tests/test-gconfig.c| 43 
> >> +
> >>  tests/xml/gconfig-domain-device-pci-hostdev.xml | 11 +++
> >>  2 files changed, 54 insertions(+)
> >>  create mode 100644 tests/xml/gconfig-domain-device-pci-hostdev.xml
> >>
> >> diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c
> >> index be55ef9..a26bb5f 100644
> >> --- a/tests/test-gconfig.c
> >> +++ b/tests/test-gconfig.c
> >> @@ -709,6 +709,47 @@ static void test_domain_device_usb_redir(void)
> >>  g_object_unref(G_OBJECT(domain));
> >>  }
> >>
> >> +static void test_domain_device_pci_hostdev(void)
> >> +{
> >> +GVirConfigDomain *domain;
> >> +GVirConfigDomainAddressPci *address;
> >> +GVirConfigDomainHostdevPci *hostdev;
> >> +
> >> +domain = gvir_config_domain_new();
> >> +
> >> +hostdev = gvir_config_domain_hostdev_pci_new();
> >> +
> >> gvir_config_domain_hostdev_set_boot_order(GVIR_CONFIG_DOMAIN_HOSTDEV(hostdev),
> >>  1);
> >> +
> >> g_assert_cmpint(gvir_config_domain_hostdev_get_boot_order(GVIR_CONFIG_DOMAIN_HOSTDEV(hostdev)),
> >>  ==, 1);
> >> +gvir_config_domain_hostdev_pci_set_managed(hostdev, TRUE);
> >> +g_assert(gvir_config_domain_hostdev_pci_get_managed(hostdev) == TRUE);
> >> +gvir_config_domain_hostdev_pci_set_rom_bar(hostdev, TRUE);
> >> +gvir_config_domain_hostdev_pci_set_rom_file(hostdev, 
> >> "/etc/fake/boot.bin");
> >> +g_assert_cmpstr(gvir_config_domain_hostdev_pci_get_rom_file(hostdev), 
> >> ==, "/etc/fake/boot.bin");
> >> +g_assert(gvir_config_domain_hostdev_pci_get_rom_bar(hostdev));
> >> +
> >> +address = gvir_config_domain_address_pci_new();
> >> +gvir_config_domain_address_pci_set_domain(address, 1);
> >> +gvir_config_domain_address_pci_set_bus(address, 2);
> >> +gvir_config_domain_address_pci_set_slot(address, 3);
> >> +gvir_config_domain_address_pci_set_function(address, 4);
> >> +gvir_config_domain_hostdev_pci_set_address(hostdev, address);
> >> +g_object_unref(G_OBJECT(address));
> >> +
> >> +address = gvir_config_domain_hostdev_pci_get_address(hostdev);
> >> +g_assert(address != NULL);
> >> +g_assert_cmpint(gvir_config_domain_address_pci_get_domain(address), 
> >> ==, 1);
> >> +g_assert_cmpint(gvir_config_domain_address_pci_get_bus(address), ==, 
> >> 2);
> >> +g_assert_cmpint(gvir_config_domain_address_pci_get_slot(address), ==, 
> >> 3);
> >> +g_assert_cmpint(gvir_config_domain_address_pci_get_function(address), 
> >> ==, 4);
> >> +g_object_unref(G_OBJECT(address));
> >> +
> >> +gvir_config_domain_add_device(domain, GVIR_CONFIG_DOMAIN_DEVICE 
> >> (hostdev));
> >> +g_object_unref(G_OBJECT(hostdev));
> >> +
> >> +check_xml(domain, "gconfig-domain-device-pci-hostdev.xml");
> >> +
> >> +g_object_unref(G_OBJECT(domain));
> >> +}
> >>
> >>  int main(int argc, char **argv)
> >>  {
> >> @@ -739,6 +780,8 @@ int main(int argc, char **argv)
> >>  test_domain_device_channel);
> >>  g_test_add_func("/libvirt-gconfig/domain-device-usb-redir",
> >>  test_domain_device_usb_redir);
> >> +g_test_add_func("/libvirt-gconfig/domain-device-pci-hostdev",
> >> +test_domain_device_pci_hostdev);
> >>
> >>  return g_test_run();
> >>  }
> >> diff --git a/tests/xml/gconfig-domain-device-pci-hostdev.xml 
> >> b/tests/xml/gconfig-domain-device-pci-hostdev.xml
> >> new file mode 100644
> >> index 000..70e32ac
> >> --- /dev/null
> >> +++ b/tests/xml/gconfig-domain-device-pci-hostdev.xml
> >> @@ -0,0 +1,11 @@
> >> +
> >> +  
> >> +
> >> +  
> >> +  
> >> +  
> >> +
> >> +  
> >> +
> >> +  
> >> +
> >> --
> >> 2.5.5
> >>
> >> --
> >> libvir-list mailing list
> >> libvir-list@redhat.com
> >> https://www.redhat.com/mailman/listinfo/libvir-list
> 
> 
> 
> -- 
> Regards,
> 
> Zeeshan Ali (Khattak)
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v4 6/6] Add test for GVirConfigDomainHostdevPci API

2016-04-26 Thread Zeeshan Ali (Khattak)
On Thu, Apr 21, 2016 at 3:14 PM, Christophe Fergeau  wrote:
> And one more.

Yours? AFAIK it's mine.

> On Fri, Apr 15, 2016 at 02:38:24PM +0100, Zeeshan Ali (Khattak) wrote:
>> ---
>>  tests/test-gconfig.c| 43 
>> +
>>  tests/xml/gconfig-domain-device-pci-hostdev.xml | 11 +++
>>  2 files changed, 54 insertions(+)
>>  create mode 100644 tests/xml/gconfig-domain-device-pci-hostdev.xml
>>
>> diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c
>> index be55ef9..a26bb5f 100644
>> --- a/tests/test-gconfig.c
>> +++ b/tests/test-gconfig.c
>> @@ -709,6 +709,47 @@ static void test_domain_device_usb_redir(void)
>>  g_object_unref(G_OBJECT(domain));
>>  }
>>
>> +static void test_domain_device_pci_hostdev(void)
>> +{
>> +GVirConfigDomain *domain;
>> +GVirConfigDomainAddressPci *address;
>> +GVirConfigDomainHostdevPci *hostdev;
>> +
>> +domain = gvir_config_domain_new();
>> +
>> +hostdev = gvir_config_domain_hostdev_pci_new();
>> +
>> gvir_config_domain_hostdev_set_boot_order(GVIR_CONFIG_DOMAIN_HOSTDEV(hostdev),
>>  1);
>> +
>> g_assert_cmpint(gvir_config_domain_hostdev_get_boot_order(GVIR_CONFIG_DOMAIN_HOSTDEV(hostdev)),
>>  ==, 1);
>> +gvir_config_domain_hostdev_pci_set_managed(hostdev, TRUE);
>> +g_assert(gvir_config_domain_hostdev_pci_get_managed(hostdev) == TRUE);
>> +gvir_config_domain_hostdev_pci_set_rom_bar(hostdev, TRUE);
>> +gvir_config_domain_hostdev_pci_set_rom_file(hostdev, 
>> "/etc/fake/boot.bin");
>> +g_assert_cmpstr(gvir_config_domain_hostdev_pci_get_rom_file(hostdev), 
>> ==, "/etc/fake/boot.bin");
>> +g_assert(gvir_config_domain_hostdev_pci_get_rom_bar(hostdev));
>> +
>> +address = gvir_config_domain_address_pci_new();
>> +gvir_config_domain_address_pci_set_domain(address, 1);
>> +gvir_config_domain_address_pci_set_bus(address, 2);
>> +gvir_config_domain_address_pci_set_slot(address, 3);
>> +gvir_config_domain_address_pci_set_function(address, 4);
>> +gvir_config_domain_hostdev_pci_set_address(hostdev, address);
>> +g_object_unref(G_OBJECT(address));
>> +
>> +address = gvir_config_domain_hostdev_pci_get_address(hostdev);
>> +g_assert(address != NULL);
>> +g_assert_cmpint(gvir_config_domain_address_pci_get_domain(address), ==, 
>> 1);
>> +g_assert_cmpint(gvir_config_domain_address_pci_get_bus(address), ==, 2);
>> +g_assert_cmpint(gvir_config_domain_address_pci_get_slot(address), ==, 
>> 3);
>> +g_assert_cmpint(gvir_config_domain_address_pci_get_function(address), 
>> ==, 4);
>> +g_object_unref(G_OBJECT(address));
>> +
>> +gvir_config_domain_add_device(domain, GVIR_CONFIG_DOMAIN_DEVICE 
>> (hostdev));
>> +g_object_unref(G_OBJECT(hostdev));
>> +
>> +check_xml(domain, "gconfig-domain-device-pci-hostdev.xml");
>> +
>> +g_object_unref(G_OBJECT(domain));
>> +}
>>
>>  int main(int argc, char **argv)
>>  {
>> @@ -739,6 +780,8 @@ int main(int argc, char **argv)
>>  test_domain_device_channel);
>>  g_test_add_func("/libvirt-gconfig/domain-device-usb-redir",
>>  test_domain_device_usb_redir);
>> +g_test_add_func("/libvirt-gconfig/domain-device-pci-hostdev",
>> +test_domain_device_pci_hostdev);
>>
>>  return g_test_run();
>>  }
>> diff --git a/tests/xml/gconfig-domain-device-pci-hostdev.xml 
>> b/tests/xml/gconfig-domain-device-pci-hostdev.xml
>> new file mode 100644
>> index 000..70e32ac
>> --- /dev/null
>> +++ b/tests/xml/gconfig-domain-device-pci-hostdev.xml
>> @@ -0,0 +1,11 @@
>> +
>> +  
>> +
>> +  
>> +  
>> +  
>> +
>> +  
>> +
>> +  
>> +
>> --
>> 2.5.5
>>
>> --
>> libvir-list mailing list
>> libvir-list@redhat.com
>> https://www.redhat.com/mailman/listinfo/libvir-list



-- 
Regards,

Zeeshan Ali (Khattak)

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


Re: [libvirt] [PATCH v4 6/6] Add test for GVirConfigDomainHostdevPci API

2016-04-21 Thread Christophe Fergeau
And one more.

On Fri, Apr 15, 2016 at 02:38:24PM +0100, Zeeshan Ali (Khattak) wrote:
> ---
>  tests/test-gconfig.c| 43 
> +
>  tests/xml/gconfig-domain-device-pci-hostdev.xml | 11 +++
>  2 files changed, 54 insertions(+)
>  create mode 100644 tests/xml/gconfig-domain-device-pci-hostdev.xml
> 
> diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c
> index be55ef9..a26bb5f 100644
> --- a/tests/test-gconfig.c
> +++ b/tests/test-gconfig.c
> @@ -709,6 +709,47 @@ static void test_domain_device_usb_redir(void)
>  g_object_unref(G_OBJECT(domain));
>  }
>  
> +static void test_domain_device_pci_hostdev(void)
> +{
> +GVirConfigDomain *domain;
> +GVirConfigDomainAddressPci *address;
> +GVirConfigDomainHostdevPci *hostdev;
> +
> +domain = gvir_config_domain_new();
> +
> +hostdev = gvir_config_domain_hostdev_pci_new();
> +
> gvir_config_domain_hostdev_set_boot_order(GVIR_CONFIG_DOMAIN_HOSTDEV(hostdev),
>  1);
> +
> g_assert_cmpint(gvir_config_domain_hostdev_get_boot_order(GVIR_CONFIG_DOMAIN_HOSTDEV(hostdev)),
>  ==, 1);
> +gvir_config_domain_hostdev_pci_set_managed(hostdev, TRUE);
> +g_assert(gvir_config_domain_hostdev_pci_get_managed(hostdev) == TRUE);
> +gvir_config_domain_hostdev_pci_set_rom_bar(hostdev, TRUE);
> +gvir_config_domain_hostdev_pci_set_rom_file(hostdev, 
> "/etc/fake/boot.bin");
> +g_assert_cmpstr(gvir_config_domain_hostdev_pci_get_rom_file(hostdev), 
> ==, "/etc/fake/boot.bin");
> +g_assert(gvir_config_domain_hostdev_pci_get_rom_bar(hostdev));
> +
> +address = gvir_config_domain_address_pci_new();
> +gvir_config_domain_address_pci_set_domain(address, 1);
> +gvir_config_domain_address_pci_set_bus(address, 2);
> +gvir_config_domain_address_pci_set_slot(address, 3);
> +gvir_config_domain_address_pci_set_function(address, 4);
> +gvir_config_domain_hostdev_pci_set_address(hostdev, address);
> +g_object_unref(G_OBJECT(address));
> +
> +address = gvir_config_domain_hostdev_pci_get_address(hostdev);
> +g_assert(address != NULL);
> +g_assert_cmpint(gvir_config_domain_address_pci_get_domain(address), ==, 
> 1);
> +g_assert_cmpint(gvir_config_domain_address_pci_get_bus(address), ==, 2);
> +g_assert_cmpint(gvir_config_domain_address_pci_get_slot(address), ==, 3);
> +g_assert_cmpint(gvir_config_domain_address_pci_get_function(address), 
> ==, 4);
> +g_object_unref(G_OBJECT(address));
> +
> +gvir_config_domain_add_device(domain, GVIR_CONFIG_DOMAIN_DEVICE 
> (hostdev));
> +g_object_unref(G_OBJECT(hostdev));
> +
> +check_xml(domain, "gconfig-domain-device-pci-hostdev.xml");
> +
> +g_object_unref(G_OBJECT(domain));
> +}
>  
>  int main(int argc, char **argv)
>  {
> @@ -739,6 +780,8 @@ int main(int argc, char **argv)
>  test_domain_device_channel);
>  g_test_add_func("/libvirt-gconfig/domain-device-usb-redir",
>  test_domain_device_usb_redir);
> +g_test_add_func("/libvirt-gconfig/domain-device-pci-hostdev",
> +test_domain_device_pci_hostdev);
>  
>  return g_test_run();
>  }
> diff --git a/tests/xml/gconfig-domain-device-pci-hostdev.xml 
> b/tests/xml/gconfig-domain-device-pci-hostdev.xml
> new file mode 100644
> index 000..70e32ac
> --- /dev/null
> +++ b/tests/xml/gconfig-domain-device-pci-hostdev.xml
> @@ -0,0 +1,11 @@
> +
> +  
> +
> +  
> +  
> +  
> +
> +  
> +
> +  
> +
> -- 
> 2.5.5
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH v4 6/6] Add test for GVirConfigDomainHostdevPci API

2016-04-15 Thread Zeeshan Ali (Khattak)
---
 tests/test-gconfig.c| 43 +
 tests/xml/gconfig-domain-device-pci-hostdev.xml | 11 +++
 2 files changed, 54 insertions(+)
 create mode 100644 tests/xml/gconfig-domain-device-pci-hostdev.xml

diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c
index be55ef9..a26bb5f 100644
--- a/tests/test-gconfig.c
+++ b/tests/test-gconfig.c
@@ -709,6 +709,47 @@ static void test_domain_device_usb_redir(void)
 g_object_unref(G_OBJECT(domain));
 }
 
+static void test_domain_device_pci_hostdev(void)
+{
+GVirConfigDomain *domain;
+GVirConfigDomainAddressPci *address;
+GVirConfigDomainHostdevPci *hostdev;
+
+domain = gvir_config_domain_new();
+
+hostdev = gvir_config_domain_hostdev_pci_new();
+
gvir_config_domain_hostdev_set_boot_order(GVIR_CONFIG_DOMAIN_HOSTDEV(hostdev), 
1);
+
g_assert_cmpint(gvir_config_domain_hostdev_get_boot_order(GVIR_CONFIG_DOMAIN_HOSTDEV(hostdev)),
 ==, 1);
+gvir_config_domain_hostdev_pci_set_managed(hostdev, TRUE);
+g_assert(gvir_config_domain_hostdev_pci_get_managed(hostdev) == TRUE);
+gvir_config_domain_hostdev_pci_set_rom_bar(hostdev, TRUE);
+gvir_config_domain_hostdev_pci_set_rom_file(hostdev, "/etc/fake/boot.bin");
+g_assert_cmpstr(gvir_config_domain_hostdev_pci_get_rom_file(hostdev), ==, 
"/etc/fake/boot.bin");
+g_assert(gvir_config_domain_hostdev_pci_get_rom_bar(hostdev));
+
+address = gvir_config_domain_address_pci_new();
+gvir_config_domain_address_pci_set_domain(address, 1);
+gvir_config_domain_address_pci_set_bus(address, 2);
+gvir_config_domain_address_pci_set_slot(address, 3);
+gvir_config_domain_address_pci_set_function(address, 4);
+gvir_config_domain_hostdev_pci_set_address(hostdev, address);
+g_object_unref(G_OBJECT(address));
+
+address = gvir_config_domain_hostdev_pci_get_address(hostdev);
+g_assert(address != NULL);
+g_assert_cmpint(gvir_config_domain_address_pci_get_domain(address), ==, 1);
+g_assert_cmpint(gvir_config_domain_address_pci_get_bus(address), ==, 2);
+g_assert_cmpint(gvir_config_domain_address_pci_get_slot(address), ==, 3);
+g_assert_cmpint(gvir_config_domain_address_pci_get_function(address), ==, 
4);
+g_object_unref(G_OBJECT(address));
+
+gvir_config_domain_add_device(domain, GVIR_CONFIG_DOMAIN_DEVICE (hostdev));
+g_object_unref(G_OBJECT(hostdev));
+
+check_xml(domain, "gconfig-domain-device-pci-hostdev.xml");
+
+g_object_unref(G_OBJECT(domain));
+}
 
 int main(int argc, char **argv)
 {
@@ -739,6 +780,8 @@ int main(int argc, char **argv)
 test_domain_device_channel);
 g_test_add_func("/libvirt-gconfig/domain-device-usb-redir",
 test_domain_device_usb_redir);
+g_test_add_func("/libvirt-gconfig/domain-device-pci-hostdev",
+test_domain_device_pci_hostdev);
 
 return g_test_run();
 }
diff --git a/tests/xml/gconfig-domain-device-pci-hostdev.xml 
b/tests/xml/gconfig-domain-device-pci-hostdev.xml
new file mode 100644
index 000..70e32ac
--- /dev/null
+++ b/tests/xml/gconfig-domain-device-pci-hostdev.xml
@@ -0,0 +1,11 @@
+
+  
+
+  
+  
+  
+
+  
+
+  
+
-- 
2.5.5

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