[LTP] [PATCH v2 1/4] lapi/sched.h: Add include <sched.h>

Cyril Hrubis chrubis@suse.cz
Fri Jan 28 14:32:38 CET 2022


Hi!
> We including headers in lapi headers instead of depending headers are
> included in tests which use lapi headers.

-ENOPARSE

The patch itself looks good though.

So maybe this should be something as:

Include <sched.h> and "lapi/syscalls.h" in "lapi/sched.h" instead of the
tests.

> Also remove redundant include lapi/syscalls.h from tests which use
> lapi/sched.h (included in lapi/sched.h).
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> New in v2
> 
>  include/lapi/sched.h                                      | 3 ++-
>  testcases/kernel/syscalls/kcmp/kcmp03.c                   | 1 -
>  testcases/kernel/syscalls/sched_getattr/sched_getattr01.c | 2 --
>  testcases/kernel/syscalls/sched_getattr/sched_getattr02.c | 2 --
>  testcases/kernel/syscalls/sched_setattr/sched_setattr01.c | 1 -
>  5 files changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/include/lapi/sched.h b/include/lapi/sched.h
> index 036edd51d1..2fc32a38ca 100644
> --- a/include/lapi/sched.h
> +++ b/include/lapi/sched.h
> @@ -6,9 +6,10 @@
>  #ifndef LAPI_SCHED_H__
>  #define LAPI_SCHED_H__
>  
> -#include "lapi/syscalls.h"
> +#include <sched.h>
>  #include <stdint.h>
>  #include <inttypes.h>
> +#include "lapi/syscalls.h"
>  
>  struct sched_attr {
>  	uint32_t size;
> diff --git a/testcases/kernel/syscalls/kcmp/kcmp03.c b/testcases/kernel/syscalls/kcmp/kcmp03.c
> index 30ac3ec9db..df8633c5fc 100644
> --- a/testcases/kernel/syscalls/kcmp/kcmp03.c
> +++ b/testcases/kernel/syscalls/kcmp/kcmp03.c
> @@ -18,7 +18,6 @@
>  
>  #include <errno.h>
>  #include <stdlib.h>
> -#include <sched.h>
>  #include <sys/wait.h>
>  #include "tst_test.h"
>  #include "kcmp.h"
> diff --git a/testcases/kernel/syscalls/sched_getattr/sched_getattr01.c b/testcases/kernel/syscalls/sched_getattr/sched_getattr01.c
> index 2a2c13a40f..0ffbce9c8d 100644
> --- a/testcases/kernel/syscalls/sched_getattr/sched_getattr01.c
> +++ b/testcases/kernel/syscalls/sched_getattr/sched_getattr01.c
> @@ -22,11 +22,9 @@
>  #include <linux/types.h>
>  #include <sys/syscall.h>
>  #include <pthread.h>
> -#include <sched.h>
>  #include <errno.h>
>  
>  #include "test.h"
> -#include "lapi/syscalls.h"
>  #include "lapi/sched.h"
>  
>  char *TCID = "sched_getattr01";
> diff --git a/testcases/kernel/syscalls/sched_getattr/sched_getattr02.c b/testcases/kernel/syscalls/sched_getattr/sched_getattr02.c
> index 2d7e15a470..9f4a09f88f 100644
> --- a/testcases/kernel/syscalls/sched_getattr/sched_getattr02.c
> +++ b/testcases/kernel/syscalls/sched_getattr/sched_getattr02.c
> @@ -31,11 +31,9 @@
>  #include <linux/types.h>
>  #include <sys/syscall.h>
>  #include <pthread.h>
> -#include <sched.h>
>  #include <errno.h>
>  
>  #include "test.h"
> -#include "lapi/syscalls.h"
>  #include "lapi/sched.h"
>  
>  char *TCID = "sched_getattr02";
> diff --git a/testcases/kernel/syscalls/sched_setattr/sched_setattr01.c b/testcases/kernel/syscalls/sched_setattr/sched_setattr01.c
> index 37ca56a0aa..82156b95cb 100644
> --- a/testcases/kernel/syscalls/sched_setattr/sched_setattr01.c
> +++ b/testcases/kernel/syscalls/sched_setattr/sched_setattr01.c
> @@ -29,7 +29,6 @@
>  #include <linux/types.h>
>  #include <sys/syscall.h>
>  #include <pthread.h>
> -#include <sched.h>
>  #include <errno.h>
>  
>  #include "test.h"
> -- 
> 2.34.1
> 

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list