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:
parent
2fc54807fc
commit
7b9e25a9a9
@ -262,14 +262,17 @@ TEST_IMPL(tty_file) {
|
|||||||
TEST_IMPL(tty_pty) {
|
TEST_IMPL(tty_pty) {
|
||||||
# if defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
|
# if defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
|
||||||
defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
int master_fd, slave_fd;
|
int master_fd, slave_fd, r;
|
||||||
struct winsize w;
|
struct winsize w;
|
||||||
uv_loop_t loop;
|
uv_loop_t loop;
|
||||||
uv_tty_t master_tty, slave_tty;
|
uv_tty_t master_tty, slave_tty;
|
||||||
|
|
||||||
ASSERT(0 == uv_loop_init(&loop));
|
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, &slave_tty, slave_fd, 0));
|
||||||
ASSERT(0 == uv_tty_init(&loop, &master_tty, master_fd, 0));
|
ASSERT(0 == uv_tty_init(&loop, &master_tty, master_fd, 0));
|
||||||
/* Check if the file descriptor was reopened. If it is,
|
/* Check if the file descriptor was reopened. If it is,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user