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

Re: [RFC PATCH 3/3] test-lib: add the '--stress' option to run a test repeatedly under load

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Dec 5, 2018, 12:07 UTC
Message-ID
<20181205120725.GK30222@szeder.dev>
In-Reply-To
<87muplyxfn.fsf@evledraar.gmail.com>
On Tue, Dec 04, 2018 at 07:11:08PM +0100, Ævar Arnfjörð Bjarmason wrote:
Show 19 quoted lines
> It's a frequent annoyance of mine in the test suite that I'm
> e.g. running t*.sh with some parallel "prove" in one screen, and then I
> run tABCD*.sh manually, and get unlucky because they use the same trash
> dir, and both tests go boom.
> 
> You can fix that with --root, which is much of what this patch does. My
> one-liner for doing --stress has been something like:
> 
>     perl -E 'say ++$_ while 1' | parallel --jobs=100% --halt-on-error soon,fail=1 './t0000-basic.sh --root=trash-{} -v'
> 
> But it would be great if I didn't have to worry about that and could
> just run two concurrent:
> 
>     ./t0000-basic.sh
> 
> So I think we could just set some env variable where instead of having
> the predictable trash directory we have a $TRASHDIR.$N as this patch
> does, except we pick $N by locking some test-runs/tABCD.Nth file with
> flock() during the run.
Is 'flock' portable?  It doesn't appear so.
> Then a stress mode like this would just be:
> 
>     GIT_TEST_FLOCKED_TRASH_DIRS=1 perl -E 'say ++$_ while 1' | parallel --jobs=100% --halt-on-error soon,fail=1 './t0000-basic.sh'
This doesn't address the issue of TCP ports for various daemons.
> And sure, we could ship a --stress option too, but it wouldn't be
> magical in any way, just another "spawn N in a loop" implementation, but
> you could also e.g. use GNU parallel to drive it, and without needing to

GNU 'parallel' may or may not be available on the platform, that's why I stuck with the barebones shell-loops-in-the-background approach.

> decide to stress test in advance, since we'd either flock() the trash
> dir, or just mktemp(1)-it.

While 'mktemp' seems to be more portable than 'flock', it doesn't seem to be portable enough; at least it's not in POSIX.

And in general I'd prefer deterministic trash directory names. If I re-run a failed test after fixing the bug, then currently the trash directory will be overwritten, and that's good. With 'mktemp's junk in the trash direcory's name it won't be overwritten, and if my bugfix doesn't work, then I'll start accumulating trash directories and won't even know which one is from the last run.

