t/helper: teach test-regex to report pattern errors (like REG_ILLSEQ)
commitaba8187e4d6a1c517e327a1512589e540943e4c9
authorCarlo Marcelo Arenas Belón <carenas@gmail.com>
Mon, 18 May 2020 18:44:15 +0000 (18 11:44 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 May 2020 20:03:35 +0000 (18 13:03 -0700)
tree0c87fd51e39f1b37bc4c085a9db6cf881ac8a08d
parentaf6b65d45ef179ed52087e80cb089f6b2349f4ec
t/helper: teach test-regex to report pattern errors (like REG_ILLSEQ)

7187c7bbb8 (t4210: skip i18n tests that don't work on FreeBSD, 2019-11-27)
adds a REG_ILLSEQ prerequisite to avoid failures from the tests added in
4e2443b181 (log tests: test regex backends in "--encode=<enc>" tests,
2019-06-28), but hardcodes it to be only enabled in FreeBSD.

Instead of hardcoding the affected platform, teach the test-regex helper,
how to validate a pattern and report back, so it can be used to detect the
same issue in other affected systems (like DragonFlyBSD or macOS).

While at it, refactor the tool so it can report back the source of the
errors it founds, and can be invoked also in a --silent mode, when needed,
for backward compatibility.  A missing flag has been added and the code
reformatted, as well as updates to the way the parameters are handled, for
consistency.

To minimize changes, it is assumed the regcomp error is of the right type
since we control the only caller, and is also assumed to affect both basic
and extended syntax (only basic is tested, but both behave the same in all
three affected platforms since they use the same function).

Based-on-patch-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/helper/test-regex.c