]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.152/selftests-static_keys-return-kselftest-skip-code-for-skipped-tests.patch
Linux 4.4.152
[thirdparty/kernel/stable-queue.git] / releases / 4.4.152 / selftests-static_keys-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: Tue, 12 Jun 2018 17:40:31 -0600
4 Subject: selftests: static_keys: return Kselftest Skip code for skipped tests
5
6 From: "Shuah Khan (Samsung OSG)" <shuah@kernel.org>
7
8 [ Upstream commit 8781578087b8fb8829558bac96c3c24e5ba26f82 ]
9
10 When static_keys test is skipped because of unmet dependencies and/or
11 unsupported configuration, it exits with error which is treated as a fail
12 by the Kselftest framework. This leads to false negative result even when
13 the test could not be run.
14
15 Change it to return kselftest skip code when a test gets skipped to clearly
16 report that the test could not be run.
17
18 Added an explicit searches for test_static_key_base and test_static_keys
19 modules and return skip code if they aren't found to differentiate between
20 the failure to load the module condition and module not found condition.
21
22 Kselftest framework SKIP code is 4 and the framework prints appropriate
23 messages to indicate that the test is skipped.
24
25 Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
26 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
27 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28 ---
29 tools/testing/selftests/static_keys/test_static_keys.sh | 13 +++++++++++++
30 1 file changed, 13 insertions(+)
31
32 --- a/tools/testing/selftests/static_keys/test_static_keys.sh
33 +++ b/tools/testing/selftests/static_keys/test_static_keys.sh
34 @@ -1,6 +1,19 @@
35 #!/bin/sh
36 # Runs static keys kernel module tests
37
38 +# Kselftest framework requirement - SKIP code is 4.
39 +ksft_skip=4
40 +
41 +if ! /sbin/modprobe -q -n test_static_key_base; then
42 + echo "static_key: module test_static_key_base is not found [SKIP]"
43 + exit $ksft_skip
44 +fi
45 +
46 +if ! /sbin/modprobe -q -n test_static_keys; then
47 + echo "static_key: module test_static_keys is not found [SKIP]"
48 + exit $ksft_skip
49 +fi
50 +
51 if /sbin/modprobe -q test_static_key_base; then
52 if /sbin/modprobe -q test_static_keys; then
53 echo "static_key: ok"