On Fri, May 16, 2025 at 05:56:57PM +0200, Juraj Marcin wrote: > From: Juraj Marcin <jmar...@redhat.com> > > Before refactoring the inet_parse() function, this patch adds tests > verifying the inet address parsing works correctly. > > Signed-off-by: Juraj Marcin <jmar...@redhat.com> > --- > tests/unit/test-util-sockets.c | 161 +++++++++++++++++++++++++++++++++ > 1 file changed, 161 insertions(+) > > diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c > index 4c9dd0b271..60f15a4ddf 100644 > --- a/tests/unit/test-util-sockets.c > +++ b/tests/unit/test-util-sockets.c > @@ -332,6 +332,144 @@ static void test_socket_unix_abstract(void)
> +static void test_inet_parse_all_options_good(void) > +{ > + char host[] = "::1"; > + char port[] = "5000"; > + InetSocketAddress exp_addr = { > + .host = host, > + .port = port, > + .has_to = true, > + .to = 5006, > + .has_ipv4 = true, > + .ipv4 = false, > + .has_ipv6 = true, > + .ipv6 = true, > + .has_keep_alive = true, > + .keep_alive = true, > +#ifdef HAVE_IPPROTO_MPTCP > + .has_mptcp = true, > + .mptcp = true, > +#endif > + }; > + inet_parse_test_helper( > + "[::1]:5000,to=5006,ipv4=off,ipv6=on,keep-alive" > +#ifdef HAVE_IPPROTO_MPTCP > + ",mptcp" > +#endif > + , &exp_addr, true); > +} This example is using bare 'keep-alive' and 'mptcp' options, but this is discouraged syntax. It is fine to test it, but we should have a 2nd test case with 'keep-alive=on', 'mptcp=on', etc. In fact, the ipv4/ipv6 options are flags too, which can omit the "=on" bit, so test both with & without for those too. 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 :|