[LTP] [PATCH v1] Fix dio_append/aiodio_append tests

Andrea Cervesato andrea.cervesato@suse.com
Tue Jan 30 11:35:02 CET 2024


Hi,

On 1/30/24 11:33, Andrea Cervesato wrote:
> From: Andrea Cervesato <andrea.cervesato@suse.com>
>
> Ensure that dio_append and aiodio_append will end all children if
> parent asked for it. The way we have to do it, is to ensure that
> *run_child variable is checked before opening the file to read.
If you can please mention that append has been increased by 10000 in 
dio_append, once patch is merged.
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
>   testcases/kernel/io/ltp-aiodio/common.h     | 12 ++++++++++--
>   testcases/kernel/io/ltp-aiodio/dio_append.c |  4 ++--
>   2 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/testcases/kernel/io/ltp-aiodio/common.h b/testcases/kernel/io/ltp-aiodio/common.h
> index 200bbe18e..9a2d27166 100644
> --- a/testcases/kernel/io/ltp-aiodio/common.h
> +++ b/testcases/kernel/io/ltp-aiodio/common.h
> @@ -62,8 +62,12 @@ static inline void io_read(const char *filename, int filesize, volatile int *run
>   	int i;
>   	int r;
>   
> -	while ((fd = open(filename, O_RDONLY, 0666)) < 0)
> +	while ((fd = open(filename, O_RDONLY, 0666)) < 0) {
> +		if (!*run_child)
> +			return;
> +
>   		usleep(100);
> +	}
>   
>   	tst_res(TINFO, "child %i reading file", getpid());
>   
> @@ -102,8 +106,12 @@ static inline void io_read_eof(const char *filename, volatile int *run_child)
>   	int fd;
>   	int r;
>   
> -	while ((fd = open(filename, O_RDONLY, 0666)) < 0)
> +	while ((fd = open(filename, O_RDONLY, 0666)) < 0) {
> +		if (!*run_child)
> +			return;
> +
>   		usleep(100);
> +	}
>   
>   	tst_res(TINFO, "child %i reading file", getpid());
>   
> diff --git a/testcases/kernel/io/ltp-aiodio/dio_append.c b/testcases/kernel/io/ltp-aiodio/dio_append.c
> index 057ae73d9..bd48a8252 100644
> --- a/testcases/kernel/io/ltp-aiodio/dio_append.c
> +++ b/testcases/kernel/io/ltp-aiodio/dio_append.c
> @@ -33,7 +33,7 @@ static void setup(void)
>   {
>   	numchildren = 16;
>   	writesize = 64 * 1024;
> -	appends = 1000;
> +	appends = 10000;
>   
>   	if (tst_parse_int(str_numchildren, &numchildren, 1, INT_MAX))
>   		tst_brk(TBROK, "Invalid number of children '%s'", str_numchildren);
> @@ -97,7 +97,7 @@ static struct tst_test test = {
>   	.options = (struct tst_option[]) {
>   		{"n:", &str_numchildren, "Number of processes (default 16)"},
>   		{"w:", &str_writesize, "Write size for each append (default 64K)"},
> -		{"c:", &str_appends, "Number of appends (default 1000)"},
> +		{"c:", &str_appends, "Number of appends (default 10000)"},
>   		{}
>   	},
>   	.skip_filesystems = (const char *[]) {

Thanks,

Andrea



More information about the ltp mailing list