qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v4] tests/qtest: netdev: test stream and dgram backends


From: Laurent Vivier
Subject: Re: [PATCH v4] tests/qtest: netdev: test stream and dgram backends
Date: Tue, 3 Jan 2023 15:46:55 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

On 1/3/23 15:08, Thomas Huth wrote:
On 03/01/2023 12.00, Laurent Vivier wrote:
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---

Notes:
     v4:
       - rework EXPECT_STATE()
       - use g_dir_make_tmp()
     v3:
     - Add "-M none" to avoid error:
       "No machine specified, and there is no default"
     v2:
     - Fix ipv6 free port allocation
     - Check for IPv4, IPv6, AF_UNIX
     - Use g_mkdtemp() rather than g_file_open_tmp()
     - Use socketpair() in test_stream_fd()
     v1: compared to v14 of "qapi: net: add unix socket type support to netdev 
backend":
     - use IP addresses 127.0.0.1 and ::1 rather than localhost

  tests/qtest/meson.build     |   2 +
  tests/qtest/netdev-socket.c | 434 ++++++++++++++++++++++++++++++++++++
  2 files changed, 436 insertions(+)
  create mode 100644 tests/qtest/netdev-socket.c
[...]
+int main(int argc, char **argv)
+{
+    int ret;
+    bool has_ipv4, has_ipv6, has_afunix;
+    g_autoptr(GError) err = NULL;
+
+    g_test_init(&argc, &argv, NULL);
+
+    if (socket_check_protocol_support(&has_ipv4, &has_ipv6) < 0) {
+        g_printerr("socket_check_protocol_support() failed\n");
+        goto end;
+    }
+
+    tmpdir = g_dir_make_tmp("netdev-socket.XXXXXX", &err);
+    if (tmpdir == NULL) {
+        g_error("Can't create temporary directory in %s: %s",
+                g_get_tmp_dir(), err->message);

Should there also be a "goto end" here?

No, g_error() is fatal.

https://docs.gtk.org/glib/func.error.html


Apart from that:
Acked-by: Thomas Huth <thuth@redhat.com>


Thanks,
Laurent

+    }
+
+    if (has_ipv4) {
+        qtest_add_func("/netdev/stream/inet/ipv4", test_stream_inet_ipv4);
+        qtest_add_func("/netdev/dgram/inet", test_dgram_inet);
+        qtest_add_func("/netdev/dgram/mcast", test_dgram_mcast);
+    }
+    if (has_ipv6) {
+        qtest_add_func("/netdev/stream/inet/ipv6", test_stream_inet_ipv6);
+    }
+
+    socket_check_afunix_support(&has_afunix);
+    if (has_afunix) {
+        qtest_add_func("/netdev/dgram/unix", test_dgram_unix);
+        qtest_add_func("/netdev/stream/unix", test_stream_unix);
+        qtest_add_func("/netdev/stream/unix/abstract",
+                       test_stream_unix_abstract);
+        qtest_add_func("/netdev/stream/fd", test_stream_fd);
+        qtest_add_func("/netdev/dgram/fd", test_dgram_fd);
+    }
+
+end:
+    ret = g_test_run();
+
+    g_rmdir(tmpdir);
+    g_free(tmpdir);
+
+    return ret;
+}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]