From 6462eaf4dc194489e810331a3b37aca9f59b8c97 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Sun, 29 Sep 2013 10:12:59 +0200 Subject: [PATCH] test: relax TTY availability assumptions test-tty.c currently assumes that a TTY is available to the test runner, and fails hard if not. This may not be true on some autobuilding environment, making the build fail as shown in [0]. Instead, let's properly skip the test in such cases. [0] http://ur1.ca/fr5bd Signed-off-by: Luca Bruno --- test/test-tty.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/test-tty.c b/test/test-tty.c index c26f7fa9..fb699107 100644 --- a/test/test-tty.c +++ b/test/test-tty.c @@ -65,12 +65,16 @@ TEST_IMPL(tty) { #else /* unix */ ttyin_fd = open("/dev/tty", O_RDONLY, 0); - if (ttyin_fd < 0) + if (ttyin_fd < 0) { LOGF("Cannot open /dev/tty as read-only: %s\n", strerror(errno)); + return TEST_SKIP; + } ttyout_fd = open("/dev/tty", O_WRONLY, 0); - if (ttyout_fd < 0) + if (ttyout_fd < 0) { LOGF("Cannot open /dev/tty as write-only: %s\n", strerror(errno)); + return TEST_SKIP; + } #endif ASSERT(ttyin_fd >= 0);