[PATCH net-next] selftests: net: Skip so_incoming_cpu on single-CPU systems

From: Kuba Pawlak

Date: Fri Sep 04 2026 - 10:55:17 EST


The test requires at least two CPUs to exercise the distribution of
connections between per-CPU listeners. It currently enforces this
prerequisite with an assertion, causing all test cases to fail on
single-vCPU systems even though no kernel functionality was tested.

Report the unsupported environment as a skip instead. Check the
prerequisite before setting up the network namespace so skipped tests do
not make unnecessary system changes.

Link: https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/2023546

Co-authored-by: Copilot <223556219+Copilot@xxxxxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Kuba Pawlak <kuba.pawlak@xxxxxxxxxxxxx>
---
tools/testing/selftests/net/so_incoming_cpu.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/net/so_incoming_cpu.c b/tools/testing/selftests/net/so_incoming_cpu.c
index 4740701f1..1b7344238 100644
--- a/tools/testing/selftests/net/so_incoming_cpu.c
+++ b/tools/testing/selftests/net/so_incoming_cpu.c
@@ -81,10 +81,11 @@ static int nr_client_per_server, nr_server, nr_client;

FIXTURE_SETUP(so_incoming_cpu)
{
- setup_netns(_metadata);
-
nr_server = get_nprocs();
- ASSERT_LE(2, nr_server);
+ if (nr_server < 2)
+ SKIP(return, "requires at least two CPUs");
+
+ setup_netns(_metadata);

if (NR_CLIENT_PER_SERVER_DEFAULT * nr_server < NR_PORT)
nr_client_per_server = NR_CLIENT_PER_SERVER_DEFAULT;
--
2.43.0