From: Elijah Newren <newren@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>,
Git Mailing List <git@vger.kernel.org>,
Phillip Wood <phillip.wood123@gmail.com>,
Taylor Blau <me@ttaylorr.com>
Subject: Re: [PATCH v2 1/3] test-lib: allow selecting tests by substring/regex with --run
Date: Wed, 14 Oct 2020 12:02:07 -0700 [thread overview]
Message-ID: <CABPp-BHV4WGygzyw6RUsJqCGkvmc-f4dseFjbAG9hUvJgkYx+Q@mail.gmail.com> (raw)
In-Reply-To: <20201014180959.GC24279@coredump.intra.peff.net>
On Wed, Oct 14, 2020 at 11:09 AM Jeff King <peff@peff.net> wrote:
>
> On Wed, Oct 14, 2020 at 10:50:03AM -0700, Elijah Newren wrote:
>
> > > > @@ -819,9 +821,8 @@ match_test_selector_list () {
> > > > *)
> > > > if expr "z$selector" : "z[0-9]*[^0-9]" >/dev/null
> > > > then
> > > > - echo "error: $title: invalid non-numeric in test" \
> > > > - "selector: '$orig_selector'" >&2
> > > > - exit 1
> > > > + echo "$title" | grep -q "$selector" && return
> > > > + continue
> > > > fi
> > >
> > > I like that you allow regexes. It's unfortunate that the skip-check
> > > costs us a process in every test. It may not be that big a deal since we
> > > only pay it if you use a non-numeric selector. But I wonder if there's
> > > any reason not to use "expr" here, as well.
> >
> > I originally used [[ $title =~ "$selector" ]] in order to avoid the
> > sub-shell...but that was bash-specific. I briefly looked to see if
> > there was a shell portable way to handle regexes, wasn't having much
> > luck, and decided that this is only likely to arise when people are
> > passing --run and thus only running a single script and they avoid all
> > the subprocesses that would have been invoked inside the test, so it's
> > still a big net win overall. Does expr handle regexes, portably? Or
> > are you suggesting dropping the regex handling and limit it to
> > substring matching? In either case, does using expr save us anything
> > (isn't expr a shell command)?
>
> There's an expr command doing a regex match in the diff context quoted
> above. :)
Oh, indeed. How'd I miss that?
> I was wrong that it would save us a process, though. I thought it was a
> builtin in modern shells, but it doesn't appear to be in either dash or
> bash. So there's little reason to prefer it over grep here (switching to
> globs could be done with case and would save a process).
I guess it's at least slightly more consistent with the surrounding code.
Oh, and I found a bug in that my code was not handling negated
substrings correctly, e.g.
./test-script.sh --run="!rename"
would run all the tests instead of excluding the ones that had
"rename" as a substring. So I'll send a reroll fixing that.
next prev parent reply other threads:[~2020-10-14 19:02 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-12 23:26 [PATCH 0/3] Make test selection easier by specifying description substrings instead of just numeric counters Elijah Newren via GitGitGadget
2020-10-12 23:26 ` [PATCH 1/3] test-lib: allow selecting tests by substring/regex with --run Elijah Newren via GitGitGadget
2020-10-13 15:39 ` Taylor Blau
2020-10-13 17:23 ` Elijah Newren
2020-10-13 17:28 ` Taylor Blau
2020-10-13 18:21 ` Elijah Newren
2020-10-12 23:26 ` [PATCH 2/3] t6006, t6012: adjust tests to use 'setup' instead of synonyms Elijah Newren via GitGitGadget
2020-10-12 23:26 ` [PATCH 3/3] test-lib: reduce verbosity of skipped tests Elijah Newren via GitGitGadget
2020-10-13 15:44 ` Taylor Blau
2020-10-13 17:56 ` Elijah Newren
2020-10-13 19:27 ` Junio C Hamano
2020-10-13 13:08 ` [PATCH 0/3] Make test selection easier by specifying description substrings instead of just numeric counters Phillip Wood
2020-10-15 11:48 ` Johannes Schindelin
2020-10-15 13:42 ` Phillip Wood
2020-10-13 19:19 ` [PATCH v2 " Elijah Newren via GitGitGadget
2020-10-13 19:19 ` [PATCH v2 1/3] test-lib: allow selecting tests by substring/regex with --run Elijah Newren via GitGitGadget
2020-10-14 17:04 ` Jeff King
2020-10-14 17:46 ` Junio C Hamano
2020-10-14 18:07 ` Jeff King
2020-10-14 19:24 ` Junio C Hamano
2020-10-14 19:41 ` Elijah Newren
2020-10-14 19:49 ` Jeff King
2020-10-15 16:09 ` Junio C Hamano
2020-10-15 15:59 ` Junio C Hamano
2020-10-14 17:50 ` Elijah Newren
2020-10-14 17:57 ` Junio C Hamano
2020-10-14 19:12 ` Elijah Newren
2020-10-15 16:10 ` Junio C Hamano
2020-10-14 18:09 ` Jeff King
2020-10-14 19:02 ` Elijah Newren [this message]
2020-10-15 16:20 ` Junio C Hamano
2020-10-15 19:46 ` Jeff King
2020-10-15 20:08 ` Junio C Hamano
2020-10-16 0:38 ` Jeff King
2020-10-16 16:16 ` Junio C Hamano
2020-10-16 16:30 ` Junio C Hamano
2020-10-16 20:06 ` Jeff King
2020-10-16 20:22 ` Junio C Hamano
2020-10-13 19:19 ` [PATCH v2 2/3] t6006, t6012: adjust tests to use 'setup' instead of synonyms Elijah Newren via GitGitGadget
2020-10-13 19:19 ` [PATCH v2 3/3] test-lib: reduce verbosity of skipped tests Elijah Newren via GitGitGadget
2020-10-14 16:53 ` Jeff King
2020-10-14 17:39 ` Elijah Newren
2020-10-14 17:55 ` Jeff King
2020-10-14 17:57 ` Elijah Newren
2020-10-13 19:49 ` [PATCH v2 0/3] Make test selection easier by specifying description substrings instead of just numeric counters Taylor Blau
2020-10-14 21:13 ` [PATCH v3 " Elijah Newren via GitGitGadget
2020-10-14 21:13 ` [PATCH v3 1/3] test-lib: allow selecting tests by substring/glob with --run Elijah Newren via GitGitGadget
2020-10-16 11:40 ` Phillip Wood
2020-10-16 17:27 ` Elijah Newren
2020-10-16 18:24 ` Phillip Wood
2020-10-16 20:02 ` Junio C Hamano
2020-10-16 20:07 ` Jeff King
2020-10-14 21:13 ` [PATCH v3 2/3] t6006, t6012: adjust tests to use 'setup' instead of synonyms Elijah Newren via GitGitGadget
2020-10-14 21:13 ` [PATCH v3 3/3] test-lib: reduce verbosity of skipped tests Elijah Newren via GitGitGadget
2020-10-15 19:48 ` [PATCH v3 0/3] Make test selection easier by specifying description substrings instead of just numeric counters Jeff King
2020-10-16 19:28 ` [PATCH v4 " Elijah Newren via GitGitGadget
2020-10-16 19:28 ` [PATCH v4 1/3] test-lib: allow selecting tests by substring/glob with --run Elijah Newren via GitGitGadget
2020-10-16 19:28 ` [PATCH v4 2/3] t6006, t6012: adjust tests to use 'setup' instead of synonyms Elijah Newren via GitGitGadget
2020-10-16 19:28 ` [PATCH v4 3/3] test-lib: reduce verbosity of skipped tests Elijah Newren via GitGitGadget
2020-10-16 20:25 ` [PATCH v4 0/3] Make test selection easier by specifying description substrings instead of just numeric counters Junio C Hamano
2020-10-16 20:56 ` Elijah Newren
2020-10-16 22:50 ` [PATCH v5 " Elijah Newren via GitGitGadget
2020-10-16 22:50 ` [PATCH v5 1/3] test-lib: allow selecting tests by substring/glob with --run Elijah Newren via GitGitGadget
2020-10-16 23:25 ` Andrei Rybak
2020-10-17 23:43 ` Elijah Newren
2020-10-16 22:50 ` [PATCH v5 2/3] t6006, t6012: adjust tests to use 'setup' instead of synonyms Elijah Newren via GitGitGadget
2020-10-16 22:50 ` [PATCH v5 3/3] test-lib: reduce verbosity of skipped tests Elijah Newren via GitGitGadget
2020-10-18 0:23 ` [PATCH v6 0/3] Make test selection easier by specifying description substrings instead of just numeric counters Elijah Newren via GitGitGadget
2020-10-18 0:23 ` [PATCH v6 1/3] test-lib: allow selecting tests by substring/glob with --run Elijah Newren via GitGitGadget
2020-10-18 0:23 ` [PATCH v6 2/3] t6006, t6012: adjust tests to use 'setup' instead of synonyms Elijah Newren via GitGitGadget
2020-10-18 0:23 ` [PATCH v6 3/3] test-lib: reduce verbosity of skipped tests Elijah Newren via GitGitGadget
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CABPp-BHV4WGygzyw6RUsJqCGkvmc-f4dseFjbAG9hUvJgkYx+Q@mail.gmail.com \
--to=newren@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=me@ttaylorr.com \
--cc=peff@peff.net \
--cc=phillip.wood123@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).