]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/selftests-user-return-kselftest-skip-code-for-skipped-tests.patch
Linux 4.9.124
[thirdparty/kernel/stable-queue.git] / queue-4.4 / selftests-user-return-kselftest-skip-code-for-skipped-tests.patch
1 From foo@baz Wed Aug 22 10:28:26 CEST 2018
2 From: "Shuah Khan (Samsung OSG)" <shuah@kernel.org>
3 Date: Wed, 13 Jun 2018 21:10:48 -0600
4 Subject: selftests: user: return Kselftest Skip code for skipped tests
5
6 From: "Shuah Khan (Samsung OSG)" <shuah@kernel.org>
7
8 [ Upstream commit d7d5311d4aa9611fe1a5a851e6f75733237a668a ]
9
10 When user test is skipped because of unmet dependencies and/or
11 unsupported configuration, it exits with error which is treated as
12 a fail by the Kselftest framework. This leads to false negative result
13 even when the test could not be run.
14
15 Change it to return kselftest skip code when a test gets skipped to
16 clearly report that the test could not be run. Add an explicit check
17 for module presence and return skip code if module isn't present.
18
19 Kselftest framework SKIP code is 4 and the framework prints appropriate
20 messages to indicate that the test is skipped.
21
22 Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
23 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 ---
26 tools/testing/selftests/user/test_user_copy.sh | 7 +++++++
27 1 file changed, 7 insertions(+)
28
29 --- a/tools/testing/selftests/user/test_user_copy.sh
30 +++ b/tools/testing/selftests/user/test_user_copy.sh
31 @@ -1,6 +1,13 @@
32 #!/bin/sh
33 # Runs copy_to/from_user infrastructure using test_user_copy kernel module
34
35 +# Kselftest framework requirement - SKIP code is 4.
36 +ksft_skip=4
37 +
38 +if ! /sbin/modprobe -q -n test_user_copy; then
39 + echo "user: module test_user_copy is not found [SKIP]"
40 + exit $ksft_skip
41 +fi
42 if /sbin/modprobe -q test_user_copy; then
43 /sbin/modprobe -q -r test_user_copy
44 echo "user_copy: ok"