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

Re: [PATCH] t4210: detect REG_ILLSEQ dynamically

From
Carlo Marcelo Arenas Belón <carenas@gmail.com>
Date
May 13, 2020, 20:18 UTC
Message-ID
<20200513201851.GA30804@Carlos-MBP>
In-Reply-To
<CAPig+cTUc2-ddWQ+oww5Ez7_N9qKgCuErk8OuOgPkXNrACdppw@mail.gmail.com>
On Wed, May 13, 2020 at 11:44:53AM -0400, Eric Sunshine wrote:
Show 12 quoted lines
> On Wed, May 13, 2020 at 7:17 AM Carlo Marcelo Arenas Belón
> <carenas@gmail.com> wrote:
> > diff --git a/t/t4210-log-i18n.sh b/t/t4210-log-i18n.sh
> > @@ -56,21 +56,29 @@ test_expect_success !MINGW 'log --grep does not find non-reencoded values (latin
> > +test_have_prereq GETTEXT_LOCALE &&
> > +! LC_ALL=$is_IS_locale test-tool regex --silent $latin1_e $latin1_e EXTENDED &&
> > +test_set_prereq REGEX_ILLSEQ
> 
> Nit: Is there precedent for formatting the code like this? At first
> glance, I read these as three distinct statements rather than one
> large composite statement. I wonder if indenting the continuation
> lines would make this more easily-digested.

yes, I copied the syntax from t7812, and I agree looks ugly and would had rather done it with an if as Junio suggested, but couldn't find precedent in another tests.

indeed, I would rather go away with the whole prereq and set a variable with a nice sounding name and use it below to `if test` the right tests, would that be ok?

Show 22 quoted lines
> >  for engine in fixed basic extended perl
> >  do
> > +       ireq=
> >         prereq=
> > +       case $engine in
> > +       basic|extended)
> > +               ireq=!REGEX_ILLSEQ,
> > +               ;;
> > +       perl)
> > +               prereq=PCRE
> > +               ;;
> > +       esac
> 
> Why do you introduce a new variable 'ireq' here considering that...
> 
> > +       test_expect_success !MINGW,GETTEXT_LOCALE,$ireq$prereq "-c grep.patternType=$engine log --grep searches in log output encoding (latin1 + locale)" "
> > +       test_expect_success !MINGW,GETTEXT_LOCALE,$ireq$prereq "-c grep.patternType=$engine log --grep does not die on invalid UTF-8 value (latin1 + locale + invalid needle)" "
> 
> ...it is always used alongside 'prereq'? It seems that you could just
> assign "!REGEX_ILLSEQ" to 'prereq' without need for 'ireq'. (And
> 'ireq' is a rather inscrutable name -- I have trouble figuring out
> what it means.)

sadly I can't because there are 3 tests, and only 2 of them (the ones shown in the patch) will have that prerequisite dynamically added, while all will have $prereq.

will send a v2 as an RFC with your suggestions
Show 13 quoted lines
> >                 LC_ALL=\"$is_IS_locale\" git -c grep.patternType=$
> > diff --git a/t/test-lib.sh b/t/test-lib.sh
> > @@ -1454,12 +1454,6 @@ case $uname_s in
> > -FreeBSD)
> > -       test_set_prereq REGEX_ILLSEQ
> > -       test_set_prereq POSIXPERM
> > -       test_set_prereq BSLASHPSPEC
> > -       test_set_prereq EXECKEEPSPID
> > -       ;;
> 
> The commit message explains why you remove the 'REGEX_ILLSEQ', but why
> are all the other lines removed, as well? Such removal seems unrelated
> to the stated purpose of this patch.

they were all added by the previous fix I am ammending and therefore are no longer needed.

the 3 unrelated variables were originally copied from the '*' entry on that case, and therefore FreeBSD will now use the ones there instead of its special case.

Carlo
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 17 in “t4210: detect REG_ILLSEQ dynamically”
  1. t4210: detect REG_ILLSEQ dynamicallyCarlo Marcelo Arenas Belón, May 13, 2020
  2. Eric SunshineMay 13, 2020
  3. Junio C HamanoMay 13, 2020
  4. Carlo Marcelo Arenas BelónMay 13, 2020
  5. Junio C HamanoMay 13, 2020
  6. Carlo Marcelo Arenas BelónMay 13, 2020
  7. t4210: detect REG_ILLSEQ dynamicallyCarlo Marcelo Arenas Belón, May 13, 2020
  8. Eric SunshineMay 13, 2020
  9. Junio C HamanoMay 15, 2020
  10. Carlo Marcelo Arenas BelónMay 15, 2020
  11. t4210: detect REG_ILLSEQ dynamicallyCarlo Marcelo Arenas Belón, May 15, 2020
  12. Junio C HamanoMay 15, 2020
  13. Junio C HamanoMay 15, 2020
  14. 0/2 auto detect REG_ILLSEQCarlo Marcelo Arenas Belón, May 18, 2020
  15. 1/2 t/helper: teach test-regex to report pattern errors (like REG_ILLSEQ)Carlo Marcelo Arenas Belón, May 18, 2020
  16. Junio C HamanoMay 18, 2020
  17. 2/2 t4210: detect REG_ILLSEQ dynamically and skip affected testsCarlo Marcelo Arenas Belón, May 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.