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

Re: [PATCH] t6500: don't run detached auto gc at the end of the test script

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Apr 20, 2017, 16:42 UTC
Message-ID
<CAM0VKjm1m4v9vTpwFEejBuD3NuGm+kAdEV-_rzCXCz2G4m5NGw@mail.gmail.com>
In-Reply-To
<20170414200829.ahqignx3pkhbuepg@sigill.intra.peff.net>
On Fri, Apr 14, 2017 at 10:08 PM, Jeff King <peff@peff.net> wrote:
Show 15 quoted lines
> On Thu, Apr 13, 2017 at 09:35:08PM +0200, SZEDER Gábor wrote:
>
>> >> diff --git a/t/test-lib.sh b/t/test-lib.sh
>> >> index 13b569682..d7fa15a69 100644
>> >> --- a/t/test-lib.sh
>> >> +++ b/t/test-lib.sh
>> >> @@ -763,7 +763,7 @@ test_done () {
>> >>
>> >>                 test -d "$remove_trash" &&
>>
>> I'm not sure under what circumstances the trash dir could be missing at
>> this point...
>
> Yeah, I don't really see the point of that line. Our whole goal is to
> remove it anyway.
It turns out it's necessary, see below.
Show 11 quoted lines
>> >>                 cd "$(dirname "$remove_trash")" &&
>> >> -               rm -rf "$(basename "$remove_trash")"
>> >> +               rm -rf "$(basename "$remove_trash")" || exit 1
>>
>> ... but when it is already removed, then I think we should not exit
>> with error here.
>> Nothing that a pair of {} wouldn't handle.
>
> I suppose so. It might be worth being picky just on the principle that
> if it _is_ gone that's unexpected and we'd prefer somebody notice and
> figure out why.
OK, agreed.

However, we do need the above 'test -d' for this to work, because 'rm -rf' doesn't consider non-existing paths as errors, so we wouldn't notice that the trash directory is already gone.

>> > Replacing it the "exit 1" with a "die" that has a message is probably a
>> > good idea, though.

test-lib.sh has a special 'die', different from git-sh-setup.sh's 'die'. I'll use 'error "uh-oh"' instead.

Show 7 quoted lines
>> If we can't 'cd' or 'rm -rf', then they will tell us why they failed
>> anyway, most likely including the name of the trash directory.
>> Do we really need more error messages than that?
>
> I just meant something like "tests passed but test cleanup failed;
> aborting" so that the user has a better idea what is going on. But since
> it shouldn't happen, maybe that doesn't matter.

And we do need an error message, because 'test -d' would remain silent when the directory were already missing.

Previous: Jeff KingNext: Jeff King
Message 24 of 41 in “t6500: don't run detached auto gc at the end of the test script”
  1. t6500: don't run detached auto gc at the end of the test scriptSZEDER Gábor, Apr 10, 2017
  2. Jeff KingApr 10, 2017
  3. SZEDER GáborApr 10, 2017
  4. Jeff KingApr 10, 2017
  5. SZEDER GáborApr 10, 2017
  6. Jeff KingApr 10, 2017
  7. Johannes SixtApr 11, 2017
  8. SZEDER GáborApr 12, 2017
  9. Jeff KingApr 12, 2017
  10. SZEDER GáborApr 12, 2017
  11. [PATCHv2] t6500: don't run detached auto gc at the end of the test scriptSZEDER Gábor, Apr 12, 2017
  12. [PATCHv2.1] t6500: wait for detached auto gc at the end of the test scriptSZEDER Gábor, Apr 13, 2017
  13. David TurnerApr 13, 2017
  14. Jeff KingApr 13, 2017
  15. SZEDER GáborApr 13, 2017
  16. Jeff KingApr 13, 2017
  17. Jeff KingApr 13, 2017
  18. Stefan BellerApr 13, 2017
  19. Jeff KingApr 13, 2017
  20. SZEDER GáborApr 13, 2017
  21. Jeff KingApr 13, 2017
  22. SZEDER GáborApr 13, 2017
  23. Jeff KingApr 14, 2017
  24. SZEDER GáborApr 20, 2017
  25. Jeff KingApr 20, 2017
  26. test-lib: abort when can't remove trash directorySZEDER Gábor, Apr 20, 2017
  27. Jeff KingApr 20, 2017
  28. Junio C HamanoApr 21, 2017
  29. SZEDER GáborApr 21, 2017
  30. Jeff KingApr 21, 2017
  31. Junio C HamanoApr 24, 2017
  32. Jeff KingApr 24, 2017
  33. Junio C HamanoApr 24, 2017
  34. Junio C HamanoApr 24, 2017
  35. Jeff KingApr 24, 2017
  36. Torsten BögershausenApr 24, 2017
  37. Jeff KingApr 24, 2017
  38. Junio C HamanoApr 25, 2017
  39. Junio C HamanoApr 25, 2017
  40. Jeff KingApr 25, 2017
  41. Junio C HamanoApr 25, 2017

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.