public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: simplemessager@163.com
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/1] Skip wqueue testcases when KEY_NOTIFICATIONS not enabled.
Date: Fri,  5 Dec 2025 11:00:21 +0800	[thread overview]
Message-ID: <20251205030021.48813-1-simplemessager@163.com> (raw)

From: Mingyu Li <limy83@chinatelecom.cn>

Skip wqueue testcases when KEY_NOTIFICATIONS not enabled.

wqueue testcases relys on both CONFIG_WATCH_QUEUE
and CONFIG_KEY_NOTIFICATIONS. keyctl will return EOPNOTSUPP
when CONFIG_KEY_NOTIFICATIONS is not enabled and the wqueue
testcases will failed when timeout. So we should skip
testcases when we got EOPNOTSUPP from keyctl.

Reported-by: Meng Yang <yangm50@chinatelecom.cn>
Signed-off-by: Mingyu Li <limy83@chinatelecom.cn>
---
 testcases/kernel/watchqueue/common.h | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/watchqueue/common.h b/testcases/kernel/watchqueue/common.h
index 92e8f079c..e9100ab52 100644
--- a/testcases/kernel/watchqueue/common.h
+++ b/testcases/kernel/watchqueue/common.h
@@ -85,8 +85,26 @@ static inline key_serial_t wqueue_add_key(int fd)
 	if (key == -1)
 		tst_brk(TBROK, "add_key error: %s", tst_strerrno(errno));
 
-	keyctl(KEYCTL_WATCH_KEY, key, fd, 0x01);
-	keyctl(KEYCTL_WATCH_KEY, KEY_SPEC_SESSION_KEYRING, fd, 0x02);
+	TEST(keyctl(KEYCTL_WATCH_KEY, key, fd, 0x01));
+	if (TST_RET) {
+		switch (TST_ERR) {
+		case EOPNOTSUPP:
+			tst_brk(TCONF | TTERRNO, "CONFIG_KEY_NOTIFICATION is not set!");
+			break;
+		default:
+			tst_res(TINFO, "CONFIG_KEY_NOTIFICATION is set.");
+		}
+	}
+	TEST(keyctl(KEYCTL_WATCH_KEY, KEY_SPEC_SESSION_KEYRING, fd, 0x02));
+	if (TST_RET) {
+		switch (TST_ERR) {
+		case EOPNOTSUPP:
+			tst_brk(TCONF | TTERRNO, "CONFIG_KEY_NOTIFICATION is not set!");
+			break;
+		default:
+			tst_res(TINFO, "CONFIG_KEY_NOTIFICATION is set.");
+		}
+	}
 
 	return key;
 }
-- 
2.47.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2025-12-09 16:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-05  3:00 simplemessager [this message]
2025-12-11 10:31 ` [LTP] [PATCH 1/1] Skip wqueue testcases when KEY_NOTIFICATIONS not enabled Andrea Cervesato via ltp
  -- strict thread matches above, loose matches on Subject: below --
2025-12-05  3:17 simplemessager
2025-12-08 15:15 ` Petr Vorel

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=20251205030021.48813-1-simplemessager@163.com \
    --to=simplemessager@163.com \
    --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