Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2686245 authored by Shuah Khan (Samsung OSG)'s avatar Shuah Khan (Samsung OSG)
Browse files

selftests: lib: return Kselftest Skip code for skipped tests



When lib test(s) 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: default avatarShuah Khan (Samsung OSG) <shuah@kernel.org>
parent 9b8f8e7f
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
#!/bin/sh
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# SPDX-License-Identifier: GPL-2.0

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

# Runs bitmap infrastructure tests using test_bitmap kernel module
# Runs bitmap infrastructure tests using test_bitmap kernel module
if ! /sbin/modprobe -q -n test_bitmap; then
if ! /sbin/modprobe -q -n test_bitmap; then
	echo "bitmap: [SKIP]"
	echo "bitmap: module test_bitmap is not found [SKIP]"
	exit 77
	exit $ksft_skip
fi
fi


if /sbin/modprobe -q test_bitmap; then
if /sbin/modprobe -q test_bitmap; then
+5 −2
Original line number Original line Diff line number Diff line
@@ -2,9 +2,12 @@
# SPDX-License-Identifier: GPL-2.0
# SPDX-License-Identifier: GPL-2.0
# Checks fast/slow prime_number generation for inconsistencies
# Checks fast/slow prime_number generation for inconsistencies


# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

if ! /sbin/modprobe -q -r prime_numbers; then
if ! /sbin/modprobe -q -r prime_numbers; then
	echo "prime_numbers: [SKIP]"
	echo "prime_numbers: module prime_numbers is not found [SKIP]"
	exit 77
	exit $ksft_skip
fi
fi


if /sbin/modprobe -q prime_numbers selftest=65536; then
if /sbin/modprobe -q prime_numbers selftest=65536; then
+6 −2
Original line number Original line Diff line number Diff line
#!/bin/sh
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# SPDX-License-Identifier: GPL-2.0
# Runs printf infrastructure using test_printf kernel module
# Runs printf infrastructure using test_printf kernel module

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

if ! /sbin/modprobe -q -n test_printf; then
if ! /sbin/modprobe -q -n test_printf; then
	echo "printf: [SKIP]"
	echo "printf: module test_printf is not found [SKIP]"
	exit 77
	exit $ksft_skip
fi
fi


if /sbin/modprobe -q test_printf; then
if /sbin/modprobe -q test_printf; then