Message ID | 20231117083947.2211323-1-lizhijian@fujitsu.com |
---|---|
State | Accepted |
Commit | 7bd8c33d989a7dea3e92e2b6587890cce70f89f3 |
Headers | show |
Series | [ndctl] test/security.sh: test keyctl before excuting | expand |
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
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 --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
test keyctl command before executing Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> --- test/security.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)