From: Cyril Hrubis <chrubis@suse.cz>
To: Dorinda Bassey <dbassey@redhat.com>
Cc: sbertram@redhat.com, javierm@redhat.com, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] kcmp03: Add check for KCMP_SYSVSEM before running test
Date: Mon, 17 Feb 2025 11:12:14 +0100 [thread overview]
Message-ID: <Z7MLfpxzQtcdhNzu@yuki.lan> (raw)
In-Reply-To: <20250214153158.96460-1-dbassey@redhat.com>
Hi!
> This commit introduces a new function
> `is_kcmp_supported()` to check if the kernel supports the
> `KCMP_SYSVSEM` operation. In the `verify_kcmp()` function,
> we add logic to detect when the kernel does not support
> `KCMP_SYSVSEM` and skip the test for that case with a TCONF
> result. This ensures that the test does not fail when the
> Kconfig that supports `KCMP_SYSVSEM` is unavailable.
First of all the coding style is inconsistent, have you run 'make check'
in the test directory and fixed all the problems?
> Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
> ---
> testcases/kernel/syscalls/kcmp/kcmp03.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/testcases/kernel/syscalls/kcmp/kcmp03.c b/testcases/kernel/syscalls/kcmp/kcmp03.c
> index 37d5118d5..255171d98 100644
> --- a/testcases/kernel/syscalls/kcmp/kcmp03.c
> +++ b/testcases/kernel/syscalls/kcmp/kcmp03.c
> @@ -52,6 +52,12 @@ static void cleanup(void)
> free(stack);
> }
>
> +static int is_kcmp_supported(void)
> +{
> + int result = syscall(__NR_kcmp, getpid(), getpid(), KCMP_SYSVSEM, 0, 0);
Why syscall() instead of kcmp() that is used in the rest of the test?
> + return result == 0 || errno != EOPNOTSUPP;
> +}
> +
> static int do_child(void *arg)
> {
> pid2 = getpid();
> @@ -64,6 +70,13 @@ static void verify_kcmp(unsigned int n)
> int res;
> struct tcase *tc = &tcases[n];
>
> + // Handle the case for KCMP_SYSVSEM specifically
> + if (tc->kcmp_type == KCMP_SYSVSEM) {
> + if (!is_kcmp_supported()) {
This function should be called once from the test setup and the results
should be cached.
> + tst_brk(TCONF, "Kernel does not support KCMP_SYSVSEM, skipping test.");
This should be just tst_res(TCONF, "..."); followed by return 0;
We do not want to abort subseqent test iterations (e.g. -i 2 on command
line) just because one operation is not supported.
> + }
> + }
> pid1 = getpid();
> tst_res(TINFO, "Testing %s", tc->desc);
>
> --
> 2.48.1
>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-02-17 10:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 15:31 [LTP] [PATCH] kcmp03: Add check for KCMP_SYSVSEM before running test Dorinda Bassey
2025-02-17 10:12 ` Cyril Hrubis [this message]
2025-02-17 12:52 ` Dorinda Bassey
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=Z7MLfpxzQtcdhNzu@yuki.lan \
--to=chrubis@suse.cz \
--cc=dbassey@redhat.com \
--cc=javierm@redhat.com \
--cc=ltp@lists.linux.it \
--cc=sbertram@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.