All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Zhao Gongyi <zhaogongyi@huawei.com>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Cc: shuah@kernel.org, akpm@linux-foundation.org,
	akinobu.mita@gmail.com, Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH -next 2/5] selftests/cpu-hotplug: Replace exit with return
Date: Wed, 31 Aug 2022 17:24:45 -0600	[thread overview]
Message-ID: <8552fc36-305f-d365-a2a0-b341bee14323@linuxfoundation.org> (raw)
In-Reply-To: <20220830083028.45504-3-zhaogongyi@huawei.com>

On 8/30/22 02:30, Zhao Gongyi wrote:
> Replace exit with return to avoid some offline cpu
> left when offline cpus fail.
> 

Some cpus will be left in offline state when online
function exits ...

Can you state this clearly in the change log.

> Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
> ---
>   .../selftests/cpu-hotplug/cpu-on-off-test.sh        | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
> index 1169ef82b55e..19028c4c9758 100755
> --- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
> +++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
> @@ -4,6 +4,7 @@
>   SYSFS=
>   # Kselftest framework requirement - SKIP code is 4.
>   ksft_skip=4
> +retval=0
> 
>   prerequisite()
>   {
> @@ -102,10 +103,10 @@ online_cpu_expect_success()
> 
>   	if ! online_cpu $cpu; then
>   		echo $FUNCNAME $cpu: unexpected fail >&2
> -		exit 1
> +		let retval=$retval+1
>   	elif ! cpu_is_online $cpu; then
>   		echo $FUNCNAME $cpu: unexpected offline >&2
> -		exit 1
> +		let retval=$retval+1
>   	fi
>   }
> 
> @@ -128,10 +129,10 @@ offline_cpu_expect_success()
> 
>   	if ! offline_cpu $cpu; then
>   		echo $FUNCNAME $cpu: unexpected fail >&2
> -		exit 1
> +		let retval=$retval+1
>   	elif ! cpu_is_offline $cpu; then
>   		echo $FUNCNAME $cpu: unexpected offline >&2
> -		exit 1
> +		let retval=$retval+1
>   	fi
>   }
> 
> @@ -201,7 +202,7 @@ if [ $allcpus -eq 0 ]; then
>   		offline_cpu_expect_success $present_max
>   		online_cpu $present_max
>   	fi
> -	exit 0
> +	exit $retval
>   else
>   	echo "Full scope test: all hotplug cpus"
>   	echo -e "\t online all offline cpus"
> @@ -291,3 +292,5 @@ done
> 
>   echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error
>   /sbin/modprobe -q -r cpu-notifier-error-inject
> +
> +exit $retval

This retval can be ksft_skip value if 4 of them fail. The test
result will be incorrect in this case and will be reported as
a skip. Let's avoid that case.

thanks,
-- Shuah

  reply	other threads:[~2022-08-31 23:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30  8:30 [PATCH -next 0/5] Optimize and bugfix for cpu-on-off-test.sh Zhao Gongyi
2022-08-30  8:30 ` [PATCH -next 1/5] selftests/cpu-hotplug: Correct log info Zhao Gongyi
2022-08-30  8:30 ` [PATCH -next 2/5] selftests/cpu-hotplug: Replace exit with return Zhao Gongyi
2022-08-31 23:24   ` Shuah Khan [this message]
2022-08-30  8:30 ` [PATCH -next 3/5] selftests/cpu-hotplug: Delete fault injection related code Zhao Gongyi
2022-08-31 23:32   ` Shuah Khan
2022-08-30  8:30 ` [PATCH -next 4/5] selftests/cpu-hotplug: Reserve one cpu online at least Zhao Gongyi
2022-08-30  8:30 ` [PATCH -next 5/5] selftests/cpu-hotplug: Add log info when test success Zhao Gongyi

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=8552fc36-305f-d365-a2a0-b341bee14323@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=zhaogongyi@huawei.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.