Previous: Jeff KingNext: Ævar Arnfjörð Bjarmason
Message 14 of 67 in “test-lib: add the '--stress' option to help reproduce occasional failures in flaky tests”
  1. 0/3 test-lib: add the '--stress' option to help reproduce occasional failures in flaky testsSZEDER Gábor, Dec 4, 2018
  2. 1/3 test-lib: consolidate naming of test-results pathsSZEDER Gábor, Dec 4, 2018
  3. Jeff KingDec 5, 2018
  4. 2/3 test-lib-functions: introduce the 'test_set_port' helper functionSZEDER Gábor, Dec 4, 2018
  5. Jeff KingDec 5, 2018
  6. SZEDER GáborDec 5, 2018
  7. Jeff KingDec 5, 2018
  8. 3/3 test-lib: add the '--stress' option to run a test repeatedly under loadSZEDER Gábor, Dec 4, 2018
  9. Ævar Arnfjörð BjarmasonDec 4, 2018
  10. SZEDER GáborDec 4, 2018
  11. Jeff KingDec 5, 2018
  12. Ævar Arnfjörð BjarmasonDec 4, 2018
  13. Jeff KingDec 5, 2018
  14. SZEDER GáborDec 5, 2018
  15. Ævar Arnfjörð BjarmasonDec 5, 2018
  16. SZEDER GáborDec 5, 2018
  17. Ævar Arnfjörð BjarmasonDec 5, 2018
  18. Jeff KingDec 5, 2018
  19. SZEDER GáborDec 5, 2018
  20. Jeff KingDec 5, 2018
  21. Junio C HamanoDec 6, 2018
  22. Jeff KingDec 6, 2018
  23. Junio C HamanoDec 6, 2018
  24. SZEDER GáborDec 6, 2018
  25. Jeff KingDec 7, 2018
  26. SZEDER GáborDec 5, 2018
  27. Jeff KingDec 5, 2018
  28. SZEDER GáborDec 6, 2018
  29. Jeff KingDec 7, 2018
  30. 0/7 test-lib: add the '--stress' option to help reproduce occasional failures in flaky testsSZEDER Gábor, Dec 9, 2018
  31. 2/7 test-lib: parse some --options earlierSZEDER Gábor, Dec 9, 2018
  32. Jeff KingDec 11, 2018
  33. SZEDER GáborDec 11, 2018
  34. Jeff KingDec 17, 2018
  35. SZEDER GáborDec 30, 2018
  36. Jeff KingJan 3, 2019
  37. 1/7 test-lib: translate SIGTERM and SIGHUP to an exitSZEDER Gábor, Dec 9, 2018
  38. Jeff KingDec 11, 2018
  39. 4/7 test-lib: set $TRASH_DIRECTORY earlierSZEDER Gábor, Dec 9, 2018
  40. 5/7 test-lib: extract Bash version check for '-x' tracingSZEDER Gábor, Dec 9, 2018
  41. 3/7 test-lib: consolidate naming of test-results pathsSZEDER Gábor, Dec 9, 2018
  42. 6/7 test-lib-functions: introduce the 'test_set_port' helper functionSZEDER Gábor, Dec 9, 2018
  43. 7/7 test-lib: add the '--stress' option to run a test repeatedly under loadSZEDER Gábor, Dec 9, 2018
  44. fixup! test-lib: add the '--stress' option to run a test repeatedly under loadSZEDER Gábor, Dec 10, 2018
  45. Jeff KingDec 11, 2018
  46. 0/8 test-lib: add the '--stress' option to help reproduce occasional failures in flaky testsSZEDER Gábor, Dec 30, 2018
  47. 1/8 test-lib: translate SIGTERM and SIGHUP to an exitSZEDER Gábor, Dec 30, 2018
  48. 2/8 test-lib: parse options in a for loop to keep $@ intactSZEDER Gábor, Dec 30, 2018
  49. 3/8 test-lib: parse command line options earlierSZEDER Gábor, Dec 30, 2018
  50. 6/8 test-lib: extract Bash version check for '-x' tracingSZEDER Gábor, Dec 30, 2018
  51. Carlo ArenasDec 31, 2018
  52. 7/8 test-lib-functions: introduce the 'test_set_port' helper functionSZEDER Gábor, Dec 30, 2018
  53. 5/8 test-lib: set $TRASH_DIRECTORY earlierSZEDER Gábor, Dec 30, 2018
  54. SZEDER GáborDec 30, 2018
  55. 5/8 test-lib: set $TRASH_DIRECTORY earlierSZEDER Gábor, Dec 30, 2018
  56. 4/8 test-lib: consolidate naming of test-results pathsSZEDER Gábor, Dec 30, 2018
  57. 8/8 test-lib: add the '--stress' option to run a test repeatedly under loadSZEDER Gábor, Dec 30, 2018
  58. 0/8 test-lib: add the '--stress' option to help reproduce occasional failures in flaky testsSZEDER Gábor, Jan 5, 2019
  59. 1/8 test-lib: translate SIGTERM and SIGHUP to an exitSZEDER Gábor, Jan 5, 2019
  60. 2/8 test-lib: extract Bash version check for '-x' tracingSZEDER Gábor, Jan 5, 2019
  61. 3/8 test-lib: parse options in a for loop to keep $@ intactSZEDER Gábor, Jan 5, 2019
  62. 4/8 test-lib: parse command line options earlierSZEDER Gábor, Jan 5, 2019
  63. 5/8 test-lib: consolidate naming of test-results pathsSZEDER Gábor, Jan 5, 2019
  64. 6/8 test-lib: set $TRASH_DIRECTORY earlierSZEDER Gábor, Jan 5, 2019
  65. 8/8 test-lib: add the '--stress' option to run a test repeatedly under loadSZEDER Gábor, Jan 5, 2019
  66. 7/8 test-lib-functions: introduce the 'test_set_port' helper functionSZEDER Gábor, Jan 5, 2019
  67. Jeff KingJan 7, 2019

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.