test: skip tty test if detected width and height are 0

This happens in certain build environments such as Jenkins if
some tweaking is not performed in the host system.

R=@bnoordhuis

This should fix some of the containerized Jenkins slaves.