All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: Geliang Tang <geliang.tang@suse.com>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v3] selftests: mptcp: add invert check in check_transfer
Date: Wed, 19 Jan 2022 16:06:26 -0800 (PST)	[thread overview]
Message-ID: <d6e12420-bc8e-9369-8acf-702539b2fe87@linux.intel.com> (raw)
In-Reply-To: <ed191af941837d4c63ea37a9a863dc39904571d2.1642570570.git.geliang.tang@suse.com>

On Wed, 19 Jan 2022, Geliang Tang wrote:

> This patch added the invert bytes check for the output data in
> check_transfer().
>
> Instead of the file mismatch error:
>
>  [ FAIL ] file received by server does not match (in, out):
>  -rw------- 1 root root 45643832 Jan 16 15:04 /tmp/tmp.9xpM6Paivv
>  Trailing bytes are:
>  MPTCP_TEST_FILE_END_MARKER
>  -rw------- 1 root root 45643832 Jan 16 15:04 /tmp/tmp.wnz1Yp4u7Z
>  Trailing bytes are:
>  MPTCP_TEST_FILE_END_MARKER
>
> Print out the inverted bytes like this:
>
>  file received by server has inverted byte at 7454789
>  file received by server has inverted byte at 7454790
>  file received by server has inverted byte at 7454791
>  file received by server has inverted byte at 7454792
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
> v3:
> - add the check_invert flag, do the invert bytes check only when this flag
> is set.
> - use 0xff directly.
> - update the output log.

Hi Geliang -

Looks good to me, thanks for the updates! Please update "selftests: mptcp: 
add mp_fail testcases" for the inversion check.

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


>
> v2:
> - instead of adding a new function is_invert, add the invert bytes
>   check in check_transfer().
> ---
> .../testing/selftests/net/mptcp/mptcp_join.sh | 25 +++++++++++++------
> 1 file changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index 2be3cad4b52b..4f8ee8a9a8f2 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -15,6 +15,7 @@ timeout_test=$((timeout_poll * 2 + 1))
> mptcp_connect=""
> capture=0
> checksum=0
> +check_invert=0
> do_all_tests=1
>
> TEST_COUNT=0
> @@ -58,6 +59,8 @@ init()
> 		fi
> 	done
>
> +	check_invert=0
> +
> 	#  ns1              ns2
> 	# ns1eth1    ns2eth1
> 	# ns1eth2    ns2eth2
> @@ -193,15 +196,21 @@ check_transfer()
> 	out=$2
> 	what=$3
>
> -	cmp "$in" "$out" > /dev/null 2>&1
> -	if [ $? -ne 0 ] ;then
> -		echo "[ FAIL ] $what does not match (in, out):"
> -		print_file_err "$in"
> -		print_file_err "$out"
> -		ret=1
> +	cmp -l "$in" "$out" | while read line; do
> +		local arr=($line)
>
> -		return 1
> -	fi
> +		let sum=0${arr[1]}+0${arr[2]}
> +		if [ $check_invert -eq 0 ] || [ $sum -ne $((0xff)) ]; then
> +			echo "[ FAIL ] $what does not match (in, out):"
> +			print_file_err "$in"
> +			print_file_err "$out"
> +			ret=1
> +
> +			return 1
> +		else
> +			echo "$what has inverted byte at ${arr[0]}"
> +		fi
> +	done
>
> 	return 0
> }
> -- 
> 2.31.1
>
>
>

--
Mat Martineau
Intel

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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19  5:42 [PATCH mptcp-next v3] selftests: mptcp: add invert check in check_transfer Geliang Tang
2022-01-20  0:06 ` Mat Martineau [this message]
2022-01-20 15:12   ` 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=d6e12420-bc8e-9369-8acf-702539b2fe87@linux.intel.com \
    --to=mathew.j.martineau@linux.intel.com \
    --cc=geliang.tang@suse.com \
    --cc=mptcp@lists.linux.dev \
    /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.