[LTP] [PATCH 2/3] Make io_read() runtime-aware

Cyril Hrubis chrubis@suse.cz
Wed Sep 14 11:36:29 CEST 2022


Hi!
> diff --git a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c
> index 88aec7952..595c76226 100644
> --- a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c
> +++ b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c
> @@ -188,7 +188,6 @@ static void cleanup(void)
>  static void run(void)
>  {
>  	char *filename = "file.bin";
> -	int status;
>  	int i, pid;
>  
>  	*run_child = 1;
> @@ -222,12 +221,10 @@ static void run(void)
>  		}
>  	}
>  
> -	if (SAFE_WAITPID(-1, &status, WNOHANG))
> -		tst_res(TFAIL, "Non zero bytes read");
> -	else
> -		tst_res(TPASS, "All bytes read were zeroed");
> -
>  	*run_child = 0;
> +
> +	if (!tst_validate_children(numchildren))
> +		tst_res(TPASS, "All bytes read were zeroed");

This actually breaks the test, have a look at the io_read() in common.h.
The code is written so that the child exits with zero if we find
non-zero bytes so the only way how to actually report a failure is to
check if any of the children did exit before we set the run_child to
zero.

Looking at the code closer the break actually breaks only the inner
for () loop, so it looks like the code was broken and is stil broken. I
guess that we should do return instead of break as well.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list