[LTP] [PATCH v2 2/2] Detangle test cases for termio and termios

Martin Doucha mdoucha@suse.cz
Thu Sep 7 13:47:33 CEST 2023


Hi,
a two notes below.

On 05. 09. 23 11:30, Marius Kittler wrote:
> As suggested in the review it is clearer to separate the test
> cases for termio and termios into separate entries in the
> `tcases` array.
> ---
>   testcases/kernel/syscalls/ioctl/ioctl01.c | 25 +++++++++++------------
>   1 file changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl01.c b/testcases/kernel/syscalls/ioctl/ioctl01.c
> index 983208925..d552746f8 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl01.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl01.c
> @@ -36,35 +36,34 @@ static struct termios termios;
>   
>   static struct tcase {
>   	int *fd;
> -	int request_tio;
> -	int request_tios;
> -	struct termio *s_tio;
> -	struct termios *s_tios;
> +	int request;
> +	void *s_tio;
>   	int error;
>   } tcases[] = {
>   	/* file descriptor is invalid */
> -	{&bfd, TCGETA, TCGETS, &termio, &termios, EBADF},
> +	{&bfd, TCGETA, &termio, EBADF},
> +	{&bfd, TCGETS, &termios, EBADF},
>   	/* termio address is invalid */
> -	{&fd, TCGETA, TCGETS, (struct termio *)-1, (struct termios *)-1, EFAULT},
> +	{&fd, TCGETA, (struct termio *)-1, EFAULT},
> +	{&fd, TCGETS, (struct termios *)-1, EFAULT},
>   	// /* command is invalid */
>   	/* This errno value was changed from EINVAL to ENOTTY
>   	 * by kernel commit 07d106d0 and bbb63c51
>   	 */
> -	{&fd, INVAL_IOCTL, INVAL_IOCTL, &termio, &termios, ENOTTY},
> +	{&fd, INVAL_IOCTL, &termio, ENOTTY},
> +	{&fd, INVAL_IOCTL, &termios, ENOTTY},

The INVAL_IOCTL, &termios testcase is probably redundant.

>   	/* file descriptor is for a regular file */
> -	{&fd_file, TCGETA, TCGETS, &termio, &termios, ENOTTY},
> +	{&fd_file, TCGETA, &termio, ENOTTY},
> +	{&fd_file, TCGETS, &termios, ENOTTY},
>   	/* termio is NULL */
> -	{&fd, TCGETA, TCGETS, NULL, NULL, EFAULT}
> +	{&fd, TCGETA, NULL, EFAULT}

No TCGETS testcase here?

>   };
>   
>   static char *device;
>   
>   static void verify_ioctl(unsigned int i)
>   {
> -	TST_EXP_FAIL(ioctl(*(tcases[i].fd), tcases[i].request_tio, tcases[i].s_tio),
> -		     tcases[i].error);
> -
> -	TST_EXP_FAIL(ioctl(*(tcases[i].fd), tcases[i].request_tios, tcases[i].s_tios),
> +	TST_EXP_FAIL(ioctl(*(tcases[i].fd), tcases[i].request, tcases[i].s_tio),
>   		     tcases[i].error);
>   }
>   

-- 
Martin Doucha   mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic



More information about the ltp mailing list