I have developed a new test case, which does below steps
test case location:
https://linaro-private.git.linaro.org/gitweb?p=bL_tests/core-tests.git;a=blob;f=basic/switcher-tests/switcher_off_hotplug_cpu.sh
Test Description:
------------------------
# ==== switcher_off_hotplug_cpu.sh description ====
# when switcher is disabled in run time, we can get cpu2, cpu3 and cpu4 also online
# total we can see 5 cpus online. this test will hot-plug cpus 1,2,3 and 4.
# hot-plug cpus randomly one after other for 100 loops on each four different ways.
# ensure there would not be any kernel crash
# enable back the switcher after test
echo 0 > /sys/kernel/bL_switcher/active
i=0
while [ $i -lt 100 ];
do
echo 0 > /sys/devices/system/cpu/cpu1/online
echo 0 > /sys/devices/system/cpu/cpu2/online
echo 0 > /sys/devices/system/cpu/cpu3/online
echo 0 > /sys/devices/system/cpu/cpu4/online
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu3/online
echo 1 > /sys/devices/system/cpu/cpu4/online
i=$(($i + 1))
done
echo 1 > /sys/kernel/bL_switcher/active
echo 0 > /sys/kernel/bL_switcher/active
i=0
while [ $i -lt 100 ];
do
echo 0 > /sys/devices/system/cpu/cpu1/online
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 0 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 0 > /sys/devices/system/cpu/cpu3/online
echo 1 > /sys/devices/system/cpu/cpu3/online
echo 0 > /sys/devices/system/cpu/cpu4/online
echo 1 > /sys/devices/system/cpu/cpu4/online
i=$(($i + 1))
done
echo 1 > /sys/kernel/bL_switcher/active
echo 0 > /sys/kernel/bL_switcher/active
i=0
while [ $i -lt 100 ];
do
echo 0 > /sys/devices/system/cpu/cpu1/online
echo 0 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 0 > /sys/devices/system/cpu/cpu3/online
echo 0 > /sys/devices/system/cpu/cpu4/online
echo 1 > /sys/devices/system/cpu/cpu4/online
echo 1 > /sys/devices/system/cpu/cpu3/online
i=$(($i + 1))
done
echo 1 > /sys/kernel/bL_switcher/active
echo 0 > /sys/kernel/bL_switcher/active
i=0
while [ $i -lt 100 ];
do
echo 0 > /sys/devices/system/cpu/cpu3/online
echo 0 > /sys/devices/system/cpu/cpu4/online
echo 1 > /sys/devices/system/cpu/cpu4/online
echo 1 > /sys/devices/system/cpu/cpu3/online
echo 0 > /sys/devices/system/cpu/cpu1/online
echo 0 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu1/online
i=$(($i + 1))
done
echo 1 > /sys/kernel/bL_switcher/active
echo "SUCCESS!!"
exit 0
Test output:
-----------------
test log has been attached to this bug.
Test summary:
--------------------
system stopped responding while test execution is in progress.
Linux kernel:
-----------------
Linux version 3.7.0-00655-g8cc8c22 (jenkins-build@ip-10-40-5-37)
May I suggest a slightly shorter and more random script to do this kind of testing. This one hotplugs cores 2, 3, 4:
echo 0 > /sys/kernel/ bL_switcher/ active
i=1
while read -r foo; do
array[i]="$foo";
(( i++ ))
done < <(shuf -i 2-4 -n 3)
FIRST=${array[1]}
SECOND=${array[2]}
THIRD=${array[3]}
echo $FIRST
echo $SECOND
echo $THIRD
i=0 system/ cpu/$FIRST/ online system/ cpu/$SECOND/ online system/ cpu/$SECOND/ online system/ cpu/$THIRD/ online system/ cpu/$FIRST/ online system/ cpu/$THIRD/ online bL_switcher/ active
while [ $i -lt 100 ];
do
echo 0 > /sys/devices/
echo 0 > /sys/devices/
echo 1 > /sys/devices/
echo 0 > /sys/devices/
echo 1 > /sys/devices/
echo 1 > /sys/devices/
i=$(($i + 1))
done
echo 1 > /sys/kernel/