linux/tools/testing/selftests/lib/printf.sh
Shuah Khan (Samsung OSG) b26862450d 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: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2018-05-30 15:29:06 -06:00

20 lines
423 B
Bash
Executable file

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# 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
echo "printf: module test_printf is not found [SKIP]"
exit $ksft_skip
fi
if /sbin/modprobe -q test_printf; then
/sbin/modprobe -q -r test_printf
echo "printf: ok"
else
echo "printf: [FAIL]"
exit 1
fi