diff mbox series

[17/51] tests/qtest: Build virtio-net-test for posix only

Message ID 20220824094029.1634519-18-bmeng.cn@gmail.com (mailing list archive)
State New, archived
Headers show
Series tests/qtest: Enable running qtest on Windows | expand

Commit Message

Bin Meng Aug. 24, 2022, 9:39 a.m. UTC
From: Bin Meng <bin.meng@windriver.com>

All of the virtio-net-test test cases require socketpair() to do the
test setup.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 tests/qtest/virtio-net-test.c | 6 ------
 tests/qtest/meson.build       | 3 +--
 2 files changed, 1 insertion(+), 8 deletions(-)

Comments

Thomas Huth Aug. 25, 2022, 11:27 a.m. UTC | #1
On 24/08/2022 11.39, Bin Meng wrote:
> From: Bin Meng <bin.meng@windriver.com>
> 
> All of the virtio-net-test test cases require socketpair() to do the
> test setup.

I think that is not true. Look at the end of the file, after the comment 
"These tests do not need a loopback backend" ... these tests are using 
virtio_net_test_setup_nosocket which does not need socketpair().

You likely have to put the #ifdefs in different locations here instead.

  Thomas
Marc-André Lureau Aug. 31, 2022, 1:25 p.m. UTC | #2
Hi

On Wed, Aug 24, 2022 at 2:24 PM Bin Meng <bmeng.cn@gmail.com> wrote:

> From: Bin Meng <bin.meng@windriver.com>
>
> All of the virtio-net-test test cases require socketpair() to do the
> test setup.
>

It is possible to implement a pretty good alternative, like I did for glib (
https://gitlab.gnome.org/GNOME/glib/-/blob/main/gio/tests/socket.c#L2193)

I intend to add that in another series (based on yours), we can enable more
tests later.


>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>
>  tests/qtest/virtio-net-test.c | 6 ------
>  tests/qtest/meson.build       | 3 +--
>  2 files changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/tests/qtest/virtio-net-test.c b/tests/qtest/virtio-net-test.c
> index 6ded252901..d44c3d9666 100644
> --- a/tests/qtest/virtio-net-test.c
> +++ b/tests/qtest/virtio-net-test.c
> @@ -26,8 +26,6 @@
>  #define QVIRTIO_NET_TIMEOUT_US (30 * 1000 * 1000)
>  #define VNET_HDR_SIZE sizeof(struct virtio_net_hdr_mrg_rxbuf)
>
> -#ifndef _WIN32
> -
>  static void rx_test(QVirtioDevice *dev,
>                      QGuestAllocator *alloc, QVirtQueue *vq,
>                      int socket)
> @@ -165,8 +163,6 @@ static void stop_cont_test(void *obj, void *data,
> QGuestAllocator *t_alloc)
>      rx_stop_cont_test(dev, t_alloc, rx, sv[0]);
>  }
>
> -#endif
> -
>  static void hotplug(void *obj, void *data, QGuestAllocator *t_alloc)
>  {
>      QVirtioPCIDevice *dev = obj;
> @@ -324,10 +320,8 @@ static void register_virtio_net_test(void)
>      };
>
>      qos_add_test("hotplug", "virtio-net-pci", hotplug, &opts);
> -#ifndef _WIN32
>      qos_add_test("basic", "virtio-net", send_recv_test, &opts);
>      qos_add_test("rx_stop_cont", "virtio-net", stop_cont_test, &opts);
> -#endif
>      qos_add_test("announce-self", "virtio-net", announce_self, &opts);
>
>      /* These tests do not need a loopback backend.  */
> diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
> index 9d0f82bf1c..72bb9e21f3 100644
> --- a/tests/qtest/meson.build
> +++ b/tests/qtest/meson.build
> @@ -259,7 +259,6 @@ qos_test_ss.add(
>    'usb-hcd-ohci-test.c',
>    'virtio-test.c',
>    'virtio-blk-test.c',
> -  'virtio-net-test.c',
>    'virtio-rng-test.c',
>    'virtio-scsi-test.c',
>    'virtio-serial-test.c',
> @@ -267,7 +266,7 @@ qos_test_ss.add(
>    'vmxnet3-test.c',
>  )
>  if config_host.has_key('CONFIG_POSIX')
> -  qos_test_ss.add(files('e1000e-test.c'))
> +  qos_test_ss.add(files('e1000e-test.c', 'virtio-net-test.c'))
>  endif
>  if have_virtfs
>    qos_test_ss.add(files('virtio-9p-test.c'))
> --
> 2.34.1
>
>
>
diff mbox series

Patch

diff --git a/tests/qtest/virtio-net-test.c b/tests/qtest/virtio-net-test.c
index 6ded252901..d44c3d9666 100644
--- a/tests/qtest/virtio-net-test.c
+++ b/tests/qtest/virtio-net-test.c
@@ -26,8 +26,6 @@ 
 #define QVIRTIO_NET_TIMEOUT_US (30 * 1000 * 1000)
 #define VNET_HDR_SIZE sizeof(struct virtio_net_hdr_mrg_rxbuf)
 
-#ifndef _WIN32
-
 static void rx_test(QVirtioDevice *dev,
                     QGuestAllocator *alloc, QVirtQueue *vq,
                     int socket)
@@ -165,8 +163,6 @@  static void stop_cont_test(void *obj, void *data, QGuestAllocator *t_alloc)
     rx_stop_cont_test(dev, t_alloc, rx, sv[0]);
 }
 
-#endif
-
 static void hotplug(void *obj, void *data, QGuestAllocator *t_alloc)
 {
     QVirtioPCIDevice *dev = obj;
@@ -324,10 +320,8 @@  static void register_virtio_net_test(void)
     };
 
     qos_add_test("hotplug", "virtio-net-pci", hotplug, &opts);
-#ifndef _WIN32
     qos_add_test("basic", "virtio-net", send_recv_test, &opts);
     qos_add_test("rx_stop_cont", "virtio-net", stop_cont_test, &opts);
-#endif
     qos_add_test("announce-self", "virtio-net", announce_self, &opts);
 
     /* These tests do not need a loopback backend.  */
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 9d0f82bf1c..72bb9e21f3 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -259,7 +259,6 @@  qos_test_ss.add(
   'usb-hcd-ohci-test.c',
   'virtio-test.c',
   'virtio-blk-test.c',
-  'virtio-net-test.c',
   'virtio-rng-test.c',
   'virtio-scsi-test.c',
   'virtio-serial-test.c',
@@ -267,7 +266,7 @@  qos_test_ss.add(
   'vmxnet3-test.c',
 )
 if config_host.has_key('CONFIG_POSIX')
-  qos_test_ss.add(files('e1000e-test.c'))
+  qos_test_ss.add(files('e1000e-test.c', 'virtio-net-test.c'))
 endif
 if have_virtfs
   qos_test_ss.add(files('virtio-9p-test.c'))