MPTCP Linux Development
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next v13 14/14] selftests: mptcp: userspace pm get addr tests
Date: Mon, 19 Feb 2024 15:56:59 +0100	[thread overview]
Message-ID: <5262a7ec-6ef6-4938-9924-e70b9bb023b8@kernel.org> (raw)
In-Reply-To: <93caac2c12105bab2e5536906c1f65b42a29f14d.1708069036.git.tanggeliang@kylinos.cn>

Hi Geliang,

On 16/02/2024 08:42, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> This patch adds a new helper userspace_pm_get_addr() in mptcp_join.sh.
> In it, parse the token value from the output of 'pm_nl_ctl events', then
> pass it to pm_nl_ctl get_addr command. Use this helper in userspace pm
> dump tests.
> 
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  .../testing/selftests/net/mptcp/mptcp_join.sh | 25 +++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index fb9b3ee9fee0..a4d121f9e467 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -3362,6 +3362,18 @@ userspace_pm_dump()
>  	ip netns exec $1 ./pm_nl_ctl dump token $tk
>  }
>  
> +# $1: ns ; $2: id
> +userspace_pm_get_addr()
> +{
> +	local evts=$evts_ns1
> +	local tk
> +
> +	[ "$1" == "$ns2" ] && evts=$evts_ns2
> +	tk=$(mptcp_lib_evts_get_info token "$evts")
> +
> +	ip netns exec $1 ./pm_nl_ctl get $2 token $tk
> +}
> +
>  check_output()
>  {
>  	local cmd="$1"
> @@ -3482,6 +3494,14 @@ userspace_tests()
>  				     $'id 10 flags signal 10.0.2.1\nid 20 flags signal 10.0.3.1' \
>  				     "      dump addrs signal"
>  		fi
> +		if mptcp_lib_kallsyms_has "mptcp_userspace_pm_get_addr$"; then

Same as in patch 9/14: you need an 'else print_skip', and best to move
duplicated code to a new helper, called with:

userspace_pm_chk_get_addr "${ns1}" "10" "<expected>"

And in this helper, you would do something like:

  local ns="${1}"
  local id="${2}"
  local exp="${3}"

  print_check "get id ${id} addr"

  if mptcp_lib_kallsyms_has "mptcp_userspace_pm_get_addr$"; then
      check_output "userspace_pm_get_addr ${ns} ${id}" "${exp}"
  else
      print_skip
  fi

> +			check_output "userspace_pm_get_addr $ns1 10" \
> +				     "id 10 flags signal 10.0.2.1" \
> +				     "      get id 10 addr"
> +			check_output "userspace_pm_get_addr $ns1 20" \
> +				     "id 20 flags signal 10.0.3.1" \
> +				     "      get id 20 addr"
> +		fi
>  		userspace_pm_rm_addr $ns1 10
>  		userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $SUB_ESTABLISHED
>  		if mptcp_lib_kallsyms_has "mptcp_userspace_pm_dump_addr$"; then
> @@ -3520,6 +3540,11 @@ userspace_tests()
>  				     "id 20 flags subflow 10.0.3.2" \
>  				     "      dump addrs subflow"
>  		fi
> +		if mptcp_lib_kallsyms_has "mptcp_userspace_pm_get_addr$"; then
> +			check_output "userspace_pm_get_addr $ns2 20" \
> +				     "id 20 flags subflow 10.0.3.2" \
> +				     "      get id 20 addr"
> +		fi
>  		userspace_pm_rm_addr $ns2 20
>  		userspace_pm_rm_sf $ns2 10.0.3.2 $SUB_ESTABLISHED
>  		if mptcp_lib_kallsyms_has "mptcp_userspace_pm_dump_addr$"; then

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

  parent reply	other threads:[~2024-02-19 14:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16  7:42 [PATCH mptcp-next v13 00/14] dump for userspace pm Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 01/14] mptcp: export mptcp_genl_family & mptcp_nl_fill_addr Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 02/14] mptcp: implement mptcp_userspace_pm_dump_addr Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 03/14] mptcp: add token for get-addr in yaml Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 04/14] mptcp: dump addrs in userspace pm list Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 05/14] mptcp: check userspace pm flags Geliang Tang
2024-02-19 14:53   ` Matthieu Baerts
2024-02-16  7:42 ` [PATCH mptcp-next v13 06/14] selftests: mptcp: add userspace pm subflow flag Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 07/14] selftests: mptcp: add token for dump_addr Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 08/14] selftests: mptcp: add check_output helper Geliang Tang
2024-02-19 14:51   ` Matthieu Baerts
2024-02-16  7:42 ` [PATCH mptcp-next v13 09/14] selftests: mptcp: dump userspace addrs list Geliang Tang
2024-02-19 14:55   ` Matthieu Baerts
2024-02-16  7:42 ` [PATCH mptcp-next v13 10/14] mptcp: add userspace_pm_lookup_addr_by_id helper Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 11/14] mptcp: implement mptcp_userspace_pm_get_addr Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 12/14] mptcp: get addr in userspace pm list Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 13/14] selftests: mptcp: add token for get_addr Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 14/14] selftests: mptcp: userspace pm get addr tests Geliang Tang
2024-02-16  8:34   ` selftests: mptcp: userspace pm get addr tests: Tests Results MPTCP CI
2024-02-16  9:55   ` MPTCP CI
2024-02-16 10:14   ` MPTCP CI
2024-02-16 10:24     ` Matthieu Baerts
2024-02-16 11:08   ` MPTCP CI
2024-02-16 11:31   ` MPTCP CI
2024-02-16 20:33   ` MPTCP CI
2024-02-19 14:56   ` Matthieu Baerts [this message]
2024-02-16 19:31 ` [PATCH mptcp-next v13 00/14] dump for userspace pm Mat Martineau
2024-02-19 14:52 ` Matthieu Baerts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5262a7ec-6ef6-4938-9924-e70b9bb023b8@kernel.org \
    --to=matttbe@kernel.org \
    --cc=geliang@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=tanggeliang@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox