netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] selftests: net: Skip test if IPv6 is not configured
@ 2025-07-23 17:35 Breno Leitao
  2025-07-24 20:13 ` Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Breno Leitao @ 2025-07-23 17:35 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Shuah Khan
  Cc: netdev, linux-kselftest, linux-kernel, kernel-team, Breno Leitao

Extend the `check_for_dependencies()` function in `lib_netcons.sh` to check
whether IPv6 is enabled by verifying the existence of
`/proc/net/if_inet6`. Having IPv6 is a now a dependency of netconsole
tests. If the file does not exist, the script will skip the test with an
appropriate message suggesting to verify if `CONFIG_IPV6` is enabled.

This prevents the test to misbehave if IPv6 is not configured.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh b/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh
index 258af805497b4..b6071e80ebbb6 100644
--- a/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh
+++ b/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh
@@ -281,6 +281,11 @@ function check_for_dependencies() {
 		exit "${ksft_skip}"
 	fi
 
+	if [ ! -f /proc/net/if_inet6 ]; then
+		echo "SKIP: IPv6 not configured. Check if CONFIG_IPV6 is enabled" >&2
+		exit "${ksft_skip}"
+	fi
+
 	if [ ! -f "${NSIM_DEV_SYS_NEW}" ]; then
 		echo "SKIP: file ${NSIM_DEV_SYS_NEW} does not exist. Check if CONFIG_NETDEVSIM is enabled" >&2
 		exit "${ksft_skip}"

---
base-commit: dd500e4aecf25e48e874ca7628697969df679493
change-id: 20250723-netcons_test_ipv6-15b1b76bb231

Best regards,
--  
Breno Leitao <leitao@debian.org>


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

* Re: [PATCH net-next] selftests: net: Skip test if IPv6 is not configured
  2025-07-23 17:35 [PATCH net-next] selftests: net: Skip test if IPv6 is not configured Breno Leitao
@ 2025-07-24 20:13 ` Simon Horman
  2025-07-25  1:24 ` Jakub Kicinski
  2025-07-25 18:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2025-07-24 20:13 UTC (permalink / raw)
  To: Breno Leitao
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Shuah Khan, netdev, linux-kselftest, linux-kernel,
	kernel-team

On Wed, Jul 23, 2025 at 10:35:06AM -0700, Breno Leitao wrote:
> Extend the `check_for_dependencies()` function in `lib_netcons.sh` to check
> whether IPv6 is enabled by verifying the existence of
> `/proc/net/if_inet6`. Having IPv6 is a now a dependency of netconsole
> tests. If the file does not exist, the script will skip the test with an
> appropriate message suggesting to verify if `CONFIG_IPV6` is enabled.
> 
> This prevents the test to misbehave if IPv6 is not configured.
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>

Reviewed-by: Simon Horman <horms@kernel.org>

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

* Re: [PATCH net-next] selftests: net: Skip test if IPv6 is not configured
  2025-07-23 17:35 [PATCH net-next] selftests: net: Skip test if IPv6 is not configured Breno Leitao
  2025-07-24 20:13 ` Simon Horman
@ 2025-07-25  1:24 ` Jakub Kicinski
  2025-07-25  8:11   ` Breno Leitao
  2025-07-25 18:40 ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2025-07-25  1:24 UTC (permalink / raw)
  To: Breno Leitao
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
	Shuah Khan, netdev, linux-kselftest, linux-kernel, kernel-team

On Wed, 23 Jul 2025 10:35:06 -0700 Breno Leitao wrote:
> Extend the `check_for_dependencies()` function in `lib_netcons.sh` to check
> whether IPv6 is enabled by verifying the existence of
> `/proc/net/if_inet6`. Having IPv6 is a now a dependency of netconsole
> tests. If the file does not exist, the script will skip the test with an
> appropriate message suggesting to verify if `CONFIG_IPV6` is enabled.
> 
> This prevents the test to misbehave if IPv6 is not configured.

IDK. I think this is related to some of the recent patches?
The context would be helpful in the commit message.
Otherwise, as networking people, I think we are obligated 
to respond with hostility to "IPv6 may not be enabled"..
-- 
pw-bot: cr

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

