* Re: [PATCH -next v2 3/5] selftests/cpu-hotplug: Delete fault injection related code
@ 2022-09-05 13:50 zhaogongyi
0 siblings, 0 replies; 2+ messages in thread
From: zhaogongyi @ 2022-09-05 13:50 UTC (permalink / raw)
To: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Cc: shuah@kernel.org, akpm@linux-foundation.org,
akinobu.mita@gmail.com
Hi shuah,
I am so sorry! There are some mistaks in the patch that did not delete the config file, please skip the patches of v2 version.
And I have resubmit the patches with new version, please see: https://patchwork.kernel.org/project/linux-kselftest/patch/20220905133615.139026-4-zhaogongyi@huawei.com/
Thanks for your review!
Kind regards,
Gongyi
>
> Delete fault injection related code since the module has been deleted.
>
> Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
> ---
> .../selftests/cpu-hotplug/cpu-on-off-test.sh | 87 ++-----------------
> 1 file changed, 6 insertions(+), 81 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 bd2e791fe887..184156763ccb 100755
> --- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
> +++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
> @@ -116,10 +116,10 @@ online_cpu_expect_fail()
>
> if online_cpu $cpu 2> /dev/null; then
> echo $FUNCNAME $cpu: unexpected success >&2
> - exit 1
> + retval=1
> elif ! cpu_is_offline $cpu; then
> echo $FUNCNAME $cpu: unexpected online >&2
> - exit 1
> + retval=1
> fi
> }
>
> @@ -142,16 +142,14 @@ offline_cpu_expect_fail()
>
> if offline_cpu $cpu 2> /dev/null; then
> echo $FUNCNAME $cpu: unexpected success >&2
> - exit 1
> + retval=1
> elif ! cpu_is_online $cpu; then
> echo $FUNCNAME $cpu: unexpected offline >&2
> - exit 1
> + retval=1
> fi
> }
>
> -error=-12
> allcpus=0
> -priority=0
> online_cpus=0
> online_max=0
> offline_cpus=0
> @@ -159,31 +157,20 @@ offline_max=0
> present_cpus=0
> present_max=0
>
> -while getopts e:ahp: opt; do
> +while getopts ah opt; do
> case $opt in
> - e)
> - error=$OPTARG
> - ;;
> a)
> allcpus=1
> ;;
> h)
> - echo "Usage $0 [ -a ] [ -e errno ] [ -p notifier-priority ]"
> + echo "Usage $0 [ -a ]"
> echo -e "\t default offline one cpu"
> echo -e "\t run with -a option to offline all cpus"
> exit
> ;;
> - p)
> - priority=$OPTARG
> - ;;
> esac
> done
>
> -if ! [ "$error" -ge -4095 -a "$error" -lt 0 ]; then
> - echo "error code must be -4095 <= errno < 0" >&2
> - exit 1
> -fi
> -
> prerequisite
>
> #
> @@ -231,66 +218,4 @@ for cpu in `hotplaggable_offline_cpus`; do
> online_cpu_expect_success $cpu
> done
>
> -#
> -# Test with cpu notifier error injection -#
> -
> -DEBUGFS=`mount -t debugfs | head -1 | awk '{ print $3 }'`
> -NOTIFIER_ERR_INJECT_DIR=$DEBUGFS/notifier-error-inject/cpu
> -
> -prerequisite_extra()
> -{
> - msg="skip extra tests:"
> -
> - /sbin/modprobe -q -r cpu-notifier-error-inject
> - /sbin/modprobe -q cpu-notifier-error-inject priority=$priority
> -
> - if [ ! -d "$DEBUGFS" ]; then
> - echo $msg debugfs is not mounted >&2
> - exit $ksft_skip
> - fi
> -
> - if [ ! -d $NOTIFIER_ERR_INJECT_DIR ]; then
> - echo $msg cpu-notifier-error-inject module is not available >&2
> - exit $ksft_skip
> - fi
> -}
> -
> -prerequisite_extra
> -
> -#
> -# Offline all hot-pluggable CPUs
> -#
> -echo 0 >
> $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error
> -for cpu in `hotpluggable_online_cpus`; do
> - offline_cpu_expect_success $cpu
> -done
> -
> -#
> -# Test CPU hot-add error handling (offline => online) -# -echo $error >
> $NOTIFIER_ERR_INJECT_DIR/actions/CPU_UP_PREPARE/error
> -for cpu in `hotplaggable_offline_cpus`; do
> - online_cpu_expect_fail $cpu
> -done
> -
> -#
> -# Online all hot-pluggable CPUs
> -#
> -echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_UP_PREPARE/error
> -for cpu in `hotplaggable_offline_cpus`; do
> - online_cpu_expect_success $cpu
> -done
> -
> -#
> -# Test CPU hot-remove error handling (online => offline) -# -echo $error >
> $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error
> -for cpu in `hotpluggable_online_cpus`; do
> - offline_cpu_expect_fail $cpu
> -done
> -
> -echo 0 >
> $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error
> -/sbin/modprobe -q -r cpu-notifier-error-inject
> -
> exit $retval
> --
> 2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH -next v2 0/5] Optimize and bugfix for cpu-on-off-test.sh
@ 2022-09-05 12:45 Zhao Gongyi
2022-09-05 12:45 ` [PATCH -next v2 3/5] selftests/cpu-hotplug: Delete fault injection related code Zhao Gongyi
0 siblings, 1 reply; 2+ messages in thread
From: Zhao Gongyi @ 2022-09-05 12:45 UTC (permalink / raw)
To: linux-kernel, linux-kselftest; +Cc: shuah, akpm, akinobu.mita, Zhao Gongyi
1. Correct log info
2. Add checking of invalid options
3. Replace exit with return to make the test exit gracefully
4. Delete fault injection related code
5. Reserve one cpu online when the test offline all cpus
Changes in v2:
- Update change log of patch 2
- Update exiting value to avoid incorrect report for patch 2
- Keep online_cpu_expect_fail() and offline_cpu_expect_fail() for
patch 3
Zhao Gongyi (5):
selftests/cpu-hotplug: Correct log info
selftests/cpu-hotplug: Use return instead of exit
selftests/cpu-hotplug: Delete fault injection related code
selftests/cpu-hotplug: Reserve one cpu online at least
selftests/cpu-hotplug: Add log info when test success
tools/testing/selftests/cpu-hotplug/Makefile | 2 +-
.../selftests/cpu-hotplug/cpu-on-off-test.sh | 140 +++++-------------
2 files changed, 37 insertions(+), 105 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH -next v2 3/5] selftests/cpu-hotplug: Delete fault injection related code
2022-09-05 12:45 [PATCH -next v2 0/5] Optimize and bugfix for cpu-on-off-test.sh Zhao Gongyi
@ 2022-09-05 12:45 ` Zhao Gongyi
0 siblings, 0 replies; 2+ messages in thread
From: Zhao Gongyi @ 2022-09-05 12:45 UTC (permalink / raw)
To: linux-kernel, linux-kselftest; +Cc: shuah, akpm, akinobu.mita, Zhao Gongyi
Delete fault injection related code since the module has been deleted.
Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
.../selftests/cpu-hotplug/cpu-on-off-test.sh | 87 ++-----------------
1 file changed, 6 insertions(+), 81 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 bd2e791fe887..184156763ccb 100755
--- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
+++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
@@ -116,10 +116,10 @@ online_cpu_expect_fail()
if online_cpu $cpu 2> /dev/null; then
echo $FUNCNAME $cpu: unexpected success >&2
- exit 1
+ retval=1
elif ! cpu_is_offline $cpu; then
echo $FUNCNAME $cpu: unexpected online >&2
- exit 1
+ retval=1
fi
}
@@ -142,16 +142,14 @@ offline_cpu_expect_fail()
if offline_cpu $cpu 2> /dev/null; then
echo $FUNCNAME $cpu: unexpected success >&2
- exit 1
+ retval=1
elif ! cpu_is_online $cpu; then
echo $FUNCNAME $cpu: unexpected offline >&2
- exit 1
+ retval=1
fi
}
-error=-12
allcpus=0
-priority=0
online_cpus=0
online_max=0
offline_cpus=0
@@ -159,31 +157,20 @@ offline_max=0
present_cpus=0
present_max=0
-while getopts e:ahp: opt; do
+while getopts ah opt; do
case $opt in
- e)
- error=$OPTARG
- ;;
a)
allcpus=1
;;
h)
- echo "Usage $0 [ -a ] [ -e errno ] [ -p notifier-priority ]"
+ echo "Usage $0 [ -a ]"
echo -e "\t default offline one cpu"
echo -e "\t run with -a option to offline all cpus"
exit
;;
- p)
- priority=$OPTARG
- ;;
esac
done
-if ! [ "$error" -ge -4095 -a "$error" -lt 0 ]; then
- echo "error code must be -4095 <= errno < 0" >&2
- exit 1
-fi
-
prerequisite
#
@@ -231,66 +218,4 @@ for cpu in `hotplaggable_offline_cpus`; do
online_cpu_expect_success $cpu
done
-#
-# Test with cpu notifier error injection
-#
-
-DEBUGFS=`mount -t debugfs | head -1 | awk '{ print $3 }'`
-NOTIFIER_ERR_INJECT_DIR=$DEBUGFS/notifier-error-inject/cpu
-
-prerequisite_extra()
-{
- msg="skip extra tests:"
-
- /sbin/modprobe -q -r cpu-notifier-error-inject
- /sbin/modprobe -q cpu-notifier-error-inject priority=$priority
-
- if [ ! -d "$DEBUGFS" ]; then
- echo $msg debugfs is not mounted >&2
- exit $ksft_skip
- fi
-
- if [ ! -d $NOTIFIER_ERR_INJECT_DIR ]; then
- echo $msg cpu-notifier-error-inject module is not available >&2
- exit $ksft_skip
- fi
-}
-
-prerequisite_extra
-
-#
-# Offline all hot-pluggable CPUs
-#
-echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error
-for cpu in `hotpluggable_online_cpus`; do
- offline_cpu_expect_success $cpu
-done
-
-#
-# Test CPU hot-add error handling (offline => online)
-#
-echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_UP_PREPARE/error
-for cpu in `hotplaggable_offline_cpus`; do
- online_cpu_expect_fail $cpu
-done
-
-#
-# Online all hot-pluggable CPUs
-#
-echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_UP_PREPARE/error
-for cpu in `hotplaggable_offline_cpus`; do
- online_cpu_expect_success $cpu
-done
-
-#
-# Test CPU hot-remove error handling (online => offline)
-#
-echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error
-for cpu in `hotpluggable_online_cpus`; do
- offline_cpu_expect_fail $cpu
-done
-
-echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error
-/sbin/modprobe -q -r cpu-notifier-error-inject
-
exit $retval
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-05 13:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-05 13:50 [PATCH -next v2 3/5] selftests/cpu-hotplug: Delete fault injection related code zhaogongyi
-- strict thread matches above, loose matches on Subject: below --
2022-09-05 12:45 [PATCH -next v2 0/5] Optimize and bugfix for cpu-on-off-test.sh Zhao Gongyi
2022-09-05 12:45 ` [PATCH -next v2 3/5] selftests/cpu-hotplug: Delete fault injection related code Zhao Gongyi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox