Age | Commit message (Collapse) | Author | Files | Lines |
|
For terminal tests that capture output/stderr, the TTY prerequisite
warning does not quite work for commands like
test_terminal foo >out 2>err
because the warning gets "swallowed" up by the redirection that's
supposed only to be done by the subcommand.
Even worse, the outcome depends on whether stdout was already a
terminal (in which case test_terminal is a noop) or not (in which case
test_terminal introduces a pseudo-tty in the middle of the pipeline).
$ test_terminal.perl sh -c 'test -t 1 && echo >&2 YES' >out
YES
$ sh -c 'test -t 1 && echo >&2 YES' >out
$
So:
- use the test_terminal script even when running with "-v".
- skip tests that require a terminal when the test_terminal
script is unusable because IO::Pty is not installed.
- write the "need to declare TTY prerequisite" message to fd 4,
where it will be printed when running tests with -v, rather
than being swallowed up by an unrelated redireciton.
Noticed-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
|
It is easy to forget to declare the TTY prerequisite when
writing tests on a system where it would always be satisfied
(because IO::Pty is installed; see v1.7.3-rc0~33^2, 2010-08-16
for example). Automatically detect this problem so there is
no need to remember.
test_terminal: need to declare TTY prerequisite
test_must_fail: command not found: test_terminal echo hi
test_terminal returns status 127 in this case to simulate
not being available.
Also replace the SIMPLEPAGERTTY prerequisite on one test with
"SIMPLEPAGER,TTY", since (1) the latter is supported now and
(2) the prerequisite detection relies on the TTY prereq being
explicitly declared.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
|
Some outputs (like the pager) care whether stdout is a
terminal. Others (like progress meters) care about stderr.
This patch sets up both. Technically speaking, we could go
further and set up just one (because either the other goes
to a terminal, or because our tests are only interested in
one). This patch does both to keep the interface to
lib-terminal simple.
Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
|
Other tests besides the pager ones may want to check how we handle
output to a terminal. This patch makes the code reusable.
Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|