summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/net/mptcp/userspace_pm.sh
diff options
context:
space:
mode:
authorGeliang Tang <tanggeliang@kylinos.cn>2024-03-09 01:10:17 +0300
committerJakub Kicinski <kuba@kernel.org>2024-03-12 01:07:26 +0300
commit339c225e2e03a41aa716038b7de2051a930603de (patch)
treeb86d60940a9fd824e57aa44d1bea8196b1e14fc1 /tools/testing/selftests/net/mptcp/userspace_pm.sh
parent747ba8783a33fca6bad9b6c74280096ee93be9f2 (diff)
downloadlinux-339c225e2e03a41aa716038b7de2051a930603de.tar.xz
selftests: mptcp: call test_fail without argument
This patch modifies test_fail() to call mptcp_lib_pr_fail() only if there are arguments (if [ ${#} -gt 0 ]) in userspace_pm.sh, add arguments "unexpected type: ${type}" when calling test_fail() from test_remove(). Then mptcp_lib_pr_fail() can be used in check_expected_one() instead of test_fail(). The same in mptcp_join.sh, calling fail_test() without argument, and adapt this helper not to call print_fail() in this case. Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://lore.kernel.org/r/20240308-upstream-net-next-20240308-selftests-mptcp-unification-v1-10-4f42c347b653@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing/selftests/net/mptcp/userspace_pm.sh')
-rwxr-xr-xtools/testing/selftests/net/mptcp/userspace_pm.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh
index 4e29aa9c2529..bc2f0184b1eb 100755
--- a/tools/testing/selftests/net/mptcp/userspace_pm.sh
+++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh
@@ -85,7 +85,10 @@ test_skip()
# $1: msg
test_fail()
{
- mptcp_lib_pr_fail "${@}"
+ if [ ${#} -gt 0 ]
+ then
+ mptcp_lib_pr_fail "${@}"
+ fi
ret=1
mptcp_lib_result_fail "${test_name}"
}
@@ -239,7 +242,7 @@ check_expected_one()
if [ "${prev_ret}" = "0" ]
then
- test_fail
+ mptcp_lib_pr_fail
fi
mptcp_lib_print_err "\tExpected value for '${var}': '${!exp}', got '${!var}'."
@@ -263,6 +266,7 @@ check_expected()
return 0
fi
+ test_fail
return 1
}
@@ -412,7 +416,7 @@ test_remove()
then
test_pass
else
- test_fail
+ test_fail "unexpected type: ${type}"
fi
# RM_ADDR using an invalid addr id should result in no action
@@ -425,7 +429,7 @@ test_remove()
then
test_pass
else
- test_fail
+ test_fail "unexpected type: ${type}"
fi
# RM_ADDR from the client to server machine