Re: [PATCH v2 3/5] selftests/ima: define common logging functions
From: Petr Vorel
Date: Thu Feb 28 2019 - 16:02:00 EST
Hi Mimi,
> Define log_info, log_pass, log_fail, and log_skip functions.
> Suggested-by: Petr Vorel <pvorel@xxxxxxx>
> Signed-off-by: Mimi Zohar <zohar@xxxxxxxxxxxxx>
Reviewed-by: Petr Vorel <pvorel@xxxxxxx>
> ---
> tools/testing/selftests/ima/common_lib.sh | 43 +++++++++++++++++++++++---
> tools/testing/selftests/ima/test_kexec_load.sh | 19 +++---------
> 2 files changed, 43 insertions(+), 19 deletions(-)
...
> diff --git a/tools/testing/selftests/ima/common_lib.sh b/tools/testing/selftests/ima/common_lib.sh
> index 5583ea74c14e..c6d04006281d 100755
> --- a/tools/testing/selftests/ima/common_lib.sh
...
> # Get secureboot mode
> local file="$efivarfs/../vars/SecureBoot-*/data"
> if [ ! -e $file ]; then
> - echo "$TEST: unknown secureboot mode" >&2
> - exit $ksft_skip
> + log_skip "unknown secureboot mode"
> fi
> - return `od -An -t u1 /sys/firmware/efi/vars/SecureBoot-*/data`
> + ret=`od -An -t u1 /sys/firmware/efi/vars/SecureBoot-*/data`
Missing local. Usually it's good to put all locals at the top.
> + [ $ret -eq 1 ] && log_info "secure boot mode enabled"
> +
> + return $ret
> }
...
Kind regards,
Petr