Skip to content

Commit

Permalink
test: fix test/test-tty.c for AIX
Browse files Browse the repository at this point in the history
'/dev/random' causes 'isatty()' to return 1 on AIX[1]. This causes
an issue where 'dev/tty' is opened (hard coded in
src/unix/tty.c:uv_tty_init). Tried to replace the hardcoded value with
what is returned by 'ttyname()' but on AIX all that is returned is
'/dev/'.

This seems to be a bug with the AIX kernel.

[1]http://goo.gl/wGa7mf

PR-URL: libuv#624
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
  • Loading branch information
Imran Iqbal authored and saghul committed Nov 24, 2015
1 parent 7b9bc28 commit f5796d2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/test-tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,14 @@ TEST_IMPL(tty_file) {
ASSERT(0 == close(fd));
}

/* Bug on AIX where '/dev/random' returns 1 from isatty() */
#ifndef _AIX
fd = open("/dev/random", O_RDONLY);
if (fd != -1) {
ASSERT(UV_EINVAL == uv_tty_init(&loop, &tty, fd, 1));
ASSERT(0 == close(fd));
}
#endif /* _AIX */

fd = open("/dev/zero", O_RDONLY);
if (fd != -1) {
Expand Down

0 comments on commit f5796d2

Please sign in to comment.