test: skip tty_pty test if pty is not available

Do not let `tty_pty` test fail if no terminals are available
to `openpty()`.

PR-URL: https://github.com/libuv/libuv/pull/919
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
Luca Bruno 2016-06-19 18:20:53 +02:00 committed by cjihrig
parent 2fc54807fc
commit 7b9e25a9a9

View File

@ -262,14 +262,17 @@ TEST_IMPL(tty_file) {
TEST_IMPL(tty_pty) {
# if defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
int master_fd, slave_fd;
int master_fd, slave_fd, r;
struct winsize w;
uv_loop_t loop;
uv_tty_t master_tty, slave_tty;
ASSERT(0 == uv_loop_init(&loop));
ASSERT(0 == openpty(&master_fd, &slave_fd, NULL, NULL, &w));
r = openpty(&master_fd, &slave_fd, NULL, NULL, &w);
if (r != 0)
RETURN_SKIP("No pty available, skipping.");
ASSERT(0 == uv_tty_init(&loop, &slave_tty, slave_fd, 0));
ASSERT(0 == uv_tty_init(&loop, &master_tty, master_fd, 0));
/* Check if the file descriptor was reopened. If it is,