[LTP] [PATCH 1/1] write05: Simplify test using TST_ macros

Avinesh Kumar akumar@suse.de
Fri Jul 21 14:29:05 CEST 2023


Hi Petr,

On Friday, July 21, 2023 3:33:30 PM IST Petr Vorel wrote:
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/kernel/syscalls/write/write05.c | 20 +++-----------------
>  1 file changed, 3 insertions(+), 17 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/write/write05.c
> b/testcases/kernel/syscalls/write/write05.c index c1e48f1df..1e85cce6d
> 100644
> --- a/testcases/kernel/syscalls/write/write05.c
> +++ b/testcases/kernel/syscalls/write/write05.c
> @@ -59,26 +59,12 @@ static void verify_write(unsigned int i)
> 
>  	sigpipe_cnt = 0;
> 
> -	TEST(write(*tc->fd, *tc->buf, tc->size));
> -
> -	if (TST_RET != -1) {
> -		tst_res(TFAIL, "write() succeeded unexpectedly");
> -		return;
> -	}
> -
> -	if (TST_ERR != tc->exp_errno) {
> -		tst_res(TFAIL | TTERRNO,
> -			"write() failed unexpectedly, expected %s",
> -			tst_strerrno(tc->exp_errno));
> +	TST_EXP_FAIL(write(*tc->fd, *tc->buf, tc->size), tc->exp_errno);
Should we use TST_EXP_FAIL2 instead?

Maybe we can also do the ascii doc changes and headers cleanup, but I'm fine if 
we do that in a separate patch.

Reviewed-by: Avinesh Kumar <akumar@suse.de>


Regards,
Avinesh





More information about the ltp mailing list