* Re: [PATCH net-next] selftests: net: Skip test if IPv6 is not configured
  2025-07-25  1:24 ` Jakub Kicinski
@ 2025-07-25  8:11   ` Breno Leitao
  2025-07-25 20:47     ` Willem de Bruijn
  0 siblings, 1 reply; 8+ messages in thread
From: Breno Leitao @ 2025-07-25  8:11 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
	Shuah Khan, netdev, linux-kselftest, linux-kernel, kernel-team

Hello Jakub,

On Thu, Jul 24, 2025 at 06:24:27PM -0700, Jakub Kicinski wrote:
> On Wed, 23 Jul 2025 10:35:06 -0700 Breno Leitao wrote:
> > Extend the `check_for_dependencies()` function in `lib_netcons.sh` to check
> > whether IPv6 is enabled by verifying the existence of
> > `/proc/net/if_inet6`. Having IPv6 is a now a dependency of netconsole
> > tests. If the file does not exist, the script will skip the test with an
> > appropriate message suggesting to verify if `CONFIG_IPV6` is enabled.
> > 
> > This prevents the test to misbehave if IPv6 is not configured.
> 
> IDK. I think this is related to some of the recent patches?

Yes, commit 3dc6c76391cbe (“selftests: net: Add IPv6 support to
netconsole basic tests”) introduced IPv6 support to the netconsole basic
tests.

Because the NIPA config enables IPv6, the tests pass in that
environment. However, if the tests are run somewhere without IPv6
support such as in a test I was doing regarding another patch, they will
fail, when it should be skipped.

> The context would be helpful in the commit message.

Apologies for not including more context in the commit message.

> Otherwise, as networking people, I think we are obligated 
> to respond with hostility to "IPv6 may not be enabled"..

As for handling systems without IPv6, if IPv6 isn’t available, the
intention is for the test to be skipped. That’s exactly what this patch
addresses.

I did consider making the test adaptable so it would just run with
whichever protocol (IPv4 or IPv6) is present, but rejected that
approach. Allowing the test to “pass” in such cases doesn’t really
demonstrate meaningful coverage, since the test isn’t actually being
exercised as intended.

In short, it seems more appropriate to skip the test entirely if all
conditions aren’t met, so, you know that your .config needs adjustment.

Thanks for your review,
--breno

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

* Re: [PATCH net-next] selftests: net: Skip test if IPv6 is not configured
  2025-07-23 17:35 [PATCH net-next] selftests: net: Skip test if IPv6 is not configured Breno Leitao
  2025-07-24 20:13 ` Simon Horman
  2025-07-25  1:24 ` Jakub Kicinski
@ 2025-07-25 18:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-25 18:40 UTC (permalink / raw)
  To: Breno Leitao
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, shuah, netdev,
	linux-kselftest, linux-kernel, kernel-team

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 23 Jul 2025 10:35:06 -0700 you wrote:
> Extend the `check_for_dependencies()` function in `lib_netcons.sh` to check
> whether IPv6 is enabled by verifying the existence of
> `/proc/net/if_inet6`. Having IPv6 is a now a dependency of netconsole
> tests. If the file does not exist, the script will skip the test with an
> appropriate message suggesting to verify if `CONFIG_IPV6` is enabled.
> 
> This prevents the test to misbehave if IPv6 is not configured.
> 
> [...]

Here is the summary with links:
  - [net-next] selftests: net: Skip test if IPv6 is not configured
    https://git.kernel.org/netdev/net-next/c/5ec9b15d8dfa

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH net-next] selftests: net: Skip test if IPv6 is not configured
  2025-07-25  8:11   ` Breno Leitao
@ 2025-07-25 20:47     ` Willem de Bruijn
  2025-07-25 20:58       ` Jakub Kicinski
  0 siblings, 1 reply; 8+ messages in thread
From: Willem de Bruijn @ 2025-07-25 20:47 UTC (permalink / raw)
  To: Breno Leitao, Jakub Kicinski
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
	Shuah Khan, netdev, linux-kselftest, linux-kernel, kernel-team

Breno Leitao wrote:
> Hello Jakub,
> 
> On Thu, Jul 24, 2025 at 06:24:27PM -0700, Jakub Kicinski wrote:
> > On Wed, 23 Jul 2025 10:35:06 -0700 Breno Leitao wrote:
> > > Extend the `check_for_dependencies()` function in `lib_netcons.sh` to check
> > > whether IPv6 is enabled by verifying the existence of
> > > `/proc/net/if_inet6`. Having IPv6 is a now a dependency of netconsole
> > > tests. If the file does not exist, the script will skip the test with an
> > > appropriate message suggesting to verify if `CONFIG_IPV6` is enabled.
> > > 
> > > This prevents the test to misbehave if IPv6 is not configured.
> > 
> > IDK. I think this is related to some of the recent patches?
> 
> Yes, commit 3dc6c76391cbe (“selftests: net: Add IPv6 support to
> netconsole basic tests”) introduced IPv6 support to the netconsole basic
> tests.
> 
> Because the NIPA config enables IPv6, the tests pass in that
> environment. However, if the tests are run somewhere without IPv6
> support such as in a test I was doing regarding another patch, they will
> fail, when it should be skipped.
> 
> > The context would be helpful in the commit message.
> 
> Apologies for not including more context in the commit message.
> 
> > Otherwise, as networking people, I think we are obligated 
> > to respond with hostility to "IPv6 may not be enabled"..
> 
> As for handling systems without IPv6, if IPv6 isn’t available, the
> intention is for the test to be skipped. That’s exactly what this patch
> addresses.

