Re: [PATCH 2/3] test-lib: add --verbose-log option
- From
Jeff King <peff@peff.net>
- Date
- Oct 21, 2016, 21:46 UTC
- Message-ID
- <20161021214622.csroal7hws3cnszg@sigill.intra.peff.net>
- In-Reply-To
- <xmqq7f91d3tb.fsf@gitster.mtv.corp.google.com>
On Fri, Oct 21, 2016 at 10:12:16AM -0700, Junio C Hamano wrote:
Show 11 quoted lines
> > -if test "$verbose" = "t" > > +if test "$verbose_log" = "t" > > +then > > + exec 3>>"$GIT_TEST_TEE_OUTPUT_FILE" 4>&3 > > +elif test "$verbose" = "t" > > then > > exec 4>&2 3>&1 > > else > > OK, unlike "verbose" case where we give 3 (saved stdout) to 1 and 4 > (saved stderr) to 2, we send 3 to the output file and 4 to the same.
Your comment made me double-check whether we ought to be separating the two in any way. Because my statement earlier in the thread that the --verbose output goes to stdout is not _entirely_ true. It goes to stdout and stderr, as written by the various programs in the tests.
So:
./t0000-whatever.sh -v | less
isn't quite sufficient. You really do want "2>&1" in there to catch everything.
But for the case of "--tee", we already do so, in order to make sure it all goes to the logfile. And since this option always implies "--tee", it is correct here to send "3" and "4" to the same place.
So the patch is correct. But when I said earlier that people might be annoyed if we just sent --verbose output to stderr, that probably isn't true. We could perhaps make:
prove t0000-whatever.sh :: -v
"just work" by sending all of the verbose output to stderr. I don't think it really matters, though. Nobody is doing that, because it's pointless without "--tee".
-Peff