diff mbox series

[ndctl] test/security.sh: test keyctl before excuting

Message ID 20231117083947.2211323-1-lizhijian@fujitsu.com
State Accepted
Commit 7bd8c33d989a7dea3e92e2b6587890cce70f89f3
Headers show
Series [ndctl] test/security.sh: test keyctl before excuting | expand

Commit Message

Zhijian Li (Fujitsu) Nov. 17, 2023, 8:39 a.m. UTC
test keyctl command before executing

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
---
 test/security.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Dave Jiang Nov. 17, 2023, 3:51 p.m. UTC | #1
On 11/17/23 01:39, Li Zhijian wrote:
> test keyctl command before executing
> 
> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  test/security.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/test/security.sh b/test/security.sh
> index 4713288..f954aec 100755
> --- a/test/security.sh
> +++ b/test/security.sh
> @@ -219,6 +219,8 @@ else
>  	do_skip "Missing input parameters"
>  fi
>  
> +check_prereq "keyctl"
> +
>  uid="$(keyctl show | grep -Eo "_uid.[0-9]+" | head -1 | cut -d. -f2-)"
>  if [ "$uid" -ne 0 ]; then
>  	do_skip "run as root or with a sudo login shell for test to work"
> @@ -227,7 +229,6 @@ fi
>  modprobe "$KMOD_TEST"
>  $CXL list
>  setup
> -check_prereq "keyctl"
>  rc=1
>  detect
>  test_cleanup
Dan Williams Dec. 7, 2023, 10:20 p.m. UTC | #2
Li Zhijian wrote:
> test keyctl command before executing

The "why" is missing here. Yes, someone can read the patch and go read
the code to see that this is probably a good idea. But what is the
effect of not doing this? Doesn't the existing "trap" result in the same
skipping of the test?
diff mbox series

Patch

diff --git a/test/security.sh b/test/security.sh
index 4713288..f954aec 100755
--- a/test/security.sh
+++ b/test/security.sh
@@ -219,6 +219,8 @@  else
 	do_skip "Missing input parameters"
 fi
 
+check_prereq "keyctl"
+
 uid="$(keyctl show | grep -Eo "_uid.[0-9]+" | head -1 | cut -d. -f2-)"
 if [ "$uid" -ne 0 ]; then
 	do_skip "run as root or with a sudo login shell for test to work"
@@ -227,7 +229,6 @@  fi
 modprobe "$KMOD_TEST"
 $CXL list
 setup
-check_prereq "keyctl"
 rc=1
 detect
 test_cleanup