[LTP] [PATCH] getrlimit/getrlimit03: Skip test if __NR_getrlimit not implemented

Li Wang liwang@redhat.com
Tue Jul 8 12:49:58 CEST 2025


On Tue, Jul 8, 2025 at 5:16 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:

> On 2025/7/8 下午3:17, Tiezhu Yang wrote:
> > In the Linux kernel, LoongArch uses the generic syscall table which
> > is defined in include/uapi/asm-generic/unistd.h, and also there is
> > no __ARCH_WANT_SET_GET_RLIMIT in arch/loongarch/include/asm/unistd.h,
> > so __NR_getrlimit is not implemented on LoongArch.
> >
> > That is to say, getrlimit are superseded with prlimit64. There is no
> > need to compare the return value and errno about the syscall numbers
> > __NR_prlimit64 and __NR_getrlimit, just check this case and then skip
> > the test.
>
> ...
>
> >
> > Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> > ---
> >   testcases/kernel/syscalls/getrlimit/getrlimit03.c | 5 +++++
> >   1 file changed, 5 insertions(+)
> >
> > diff --git a/testcases/kernel/syscalls/getrlimit/getrlimit03.c
> b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
> > index 604082ccf..2d79057da 100644
> > --- a/testcases/kernel/syscalls/getrlimit/getrlimit03.c
> > +++ b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
> > @@ -162,6 +162,11 @@ static void run(unsigned int resource)
> >       errno = 0;
> >       ret_ul = getrlimit_ulong(resource, &rlim_ul);
> >       errno_ul = errno;
> > +     if (errno_ul == ENOSYS) {
> > +             tst_res(TCONF | TERRNO,
> > +                     "%s not implemented", __NR_getrlimit_ulong_str);
>
> Self review:
>
> I am not sure whether it should add the following code:
>
> +               test.tcnt = 1;
>
> to skip only once if __NR_getrlimit_ulong_str (maybe __NR_getrlimit
> or __NR_ugetrlimit) not implemented.
>
> > +             return;
> > +     }
> >
> >       if (compare_retval(resource, ret_u64, errno_u64, ret_ul, errno_ul,
> >                          __NR_getrlimit_ulong_str) ||
> >
>
> If yes, it is necessary to modify another place in this function,
> something like this:
>
> @@ -186,6 +187,7 @@ static void run(unsigned int resource)
>          if (errno_l == ENOSYS) {
>                  tst_res(TCONF | TERRNO,
>                          "__NR_getrlimit(%d) not implemented",
> __NR_getrlimit);
> +               test.tcnt = 1;
>                  return;
>          }
>
> Please let me know your opinions, should I squash the above changes
> into this patch or should I send a small patch series with two patches?
>

Yes, if both __NR_getrlimit and __NR_ugetrlimit are undefined on LoongArch,
apparently there is unnecessary to iterate the TCONF for RLIM_NLIMITS times.

I think you can squash with test.tcnt=1 when ENOSYS is detected.

Feel free to add my RBT:
Reviewed-by: Li Wang <liwang@redhat.com>

-- 
Regards,
Li Wang


More information about the ltp mailing list