summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/net/mptcp/mptcp_join.sh
diff options
context:
space:
mode:
authorGeliang Tang <geliang.tang@suse.com>2023-11-28 15:18:58 -0800
committerJakub Kicinski <kuba@kernel.org>2023-11-29 20:06:19 -0800
commit9d9095bbc24df4432b38fb33a3cf59ea1e9213d0 (patch)
tree048b6dc6dcb41a5cf501c65654abaf5d3a2913cb /tools/testing/selftests/net/mptcp/mptcp_join.sh
parent3a96dea9f88763cfa29e15f681f95fca8952ec77 (diff)
selftests: mptcp: add mptcp_lib_check_transfer
To avoid duplicated code in different MPTCP selftests, we can add and use helpers defined in mptcp_lib.sh. check_transfer() and print_file_err() helpers are defined both in mptcp_connect.sh and mptcp_sockopt.sh, export them into mptcp_lib.sh and rename them with mptcp_lib_ prefix. And use them in all scripts. Note: In mptcp_sockopt.sh it is OK to drop 'ret=1' in check_transfer() because it will be set in run_tests() anyway. Reviewed-by: Matthieu Baerts <matttbe@kernel.org> Signed-off-by: Geliang Tang <geliang.tang@suse.com> Signed-off-by: Mat Martineau <martineau@kernel.org> Link: https://lore.kernel.org/r/20231128-send-net-next-2023107-v4-14-8d6b94150f6b@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing/selftests/net/mptcp/mptcp_join.sh')
-rwxr-xr-xtools/testing/selftests/net/mptcp/mptcp_join.sh11
1 files changed, 2 insertions, 9 deletions
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 37f434cbfa44..420e4b3f9ad0 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -511,13 +511,6 @@ get_failed_tests_ids()
done | sort -n
}
-print_file_err()
-{
- ls -l "$1" 1>&2
- echo -n "Trailing bytes are: "
- tail -c 27 "$1"
-}
-
check_transfer()
{
local in=$1
@@ -548,8 +541,8 @@ check_transfer()
local sum=$((0${a} + 0${b}))
if [ $check_invert -eq 0 ] || [ $sum -ne $((0xff)) ]; then
fail_test "$what does not match (in, out):"
- print_file_err "$in"
- print_file_err "$out"
+ mptcp_lib_print_file_err "$in"
+ mptcp_lib_print_file_err "$out"
return 1
else