[PATCH mptcp-next 2/4] Squash to "selftests: mptcp: lib: use setup/cleanup_ns helpers"

Geliang Tang posted 4 patches 4 months, 3 weeks ago
[PATCH mptcp-next 2/4] Squash to "selftests: mptcp: lib: use setup/cleanup_ns helpers"
Posted by Geliang Tang 4 months, 3 weeks ago
From: Geliang Tang <tanggeliang@kylinos.cn>

setup_ns exits when it fails, so I think no need to exit in
mptcp_lib_ns_init anymore.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 tools/testing/selftests/net/mptcp/mptcp_lib.sh | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
index 194c8fc2e55a..7a461830539b 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
@@ -428,10 +428,7 @@ mptcp_lib_check_tools() {
 }
 
 mptcp_lib_ns_init() {
-	if ! setup_ns ${@}; then
-		mptcp_lib_pr_fail "Failed to setup namespace ${@}"
-		exit ${KSFT_FAIL}
-	fi
+	setup_ns "${@}"
 
 	local netns
 	for netns in "${@}"; do
-- 
2.43.0
Re: [PATCH mptcp-next 2/4] Squash to "selftests: mptcp: lib: use setup/cleanup_ns helpers"
Posted by Matthieu Baerts 4 months, 3 weeks ago
Hi Geliang,

On 25/05/2024 15:01, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> setup_ns exits when it fails, so I think no need to exit in
> mptcp_lib_ns_init anymore.
> 
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  tools/testing/selftests/net/mptcp/mptcp_lib.sh | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> index 194c8fc2e55a..7a461830539b 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> @@ -428,10 +428,7 @@ mptcp_lib_check_tools() {
>  }
>  
>  mptcp_lib_ns_init() {
> -	if ! setup_ns ${@}; then
> -		mptcp_lib_pr_fail "Failed to setup namespace ${@}"
> -		exit ${KSFT_FAIL}
> -	fi
> +	setup_ns "${@}"

It only exits when there is an internal error (name conflict), but not
if there was an issue with 'ip netns add'. I think it is safer to keep
this check, no?

>  
>  	local netns
>  	for netns in "${@}"; do

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.