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

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

selftests: efivarfs: return Kselftest Skip code for skipped tests



When efivarfs test is skipped because of unmet dependencies and/or
unsupported configuration, it returns 0 which is treated as a pass
by the Kselftest framework. This leads to false positive 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 4c5b95c1
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -4,18 +4,21 @@
efivarfs_mount=/sys/firmware/efi/efivars
efivarfs_mount=/sys/firmware/efi/efivars
test_guid=210be57c-9849-4fc7-a635-e6382d1aec27
test_guid=210be57c-9849-4fc7-a635-e6382d1aec27


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

check_prereqs()
check_prereqs()
{
{
	local msg="skip all tests:"
	local msg="skip all tests:"


	if [ $UID != 0 ]; then
	if [ $UID != 0 ]; then
		echo $msg must be run as root >&2
		echo $msg must be run as root >&2
		exit 0
		exit $ksft_skip
	fi
	fi


	if ! grep -q "^\S\+ $efivarfs_mount efivarfs" /proc/mounts; then
	if ! grep -q "^\S\+ $efivarfs_mount efivarfs" /proc/mounts; then
		echo $msg efivarfs is not mounted on $efivarfs_mount >&2
		echo $msg efivarfs is not mounted on $efivarfs_mount >&2
		exit 0
		exit $ksft_skip
	fi
	fi
}
}