git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 1/3] t/gitweb-lib.sh: print to stderr when gitweb_run has errors

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Feb 19, 2011, 19:11 UTC
Message-ID
<AANLkTinwV0zFTR3zYtN53JJOZYDhtAkhoY4TC1RstZHC@mail.gmail.com>
In-Reply-To
<201102191916.21164.jnareb@gmail.com>
On Sat, Feb 19, 2011 at 19:16, Jakub Narebski <jnareb@gmail.com> wrote:
Show 42 quoted lines
> On Sat, 19 Feb 2011, Ævar Arnfjörð Bjarmason wrote:
>> On Sat, Feb 19, 2011 at 16:46, Jakub Narebski <jnareb@gmail.com> 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.
>
> Ah, so that is what it is about: using --immediate negates --debug.

Yeah, I didn't realize that when I submitted my patch, I just thought it would never be printed, period.

> Note that it is *much* wider issue; it is not only gitweb tests that use
> test_debug in such way.  See for example t/t4114-apply-typechange.sh
> where you have
Indeed, it's all over the test suite.
Show 23 quoted lines
>  test_expect_success SYMLINKS 'directory becomes symlink' '
>        git checkout -f foo-becomes-a-directory &&
>        git diff-tree -p HEAD foo-symlinked-to-bar > patch &&
>        git apply --index < patch
>        '
>  test_debug 'cat patch'
>
> This causes the same problem.
>
>> 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.
>
> Below there is proposed patch that removes duplication of --debug output...
> but does not solve issue for other places where we use test_debug in test
> suite and incompatibility with --immediate run.
This patch looks good to me.
Previous: Jakub NarebskiNext: Junio C Hamano
Message 7 of 15 in “gitweb/gitweb.perl: remove use of qw(...) as parentheses”
  1. gitweb/gitweb.perl: remove use of qw(...) as parenthesesÆvar Arnfjörð Bjarmason, Feb 19, 2011
  2. 0/3 Fix failure-causing warnings in Gitweb + improve gitweb-lib.shÆvar Arnfjörð Bjarmason, Feb 19, 2011
  3. 1/3 t/gitweb-lib.sh: print to stderr when gitweb_run has errorsÆvar Arnfjörð Bjarmason, Feb 19, 2011
  4. Jakub NarebskiFeb 19, 2011
  5. Ævar Arnfjörð BjarmasonFeb 19, 2011
  6. Jakub NarebskiFeb 19, 2011
  7. Ævar Arnfjörð BjarmasonFeb 19, 2011
  8. Junio C HamanoFeb 21, 2011
  9. 2/3 gitweb/gitweb.perl: remove use of qw(...) as parenthesesÆvar Arnfjörð Bjarmason, Feb 19, 2011
  10. Jakub NarebskiFeb 19, 2011
  11. Jakub NarebskiFeb 19, 2011
  12. Ævar Arnfjörð BjarmasonFeb 19, 2011
  13. Jakub NarebskiFeb 20, 2011
  14. 3/3 gitweb/gitweb.perl: don't call S_ISREG() with undefÆvar Arnfjörð Bjarmason, Feb 19, 2011
  15. Jakub NarebskiFeb 19, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.