[LTP] [PATCH v2] kernel/pty07: Skip test when TTY not available

Bogdan Lezhepekov blezhepekov@suse.de
Wed Apr 20 11:25:02 CEST 2022


Since TTY under test is hardcoded, it
might not be available in some systems.

Signed-off-by: Bogdan Lezhepekov <blezhepekov@suse.de>
---
 testcases/kernel/pty/pty07.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testcases/kernel/pty/pty07.c b/testcases/kernel/pty/pty07.c
index 2887de6fa..c63b71c89 100644
--- a/testcases/kernel/pty/pty07.c
+++ b/testcases/kernel/pty/pty07.c
@@ -81,6 +81,9 @@ static void setup(void)
 	struct vt_stat stat;
 
 	sprintf(tty_path, "/dev/tty%d", test_tty_port);
+	if (access(tty_path, F_OK))
+		tst_brk(TCONF, "TTY (/dev/tty%d) under test not available in system", test_tty_port);
+
 	fd = SAFE_OPEN(tty_path, O_RDWR);
 	SAFE_IOCTL(fd, VT_GETSTATE, &stat);
 	vt_active = stat.v_active;
-- 
2.35.1



More information about the ltp mailing list