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

Re: [PATCH v3 1/3] test-lib: allow selecting tests by substring/glob with --run

From
Elijah Newren <newren@gmail.com>
Date
Oct 16, 2020, 17:27 UTC
Message-ID
<CABPp-BHkykWh8L_FYhLR1BCCpPDmc_2q+Tccg_yZ7W8ZHZ4WsA@mail.gmail.com>
In-Reply-To
<2b757512-793d-a6e0-0a50-368061e122dd@gmail.com>
Hi Phillip,
On Fri, Oct 16, 2020 at 4:41 AM Phillip Wood <phillip.wood123@gmail.com> wrote:
Show 59 quoted lines
>
> Hi Elijah
>
> On 14/10/2020 22:13, Elijah Newren via GitGitGadget wrote:
> > From: Elijah Newren <newren@gmail.com>
> >
> > Many of our test scripts have several "setup" tests.  It's a lot easier
> > to say
> >
> >     ./t0050-filesystem.sh --run=setup,9
> >
> > in order to run all the setup tests as well as test #9, than it is to
> > track down what all the setup tests are and enter all their numbers in
> > the list.  Also, I often find myself wanting to run just one or a couple
> > tests from the test file, but I don't know the numbering of any of the
> > tests -- to get it I either have to first run the whole test file (or
> > start counting by hand or figure out some other clever but non-obvious
> > tricks).  It's really convenient to be able to just look at the test
> > description(s) and then run
> >
> >     ./t6416-recursive-corner-cases.sh --run=symlink
> >
> > or
> >
> >     ./t6402-merge-rename.sh --run='setup,unnecessary update'
>
> The beginning of match_test_selector_list() looks like
>
> match_test_selector_list () {
>         title="$1"
>         shift
>         arg="$1"
>         shift
>         test -z "$1" && return 0
>
>         # Both commas and whitespace are accepted as separators.
>         OLDIFS=$IFS
>         IFS='   ,'
>         set -- $1
>         IFS=$OLDIFS
>
>         # If the first selector is negative we include by default.
>         include=
>         case "$1" in
>                 !*) include=t ;;
>         esac
>
>         for selector
>         do
>
> If I'm reading it correctly the selectors are split on commas and
> whitespace which would mean we cannot match on "unnecessary update". I
> think we definitely want the ability to include whitespace in the
> selectors in order to be able to narrow down the tests that are run. I'm
> not sure that there is much value in splitting numbers on whitespace as
> it would mean the user has to quote them on the command line so we can
> probably just do 'IFS=,'. We'd also need to keep IFS as ',' in the case
> statement you add below as well rather than restoring it straight after
> the 'set' statement above.

Given that t/README explicitly shows examples of space-separated lists of numbers, I'm worried we're breaking long-built expectations of other developers by changing IFS here. Perhaps I could instead add the following paragraph to t/README:

Note: The argument to --run is split on commas and whitespace into
separate strings, numbers, and ranges, and picks all tests that match
any of individual selection criteria.  If the substring you want to
match from the description text includes a comma or space, use the
glob character '?' instead.  For example --run='unnecessary?update
timing' would match on all tests that match either the glob
*unnecessary?update* or the glob *timing*.

Does that address your concern? The '?' will of course match on characters other than a space or comma, but the odds that it actually matches anything other than what you want is pretty slim, so I suspect that is good enough.

