[LTP] [PATCH 3/3] fix make check warning: using .needs_kconfigs instead of ENOSYS
Petr Vorel
pvorel@suse.cz
Tue Jan 14 17:32:04 CET 2025
Hi all,
> Replace ENOSYS with .needs_kconfigs `CONFIG_BSD_PROCESS_ACCT=y`
> Signed-off-by: lufei <lufei@uniontech.com>
> ---
> testcases/kernel/syscalls/acct/acct01.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
> diff --git a/testcases/kernel/syscalls/acct/acct01.c b/testcases/kernel/syscalls/acct/acct01.c
> index de653d810..cfd25c665 100644
> --- a/testcases/kernel/syscalls/acct/acct01.c
> +++ b/testcases/kernel/syscalls/acct/acct01.c
> @@ -92,8 +92,6 @@ static void setup(void)
> int fd;
> TEST(acct(NULL));
> - if (TST_RET == -1 && TST_ERR == ENOSYS)
> - tst_brk(TCONF, "acct() system call isn't configured in kernel");
> ltpuser = SAFE_GETPWNAM("nobody");
> @@ -148,5 +146,8 @@ static struct tst_test test = {
> {&file_enametoolong, .size = PATH_MAX+2},
> {&file_erofs, .str = FILE_EROFS},
> {}
> + },
> + .needs_kconfigs = (const char *[]) {
> + "CONFIG_BSD_PROCESS_ACCT=y",
> }
> };
For a record, the warning was:
acct01.c:95: WARNING: ENOSYS means 'invalid syscall nr' and nothing else
This is relevant for kernel code, but not for LTP.
We in the past tried to avoid on kernel configs. Now we on many places use
.needs_kconfigs. Does it mean we just request kernel config? Nobody complained
about it and .needs_kconfigs is kind of documentation, but still I hope that
there aren't many quiet users who see many TCONF. Due this reason I think twice
before I add .needs_kconfigs, specially when ENOSYS is valid detection we use in
tst_syscall().
lib/tst_test.c
if (tst_test->needs_kconfigs && tst_kconfig_check(tst_test->needs_kconfigs))
tst_brk(TCONF, "Aborting due to unsuitable kernel config, see above!");
Kind regards,
Petr
More information about the ltp
mailing list