From: Ævar Arnfjörð Bjarmason Date: Sat, 19 Feb 2011 16:17:39 GMT Subject: Re: [PATCH v2 1/3] t/gitweb-lib.sh: print to stderr when gitweb_run has errors Message-ID: In-Reply-To: <201102191646.02543.jnareb@gmail.com> On Sat, Feb 19, 2011 at 16:46, Jakub Narebski wrote: > On Sat, 19 Feb 2011, Ęvar Arnfjörš Bjarmason wrote: > >> Change the gitweb_run test subroutine to spew errors to stderr if >> there are any, previously it would just silently fail, which made >> tests very hard to debug. >> >> Before you'd get this output, when running tests under `--verbose >> --immediate --debug`: > > Which test? > > [...] >> --- a/t/gitweb-lib.sh >> +++ b/t/gitweb-lib.sh >> @@ -82,7 +82,12 @@ gitweb_run () { >>               } >>               close O; >>       ' gitweb.output && >> -     if grep '^[[]' gitweb.log >/dev/null 2>&1; then false; else true; fi >> +     if grep '^[[]' gitweb.log >/dev/null 2>&1; then >> +             cat gitweb.log >&2 >> +             false >> +     else >> +             true >> +     fi > > I don't understand this change.  Either it is not necessary, because > test suite (or at least t9500) has > >  test_debug 'cat gitweb.log' > > after each test, so that error messages would be printed with `--debug`, > or it doesn't go far enough: if the above is used then those test_debug > should be removed. The way you're using test_debug() is incompatible with --immediate. The test dies, but I'll never see your debug message because I'm using --immediate. It would be better to just use test_debug in gitweb_run (instead of my "cat gitweb.log"). Anyway, if you feel like fixing that feel free, I wan't pursue this further (going to hack on what I was going to do before gitweb tests started failing). Junio, you can drop this patch since it'll produce duplicate output if the test fails and the user *doesn't* use --immediate, but IMO this should be fixed by doing the debug output differently.