Commit c660a817 authored by Mimi Zohar's avatar Mimi Zohar Committed by Shuah Khan

selftests/kexec: define "require_root_privileges"

Many tests require root privileges.  Define a common function.
Suggested-by: default avatarPetr Vorel <pvorel@suse.cz>
Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
Reviewed-by: default avatarPetr Vorel <pvorel@suse.cz>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 6038c815
......@@ -66,3 +66,10 @@ get_secureboot_mode()
log_info "secure boot mode not enabled"
return 0;
}
require_root_privileges()
{
if [ $(id -ru) -ne 0 ]; then
log_skip "requires root privileges"
fi
}
......@@ -8,9 +8,7 @@ TEST="$0"
. ./kexec_common_lib.sh
# kexec requires root privileges
if [ $(id -ru) -ne 0 ]; then
log_skip "requires root privileges"
fi
require_root_privileges
get_secureboot_mode
secureboot=$?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment