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:
parent
429bb804ed
commit
6462eaf4dc
@ -65,12 +65,16 @@ TEST_IMPL(tty) {
|
|||||||
|
|
||||||
#else /* unix */
|
#else /* unix */
|
||||||
ttyin_fd = open("/dev/tty", O_RDONLY, 0);
|
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));
|
LOGF("Cannot open /dev/tty as read-only: %s\n", strerror(errno));
|
||||||
|
return TEST_SKIP;
|
||||||
|
}
|
||||||
|
|
||||||
ttyout_fd = open("/dev/tty", O_WRONLY, 0);
|
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));
|
LOGF("Cannot open /dev/tty as write-only: %s\n", strerror(errno));
|
||||||
|
return TEST_SKIP;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ASSERT(ttyin_fd >= 0);
|
ASSERT(ttyin_fd >= 0);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user