public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3] commands/keyctl01: Check keyctl support instead of kernel version
Date: Fri, 4 Aug 2017 14:08:08 +0200	[thread overview]
Message-ID: <20170804120808.GA5400@rei> (raw)
In-Reply-To: <20170720053812.4394-1-fenggw-fnst@cn.fujitsu.com>

Hi!
Looking at this closer we only check that the keyctl binary understands
these requests, shouldn't we as well try to request2 and unlink a key to
seek if kernel is up to the task?

And btw, it would be a bit cleaner to use a for loop to check for each
flag separately and tell user what flag is not supported:

diff --git a/testcases/commands/keyctl/keyctl01.sh b/testcases/commands/keyctl/keyctl01.sh
old mode 100644
new mode 100755
index 76226ae4d..f831acbfc
--- a/testcases/commands/keyctl/keyctl01.sh
+++ b/testcases/commands/keyctl/keyctl01.sh
@@ -34,11 +34,18 @@ TST_NEEDS_TMPDIR=1
 TST_NEEDS_CMDS="keyctl"
 . tst_test.sh
 
+check_keyctl()
+{
+       for op in $@; do
+               if ! keyctl 2>&1 | grep -q "keyctl $op"; then
+                       tst_brk TCONF "keyctl operation $op not supported"
+               fi
+       done
+}
+
 setup()
 {
-       if tst_kvcmp -le 2.6.33; then
-               tst_brk TCONF "Kernel newer than 2.6.33 is needed"
-       fi
+       check_keyctl negate request2 show unlink
 
        PATH_KEYSTAT="/proc/key-users"
        PATH_KEYQUOTA="/proc/sys/kernel/keys/root_maxbytes"


-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2017-08-04 12:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-11  6:20 [LTP] [PATCH 1/3] commands/keyctl01: Fix potential infinite loop Guangwen Feng
2017-05-11  6:20 ` [LTP] [PATCH 2/3] commands/keyctl01: Fix getting key serial number Guangwen Feng
2017-07-07 13:08   ` Cyril Hrubis
2017-07-11 12:27     ` Guangwen Feng
2017-07-13 10:55       ` Guangwen Feng
2017-07-13 12:15         ` Guangwen Feng
2017-07-17 11:42           ` Cyril Hrubis
2017-07-18  6:31             ` [LTP] [PATCH v2 1/3] commands/keyctl01: Fix potential infinite loop Guangwen Feng
2017-07-18  6:31               ` [LTP] [PATCH v2 2/3] commands/keyctl01: Fix getting key serial number Guangwen Feng
2017-07-18  6:31               ` [LTP] [PATCH v2 3/3] commands/keyctl01: Check keyctl support instead of kernel version Guangwen Feng
2017-07-18 13:27                 ` Cyril Hrubis
2017-07-19  3:42                   ` Guangwen Feng
2017-07-20  5:38                     ` [LTP] [PATCH v3] " Guangwen Feng
2017-08-04 12:08                       ` Cyril Hrubis [this message]
2017-08-14 11:25                         ` [LTP] [PATCH v4] " Guangwen Feng
2017-08-23 16:23                           ` Cyril Hrubis
2017-05-11  6:20 ` [LTP] [PATCH 3/3] commands/keyctl01: Enable this test for RHEL6 Guangwen Feng
2017-07-07 13:13   ` Cyril Hrubis
2017-07-11 11:47     ` Guangwen Feng
2017-07-04  2:33 ` [LTP] [PATCH 1/3] commands/keyctl01: Fix potential infinite loop Guangwen Feng
2017-07-07 12:55 ` Cyril Hrubis
2017-07-11 11:48   ` Guangwen Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170804120808.GA5400@rei \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox