Skip to content

Commit c65e415

Browse files
committed
selftests: firmware: Fix it to do root uid check and skip
firmware attempts to load test modules that require root access and fail. Fix it to check for root uid and exit with skip code instead. Before this fix: selftests: firmware: fw_run_tests.sh modprobe: ERROR: could not insert 'test_firmware': Operation not permitted You must have the following enabled in your kernel: CONFIG_TEST_FIRMWARE=y CONFIG_FW_LOADER=y CONFIG_FW_LOADER_USER_HELPER=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y not ok 1 selftests: firmware: fw_run_tests.sh # SKIP With this fix: selftests: firmware: fw_run_tests.sh skip all tests: must be run as root not ok 1 selftests: firmware: fw_run_tests.sh # SKIP Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Reviwed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 7648dd9 commit c65e415

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/testing/selftests/firmware/fw_lib.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ test_modprobe()
3434

3535
check_mods()
3636
{
37+
local uid=$(id -u)
38+
if [ $uid -ne 0 ]; then
39+
echo "skip all tests: must be run as root" >&2
40+
exit $ksft_skip
41+
fi
42+
3743
trap "test_modprobe" EXIT
3844
if [ ! -d $DIR ]; then
3945
modprobe test_firmware

0 commit comments

Comments
 (0)