[LTP] [PATCH] syscalls/truncate03.c: use TST_EXP_FAIL() macro

Petr Vorel pvorel@suse.cz
Thu Sep 1 13:32:55 CEST 2022


Hi Avinesh,

...
> -	TEST(truncate(tc->pathname, tc->length));
> -	if (TST_RET == 0) {
> -		tst_res(TFAIL, "truncate() succeeded when failure expected");
> -		return;
> -	}
> -
> -	if (TST_RET != -1) {
> -		tst_res(TFAIL, "truncate() returned invalid value %ld",
> -			TST_RET);
> -		return;
> -	}
> -
> -	if (TST_ERR == tc->exp_errno) {
> -		tst_res(TPASS | TTERRNO, "truncate() failed as expected");
> -	} else {
> -		tst_res(TFAIL | TTERRNO,
> -			"truncate() failed unexpectedly; expected: %d - %s",
> -			tc->exp_errno, strerror(tc->exp_errno));
> -	}
> +	TST_EXP_FAIL(truncate(tc->pathname, tc->length),
> +				tc->exp_errno);

I put this on single line, updated copyright and merged.
Thanks!

Petr


More information about the ltp mailing list