Skip wqueue testcases when KEY_NOTIFICATIONS not enabled.
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.
Reported-by Meng Yang <[email protected]>
Signed-off-by Mingyu Li <[email protected]>
--- testcases/kernel/watchqueue/common.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
testcases/kernel/watchqueue/common.h +20 -2
@@ -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
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:
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