From: Hangbin Liu <[email protected]> Extract the End PSP policy setup from setup() into setup_end_flv_psp().
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. Split the PSP-specific setup into its own helper so each PSP test case can setup and later cleanup independently. Use set -e around the PSP setup block so failures during setup are treated as errors instead of silently continuing into the connectivity checks. Signed-off-by: Hangbin Liu <[email protected]> --- tools/testing/selftests/net/srv6_end_flavors_test.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/srv6_end_flavors_test.sh b/tools/testing/selftests/net/srv6_end_flavors_test.sh index 318487eda671..56a1c5f865a7 100755 --- a/tools/testing/selftests/net/srv6_end_flavors_test.sh +++ b/tools/testing/selftests/net/srv6_end_flavors_test.sh @@ -645,6 +645,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. @@ -661,9 +667,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() @@ -758,7 +761,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

