All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: Paolo Abeni <pabeni@redhat.com>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-net] selftests: mptcp: more stable diag tests
Date: Thu, 16 Jun 2022 17:01:48 -0700 (PDT)	[thread overview]
Message-ID: <2aa056e8-f51-e367-5bf0-1a9371cc88c4@linux.intel.com> (raw)
In-Reply-To: <f318c8ca562695b07272ea3753a52f950555c18a.1655362313.git.pabeni@redhat.com>

On Thu, 16 Jun 2022, Paolo Abeni wrote:

> The mentioned test-case still use an hard-coded-len sleep to
> wait for a relative large number of connection to be established.
>
> On very slow VM and with debug build such timeout could be exceeded,
> causing failures in our CI.
>
> Address the issue polling for the expected condition several times,
> up to an unreasonable high amount of time. On reasonably fast system
> the self-tests will be faster then before, on very slow one we will
> still catch the correct condition.
>
> Fixes: df62f2ec3df6 ("selftests/mptcp: add diag interface tests")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Looks good to me, thanks Paolo.

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>


> ---
> tools/testing/selftests/net/mptcp/diag.sh | 40 ++++++++++++++++++++---
> 1 file changed, 36 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh
> index 9dd43d7d957b..ee2f238255ec 100755
> --- a/tools/testing/selftests/net/mptcp/diag.sh
> +++ b/tools/testing/selftests/net/mptcp/diag.sh
> @@ -61,6 +61,39 @@ chk_msk_nr()
> 	__chk_nr "grep -c token:" $*
> }
>
> +wait_msk_nr()
> +{
> +	local condition="grep -c token:"
> +	local expected=$1
> +	local timeout=20
> +	local msg nr
> +	local max=0
> +	local i=0
> +
> +	shift 1
> +	msg=$*
> +
> +	while [ $i -lt $timeout ]; do
> +		nr=$(ss -inmHMN $ns | $condition)
> +		[ $nr == $expected ] && break;
> +		[ $nr -gt $max ] && max=$nr
> +		i=$((i + 1))
> +		sleep 1
> +	done
> +
> +	printf "%-50s" "$msg"
> +	if [ $i -ge $timeout ]; then
> +		echo "[ fail ] timeout while expecting $expected max $max last $nr"
> +		ret=$test_cnt
> +	elif [ $nr != $expected ]; then
> +		echo "[ fail ] expected $expected found $nr"
> +		ret=$test_cnt
> +	else
> +		echo "[  ok  ]"
> +	fi
> +	test_cnt=$((test_cnt+1))
> +}
> +
> chk_msk_fallback_nr()
> {
> 		__chk_nr "grep -c fallback" $*
> @@ -184,7 +217,7 @@ for I in `seq 1 $NR_CLIENTS`; do
> 	echo "a" | \
> 		timeout ${timeout_test} \
> 			ip netns exec $ns \
> -				./mptcp_connect -p $((I+10001)) -l -w 10 \
> +				./mptcp_connect -p $((I+10001)) -l -w 20 \
> 					-t ${timeout_poll} 0.0.0.0 >/dev/null &
> done
> wait_local_port_listen $ns $((NR_CLIENTS + 10001))
> @@ -193,12 +226,11 @@ for I in `seq 1 $NR_CLIENTS`; do
> 	echo "b" | \
> 		timeout ${timeout_test} \
> 			ip netns exec $ns \
> -				./mptcp_connect -p $((I+10001)) -w 10 \
> +				./mptcp_connect -p $((I+10001)) -w 20 \
> 					-t ${timeout_poll} 127.0.0.1 >/dev/null &
> done
> -sleep 1.5
>
> -chk_msk_nr $((NR_CLIENTS*2)) "many msk socket present"
> +wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present"
> flush_pids
>
> exit $ret
> -- 
> 2.35.3
>
>
>

--
Mat Martineau
Intel

  parent reply	other threads:[~2022-06-17  0:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-16  6:51 [PATCH mptcp-net] selftests: mptcp: more stable diag tests Paolo Abeni
2022-06-16  8:17 ` selftests: mptcp: more stable diag tests: Tests Results MPTCP CI
2022-06-17  0:01 ` Mat Martineau [this message]
2022-06-20 16:33 ` [PATCH mptcp-net] selftests: mptcp: more stable diag tests 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=2aa056e8-f51-e367-5bf0-1a9371cc88c4@linux.intel.com \
    --to=mathew.j.martineau@linux.intel.com \
    --cc=mptcp@lists.linux.dev \
    --cc=pabeni@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.