From a52b55b439ed47e4b8d5c0b757bc0682d1ce058a Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Sun, 23 Oct 2016 14:36:45 +0100 Subject: [PATCH] test: skip tty_pty test if pty is not available MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-By: Colin Ihrig Reviewed-By: Saúl Ibarra Corretgé Forwarded: yes, accepted already: https://github.com/libuv/libuv/pull/919 Last-Update: Sun, 19 Jun 2016 18:20:53 +0200 Do not let `tty_pty` test fail if no terminals are available to `openpty()`. Gbp-Pq: Name skip_test_if_no_pty.patch --- test/test-tty.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/test-tty.c b/test/test-tty.c index 55cc016..5787d1d 100644 --- a/test/test-tty.c +++ b/test/test-tty.c @@ -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, -- 2.30.2