Skip to content

Commit 8781578

Browse files
author
Shuah Khan (Samsung OSG)
committed
selftests: static_keys: return Kselftest Skip code for skipped tests
When static_keys test is skipped because of unmet dependencies and/or unsupported configuration, it exits with error which 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. Added an explicit searches for test_static_key_base and test_static_keys modules and return skip code if they aren't found to differentiate between the failure to load the module condition and module not found condition. 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>
1 parent 856e7c4 commit 8781578

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tools/testing/selftests/static_keys/test_static_keys.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
# SPDX-License-Identifier: GPL-2.0
33
# Runs static keys kernel module tests
44

5+
# Kselftest framework requirement - SKIP code is 4.
6+
ksft_skip=4
7+
8+
if ! /sbin/modprobe -q -n test_static_key_base; then
9+
echo "static_key: module test_static_key_base is not found [SKIP]"
10+
exit $ksft_skip
11+
fi
12+
13+
if ! /sbin/modprobe -q -n test_static_keys; then
14+
echo "static_key: module test_static_keys is not found [SKIP]"
15+
exit $ksft_skip
16+
fi
17+
518
if /sbin/modprobe -q test_static_key_base; then
619
if /sbin/modprobe -q test_static_keys; then
720
echo "static_key: ok"

0 commit comments

Comments
 (0)