Article View: linux.kernel.netdev
Article #1164[PATCH net-next v2 3/5] selftests: seg6: move SRv6 End PSP setup into its own helper
From: Hangbin Liu
Date: Fri, 09 Oct 2026 09:58
Date: Fri, 09 Oct 2026 09:58
77 lines
8241 bytes
8241 bytes
From: Hangbin Liu <liuhangbin@kylinos.cn>
Currently setup() installs both the base topology and the End PSP
policy. That couples general SRv6 test setup with a specific flavor
test case, which makes it hard to add other flavor scenarios cleanly.
Extract the End PSP policy setup from setup() into setup_end_flv_psp(),
So extend PSP test cases can setup and later cleanup independently. The
matching cleanup_end_flv_psp() arrives in the following patch.
Use set -e around the PSP setup block so failures during setup are
treated as errors instead of silently continuing into the connectivity
checks.
Since SETUP_ERR is not set in one setup function, and the middle test may
set ret to 1, we also need to check ret before setting the result as SKIP
Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
---
tools/testing/selftests/net/srv6_end_flavors_test.sh | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/net/srv6_end_flavors_test.sh b/tools/testing/selftests/net/srv6_end_flavors_test.sh
index 30a939392eea..5ebd6a0344d6 100755
--- a/tools/testing/selftests/net/srv6_end_flavors_test.sh
+++ b/tools/testing/selftests/net/srv6_end_flavors_test.sh
@@ -328,7 +328,7 @@ cleanup()
# check whether the setup phase was completed successfully or not. In
# case of an error during the setup phase of the testing environment,
# the selftest is considered as "skipped".
- if [ "${SETUP_ERR}" -ne 0 ]; then
+ if [ "${SETUP_ERR}" -ne 0 ] && [ "$ret" -ne "$ksft_fail" ]; then
echo "SKIP: Setting up the testing environment failed"
exit "${ksft_skip}"
fi
@@ -628,6 +628,12 @@ setup()
setup_rt_local_sids 3 "1 2 4"
setup_rt_local_sids 4 "1 2 3"
+ # testing environment was set up successfully
+ SETUP_ERR=0
+}
+
+setup_end_flv_psp()
+{
# set up SRv6 policies
# create a connection between hosts hs-1 and hs-2.
# The path between hs-1 and hs-2 traverses SRv6 aware routers.
@@ -644,9 +650,6 @@ setup()
# - rt-1 (SRv6 End flavor PSP with SL=1)
setup_rt_policy_ipv6 2 1 "3:noflv 4:psp 2:psp"
setup_rt_policy_ipv6 1 2 "1:psp"
-
- # testing environment was set up successfully
- SETUP_ERR=0
}
check_rt_connectivity()
@@ -741,7 +744,13 @@ host2gateway_tests()
host_srv6_end_flv_psp_tests()
{
- log_section "SRv6 connectivity test hosts (h1 <-> h2, PSP flavor)"
+ set -e
+ SETUP_ERR=1
+ setup_end_flv_psp
+ SETUP_ERR=0
+ set +e
+
+ log_section "SRv6 connectivity test hosts (h1 <-> h2, End flavor PSP)"
check_and_log_hs_connectivity 1 2
check_and_log_hs_connectivity 2 1
--
2.55.0
Technical Details
Message-ID:
<20261009-srv6_flavors_endx-v2-3-56ac7f838f41@kylinos.cn>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-343568-linux-kernel-netdev=dewy.ruReferences:
<20261009-srv6_flavors_endx-v2-0-56ac7f838f41@kylinos.cn>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-343568-linux-kernel-netdev=dewy.ru From: hangbin.liu@linux.dev (Hangbin Liu) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v2 3/5] selftests: seg6: move SRv6 End PSP setup into its own helper Date: Fri, 09 Oct 2026 17:58:39 +0800 Organization: Usenet Network Message-ID: <20261009-srv6_flavors_endx-v2-3-56ac7f838f41@kylinos.cn> References: <20261009-srv6_flavors_endx-v2-0-56ac7f838f41@kylinos.cn> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1078636"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:1EXGzbdql/sZlUClAsY7N9qZiYE= sha256:4rWj+GJKV9WARc3HxXYIksaCb5l42oNjDYLMvw4butE= sha1:HNUEAqMAseTw/1vOYGzNsaKqnsE= sha256:wzhSbdgbmTeQ7lo7YNClZfR8zi9ti0hBN8+Q7mctXxQ= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 8A21B10F645; Fri, 9 Oct 2026 13:00:32 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.15 X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=linux.dev X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gVTx-JOaAPjy; Fri, 9 Oct 2026 13:00:29 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-343568-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 3BD6E10E9C2; Fri, 9 Oct 2026 13:00:25 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sto.lore.kernel.org (Postfix) with ESMTP id 884226097F0; Fri, 9 Oct 2026 09:59:38 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D67A4A4F00; Fri, 9 Oct 2026 09:59:18 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Y2MD5F2C" X-Received: from mta1.migadu.com (out-51.mta1.migadu.com [95.215.58.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8F984AA028 for <netdev@vger.kernel.org>; Fri, 9 Oct 2026 09:59:16 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.51 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791539958; cv=none; b=ZobKAmkR8Spi/kgvARjHN+dxPBgEHiLzUutUimB1SqmYnFOO1Yc+O0+/NHi1KOE229d032lX85gtNYll9SueIIfKYu5sW61gHrikzmMbfU9GDXd7b4YFZg+iOz4vb+ZEIkmoEK4gacKcxt1vGU6jMY3bVnscdZm2Fwh3quGDiYc= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791539958; c=relaxed/simple; bh=pfE74BMIExp61S0YZU3qrevRRQ6az2m/pNajcAw9Cn4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZG9asBtFGmy0h+rn4AK8fVMwt4gZhH3VUtSASzkUih8Hs9YGcQVLHhIhJiRKUVEC452C7Ku0fzo2Q1I7JLqvsr6V7uXvkRvB0cxMzJjF616L5y+xV9PPj9KGFMmA6JgPLacv9gy8Gdhn0UG8Hsgsrx7mJo//p4Z4cQL64dbQNRs= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Y2MD5F2C; arc=none smtp.client-ip=95.215.58.51 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: netdev@vger.kernel.org X-DKIM-Signature: a=rsa-sha256; bh=pfE74BMIExp61S0YZU3qrevRRQ6az2m/pNajcAw9Cn4=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1791539954; v=1; x=1792144754; b=Y2MD5F2CvewzF/b8fKiRV04TIF0p2RnTnlv6mrWOaNJ8w3FaPKvVGYpexA29cL7UPgx1XXaS ZFqLVeLUGCtbi3KPVqzenM+2ylVlpi36fSQZhh3YiSdRLe1y01CKnSXewoEh99UyRUV+1eIQQYl W/ReH55DHuoHwMeUMS7DVoWA= X-Envelope-To: netdev@vger.kernel.org X-Received: by mta10.migadu.com with ESMTPS id 309d0623b114de6b; Fri, 09 Oct 2026 09:59:14 +0000 X-Mizu-Trace-ID: 309d0623b114de6b X-Migadu-Flow: FLOW_OUT X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-In-Reply-To: <20261009-srv6_flavors_endx-v2-0-56ac7f838f41@kylinos.cn> X-Cc: Hangbin Liu <hangbin.liu@linux.dev>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Hangbin Liu <liuhangbin@kylinos.cn> X-Mailer: b4 0.14.3