[LTP] [PATCH 1/2] syscalls/pidfd_open: Simplify code

Petr Vorel pvorel@suse.cz
Wed Feb 9 15:19:04 CET 2022


Hi Xu,

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Nice cleanup.
+1 for Cyril's note to TST_EXP_FD_SILENT().

> diff --git a/testcases/kernel/syscalls/pidfd_open/pidfd_open01.c b/testcases/kernel/syscalls/pidfd_open/pidfd_open01.c
> +static void setup(void)
> +{
> +	pidfd_open_supported();
> +}
> +
>  static struct tst_test test = {
> -	.min_kver = "5.3",
> +	.setup = setup,
>  	.test_all = run,
why not just .setup = pidfd_open_supported; ?

...

> diff --git a/testcases/kernel/syscalls/pidfd_open/pidfd_open03.c b/testcases/kernel/syscalls/pidfd_open/pidfd_open03.c
> index 48470e5e1..f41afa2fc 100644
> --- a/testcases/kernel/syscalls/pidfd_open/pidfd_open03.c
> +++ b/testcases/kernel/syscalls/pidfd_open/pidfd_open03.c
...
> +static void setup(void)
> +{
> +	pidfd_open_supported();
> +}
> +
And here as well.

Kind regards,
Petr

>  static struct tst_test test = {
> -	.min_kver = "5.3",
> +	.setup = setup,
>  	.test_all = run,
>  	.forks_child = 1,
>  	.needs_checkpoints = 1,


More information about the ltp mailing list