Re: git: 0849f1634a70 - main - tests/netinet: add test for IP_MULTICAST_IF

From: Gleb Smirnoff <glebius_at_freebsd.org>
Date: Mon, 24 Mar 2025 06:12:24 UTC
On Mon, Mar 24, 2025 at 11:45:55AM +0900, Kristof Provost wrote:
K> >     tests/netinet: add test for IP_MULTICAST_IF
K> > 
K> It bugs me a little that we have to jump through hoops to get a C program
K> running in a specific jail/network setup.
K> It’s somewhat common for that to happen, and I’m sure there’d be more cases
K> if it were easier to do (e.g. the getaddrinfo tests you’ve been working on
K> could be even more useful with a custom DNS server, so in their own vnet
K> jail).

It bugs me, too. :) Igor has already pushed changes that allow you to specify
in the Makefile:

TEST_METADATA.foo+= "execenv="jail" execenv_jail_params="vnet"

Then this gets into Kyuafile after build. This is a step forward, but not
enough. First problem is that the created jail is empty and doesn't have any
interfaces. Second problem is that the specified environment affects all tests
inside one test file.

Ideally we'd like to have a declarative language to describe jail environment
for a test.  This is basically what vnet.subr does for shell tests and what
atf_python.sys.net.vnet does for python tests, but brought to kyua level and of
course agnostic to the language of a test.  Igor is thinking in this direction
and hopefully will eventually deliver something.


K> The downside is that we’re compiling the C test code on every run, but I
K> expect test programs to be tiny, so that’s not too much of a cost.
K> 
K> Does this seem useful to you too?

That would fail on decreased installation, that has tests, but doesn't have
compiler.  This is not just a made up problem, this is what many would do in
CI, cause you want usually as quick as possible response time from CI, and if
your team is not hacking the compiler, you won't add compiler to the CI build.

-- 
Gleb Smirnoff