From: Richard Palethorpe <rpalethorpe@suse.de>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 2/2] setitimer03: convert to new API
Date: Thu, 20 Oct 2022 09:17:00 +0100 [thread overview]
Message-ID: <875ygex5ob.fsf@suse.de> (raw)
In-Reply-To: <20221009065520.3236525-2-liwang@redhat.com>
Hello,
Li Wang <liwang@redhat.com> writes:
> Combine this EINVAL test into setitimer02 and add one additional
> ITIMER_VIRTUAL verification.
EINVAL is not mentioned in the test description.
>
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
> runtest/syscalls | 1 -
> .../kernel/syscalls/setitimer/.gitignore | 1 -
> .../kernel/syscalls/setitimer/setitimer02.c | 30 +++-
> .../kernel/syscalls/setitimer/setitimer03.c | 158 ------------------
> 4 files changed, 24 insertions(+), 166 deletions(-)
> delete mode 100644 testcases/kernel/syscalls/setitimer/setitimer03.c
>
> diff --git a/runtest/syscalls b/runtest/syscalls
> index 61a7b7677..2d673836d 100644
> --- a/runtest/syscalls
> +++ b/runtest/syscalls
> @@ -1325,7 +1325,6 @@ sethostname03 sethostname03
>
> setitimer01 setitimer01
> setitimer02 setitimer02
> -setitimer03 setitimer03
>
> setns01 setns01
> setns02 setns02
> diff --git a/testcases/kernel/syscalls/setitimer/.gitignore b/testcases/kernel/syscalls/setitimer/.gitignore
> index 048db9b31..35779a32c 100644
> --- a/testcases/kernel/syscalls/setitimer/.gitignore
> +++ b/testcases/kernel/syscalls/setitimer/.gitignore
> @@ -1,3 +1,2 @@
> /setitimer01
> /setitimer02
> -/setitimer03
> diff --git a/testcases/kernel/syscalls/setitimer/setitimer02.c b/testcases/kernel/syscalls/setitimer/setitimer02.c
> index 9ac9ce1fa..ccba231c9 100644
> --- a/testcases/kernel/syscalls/setitimer/setitimer02.c
> +++ b/testcases/kernel/syscalls/setitimer/setitimer02.c
> @@ -18,17 +18,33 @@
> #include "tst_test.h"
> #include "lapi/syscalls.h"
>
> -static struct itimerval *value;
> +static struct itimerval *value, *ovalue;
> +
> +static struct tcase {
> + int which;
> + struct itimerval **val;
> + struct itimerval **oval;
> + int exp_errno;
There is a whitespace error here (see checkpatch/make check)
> +} tcases[] = {
> + {ITIMER_REAL, &value, &ovalue, EFAULT},
> + {ITIMER_VIRTUAL, &value, &ovalue, EFAULT},
> + {-ITIMER_PROF, &value, &ovalue, EINVAL},
> +};
Why do we need value and ovalue in the struct?
>
> static int sys_setitimer(int which, void *new_value, void *old_value)
> {
> return tst_syscall(__NR_setitimer, which, new_value, old_value);
> }
>
> -static void verify_setitimer(void)
> +static void verify_setitimer(unsigned int i)
> {
> - TST_EXP_FAIL(sys_setitimer(ITIMER_REAL, value, (struct itimerval *)-1),
> - EFAULT);
> + struct tcase *tc = &tcases[i];
> +
> + if (tc->exp_errno == EFAULT)
> + *(tc->oval) = (struct itimerval *)-1;
Or, why do we use an if statement here instead of defining it in the struct?
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-10-20 8:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-09 6:55 [LTP] [PATCH 1/2] getitimer02: add ITIMER_VIRTUAL timer error check Li Wang
2022-10-09 6:55 ` [LTP] [PATCH 2/2] setitimer03: convert to new API Li Wang
2022-10-20 8:17 ` Richard Palethorpe [this message]
2022-10-20 9:30 ` Li Wang
2022-10-20 9:45 ` Li Wang
2022-10-20 10:31 ` Richard Palethorpe
2022-10-20 11:28 ` Li Wang
2022-10-20 8:11 ` [LTP] [PATCH 1/2] getitimer02: add ITIMER_VIRTUAL timer error check Richard Palethorpe
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=875ygex5ob.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=liwang@redhat.com \
--cc=ltp@lists.linux.it \
/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.