Skip to contentSkip to conversation

Skip wqueue testcases when KEY_NOTIFICATIONS not enabled.

PATCH In review [email protected] 2 participants 2 messages Dec 9, 2025 – Dec 11, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Skip wqueue testcases when KEY_NOTIFICATIONS not enabled.

From: Mingyu Li <[email protected]>

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.

---
 testcases/kernel/watchqueue/common.h | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
testcases/kernel/watchqueue/common.h +20 -2
index 92e8f079c..e9100ab52 100644
@@ -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;
 }
Signature · 5 lines
2.47.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi!

If you really want to skip a test when kernel configurations have not been defined, there's .needs_kconfigs flag inside tst_test definition. Please refer to the documentation before sending v2:

https://linux-test-project.readthedocs.io/en/latest/developers/writing_tests.html#ltp-c-and-shell-test-api-comparison

There tests using this feature are one grep away from it :-)

Signature · 7 lines
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]


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