Previous: Phillip WoodNext: Phillip Wood
Message 51 of 71 in “Make test selection easier by specifying description substrings instead of just numeric counters”
  1. 0/3 Make test selection easier by specifying description substrings instead of just numeric countersElijah Newren via GitGitGadget, Oct 12, 2020
  2. 1/3 test-lib: allow selecting tests by substring/regex with --runElijah Newren via GitGitGadget, Oct 12, 2020
  3. Taylor BlauOct 13, 2020
  4. Elijah NewrenOct 13, 2020
  5. Taylor BlauOct 13, 2020
  6. Elijah NewrenOct 13, 2020
  7. 3/3 test-lib: reduce verbosity of skipped testsElijah Newren via GitGitGadget, Oct 12, 2020
  8. Taylor BlauOct 13, 2020
  9. Elijah NewrenOct 13, 2020
  10. Junio C HamanoOct 13, 2020
  11. 2/3 t6006, t6012: adjust tests to use 'setup' instead of synonymsElijah Newren via GitGitGadget, Oct 12, 2020
  12. Phillip WoodOct 13, 2020
  13. Johannes SchindelinOct 15, 2020
  14. Phillip WoodOct 15, 2020
  15. 0/3 Make test selection easier by specifying description substrings instead of just numeric countersElijah Newren via GitGitGadget, Oct 13, 2020
  16. 1/3 test-lib: allow selecting tests by substring/regex with --runElijah Newren via GitGitGadget, Oct 13, 2020
  17. Jeff KingOct 14, 2020
  18. Junio C HamanoOct 14, 2020
  19. Jeff KingOct 14, 2020
  20. Junio C HamanoOct 14, 2020
  21. Elijah NewrenOct 14, 2020
  22. Jeff KingOct 14, 2020
  23. Junio C HamanoOct 15, 2020
  24. Junio C HamanoOct 15, 2020
  25. Elijah NewrenOct 14, 2020
  26. Junio C HamanoOct 14, 2020
  27. Elijah NewrenOct 14, 2020
  28. Junio C HamanoOct 15, 2020
  29. Jeff KingOct 14, 2020
  30. Elijah NewrenOct 14, 2020
  31. Junio C HamanoOct 15, 2020
  32. Jeff KingOct 15, 2020
  33. Junio C HamanoOct 15, 2020
  34. Jeff KingOct 16, 2020
  35. Junio C HamanoOct 16, 2020
  36. Junio C HamanoOct 16, 2020
  37. Jeff KingOct 16, 2020
  38. Junio C HamanoOct 16, 2020
  39. 2/3 t6006, t6012: adjust tests to use 'setup' instead of synonymsElijah Newren via GitGitGadget, Oct 13, 2020
  40. 3/3 test-lib: reduce verbosity of skipped testsElijah Newren via GitGitGadget, Oct 13, 2020
  41. Jeff KingOct 14, 2020
  42. Elijah NewrenOct 14, 2020
  43. Jeff KingOct 14, 2020
  44. Elijah NewrenOct 14, 2020
  45. Taylor BlauOct 13, 2020
  46. 0/3 Make test selection easier by specifying description substrings instead of just numeric countersElijah Newren via GitGitGadget, Oct 14, 2020
  47. 2/3 t6006, t6012: adjust tests to use 'setup' instead of synonymsElijah Newren via GitGitGadget, Oct 14, 2020
  48. 3/3 test-lib: reduce verbosity of skipped testsElijah Newren via GitGitGadget, Oct 14, 2020
  49. 1/3 test-lib: allow selecting tests by substring/glob with --runElijah Newren via GitGitGadget, Oct 14, 2020
  50. Phillip WoodOct 16, 2020
  51. Elijah NewrenOct 16, 2020
  52. Phillip WoodOct 16, 2020
  53. Junio C HamanoOct 16, 2020
  54. Jeff KingOct 16, 2020
  55. Jeff KingOct 15, 2020
  56. 0/3 Make test selection easier by specifying description substrings instead of just numeric countersElijah Newren via GitGitGadget, Oct 16, 2020
  57. 1/3 test-lib: allow selecting tests by substring/glob with --runElijah Newren via GitGitGadget, Oct 16, 2020
  58. 3/3 test-lib: reduce verbosity of skipped testsElijah Newren via GitGitGadget, Oct 16, 2020
  59. 2/3 t6006, t6012: adjust tests to use 'setup' instead of synonymsElijah Newren via GitGitGadget, Oct 16, 2020
  60. Junio C HamanoOct 16, 2020
  61. Elijah NewrenOct 16, 2020
  62. 0/3 Make test selection easier by specifying description substrings instead of just numeric countersElijah Newren via GitGitGadget, Oct 16, 2020
  63. 2/3 t6006, t6012: adjust tests to use 'setup' instead of synonymsElijah Newren via GitGitGadget, Oct 16, 2020
  64. 3/3 test-lib: reduce verbosity of skipped testsElijah Newren via GitGitGadget, Oct 16, 2020
  65. 1/3 test-lib: allow selecting tests by substring/glob with --runElijah Newren via GitGitGadget, Oct 16, 2020
  66. Andrei RybakOct 16, 2020
  67. Elijah NewrenOct 17, 2020
  68. 0/3 Make test selection easier by specifying description substrings instead of just numeric countersElijah Newren via GitGitGadget, Oct 18, 2020
  69. 1/3 test-lib: allow selecting tests by substring/glob with --runElijah Newren via GitGitGadget, Oct 18, 2020
  70. 2/3 t6006, t6012: adjust tests to use 'setup' instead of synonymsElijah Newren via GitGitGadget, Oct 18, 2020
  71. 3/3 test-lib: reduce verbosity of skipped testsElijah Newren via GitGitGadget, Oct 18, 2020

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.