tests: refactor the handling of Perl

Let's make a difference between places where Perl is required for the
test (AT_PERL_REQUIRE), and the places where it's used to run the
test, but it's not not to run the test (AT_PERL_CHECK).

* tests/local.at (AT_REQUIRE): New.
(AT_PERL_CHECK, AT_PERL_REQUIRE): New.
Use them where appropriate.

* tests/local.mk ($(TESTSUITE)): Beware not to start the line with
'-pi' if Perl is empty, as Make understands this as "it's ok to fail".
Which it is not.
This commit is contained in:
Akim Demaille
2019-10-12 12:34:10 +02:00
parent 59cb1f421c
commit c483b6593f
13 changed files with 65 additions and 39 deletions

View File

@@ -39,14 +39,16 @@ AT_DATA_GRAMMAR([[input.y]], [$2])
# For some reason, literal ^M in the input are removed and don't end
# in `input.y`. So use the two-character ^M represent it, and let
# Perl insert real CR characters.
AT_CHECK([$PERL -pi -e 's{\^M}{\r}gx' input.y || exit 77])
if grep '\^M' input.y >/dev/null; then
AT_PERL_REQUIRE([-pi -e 's{\^M}{\r}gx' input.y])
fi
AT_DATA([experr], [$4])
AT_CHECK([LC_ALL=en_US.UTF-8 $5 bison -fcaret --color=debug -Wall input.y], [$3], [], [experr])
# When no style, same messages, but without style.
AT_CHECK(["$PERL" -pi -e 's{(</?(-|\w)+>)}{ $[]1 eq "<tag>" ? $[]1 : "" }ge' experr || exit 77])
AT_PERL_REQUIRE([-pi -e 's{(</?(-|\w)+>)}{ $[]1 eq "<tag>" ? $[]1 : "" }ge' experr])
# Cannot use AT_BISON_CHECK easily as we need to change the
# environment.