Page MenuHomeFreeBSD

tests/netinet/socket_afinet: unroll multibind test into a table
ClosedPublic

Authored by glebius on Jul 7 2026, 4:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Aug 8, 5:54 PM
Unknown Object (File)
Sat, Aug 8, 3:04 PM
Unknown Object (File)
Tue, Aug 4, 10:43 PM
Unknown Object (File)
Fri, Jul 31, 3:50 AM
Unknown Object (File)
Thu, Jul 30, 11:24 PM
Unknown Object (File)
Sat, Jul 25, 2:10 PM
Unknown Object (File)
Tue, Jul 21, 3:13 AM
Unknown Object (File)
Mon, Jul 20, 10:07 AM

Details

Summary

The test has 6 dimensions: address family, socket type, socket option on
the first socket, socket option on the second socket, is first socket
bound to specific address or wildcard and is the second socket priveleged
or not. Before the change 3 dimensions are implemented as 3 nested for()
loops, 2 dimensions are implemented as repetitions in the test body and
one dimension as two actions in the innermost loop.

I'm about to add one more dimension: whether the second socket is bound to
a specific address or wildcard instead of using first socket's
getsockopt(2) result. Also, there is a change under discussion that would
make SOCK_STREAM sockets behave different to SOCK_DGRAM. That would break
result consistency in the dimensions of socket type.

We expect that consistency in the dimension of address families shall
never break, thus this one remains a for() loop. The priveleged & non-
privileged bind(2) attempts also remain as two actions, but expected
results are in the table. The rest of dimensions are unrolled into a
table, which at the moment has quite a lot of lines with identical
results. However, as more tests are added and SOCK_STREAM behavior
changes, the table will get more mixed results. Also, reading a test that
is written in a declarative manner a table is much easier and modifying it
is more resistent to accidential breakage.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable