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() ...@@ -66,3 +66,10 @@ get_secureboot_mode()
log_info "secure boot mode not enabled" log_info "secure boot mode not enabled"
return 0; return 0;
} }
require_root_privileges()
{
if [ $(id -ru) -ne 0 ]; then
log_skip "requires root privileges"
fi
}
...@@ -8,9 +8,7 @@ TEST="$0" ...@@ -8,9 +8,7 @@ TEST="$0"
. ./kexec_common_lib.sh . ./kexec_common_lib.sh
# kexec requires root privileges # kexec requires root privileges
if [ $(id -ru) -ne 0 ]; then require_root_privileges
log_skip "requires root privileges"
fi
get_secureboot_mode get_secureboot_mode
secureboot=$? 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