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

Re: [PATCH] grep: Don't pass a TODO test if REG_STARTEND is supported

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jul 16, 2010, 14:33 UTC
Message-ID
<AANLkTimZ3f550HQwx3OEpO6n1b037He6hJ6rAXP8vfIk@mail.gmail.com>
In-Reply-To
<AANLkTim-4I5Sdu653yJOmnVYDqI8bb71839Vqfd3FKCi@mail.gmail.com>
On Thu, Jul 15, 2010 at 18:44, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 52 quoted lines
> On Thu, Jul 15, 2010 at 17:47, Junio C Hamano <gitster@pobox.com> wrote:
>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>>
>>> On Thu, Jul 8, 2010 at 19:40, Junio C Hamano <gitster@pobox.com> wrote:
>>>> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
>>>>
>>>>> +if git grep ile a
>>>>> +then
>>>>> +     test_expect_success 'git grep ile a' 'git grep ile a'
>>>>> +else
>>>>> +     test_expect_failure 'git grep ile a' 'git grep ile a'
>>>>> +fi
>>>>
>>>> So if command "X" is known to succeed, we run it inside expect_success
>>>> and if not we run it inside expect_failure?
>>>>
>>>> What kind of idiocy is that, I have to wonder...
>>>
>>> Well, the point is to normalize the test suite so that we never have
>>> passing TODO tests if everything's OK.
>>
>> I do not consider a test that passes under some condition but doesn't
>> under some other condition "everything is OK".  Marking the test as
>> "expect failure" as René originally did makes a lot of sense to me.
>>
>> The quoted patch is even worse as it will _actively_ prevent you from
>> catching a new error you just introduced while futzing "git grep" on a
>> platform that used to work.  Your "if" statement will say "ah, grep is
>> broken", and you will use expect-failure, not because your platform does
>> not support REG_STARTEND, but because you broke "git grep".
>>
>> The point of having tests is to help you catch your bugs while you
>> develop.  A test that turns itself off when the feature it is testing is
>> broken helps nobody.
>>
>> So forget about "passing TODO tests", whatever a "TODO test" is.  The
>> change in question is actively _wrong_.
>
> I was under the impression that REG_STARTEND was considered purely
> icing on the cake, i.e. that the tests should be passing whether or
> not it was present.
>
> I guess my reasoning at the time was that if that wasn't the case,
> reporting an unexpected pass by default, as opposed to a failing TODO
> on platforms without REG_STARTEND. Since only TAP will report this, I
> thought that was just an omission.
>
> Anyway, since REG_STARTEND *isn't* obviously considered icing you're
> of course right, but the test is still broken as-is. Now it reports an
> abnormal condition if REG_STARTEND is present (passing TODO test), it
> should instead have a failing TODO test where REG_STARTEND isn't
> present. I'll come up with a patch to fix that.

Well to clarify: The TAP is arguably right, although semantically these sort of tests should probably be a SKIP on unsupported platforms, not a passing TODO.

prove(1) also features passing TODO tests a bit too prominently for my tastes. I've filed a bug for that: https://rt.cpan.org/Public/Bug/Display.html?id=59428

Show 5 quoted lines
> We should also just upgrade the GNU regex library in compat/regex to
> the version that supports REG_STARTEND. Unfortunately that seems
> easier said than done, since the library is now part of glibc, and has
> aquired a lot of glibc specific macros and other constructs that would
> need to be #defined away or otherwise worked around.

This is what we should be focusing on, the patch by Jonathan Nieder is a good start.

Previous: Ævar Arnfjörð BjarmasonNext: Jonathan Nieder
Message 8 of 36 in “grep: Don't pass a TODO test if REG_STARTEND is supported”
  1. grep: Don't pass a TODO test if REG_STARTEND is supportedÆvar Arnfjörð Bjarmason, Jul 8, 2010
  2. Junio C HamanoJul 8, 2010
  3. Ævar Arnfjörð BjarmasonJul 8, 2010
  4. René ScharfeJul 8, 2010
  5. Ævar Arnfjörð BjarmasonJul 15, 2010
  6. Junio C HamanoJul 15, 2010
  7. Ævar Arnfjörð BjarmasonJul 15, 2010
  8. Ævar Arnfjörð BjarmasonJul 16, 2010
  9. Jonathan NiederJul 16, 2010
  10. Ævar Arnfjörð BjarmasonJul 16, 2010
  11. Jonathan NiederJul 16, 2010
  12. Ævar Arnfjörð BjarmasonJul 16, 2010
  13. Ævar Arnfjörð BjarmasonJul 16, 2010
  14. Andreas SchwabJul 16, 2010
  15. Ævar Arnfjörð BjarmasonAug 15, 2010
  16. Paolo BonziniAug 16, 2010
  17. 0/3 Update compat/regexÆvar Arnfjörð Bjarmason, Aug 17, 2010
  18. 2/3 compat/regex: hacks to get the gawk regex engine to compile within gitÆvar Arnfjörð Bjarmason, Aug 17, 2010
  19. Jonathan NiederAug 17, 2010
  20. 3/3 t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTENDÆvar Arnfjörð Bjarmason, Aug 17, 2010
  21. 0/3 Update compat/regexÆvar Arnfjörð Bjarmason, Aug 17, 2010
  22. Jonathan NiederAug 17, 2010
  23. 0/5 Update compat/regexÆvar Arnfjörð Bjarmason, Aug 17, 2010
  24. Paolo BonziniAug 17, 2010
  25. Junio C HamanoAug 17, 2010
  26. Jonathan NiederAug 17, 2010
  27. Ævar Arnfjörð BjarmasonAug 18, 2010
  28. 2/5 compat/regex: get the gawk regex engine to compile within gitÆvar Arnfjörð Bjarmason, Aug 17, 2010
  29. 3/5 Change regerror() declaration from K&R style to ANSI C (C89)Ævar Arnfjörð Bjarmason, Aug 17, 2010
  30. 4/5 t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTENDÆvar Arnfjörð Bjarmason, Aug 17, 2010
  31. 5/5 autoconf: don't use platform regex if it lacks REG_STARTENDÆvar Arnfjörð Bjarmason, Aug 17, 2010
  32. 2/3 compat/regex: get the gawk regex engine to compile within gitÆvar Arnfjörð Bjarmason, Aug 17, 2010
  33. 3/3 t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTENDÆvar Arnfjörð Bjarmason, Aug 17, 2010
  34. Jonathan NiederAug 17, 2010
  35. Ævar Arnfjörð BjarmasonAug 17, 2010
  36. Jonathan NiederAug 17, 2010

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.