Re: [PATCH v2 1/3] test-lib: allow selecting tests by substring/regex with --run
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 14, 2020, 17:46 UTC
- Message-ID
- <CAPc5daVa4j5mDvTzCFCX2bLr1qVFLO=P=nSakT+mDG1kqeXa+g@mail.gmail.com>
- In-Reply-To
- <20201014170413.GB21687@coredump.intra.peff.net>
Show 15 quoted lines
> > @@ -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.If you define the pattern is not regexp but is glob, you can use case/esac to do this without any forking.
Your expr may well be built-in, though.