diff mbox series

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

Message ID 029bea7a92e16983747025bc586910cbfa4dd2ac.1716641976.git.tanggeliang@kylinos.cn (mailing list archive)
State Rejected, archived
Headers show
Series Squash to "use helpers in lib.sh" v5 | expand

Checks

Context Check Description
matttbe/build success Build and static analysis OK
matttbe/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
matttbe/shellcheck success No ShellCheck issues
matttbe/KVM_Validation__normal success Success! ✅
matttbe/KVM_Validation__debug success Success! ✅
matttbe/KVM_Validation__btf__only_bpftest_all_ success Success! ✅

Commit Message

Geliang Tang May 25, 2024, 1:01 p.m. UTC
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(-)

Comments

Matthieu Baerts (NGI0) May 27, 2024, 10:15 a.m. UTC | #1
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
diff mbox series

Patch

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