diff options
| author | Li Zhijian <lizhijian@cn.fujitsu.com> | 2017-08-13 21:28:15 -0400 |
|---|---|---|
| committer | Shuah Khan <shuahkh@osg.samsung.com> | 2017-08-16 19:48:18 -0400 |
| commit | 8fe6e53a8ed5f043ff4e6a366ebb3a641114546b (patch) | |
| tree | 3d0f15a0234f2d757da3f2849c754c05ab83412e /tools/testing/selftests/cpu-hotplug | |
| parent | b274e75c20f91c2d8fec43f8246282c2817f8e7c (diff) | |
selftests/cpu-hotplug: exit with failure when test occured unexpected behaviors
Previously, 'make run_tests -C cpu-hotplug' always PASS since cpu-on-off-test.sh
always exits 0 even though the test got some unexpected errors like below:
root@debian9:/home/lizhijian/chroot/linux/tools/testing/selftests/cpu-hotplug# make run_tests
pid 878's current affinity mask: 1
pid 878's new affinity mask: 1
CPU online/offline summary:
Cpus in online state: 0
Cpus in offline state: 0
Limited scope test: one hotplug cpu
(leaves cpu in the original state):
online to offline to online: cpu 0
./cpu-on-off-test.sh: line 83: /sys/devices/system/cpu/cpu0/online: Permission denied
offline_cpu_expect_success 0: unexpected fail
./cpu-on-off-test.sh: line 78: /sys/devices/system/cpu/cpu0/online: Permission denied
online_cpu_expect_success 0: unexpected fail
selftests: cpu-on-off-test.sh [PASS]
after this patch, the test will exit with failure once it occurs some unexpected behaviors
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Diffstat (limited to 'tools/testing/selftests/cpu-hotplug')
| -rwxr-xr-x | tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh | 8 |
1 files changed, 8 insertions, 0 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 98b1d6565f2c..e5666dd366ed 100755 --- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh +++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh | |||
| @@ -89,8 +89,10 @@ online_cpu_expect_success() | |||
| 89 | 89 | ||
| 90 | if ! online_cpu $cpu; then | 90 | if ! online_cpu $cpu; then |
| 91 | echo $FUNCNAME $cpu: unexpected fail >&2 | 91 | echo $FUNCNAME $cpu: unexpected fail >&2 |
| 92 | exit 1 | ||
| 92 | elif ! cpu_is_online $cpu; then | 93 | elif ! cpu_is_online $cpu; then |
| 93 | echo $FUNCNAME $cpu: unexpected offline >&2 | 94 | echo $FUNCNAME $cpu: unexpected offline >&2 |
| 95 | exit 1 | ||
| 94 | fi | 96 | fi |
| 95 | } | 97 | } |
| 96 | 98 | ||
| @@ -100,8 +102,10 @@ online_cpu_expect_fail() | |||
| 100 | 102 | ||
| 101 | if online_cpu $cpu 2> /dev/null; then | 103 | if online_cpu $cpu 2> /dev/null; then |
| 102 | echo $FUNCNAME $cpu: unexpected success >&2 | 104 | echo $FUNCNAME $cpu: unexpected success >&2 |
| 105 | exit 1 | ||
| 103 | elif ! cpu_is_offline $cpu; then | 106 | elif ! cpu_is_offline $cpu; then |
| 104 | echo $FUNCNAME $cpu: unexpected online >&2 | 107 | echo $FUNCNAME $cpu: unexpected online >&2 |
| 108 | exit 1 | ||
| 105 | fi | 109 | fi |
| 106 | } | 110 | } |
| 107 | 111 | ||
| @@ -111,8 +115,10 @@ offline_cpu_expect_success() | |||
| 111 | 115 | ||
| 112 | if ! offline_cpu $cpu; then | 116 | if ! offline_cpu $cpu; then |
| 113 | echo $FUNCNAME $cpu: unexpected fail >&2 | 117 | echo $FUNCNAME $cpu: unexpected fail >&2 |
| 118 | exit 1 | ||
| 114 | elif ! cpu_is_offline $cpu; then | 119 | elif ! cpu_is_offline $cpu; then |
| 115 | echo $FUNCNAME $cpu: unexpected offline >&2 | 120 | echo $FUNCNAME $cpu: unexpected offline >&2 |
| 121 | exit 1 | ||
| 116 | fi | 122 | fi |
| 117 | } | 123 | } |
| 118 | 124 | ||
| @@ -122,8 +128,10 @@ offline_cpu_expect_fail() | |||
| 122 | 128 | ||
| 123 | if offline_cpu $cpu 2> /dev/null; then | 129 | if offline_cpu $cpu 2> /dev/null; then |
| 124 | echo $FUNCNAME $cpu: unexpected success >&2 | 130 | echo $FUNCNAME $cpu: unexpected success >&2 |
| 131 | exit 1 | ||
| 125 | elif ! cpu_is_online $cpu; then | 132 | elif ! cpu_is_online $cpu; then |
| 126 | echo $FUNCNAME $cpu: unexpected offline >&2 | 133 | echo $FUNCNAME $cpu: unexpected offline >&2 |
| 134 | exit 1 | ||
| 127 | fi | 135 | fi |
| 128 | } | 136 | } |
| 129 | 137 | ||
