The "-x" tracing option implies "--verbose". This is a
problem when running under a TAP harness like "prove", where
we need to use "--verbose-log" instead. Instead, let's
handle this the same way we do for --valgrind, including the
recent fix from 88c6e9d31c (test-lib: --valgrind should not
override --verbose-log, 2017-09-05). Namely, let's enable
--verbose only when we there isn't a more specific verbosity
option indicated.

Note that we also have to tweak `want_trace` to turn it on
(we re-check $verbose in each test because that's how we
handle --verbose-only, but --verbose-log is always on for
all tests).

Signed-off-by: Jeff King <p...@peff.net>
---
 t/test-lib.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 3399fc3c88..14fac6d6f2 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -263,7 +263,6 @@ do
                shift ;;
        -x)
                trace=t
-               verbose=t
                shift ;;
        --verbose-log)
                verbose_log=t
@@ -282,6 +281,11 @@ then
        test -z "$verbose_log" && verbose=t
 fi
 
+if test -n "$trace" && test -z "$verbose_log"
+then
+       verbose=t
+fi
+
 if test -n "$color"
 then
        # Save the color control sequences now rather than run tput
@@ -585,7 +589,9 @@ maybe_setup_valgrind () {
 }
 
 want_trace () {
-       test "$trace" = t && test "$verbose" = t
+       test "$trace" = t && {
+               test "$verbose" = t || test "$verbose_log" = t
+       }
 }
 
 # This is a separate function because some tests use
-- 
2.15.0.rc1.560.g5f0609e481

Reply via email to