mbox series

[00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno

Message ID 20210720133324.21752-1-aleksei.kodanev@bell-sw.com
Headers show
Series syscalls/sched_*: convert to new API and handle ENOSYS errno | expand

Message

Alexey Kodanev July 20, 2021, 1:33 p.m. UTC
The patch-set introduced new tst_sched_* wrappers to handle ENOSYS
error that can be returned by libc (musl [1]). In that particular
case the wrapper uses syscall directly to test the kernel anyway.

[1]: https://git.musl-libc.org/cgit/musl/commit/?id=1e21e78bf7a5

Alexey Kodanev (16):
  lib/tst_sched: add ltp tst_sched_*()
  syscalls/sched_getparam01: use tst_sched_*()
  syscalls/sched_getparam03: use tst_sched_*()
  syscalls/sched_setparam01: convert to new API
  syscalls/sched_setparam02: convert to new API
  syscalls/sched_setparam03: convert to new API
  syscalls/sched_setparam04: convert to new API
  syscalls/sched_setparam05: convert to new API
  syscalls/sched_rr_get_interval01: use tst_sched_*()
  syscalls/sched_rr_get_interval02: use tst_sched_*()
  syscalls/sched_rr_get_interval03: use tst_sched_*()
  syscalls/sched_setscheduler01: convert to new API
  syscalls/sched_setscheduler02: convert to new API
  syscalls/sched_setscheduler03: use tst_sched_*()
  syscalls/sched_getscheduler01: convert to new API
  syscalls/sched_getscheduler02: convert to new API

 include/tst_sched.h                           |  16 ++
 lib/tst_sched.c                               |  36 +++
 .../sched_getparam/sched_getparam01.c         |   6 +-
 .../sched_getparam/sched_getparam03.c         |   4 +-
 .../sched_getscheduler/sched_getscheduler01.c | 141 +++---------
 .../sched_getscheduler/sched_getscheduler02.c | 104 ++-------
 .../sched_rr_get_interval01.c                 |   4 +-
 .../sched_rr_get_interval02.c                 |   4 +-
 .../sched_rr_get_interval03.c                 |   4 +-
 .../sched_setparam/sched_setparam01.c         | 135 ++---------
 .../sched_setparam/sched_setparam02.c         | 195 +++-------------
 .../sched_setparam/sched_setparam03.c         | 215 ++++--------------
 .../sched_setparam/sched_setparam04.c         | 161 +++----------
 .../sched_setparam/sched_setparam05.c         | 186 +++------------
 .../sched_setscheduler/sched_setscheduler01.c | 171 ++++----------
 .../sched_setscheduler/sched_setscheduler02.c | 154 +++----------
 .../sched_setscheduler/sched_setscheduler03.c |  10 +-
 17 files changed, 345 insertions(+), 1201 deletions(-)
 create mode 100644 include/tst_sched.h
 create mode 100644 lib/tst_sched.c

Comments

Cyril Hrubis July 20, 2021, 1:18 p.m. UTC | #1
Hi!
> The patch-set introduced new tst_sched_* wrappers to handle ENOSYS
> error that can be returned by libc (musl [1]). In that particular
> case the wrapper uses syscall directly to test the kernel anyway.

Can't we use the test_variants to test both the kernel and libc calls
instead?

> [1]: https://git.musl-libc.org/cgit/musl/commit/?id=1e21e78bf7a5
> 
> Alexey Kodanev (16):
>   lib/tst_sched: add ltp tst_sched_*()
>   syscalls/sched_getparam01: use tst_sched_*()
>   syscalls/sched_getparam03: use tst_sched_*()
>   syscalls/sched_setparam01: convert to new API
>   syscalls/sched_setparam02: convert to new API
>   syscalls/sched_setparam03: convert to new API
>   syscalls/sched_setparam04: convert to new API
>   syscalls/sched_setparam05: convert to new API
>   syscalls/sched_rr_get_interval01: use tst_sched_*()
>   syscalls/sched_rr_get_interval02: use tst_sched_*()
>   syscalls/sched_rr_get_interval03: use tst_sched_*()
>   syscalls/sched_setscheduler01: convert to new API
>   syscalls/sched_setscheduler02: convert to new API
>   syscalls/sched_setscheduler03: use tst_sched_*()
>   syscalls/sched_getscheduler01: convert to new API
>   syscalls/sched_getscheduler02: convert to new API
> 
>  include/tst_sched.h                           |  16 ++
>  lib/tst_sched.c                               |  36 +++
>  .../sched_getparam/sched_getparam01.c         |   6 +-
>  .../sched_getparam/sched_getparam03.c         |   4 +-
>  .../sched_getscheduler/sched_getscheduler01.c | 141 +++---------
>  .../sched_getscheduler/sched_getscheduler02.c | 104 ++-------
>  .../sched_rr_get_interval01.c                 |   4 +-
>  .../sched_rr_get_interval02.c                 |   4 +-
>  .../sched_rr_get_interval03.c                 |   4 +-
>  .../sched_setparam/sched_setparam01.c         | 135 ++---------
>  .../sched_setparam/sched_setparam02.c         | 195 +++-------------
>  .../sched_setparam/sched_setparam03.c         | 215 ++++--------------
>  .../sched_setparam/sched_setparam04.c         | 161 +++----------
>  .../sched_setparam/sched_setparam05.c         | 186 +++------------
>  .../sched_setscheduler/sched_setscheduler01.c | 171 ++++----------
>  .../sched_setscheduler/sched_setscheduler02.c | 154 +++----------
>  .../sched_setscheduler/sched_setscheduler03.c |  10 +-
>  17 files changed, 345 insertions(+), 1201 deletions(-)
>  create mode 100644 include/tst_sched.h
>  create mode 100644 lib/tst_sched.c
> 
> -- 
> 2.25.1
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp
Cyril Hrubis July 20, 2021, 2:06 p.m. UTC | #2
Hi!
> >> The patch-set introduced new tst_sched_* wrappers to handle ENOSYS
> >> error that can be returned by libc (musl [1]). In that particular
> >> case the wrapper uses syscall directly to test the kernel anyway.
> > 
> > Can't we use the test_variants to test both the kernel and libc calls
> > instead?
> 
> With glibc it seems it would be just a redundant work to call both
> variants, wouldn't it?

I do not think so, since the libc wrappers may be more complex than just
a syscall(__NR_foo, ...). At least recently the libc variants are
switching between foo and foo_time64 syscall variants and convert the
timespecs accordingly.

> BTW, sched_rr_get_interval* tests already using tst_variants, adding
> more variants will double them too, right?

That's true and this makes things slightly more complicated. But as
these test just calls a few syscalls and check return values I doubt
that doubling the test matrix would be measureable in the test runtime.
Alexey Kodanev July 20, 2021, 2:06 p.m. UTC | #3
Hi Cyril,
On 20.07.2021 16:18, Cyril Hrubis wrote:
> Hi!
>> The patch-set introduced new tst_sched_* wrappers to handle ENOSYS
>> error that can be returned by libc (musl [1]). In that particular
>> case the wrapper uses syscall directly to test the kernel anyway.
> 
> Can't we use the test_variants to test both the kernel and libc calls
> instead?

With glibc it seems it would be just a redundant work to call both
variants, wouldn't it?

BTW, sched_rr_get_interval* tests already using tst_variants, adding
more variants will double them too, right?

> 
>> [1]: https://git.musl-libc.org/cgit/musl/commit/?id=1e21e78bf7a5
>>
>> Alexey Kodanev (16):
>>   lib/tst_sched: add ltp tst_sched_*()
>>   syscalls/sched_getparam01: use tst_sched_*()
>>   syscalls/sched_getparam03: use tst_sched_*()
>>   syscalls/sched_setparam01: convert to new API
>>   syscalls/sched_setparam02: convert to new API
>>   syscalls/sched_setparam03: convert to new API
>>   syscalls/sched_setparam04: convert to new API
>>   syscalls/sched_setparam05: convert to new API
>>   syscalls/sched_rr_get_interval01: use tst_sched_*()
>>   syscalls/sched_rr_get_interval02: use tst_sched_*()
>>   syscalls/sched_rr_get_interval03: use tst_sched_*()
>>   syscalls/sched_setscheduler01: convert to new API
>>   syscalls/sched_setscheduler02: convert to new API
>>   syscalls/sched_setscheduler03: use tst_sched_*()
>>   syscalls/sched_getscheduler01: convert to new API
>>   syscalls/sched_getscheduler02: convert to new API
>>
>>  include/tst_sched.h                           |  16 ++
>>  lib/tst_sched.c                               |  36 +++
>>  .../sched_getparam/sched_getparam01.c         |   6 +-
>>  .../sched_getparam/sched_getparam03.c         |   4 +-
>>  .../sched_getscheduler/sched_getscheduler01.c | 141 +++---------
>>  .../sched_getscheduler/sched_getscheduler02.c | 104 ++-------
>>  .../sched_rr_get_interval01.c                 |   4 +-
>>  .../sched_rr_get_interval02.c                 |   4 +-
>>  .../sched_rr_get_interval03.c                 |   4 +-
>>  .../sched_setparam/sched_setparam01.c         | 135 ++---------
>>  .../sched_setparam/sched_setparam02.c         | 195 +++-------------
>>  .../sched_setparam/sched_setparam03.c         | 215 ++++--------------
>>  .../sched_setparam/sched_setparam04.c         | 161 +++----------
>>  .../sched_setparam/sched_setparam05.c         | 186 +++------------
>>  .../sched_setscheduler/sched_setscheduler01.c | 171 ++++----------
>>  .../sched_setscheduler/sched_setscheduler02.c | 154 +++----------
>>  .../sched_setscheduler/sched_setscheduler03.c |  10 +-
>>  17 files changed, 345 insertions(+), 1201 deletions(-)
>>  create mode 100644 include/tst_sched.h
>>  create mode 100644 lib/tst_sched.c
>>
>> -- 
>> 2.25.1
>>
>>
>> -- 
>> Mailing list info: https://lists.linux.it/listinfo/ltp
>
Cyril Hrubis July 20, 2021, 2:23 p.m. UTC | #4
Hi!
> BTW, sched_rr_get_interval* tests already using tst_variants, adding
> more variants will double them too, right?

Actually not, since we do run the test for both the libc
sched_rr_get_interval and for all possible syscalls variants we don't
have to touch these tests at all.
Alexey Kodanev July 20, 2021, 3:26 p.m. UTC | #5
On 20.07.2021 17:23, Cyril Hrubis wrote:
> Hi!
>> BTW, sched_rr_get_interval* tests already using tst_variants, adding
>> more variants will double them too, right?
> 
> Actually not, since we do run the test for both the libc
> sched_rr_get_interval and for all possible syscalls variants we don't
> have to touch these tests at all.

sched_rr_get_interval works with musl, the one which returns ENOSYS
is sched_setscheduler() there, in setup().
Cyril Hrubis July 20, 2021, 5:23 p.m. UTC | #6
Hi!
> >> BTW, sched_rr_get_interval* tests already using tst_variants, adding
> >> more variants will double them too, right?
> > 
> > Actually not, since we do run the test for both the libc
> > sched_rr_get_interval and for all possible syscalls variants we don't
> > have to touch these tests at all.
> 
> sched_rr_get_interval works with musl, the one which returns ENOSYS
> is sched_setscheduler() there, in setup().

Since this is setup we may as well switch to syscall() in the test
setup and be done with it, we are not testing sched_setscheduler() in
these tests.