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

Bogdan Lezhepekov blezhepekov@suse.de
Fri Mar 11 13:40:07 CET 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 462569c4a..8bb9417ec 100644
--- a/testcases/kernel/pty/pty07.c
+++ b/testcases/kernel/pty/pty07.c
@@ -77,6 +77,9 @@ static void do_test(void)
 static void setup(void)
 {
 	sprintf(tty_path, "/dev/tty%d", test_tty_port);
+	if (access(tty_path, F_OK) != 0)
+		tst_brk(TCONF, "TTY (/dev/tty%d) under test not available in system", test_tty_port);
+
 	fd = SAFE_OPEN(tty_path, O_RDWR);
 	tst_fzsync_pair_init(&fzp);
 }
-- 
2.35.1



More information about the ltp mailing list