diff options
author | Shuah Khan (Samsung OSG) <shuah@kernel.org> | 2018-05-04 15:49:47 -0400 |
---|---|---|
committer | Shuah Khan (Samsung OSG) <shuah@kernel.org> | 2018-05-30 17:29:06 -0400 |
commit | e1890c502ca7f0bb13a7372dc8945f5e06832346 (patch) | |
tree | 3b264ea2c93f99a0241b7a83d7260523c889e1bc | |
parent | b27f0259e8cea74c627327c063742a83613dd460 (diff) |
selftests: memory-hotplug: return Kselftest Skip code for skipped tests
When memory-hotplug test is skipped because of unmet dependencies and/or
unsupported configuration, it returns non-zero value hich is treated as a
fail by the Kselftest framework. This leads to false negative result even
when the test could not be run.
Change it to return kselftest skip code when a test gets skipped to
clearly report that the test could not be run.
Kselftest framework SKIP code is 4 and the framework prints appropriate
messages to indicate that the test is skipped.
Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
-rwxr-xr-x | tools/testing/selftests/memory-hotplug/mem-on-off-test.sh | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh index ff4991704d07..b37585e6aa38 100755 --- a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh +++ b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh | |||
@@ -3,30 +3,33 @@ | |||
3 | 3 | ||
4 | SYSFS= | 4 | SYSFS= |
5 | 5 | ||
6 | # Kselftest framework requirement - SKIP code is 4. | ||
7 | ksft_skip=4 | ||
8 | |||
6 | prerequisite() | 9 | prerequisite() |
7 | { | 10 | { |
8 | msg="skip all tests:" | 11 | msg="skip all tests:" |
9 | 12 | ||
10 | if [ $UID != 0 ]; then | 13 | if [ $UID != 0 ]; then |
11 | echo $msg must be run as root >&2 | 14 | echo $msg must be run as root >&2 |
12 | exit 0 | 15 | exit $ksft_skip |
13 | fi | 16 | fi |
14 | 17 | ||
15 | SYSFS=`mount -t sysfs | head -1 | awk '{ print $3 }'` | 18 | SYSFS=`mount -t sysfs | head -1 | awk '{ print $3 }'` |
16 | 19 | ||
17 | if [ ! -d "$SYSFS" ]; then | 20 | if [ ! -d "$SYSFS" ]; then |
18 | echo $msg sysfs is not mounted >&2 | 21 | echo $msg sysfs is not mounted >&2 |
19 | exit 0 | 22 | exit $ksft_skip |
20 | fi | 23 | fi |
21 | 24 | ||
22 | if ! ls $SYSFS/devices/system/memory/memory* > /dev/null 2>&1; then | 25 | if ! ls $SYSFS/devices/system/memory/memory* > /dev/null 2>&1; then |
23 | echo $msg memory hotplug is not supported >&2 | 26 | echo $msg memory hotplug is not supported >&2 |
24 | exit 0 | 27 | exit $ksft_skip |
25 | fi | 28 | fi |
26 | 29 | ||
27 | if ! grep -q 1 $SYSFS/devices/system/memory/memory*/removable; then | 30 | if ! grep -q 1 $SYSFS/devices/system/memory/memory*/removable; then |
28 | echo $msg no hot-pluggable memory >&2 | 31 | echo $msg no hot-pluggable memory >&2 |
29 | exit 0 | 32 | exit $ksft_skip |
30 | fi | 33 | fi |
31 | } | 34 | } |
32 | 35 | ||