I think there is some consensus that these environments should no
longer exist in 2025. And test failure is the best way to accomplish
that.

Less opinionated: the tests implicitly depends on the config files
in the test directory. Do we have to start making the robust against
situations where CONFIGs in that file are missing?

> I did consider making the test adaptable so it would just run with
> whichever protocol (IPv4 or IPv6) is present, but rejected that
> approach. Allowing the test to “pass” in such cases doesn’t really
> demonstrate meaningful coverage, since the test isn’t actually being
> exercised as intended.
> 
> In short, it seems more appropriate to skip the test entirely if all
> conditions aren’t met, so, you know that your .config needs adjustment.
> 
> Thanks for your review,
> --breno



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

* Re: [PATCH net-next] selftests: net: Skip test if IPv6 is not configured
  2025-07-25 20:47     ` Willem de Bruijn
@ 2025-07-25 20:58       ` Jakub Kicinski
  2025-07-25 21:11         ` Willem de Bruijn
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2025-07-25 20:58 UTC (permalink / raw)
  To: Willem de Bruijn
  Cc: Breno Leitao, Andrew Lunn, David S. Miller, Eric Dumazet,
	Paolo Abeni, Shuah Khan, netdev, linux-kselftest, linux-kernel,
	kernel-team

On Fri, 25 Jul 2025 16:47:54 -0400 Willem de Bruijn wrote:
> Less opinionated: the tests implicitly depends on the config files
> in the test directory. Do we have to start making the robust against
> situations where CONFIGs in that file are missing?

I was considering adding something like this to the test guidance.

  ### Ensure necessary kernel config knobs are set

  Each test directory has a `config` file listing which kernel
  configuration options the tests depend on. This file must be kept
  up to date, our CIs build minimal kernels for each test group. 

  Adding checks inside the tests to validate that the necessary kernel
  configs are enabled is discouraged. The test author may include such
  checks, but standalone patches to make tests compatible e.g. with 
  distro kernel configs are unlikely to be accepted.

WDYT?

Primarily trying to minimize the number of patches and adjustments 
we'd see, as the matrix of systems and kernel configs can easily get
out of hand..

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

* Re: [PATCH net-next] selftests: net: Skip test if IPv6 is not configured
  2025-07-25 20:58       ` Jakub Kicinski
@ 2025-07-25 21:11         ` Willem de Bruijn
  0 siblings, 0 replies; 8+ messages in thread
From: Willem de Bruijn @ 2025-07-25 21:11 UTC (permalink / raw)
  To: Jakub Kicinski, Willem de Bruijn
  Cc: Breno Leitao, Andrew Lunn, David S. Miller, Eric Dumazet,
	Paolo Abeni, Shuah Khan, netdev, linux-kselftest, linux-kernel,
	kernel-team

Jakub Kicinski wrote:
> On Fri, 25 Jul 2025 16:47:54 -0400 Willem de Bruijn wrote:
> > Less opinionated: the tests implicitly depends on the config files
> > in the test directory. Do we have to start making the robust against
> > situations where CONFIGs in that file are missing?
> 
> I was considering adding something like this to the test guidance.
> 
>   ### Ensure necessary kernel config knobs are set
> 
>   Each test directory has a `config` file listing which kernel
>   configuration options the tests depend on. This file must be kept
>   up to date, our CIs build minimal kernels for each test group. 
> 
>   Adding checks inside the tests to validate that the necessary kernel
>   configs are enabled is discouraged. The test author may include such
>   checks, but standalone patches to make tests compatible e.g. with 
>   distro kernel configs are unlikely to be accepted.
> 
> WDYT?
> 
> Primarily trying to minimize the number of patches and adjustments 
> we'd see, as the matrix of systems and kernel configs can easily get
> out of hand..

This is great!

It's not really feasible to maintain tests with arbitrary missing
dependencies.

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

end of thread, other threads:[~2025-07-25 21:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-23 17:35 [PATCH net-next] selftests: net: Skip test if IPv6 is not configured Breno Leitao
2025-07-24 20:13 ` Simon Horman
2025-07-25  1:24 ` Jakub Kicinski
2025-07-25  8:11   ` Breno Leitao
2025-07-25 20:47     ` Willem de Bruijn
2025-07-25 20:58       ` Jakub Kicinski
2025-07-25 21:11         ` Willem de Bruijn
2025-07-25 18:40 ` patchwork-bot+netdevbpf

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).