test: add error logging to tty unit test

This commit is contained in:
Miroslav Bajtoš 2013-04-15 21:03:05 +02:00 committed by Ben Noordhuis
parent af6e865a07
commit fe2a3150c0

View File

@ -30,6 +30,9 @@
# include <unistd.h>
#endif
#include <string.h>
#include <errno.h>
TEST_IMPL(tty) {
int r, width, height;
@ -62,7 +65,12 @@ TEST_IMPL(tty) {
#else /* unix */
ttyin_fd = open("/dev/tty", O_RDONLY, 0);
if (ttyin_fd < 0)
LOGF("Cannot open /dev/tty as read-only: %s\n", strerror(errno));
ttyout_fd = open("/dev/tty", O_WRONLY, 0);
if (ttyout_fd < 0)
LOGF("Cannot open /dev/tty as write-only: %s\n", strerror(errno));
#endif
ASSERT(ttyin_fd >= 0);