summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorRui Qi <qirui.001@bytedance.com>2026-08-13 21:28:07 +0800
committerTejun Heo <tj@kernel.org>2026-08-13 07:07:34 -1000
commitddabc5dbd262f3ca981e679ddae99ed7a9adb279 (patch)
treece72975f1c544c72b4f503854f8285b9aa86866f /tools/testing
parent44f57a2b1b9fabe3735a9b2669bb146ddb571fce (diff)
downloadlinux-ddabc5dbd262f3ca981e679ddae99ed7a9adb279.tar.gz
linux-ddabc5dbd262f3ca981e679ddae99ed7a9adb279.zip
selftests/cgroup: Preserve CPU hotplug write errors
The cpuset partition root state selftest checks several CPU hotplug transitions. If writing to a CPU online file fails, the helper still runs pause afterwards and returns the status of pause instead of the failed write. This hides the real hotplug failure and can make later checks run against expectations for a transition that never happened. Move the write before the bookkeeping and return when it fails, so callers can observe the hotplug error and the test does not record a CPU as offline unless the offline operation actually succeeded. Also change the O* command handler in set_ctrl_state() to use "eval $COMM $REDIRECT" like all other handlers. The previous version set COMM but still called write_cpu_online directly, bypassing the redirect that captures stderr for error reporting. Changes since v1: - Use eval $COMM $REDIRECT in the O* handler instead of calling write_cpu_online directly (Waiman Long) Fixes: a8c52eba880a ("kselftest/cgroup: Add cpuset v2 partition root state test") Signed-off-by: Rui Qi <qirui.001@bytedance.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/testing')
-rwxr-xr-xtools/testing/selftests/cgroup/test_cpuset_prs.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index 8380fd9d76bd..da8f7b920178 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -526,6 +526,7 @@ write_cpu_online()
CPU=${1%=*}
VAL=${1#*=}
CPUFILE=//sys/devices/system/cpu/cpu${CPU}/online
+ echo $VAL > $CPUFILE || return 1
if [[ $VAL -eq 0 ]]
then
OFFLINE_CPUS="$OFFLINE_CPUS $CPU"
@@ -535,7 +536,6 @@ write_cpu_online()
sort | uniq -u)
}
fi
- echo $VAL > $CPUFILE
pause 0.05
}
@@ -603,7 +603,8 @@ set_ctrl_state()
eval $COMM $REDIRECT
;;
O*) VAL=${CMD#?}
- write_cpu_online $VAL
+ COMM="write_cpu_online $VAL"
+ eval $COMM $REDIRECT
;;
T*) COMM="echo 0 > $TFILE"
eval $COMM $REDIRECT