Re: [PATCH v2 1/3] test-lib: allow selecting tests by substring/regex with --run
- From
Elijah Newren <newren@gmail.com>
- Date
- Oct 14, 2020, 19:12 UTC
- Message-ID
- <CABPp-BGBG=wh41BrvFZdzsN6biUPvuDkrA9EZURM4GKLx8kC0A@mail.gmail.com>
- In-Reply-To
- <CAPc5daU+w2U_5FBrSYEVO5PB2sOV_fxvBQ1=51_=NMTZooZGmA@mail.gmail.com>
On Wed, Oct 14, 2020 at 10:57 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 8 quoted lines
> > > 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)? > > I had something along this line in mind, not to do a regex but a glob. > > case "$title" in $selector) found=1 ;; esac
Interesting. Since it needs to handle substring searching (e.g.
./test-script.sh --run=setup,rename), I think this would need to be
tweaked to be
case "$title" in *${selector}*) include=$positive ;; esacThat'd probably be good enough for most cases, but I'm still inclined to just pay the subprocess cost in order to allow regexes. If someone is specifying --run, they are going to be skipping many of the tests (and thus a whole code block with dozens or even hundreds of execs per test skipped), more than making up for the one extra exec per test. And if someone doesn't specify --run, there is no extra cost.