selftests/cpu-hotplug: Skip test when there is only one online cpu
authorLi Zhijian <lizhijian@cn.fujitsu.com>
Mon, 14 Aug 2017 01:28:16 +0000 (09:28 +0800)
committerShuah Khan <shuahkh@osg.samsung.com>
Wed, 16 Aug 2017 23:48:18 +0000 (17:48 -0600)
For only one online cpu case, 'make run_tests' try to offline the cpu0 that will
always fail since the host can't offline this unique online cpu.

this patch will skip the test to avoid this failure.

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh

index e5666dd..b18b253 100755 (executable)
@@ -28,6 +28,12 @@ prerequisite()
        echo "CPU online/offline summary:"
        online_cpus=`cat $SYSFS/devices/system/cpu/online`
        online_max=${online_cpus##*-}
+
+       if [[ "$online_cpus" = "$online_max" ]]; then
+               echo "$msg: since there is only one cpu: $online_cpus"
+               exit 0
+       fi
+
        echo -e "\t Cpus in online state: $online_cpus"
 
        offline_cpus=`cat $SYSFS/devices/system/cpu/offline`