aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kexec/kexec_common_lib.sh
diff options
context:
space:
mode:
authorMimi Zohar <zohar@linux.ibm.com>2019-02-13 11:46:55 -0500
committerShuah Khan <skhan@linuxfoundation.org>2019-04-17 15:32:14 -0600
commit6038c81526d748b2bba691688095ced72a620539 (patch)
tree3868980bd7886babef513178019460bf43cd7d5b /tools/testing/selftests/kexec/kexec_common_lib.sh
parentselftests/kexec: define a set of common functions (diff)
downloadlinux-dev-6038c81526d748b2bba691688095ced72a620539.tar.xz
linux-dev-6038c81526d748b2bba691688095ced72a620539.zip
selftests/kexec: define common logging functions
Define log_info, log_pass, log_fail, and log_skip functions. 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/kexec_common_lib.sh')
-rwxr-xr-xtools/testing/selftests/kexec/kexec_common_lib.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/testing/selftests/kexec/kexec_common_lib.sh b/tools/testing/selftests/kexec/kexec_common_lib.sh
index 05376be6a6f7..347a0d171450 100755
--- a/tools/testing/selftests/kexec/kexec_common_lib.sh
+++ b/tools/testing/selftests/kexec/kexec_common_lib.sh
@@ -1,5 +1,35 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
+#
+# Kselftest framework defines: ksft_pass=0, ksft_fail=1, ksft_skip=4
+
+VERBOSE="${VERBOSE:-1}"
+
+log_info()
+{
+ [ $VERBOSE -ne 0 ] && echo "[INFO] $1"
+}
+
+# The ksefltest framework requirement returns 0 for PASS.
+log_pass()
+{
+ [ $VERBOSE -ne 0 ] && echo "$1 [PASS]"
+ exit 0
+}
+
+# The ksefltest framework requirement returns 1 for FAIL.
+log_fail()
+{
+ [ $VERBOSE -ne 0 ] && echo "$1 [FAIL]"
+ exit 1
+}
+
+# The ksefltest framework requirement returns 4 for SKIP.
+log_skip()
+{
+ [ $VERBOSE -ne 0 ] && echo "$1"
+ exit 4
+}
# Check efivar SecureBoot-$(the UUID) and SetupMode-$(the UUID).
# The secure boot mode can be accessed either as the last integer