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

@@ -90,7 +90,7 @@ default: 'a' }
%-
%{
]])
AT_CHECK([["$PERL" -pi -e 's/\\(\d{3})/chr(oct($1))/ge' input.y || exit 77]])
AT_PERL_REQUIRE([[-pi -e 's/\\(\d{3})/chr(oct($1))/ge' input.y]])
AT_BISON_CHECK([input.y], [1], [],
[[input.y:1.1-2: error: invalid characters: '\0\001\002\377?'
@@ -2184,7 +2184,7 @@ AT_DATA([empty.y],
start: '';
start: '
]])
AT_CHECK([["$PERL" -e "print 'start: \'';" >> empty.y || exit 77]])
AT_PERL_REQUIRE([[-e "print 'start: \'';" >> empty.y]])
AT_BISON_CHECK([-fcaret empty.y], [1], [],
[[empty.y:2.8-9: warning: empty character literal [-Wother]
@@ -2209,7 +2209,7 @@ AT_DATA([two.y],
start: 'ab';
start: 'ab
]])
AT_CHECK([["$PERL" -e "print 'start: \'ab';" >> two.y || exit 77]])
AT_PERL_REQUIRE([[-e "print 'start: \'ab';" >> two.y]])
AT_BISON_CHECK([two.y], [1], [],
[[two.y:2.8-11: warning: extra characters in character literal [-Wother]
@@ -2224,7 +2224,7 @@ AT_DATA([three.y],
start: 'abc';
start: 'abc
]])
AT_CHECK([["$PERL" -e "print 'start: \'abc';" >> three.y || exit 77]])
AT_PERL_REQUIRE([[-e "print 'start: \'abc';" >> three.y]])
AT_BISON_CHECK([three.y], [1], [],
[[three.y:2.8-12: warning: extra characters in character literal [-Wother]
@@ -2254,8 +2254,7 @@ start: '\777' '\0' '\xfff' '\x0'
# Beside we cannot even expect "echo '\0'" to output two characters
# (well three with \n): at least Bash 3.2 converts the two-character
# sequence "\0" into a single NUL character.
AT_CHECK([["$PERL" -e 'print "start: \"\\\t\\\f\\\0\\\1\" ;";' >> input.y \
|| exit 77]])
AT_PERL_REQUIRE([[-e 'print "start: \"\\\t\\\f\\\0\\\1\" ;";' >> input.y]])
AT_BISON_CHECK([input.y], [1], [],
[[input.y:2.9-12: error: invalid number after \-escape: 777