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 <lucab@debian.org>
This commit is contained in:
Luca Bruno 2013-09-29 10:12:59 +02:00 committed by Ben Noordhuis
parent 429bb804ed
commit 6462eaf4dc

View File

@ -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);