[LTP] [PATCH v1] ioctl01.c:Test also struct termios

Petr Vorel pvorel@suse.cz
Mon Feb 6 06:31:35 CET 2023


Hi Wei,

> ATM we're testing just legacy struct termio in ioctl01.c,
> we also need test struct termios.

Good idea.

> @@ -64,7 +66,21 @@ static void verify_ioctl(unsigned int i)
>  	if (TST_ERR != tcases[i].error) {
>  		tst_res(TFAIL | TTERRNO,
>  			"failed unexpectedly; expected %s",
> -		        tst_strerrno(tcases[i].error));
> +			tst_strerrno(tcases[i].error));
> +		return;
> +	}
Could you please replace TEST(ioctl(...) with TST_EXP_FAIL(ioctl(...))?
That would save all error handling.

We try to use these helping macros in include/tst_test_macros.h.
Although they would deserve some docs as macros are a bit harder to read.

> +
> +	TEST(ioctl(*(tcases[i].fd), tcases[i].request, tcases[i].s_tios));
> +
And obviously here should go TST_EXP_FAIL(ioctl(...)) as well.

Kind regards,
Petr
> +	if (TST_RET != -1) {
> +		tst_res(TFAIL, "call succeeded unexpectedly");
> +		return;
> +	}
> +
> +	if (TST_ERR != tcases[i].error) {
> +		tst_res(TFAIL | TTERRNO,
> +			"failed unexpectedly; expected %s",
> +			tst_strerrno(tcases[i].error));
>  		return;
>  	}



More information about the ltp mailing list