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 v5 08/12] selftests: mptcp: move test_fail out of check_expected_one
Date: Mon, 26 Feb 2024 13:41:45 +0100	[thread overview]
Message-ID: <1de56e13-e6aa-47b1-bc5b-aeea2c1119aa@kernel.org> (raw)
In-Reply-To: <906425f25bc2951a4c18187befb60443e9d777d4.1708939962.git.tanggeliang@kylinos.cn>

Hi Geliang,

On 26/02/2024 10:43, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> This patch moves test_fail out of check_expected_one(), since test_fail
> is a private function in userspace_pm.sh, and check_expected_one will be
> exported in mptcp_lib.sh in the next commit.
> 
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  tools/testing/selftests/net/mptcp/userspace_pm.sh | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh
> index 27f308601005..473639a8009f 100755
> --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh
> +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh
> @@ -247,7 +247,7 @@ check_expected_one()
>  
>  	if [ "${prev_ret}" = "0" ]
>  	then
> -		test_fail

I think, the goal to do it here was to print "FAIL", then the details.

> +		return 2

Just return 1, no?

>  	fi
>  
>  	_printf "\tExpected value for '%s': '%s', got '%s'.\n" \

What's the output now in case of issue? Does it still make sense to use
the '\t' here at the beginning?

> @@ -263,13 +263,20 @@ check_expected()
>  
>  	for var in "${@}"
>  	do
> -		check_expected_one "${var}" "${rc}" || rc=1
> +		check_expected_one "${var}" "${rc}" || rc="${?}"
> +		if [ "${rc}" -eq 2 ]
> +		then
> +			break

Why breaking? If you break, you only print one error, not all like before.

Please check the behaviour in case of error before and after the
modification.

> +		fi
>  	done
>  
>  	if [ ${rc} -eq 0 ]
>  	then
>  		test_pass
>  		return 0
> +	elif [ "${rc}" -eq 2 ]
> +	then
> +		test_fail

Just 'test_fail' after the 'if'.

>  	fi
>  
>  	return 1

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

  reply	other threads:[~2024-02-26 12:41 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-26  9:43 [PATCH mptcp-next v5 00/12] add helpers and vars in mptcp_lib.sh, part 3 Geliang Tang
2024-02-26  9:43 ` [PATCH mptcp-next v5 01/12] selftests: mptcp: capitalize ok/fail/skip Geliang Tang
2024-02-26 12:40   ` Matthieu Baerts
2024-02-28  7:47     ` Geliang Tang
2024-02-26  9:43 ` [PATCH mptcp-next v5 02/12] selftests: mptcp: sockopt: print every test result Geliang Tang
2024-02-26 12:40   ` Matthieu Baerts
2024-02-28  7:57     ` Geliang Tang
2024-02-28  9:13       ` Matthieu Baerts
2024-02-28  9:51         ` Geliang Tang
2024-02-26  9:43 ` [PATCH mptcp-next v5 03/12] selftests: mptcp: connect: fix misaligned OK/FAIL Geliang Tang
2024-02-26 12:40   ` Matthieu Baerts
2024-02-28  7:58     ` Geliang Tang
2024-02-26  9:43 ` [PATCH mptcp-next v5 04/12] selftests: mptcp: print test results with colors Geliang Tang
2024-02-26 12:41   ` Matthieu Baerts
2024-02-28  8:06     ` Geliang Tang
2024-02-26  9:43 ` [PATCH mptcp-next v5 05/12] selftests: mptcp: connect: add dedicated port counter Geliang Tang
2024-02-26 12:41   ` Matthieu Baerts
2024-02-28  8:09     ` Geliang Tang
2024-02-26  9:43 ` [PATCH mptcp-next v5 06/12] selftests: mptcp: connect: print out ping tests info Geliang Tang
2024-02-26 12:41   ` Matthieu Baerts
2024-02-28  8:31     ` Geliang Tang
2024-02-26  9:43 ` [PATCH mptcp-next v5 07/12] selftests: mptcp: print test results with counters Geliang Tang
2024-02-26 12:41   ` Matthieu Baerts
2024-02-28  8:23     ` Geliang Tang
2024-02-28 10:20       ` Matthieu Baerts
2024-02-26  9:43 ` [PATCH mptcp-next v5 08/12] selftests: mptcp: move test_fail out of check_expected_one Geliang Tang
2024-02-26 12:41   ` Matthieu Baerts [this message]
2024-02-26  9:43 ` [PATCH mptcp-next v5 09/12] selftests: mptcp: extract mptcp_lib_check_expected Geliang Tang
2024-02-26 12:41   ` Matthieu Baerts
2024-02-26  9:43 ` [PATCH mptcp-next v5 10/12] selftests: mptcp: export event macros in mptcp_lib Geliang Tang
2024-02-26 12:42   ` Matthieu Baerts
2024-02-26  9:43 ` [PATCH mptcp-next v5 11/12] selftests: mptcp: add mptcp_lib_verify_listener_events Geliang Tang
2024-02-26 12:42   ` Matthieu Baerts
2024-02-26  9:43 ` [PATCH mptcp-next v5 12/12] selftests: mptcp: use KSFT_SKIP/KSFT_PASS/KSFT_FAIL Geliang Tang
2024-02-26 10:33   ` selftests: mptcp: use KSFT_SKIP/KSFT_PASS/KSFT_FAIL: Tests Results MPTCP CI
2024-02-26 12:40 ` [PATCH mptcp-next v5 00/12] add helpers and vars in mptcp_lib.sh, part 3 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=1de56e13-e6aa-47b1-bc5b-aeea2c1119aa@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