aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kexec/test_kexec_load.sh
diff options
context:
space:
mode:
authorMimi Zohar <zohar@linux.ibm.com>2019-01-24 08:57:20 -0500
committerShuah Khan <skhan@linuxfoundation.org>2019-04-17 15:32:02 -0600
commit5025b0f0fa25a0b71ae7ada96b18b6b63c24302f (patch)
treedbce97c120395501cab762e242bbab18f818caa2 /tools/testing/selftests/kexec/test_kexec_load.sh
parentselftests/kexec: cleanup the kexec selftest (diff)
downloadlinux-dev-5025b0f0fa25a0b71ae7ada96b18b6b63c24302f.tar.xz
linux-dev-5025b0f0fa25a0b71ae7ada96b18b6b63c24302f.zip
selftests/kexec: define a set of common functions
Define, update and move get_secureboot_mode() to a common file for use by other tests. Updated to check both the efivar SecureBoot-$(UUID) and SetupMode-$(UUID), based on Dave Young's review. 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 '')
-rwxr-xr-xtools/testing/selftests/kexec/test_kexec_load.sh17
1 files changed, 3 insertions, 14 deletions
diff --git a/tools/testing/selftests/kexec/test_kexec_load.sh b/tools/testing/selftests/kexec/test_kexec_load.sh
index 82a01a4d5c8d..86625c3f1e5d 100755
--- a/tools/testing/selftests/kexec/test_kexec_load.sh
+++ b/tools/testing/selftests/kexec/test_kexec_load.sh
@@ -5,7 +5,7 @@
# is booted in secureboot mode.
TEST="$0"
-EFIVARFS="/sys/firmware/efi/efivars"
+. ./kexec_common_lib.sh
rc=0
# Kselftest framework requirement - SKIP code is 4.
@@ -17,19 +17,8 @@ if [ $(id -ru) -ne 0 ]; then
exit $ksft_skip
fi
-# Make sure that efivars is mounted in the normal location
-if ! grep -q "^\S\+ $EFIVARFS efivarfs" /proc/mounts; then
- echo "$TEST: efivars is not mounted on $EFIVARFS" >&2
- exit $ksft_skip
-fi
-
-# Get secureboot mode
-file="$EFIVARFS/SecureBoot-*"
-if [ ! -e $file ]; then
- echo "$TEST: unknown secureboot mode" >&2
- exit $ksft_skip
-fi
-secureboot=`hexdump $file | awk '{print substr($4,length($4),1)}'`
+get_secureboot_mode
+secureboot=$?
# kexec_load should fail in secure boot mode
KERNEL_IMAGE="/boot/vmlinuz-`uname -r`"