public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Wei Gao via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] ioctl01.c:Test also struct termios
Date: Tue,  7 Feb 2023 02:16:18 -0500	[thread overview]
Message-ID: <20230207071618.26259-1-wegao@suse.com> (raw)
In-Reply-To: <20230129183930.2045-1-wegao@suse.com>

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

Signed-off-by: Wei Gao <wegao@suse.com>
Reviewed-by: Li Wang <liwang@redhat.com>
---
 testcases/kernel/syscalls/ioctl/ioctl01.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/testcases/kernel/syscalls/ioctl/ioctl01.c b/testcases/kernel/syscalls/ioctl/ioctl01.c
index ccc48cdb2..1be38e79d 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl01.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl01.c
@@ -32,26 +32,28 @@ static int fd, fd_file;
 static int bfd = -1;
 
 static struct termio termio;
+static struct termios termios;
 
 static struct tcase {
 	int *fd;
 	int request;
 	struct termio *s_tio;
+	struct termios *s_tios;
 	int error;
 } tcases[] = {
 	/* file descriptor is invalid */
-	{&bfd, TCGETA, &termio, EBADF},
+	{&bfd, TCGETA, &termio, &termios, EBADF},
 	/* termio address is invalid */
-	{&fd, TCGETA, (struct termio *)-1, EFAULT},
+	{&fd, TCGETA, (struct termio *)-1, (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, &termio, ENOTTY},
+	{&fd, INVAL_IOCTL, &termio, &termios, ENOTTY},
 	/* file descriptor is for a regular file */
-	{&fd_file, TCGETA, &termio, ENOTTY},
+	{&fd_file, TCGETA, &termio, &termios, ENOTTY},
 	/* termio is NULL */
-	{&fd, TCGETA, NULL, EFAULT}
+	{&fd, TCGETA, NULL, NULL, EFAULT}
 };
 
 static char *device;
@@ -60,6 +62,9 @@ static void verify_ioctl(unsigned int i)
 {
 	TST_EXP_FAIL(ioctl(*(tcases[i].fd), tcases[i].request, tcases[i].s_tio),
 		     tcases[i].error);
+
+	TST_EXP_FAIL(ioctl(*(tcases[i].fd), tcases[i].request, tcases[i].s_tios),
+		     tcases[i].error);
 }
 
 static void setup(void)
-- 
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      parent reply	other threads:[~2023-02-07  7:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-29 18:39 [LTP] [PATCH v1] ioctl01.c:Test also struct termios Wei Gao via ltp
2023-02-03  9:03 ` Li Wang
2023-02-06  5:31 ` Petr Vorel
2023-02-06  6:12   ` Petr Vorel
2023-02-07  7:17     ` Wei Gao via ltp
2023-02-07  7:16 ` Wei Gao via ltp [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230207071618.26259-1-wegao@suse.com \
    --to=ltp@lists.linux.it \
    --cc=wegao@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox