qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tests: use macros for registering char tests for sockets
@ 2025-10-16 13:25 Daniel P. Berrangé
  2025-10-16 13:30 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel P. Berrangé @ 2025-10-16 13:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Daniel P. Berrangé

The test-char.c has a couple of helper macros for registering tests that
need to be repeated for both IP and UNIX sockets. One test case was not
using the macro though.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tests/unit/test-char.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tests/unit/test-char.c b/tests/unit/test-char.c
index f30a39f61f..3c9f0a68e8 100644
--- a/tests/unit/test-char.c
+++ b/tests/unit/test-char.c
@@ -1969,19 +1969,17 @@ int main(int argc, char **argv)
     g_test_add_data_func("/char/socket/client/reconnect-error/" # name, \
                          &client7 ##name, char_socket_client_test);     \
     g_test_add_data_func("/char/socket/client/dupid-reconnect/" # name, \
-                         &client8 ##name, char_socket_client_dupid_test)
+                         &client8 ##name, char_socket_client_dupid_test); \
+    g_test_add_data_func("/char/socket/server/two-clients/" # name,     \
+                         addr, char_socket_server_two_clients_test)
 
     if (has_ipv4) {
         SOCKET_SERVER_TEST(tcp, &tcpaddr);
         SOCKET_CLIENT_TEST(tcp, &tcpaddr);
-        g_test_add_data_func("/char/socket/server/two-clients/tcp", &tcpaddr,
-                             char_socket_server_two_clients_test);
     }
 #ifndef WIN32
     SOCKET_SERVER_TEST(unix, &unixaddr);
     SOCKET_CLIENT_TEST(unix, &unixaddr);
-    g_test_add_data_func("/char/socket/server/two-clients/unix", &unixaddr,
-                         char_socket_server_two_clients_test);
 #endif
 
     g_test_add_func("/char/udp", char_udp_test);
-- 
2.50.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tests: use macros for registering char tests for sockets
  2025-10-16 13:25 [PATCH] tests: use macros for registering char tests for sockets Daniel P. Berrangé
@ 2025-10-16 13:30 ` Peter Maydell
  2025-10-16 13:33   ` Daniel P. Berrangé
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2025-10-16 13:30 UTC (permalink / raw)
  To: Daniel P. Berrangé; +Cc: qemu-devel

On Thu, 16 Oct 2025 at 14:27, Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> The test-char.c has a couple of helper macros for registering tests that
> need to be repeated for both IP and UNIX sockets. One test case was not
> using the macro though.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  tests/unit/test-char.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/tests/unit/test-char.c b/tests/unit/test-char.c
> index f30a39f61f..3c9f0a68e8 100644
> --- a/tests/unit/test-char.c
> +++ b/tests/unit/test-char.c
> @@ -1969,19 +1969,17 @@ int main(int argc, char **argv)
>      g_test_add_data_func("/char/socket/client/reconnect-error/" # name, \
>                           &client7 ##name, char_socket_client_test);     \
>      g_test_add_data_func("/char/socket/client/dupid-reconnect/" # name, \
> -                         &client8 ##name, char_socket_client_dupid_test)
> +                         &client8 ##name, char_socket_client_dupid_test); \
> +    g_test_add_data_func("/char/socket/server/two-clients/" # name,     \
> +                         addr, char_socket_server_two_clients_test)
>
>      if (has_ipv4) {
>          SOCKET_SERVER_TEST(tcp, &tcpaddr);
>          SOCKET_CLIENT_TEST(tcp, &tcpaddr);
> -        g_test_add_data_func("/char/socket/server/two-clients/tcp", &tcpaddr,
> -                             char_socket_server_two_clients_test);
>      }
>  #ifndef WIN32
>      SOCKET_SERVER_TEST(unix, &unixaddr);
>      SOCKET_CLIENT_TEST(unix, &unixaddr);
> -    g_test_add_data_func("/char/socket/server/two-clients/unix", &unixaddr,
> -                         char_socket_server_two_clients_test);
>  #endif

This is a "server" test, but it looks like you've added it to
the SOCKET_CLIENT_TEST macro instead of the SOCKET_SERVER_TEST macro ?

thanks
-- PMM


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tests: use macros for registering char tests for sockets
  2025-10-16 13:30 ` Peter Maydell
@ 2025-10-16 13:33   ` Daniel P. Berrangé
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel P. Berrangé @ 2025-10-16 13:33 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel

On Thu, Oct 16, 2025 at 02:30:47PM +0100, Peter Maydell wrote:
> On Thu, 16 Oct 2025 at 14:27, Daniel P. Berrangé <berrange@redhat.com> wrote:
> >
> > The test-char.c has a couple of helper macros for registering tests that
> > need to be repeated for both IP and UNIX sockets. One test case was not
> > using the macro though.
> >
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> >  tests/unit/test-char.c | 8 +++-----
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/tests/unit/test-char.c b/tests/unit/test-char.c
> > index f30a39f61f..3c9f0a68e8 100644
> > --- a/tests/unit/test-char.c
> > +++ b/tests/unit/test-char.c
> > @@ -1969,19 +1969,17 @@ int main(int argc, char **argv)
> >      g_test_add_data_func("/char/socket/client/reconnect-error/" # name, \
> >                           &client7 ##name, char_socket_client_test);     \
> >      g_test_add_data_func("/char/socket/client/dupid-reconnect/" # name, \
> > -                         &client8 ##name, char_socket_client_dupid_test)
> > +                         &client8 ##name, char_socket_client_dupid_test); \
> > +    g_test_add_data_func("/char/socket/server/two-clients/" # name,     \
> > +                         addr, char_socket_server_two_clients_test)
> >
> >      if (has_ipv4) {
> >          SOCKET_SERVER_TEST(tcp, &tcpaddr);
> >          SOCKET_CLIENT_TEST(tcp, &tcpaddr);
> > -        g_test_add_data_func("/char/socket/server/two-clients/tcp", &tcpaddr,
> > -                             char_socket_server_two_clients_test);
> >      }
> >  #ifndef WIN32
> >      SOCKET_SERVER_TEST(unix, &unixaddr);
> >      SOCKET_CLIENT_TEST(unix, &unixaddr);
> > -    g_test_add_data_func("/char/socket/server/two-clients/unix", &unixaddr,
> > -                         char_socket_server_two_clients_test);
> >  #endif
> 
> This is a "server" test, but it looks like you've added it to
> the SOCKET_CLIENT_TEST macro instead of the SOCKET_SERVER_TEST macro ?

Opps, yes, though it raises the question of why we have separate
macros for server vs client tests instead of one.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-16 13:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-16 13:25 [PATCH] tests: use macros for registering char tests for sockets Daniel P. Berrangé
2025-10-16 13:30 ` Peter Maydell
2025-10-16 13:33   ` Daniel P. Berrangé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).