[LTP] [PATCH 1/3] ioctl01: Add default tty device

Petr Vorel pvorel@suse.cz
Tue Feb 7 14:17:12 CET 2023


Saves user to specify it when run manually.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/syscalls/ioctl/ioctl01.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/ioctl/ioctl01.c b/testcases/kernel/syscalls/ioctl/ioctl01.c
index 1be38e79d3..cb184aee40 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl01.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl01.c
@@ -27,6 +27,7 @@
 #include "lapi/ioctl.h"
 
 #define	INVAL_IOCTL	9999999
+#define	DEFAULT_TTY_DEVICE	"/dev/tty0"
 
 static int fd, fd_file;
 static int bfd = -1;
@@ -70,7 +71,9 @@ static void verify_ioctl(unsigned int i)
 static void setup(void)
 {
 	if (!device)
-		tst_brk(TBROK, "You must specify a tty device with -D option");
+		device = DEFAULT_TTY_DEVICE;
+
+	tst_res(TINFO, "Using device '%s'", device);
 
 	fd = SAFE_OPEN(device, O_RDWR, 0777);
 	fd_file = SAFE_OPEN("x", O_CREAT, 0777);
-- 
2.39.1



More information about the ltp mailing list