diff options
author | Mimi Zohar <zohar@linux.ibm.com> | 2019-03-06 19:19:45 +0300 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2019-04-18 00:32:19 +0300 |
commit | c660a81796d456f0769937dd3ecf4cfd30f0ece6 (patch) | |
tree | 44230e58ce824cfac67db34fa2adcac6e077d779 /tools/testing/selftests/kexec | |
parent | 6038c81526d748b2bba691688095ced72a620539 (diff) | |
download | linux-c660a81796d456f0769937dd3ecf4cfd30f0ece6.tar.xz |
selftests/kexec: define "require_root_privileges"
Many tests require root privileges. Define a common function.
Suggested-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/kexec')
-rwxr-xr-x | tools/testing/selftests/kexec/kexec_common_lib.sh | 7 | ||||
-rwxr-xr-x | tools/testing/selftests/kexec/test_kexec_load.sh | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/tools/testing/selftests/kexec/kexec_common_lib.sh b/tools/testing/selftests/kexec/kexec_common_lib.sh index 347a0d171450..a65337e8f290 100755 --- a/tools/testing/selftests/kexec/kexec_common_lib.sh +++ b/tools/testing/selftests/kexec/kexec_common_lib.sh @@ -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 +} diff --git a/tools/testing/selftests/kexec/test_kexec_load.sh b/tools/testing/selftests/kexec/test_kexec_load.sh index cbf598a380d2..49545fcdc646 100755 --- a/tools/testing/selftests/kexec/test_kexec_load.sh +++ b/tools/testing/selftests/kexec/test_kexec_load.sh @@ -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=$? |