* [LTP] [PATCH 1/1] Skip wqueue testcases when KEY_NOTIFICATIONS not enabled.
@ 2025-12-05 3:00 simplemessager
2025-12-11 10:31 ` Andrea Cervesato via ltp
0 siblings, 1 reply; 4+ messages in thread
From: simplemessager @ 2025-12-05 3:00 UTC (permalink / raw)
To: ltp
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [LTP] [PATCH 1/1] Skip wqueue testcases when KEY_NOTIFICATIONS not enabled.
@ 2025-12-05 3:17 simplemessager
2025-12-08 15:15 ` Petr Vorel
0 siblings, 1 reply; 4+ messages in thread
From: simplemessager @ 2025-12-05 3:17 UTC (permalink / raw)
To: ltp
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH 1/1] Skip wqueue testcases when KEY_NOTIFICATIONS not enabled.
2025-12-05 3:17 [LTP] [PATCH 1/1] Skip wqueue testcases when KEY_NOTIFICATIONS not enabled simplemessager
@ 2025-12-08 15:15 ` Petr Vorel
0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2025-12-08 15:15 UTC (permalink / raw)
To: simplemessager; +Cc: Meng Yang, ltp, Mingyu Li
Hi Mingyu, Meng,
I sent an alternative approach for this. Could you please retest it.
https://lore.kernel.org/ltp/20251208150542.704006-1-pvorel@suse.cz/T/#t
https://patchwork.ozlabs.org/project/ltp/list/?series=484779&state=*
> 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!");
nit: "| TTERRNO" is not needed, because we know the content of errno:
EOPNOTSUPP.
> + break;
> + default:
> + tst_res(TINFO, "CONFIG_KEY_NOTIFICATION is set.");
> + }
If your approach is taken, I would simplify it (we don't need TINFO)
if (keyctl(KEYCTL_WATCH_KEY, key, fd, 0x01) && errno == EOPNOTSUPP)
tst_brk(TCONF, "CONFIG_KEY_NOTIFICATION is not set!");
if (keyctl(KEYCTL_WATCH_KEY, KEY_SPEC_SESSION_KEYRING, fd, 0x02) && errno == EOPNOTSUPP)
tst_brk(TCONF, "CONFIG_KEY_NOTIFICATION is not set!");
Kind regards,
Petr
> + }
> + 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;
> }
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH 1/1] Skip wqueue testcases when KEY_NOTIFICATIONS not enabled.
2025-12-05 3:00 simplemessager
@ 2025-12-11 10:31 ` Andrea Cervesato via ltp
0 siblings, 0 replies; 4+ messages in thread
From: Andrea Cervesato via ltp @ 2025-12-11 10:31 UTC (permalink / raw)
To: simplemessager, ltp
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 :-)
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-12-11 10:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-05 3:17 [LTP] [PATCH 1/1] Skip wqueue testcases when KEY_NOTIFICATIONS not enabled simplemessager
2025-12-08 15:15 ` Petr Vorel
-- strict thread matches above, loose matches on Subject: below --
2025-12-05 3:00 simplemessager
2025-12-11 10:31 ` Andrea Cervesato via ltp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox