mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
tests: be really robust to Perl missing
My previous tests (with ./configure PERL=false) have been fooled by configure, that managed to find perl anyway. This time, I ran this on a Fedora in Docker, without Perl. * tests/calc.at, tests/diagnostics.at, tests/headers.at, * tests/input.at, tests/local.at, tests/named-refs.at, * tests/output.at, tests/regression.at, tests/skeletons.at, * tests/synclines.at, tests/torture.at: Don't require Perl.
This commit is contained in:
@@ -619,7 +619,7 @@ AT_CHECK([cat stderr], 0, [expout])
|
||||
# Make sure we did not introduce bad spaces. Checked here because all
|
||||
# the skeletons are (or should be) exercized here.
|
||||
m4_define([AT_CHECK_SPACES],
|
||||
[AT_CHECK([$PERL -ne '
|
||||
[AT_CHECK(["$PERL" -ne '
|
||||
chomp;
|
||||
print "$ARGV:$.: {$_}\n"
|
||||
if (# No starting/ending empty lines.
|
||||
@@ -628,7 +628,7 @@ m4_define([AT_CHECK_SPACES],
|
||||
|| /\s$/
|
||||
# No tabs.
|
||||
|| /\t/
|
||||
)' $1
|
||||
)' $1 || exit 77
|
||||
])dnl
|
||||
])
|
||||
|
||||
|
||||
@@ -39,14 +39,14 @@ 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])
|
||||
AT_CHECK([$PERL -pi -e 's{\^M}{\r}gx' input.y || exit 77])
|
||||
|
||||
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])
|
||||
AT_CHECK(["$PERL" -pi -e 's{(</?(-|\w)+>)}{ $[]1 eq "<tag>" ? $[]1 : "" }ge' experr || exit 77])
|
||||
|
||||
# Cannot use AT_BISON_CHECK easily as we need to change the
|
||||
# environment.
|
||||
|
||||
@@ -314,7 +314,7 @@ AT_TEST([x9], [%locations %code requires {#include "location.hh"} %define api.lo
|
||||
# Ignore comments, YYChar (template parameter), YYPUSH_MORE(_DEFINED)?
|
||||
# (constant definition), YY_\w+_INCLUDED (header guards).
|
||||
# YYDEBUG (not renamed) can be read, but not changed.
|
||||
AT_CHECK([[$PERL -n -0777 -e '
|
||||
AT_CHECK([["$PERL" -n -0777 -e '
|
||||
s{/\*.*?\*/}{}gs;
|
||||
s{//.*}{}g;
|
||||
s{\b((defined|if)\ YYDEBUG
|
||||
@@ -347,7 +347,7 @@ AT_CHECK([[$PERL -n -0777 -e '
|
||||
print "$ARGV: invalid exported yy: $1\n";
|
||||
}
|
||||
}
|
||||
' -- *.hh *.h]])
|
||||
' -- *.hh *.h || exit 77]])
|
||||
|
||||
# Do this late, so that other checks have been performed.
|
||||
AT_SKIP_IF_CANNOT_LINK_C_AND_CXX
|
||||
|
||||
@@ -90,7 +90,7 @@ default: 'a' }
|
||||
%-
|
||||
%{
|
||||
]])
|
||||
AT_CHECK([[$PERL -pi -e 's/\\(\d{3})/chr(oct($1))/ge' input.y || exit 77]])
|
||||
AT_CHECK([["$PERL" -pi -e 's/\\(\d{3})/chr(oct($1))/ge' input.y || exit 77]])
|
||||
|
||||
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_CHECK([["$PERL" -e "print 'start: \'';" >> empty.y || exit 77]])
|
||||
|
||||
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_CHECK([["$PERL" -e "print 'start: \'ab';" >> two.y || exit 77]])
|
||||
|
||||
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_CHECK([["$PERL" -e "print 'start: \'abc';" >> three.y || exit 77]])
|
||||
|
||||
AT_BISON_CHECK([three.y], [1], [],
|
||||
[[three.y:2.8-12: warning: extra characters in character literal [-Wother]
|
||||
@@ -2254,7 +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 \
|
||||
AT_CHECK([["$PERL" -e 'print "start: \"\\\t\\\f\\\0\\\1\" ;";' >> input.y \
|
||||
|| exit 77]])
|
||||
|
||||
AT_BISON_CHECK([input.y], [1], [],
|
||||
|
||||
@@ -55,10 +55,10 @@ m4_define([AT_SETUP_STRIP],
|
||||
# Expect COUNT matches of the PERL-REGEXP in FILE. The file is
|
||||
# taken in "slurp" mode, i.e., one can match end-of-lines.
|
||||
m4_define([AT_MATCHES_CHECK],
|
||||
[AT_CHECK([$PERL -0777 -ne '
|
||||
[AT_CHECK(["$PERL" -0777 -ne '
|
||||
my $count = 0;
|
||||
s{$2}{ ++$count; "" }gem;
|
||||
printf "$count\n";' $1], [0], [$3
|
||||
printf "$count\n";' $1 || exit 77], [0], [$3
|
||||
])])
|
||||
|
||||
|
||||
@@ -857,17 +857,19 @@ if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then
|
||||
# Run with -Werror.
|
||||
]AT_BISON_CHECK_([$1[ -Werror]], [[1]], [expout], [stderr])[
|
||||
|
||||
# Build expected stderr up to and including the "warnings being
|
||||
# treated as errors" message.
|
||||
]AT_DATA([[experr]], [$4])[
|
||||
$PERL -pi -e 's{(.*): warning:}{$][1: error:};' \
|
||||
-e 's{\[-W(.*)\]$}{@<:@-Werror=$][1@:>@}' \
|
||||
experr
|
||||
]AT_CHECK([[sed 's,.*/$,,' stderr 1>&2]], [[0]], [[]], [experr])[
|
||||
if test x"$PERL" != x; then
|
||||
# Build expected stderr up to and including the "warnings being
|
||||
# treated as errors" message.
|
||||
]AT_DATA([[experr]], [$4])[
|
||||
"$PERL" -pi -e 's{(.*): warning:}{$][1: error:};' \
|
||||
-e 's{\[-W(.*)\]$}{@<:@-Werror=$][1@:>@}' \
|
||||
experr
|
||||
]AT_CHECK([[sed 's,.*/$,,' stderr 1>&2]], [[0]], [[]], [experr])[
|
||||
|
||||
# Now check --warnings=error.
|
||||
cp stderr experr
|
||||
]AT_BISON_CHECK_([$1[ --warnings=error]], [[1]], [expout], [experr])[
|
||||
# Now check --warnings=error.
|
||||
cp stderr experr
|
||||
]AT_BISON_CHECK_([$1[ --warnings=error]], [[1]], [expout], [experr])[
|
||||
fi
|
||||
|
||||
# Now check -Wnone and --warnings=none by making sure that
|
||||
# -Werror doesn't change the exit status when -Wnone or
|
||||
|
||||
@@ -604,7 +604,7 @@ AT_DATA_GRAMMAR([test.y],
|
||||
start: foo[ % /* aaa */ *&-.+\000\001\002\377 ] bar
|
||||
{ s = $foo; }
|
||||
]])
|
||||
AT_CHECK([[$PERL -pi -e 's/\\(\d{3})/chr(oct($1))/ge' test.y || exit 77]])
|
||||
AT_CHECK([["$PERL" -pi -e 's/\\(\d{3})/chr(oct($1))/ge' test.y || exit 77]])
|
||||
AT_BISON_CHECK([-o test.c test.y], 1, [],
|
||||
[[test.y:11.13: error: invalid character in bracketed name: '%'
|
||||
test.y:11.25-27: error: invalid characters in bracketed name: '*&-'
|
||||
|
||||
@@ -23,10 +23,10 @@ AT_BANNER([[Output file names.]])
|
||||
# Check that the current directory contains FILE... (sorted).
|
||||
m4_define([AT_CHECK_FILES],
|
||||
[AT_CHECK([[find . -type f |
|
||||
$PERL -ne '
|
||||
"$PERL" -ne '
|
||||
s,\./,,; chomp;
|
||||
push @file, $_ unless m{^($2|testsuite.log)$};
|
||||
END { print join (" ", sort @file), "\n" }']],
|
||||
END { print join (" ", sort @file), "\n" }' || exit 77]],
|
||||
[], [$1
|
||||
])])
|
||||
|
||||
@@ -48,7 +48,7 @@ foo: '0' {};
|
||||
]])
|
||||
|
||||
# There is not AT_DATA_UNQUOTED.
|
||||
AT_CHECK([$PERL -pi -e 's{\$at_dir}'"{$at_group_dir}g" $1])
|
||||
AT_CHECK(["$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" $1 || exit 77])
|
||||
|
||||
|
||||
AT_BISON_CHECK([$3 $1], [$5], [], [ignore])[
|
||||
|
||||
@@ -1352,18 +1352,18 @@ AT_CHECK([[grep 'syntax error,' stderr.txt]], [[0]],
|
||||
|
||||
# Check number of default reductions in inconsistent states to be sure
|
||||
# syntax error is detected before unnecessary reductions are performed.
|
||||
AT_CHECK([[$PERL -0777 -ne 'print s/inconsistent default reduction//g;' \
|
||||
AT_CHECK([["$PERL" -0777 -ne 'print s/inconsistent default reduction//g;' \
|
||||
< stdout.txt || exit 77]], [[0]], [[14]])
|
||||
|
||||
# Check number of default reductions in consistent states to be sure
|
||||
# it is performed before the syntax error is detected.
|
||||
AT_CHECK([[$PERL -0777 -ne 'print s/\bconsistent default reduction//g;' \
|
||||
AT_CHECK([["$PERL" -0777 -ne 'print s/\bconsistent default reduction//g;' \
|
||||
< stdout.txt || exit 77]], [[0]], [[2]])
|
||||
|
||||
]AT_C_IF([[
|
||||
# Check number of reallocs to be sure reallocated memory isn't somehow
|
||||
# lost between LAC invocations.
|
||||
AT_CHECK([[$PERL -0777 -ne 'print s/\(realloc//g;' < stderr.txt \
|
||||
AT_CHECK([["$PERL" -0777 -ne 'print s/\(realloc//g;' < stderr.txt \
|
||||
|| exit 77]], [[0]], [[3]])
|
||||
]])[
|
||||
|
||||
|
||||
@@ -311,7 +311,7 @@ print '@output(@,@,@)', "\n";
|
||||
(print "garbage"x10, "\n") for (1..1000);
|
||||
print "${M4}_divert_pop(0)\n";
|
||||
]])
|
||||
AT_CHECK([[$PERL gen-skel.pl > skel.c || exit 77]])
|
||||
AT_CHECK([["$PERL" gen-skel.pl > skel.c || exit 77]])
|
||||
|
||||
AT_DATA([[input.y]],
|
||||
[[%skeleton "./skel.c"
|
||||
|
||||
@@ -97,7 +97,7 @@ m4_define([_AT_SYNCLINES_COMPILE],
|
||||
# syncline.c:4:2: error: #error "4"
|
||||
# 4 | #error "4"
|
||||
# | ^~~~~
|
||||
AT_CHECK([[$PERL -p -0777 - stderr <<\EOF
|
||||
AT_CHECK([["$PERL" -p -0777 - stderr <<\EOF || exit 77
|
||||
# Remove left-hand margin.
|
||||
s/^[\d ]{6}\| //gm;
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ EOF
|
||||
]])
|
||||
AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_CHECK([$PERL -w ./gengram.pl $2 || exit 77], 0, [stdout])
|
||||
AT_CHECK(["$PERL" -w ./gengram.pl $2 || exit 77], 0, [stdout])
|
||||
mv stdout $1
|
||||
])
|
||||
|
||||
@@ -203,7 +203,7 @@ yylex (void)
|
||||
EOF
|
||||
]])
|
||||
|
||||
AT_CHECK([$PERL -w ./gengram.pl $2 || exit 77], 0, [stdout])
|
||||
AT_CHECK(["$PERL" -w ./gengram.pl $2 || exit 77], 0, [stdout])
|
||||
mv stdout $1
|
||||
AT_BISON_OPTION_POPDEFS
|
||||
])
|
||||
@@ -375,7 +375,7 @@ yylex (void)
|
||||
EOF
|
||||
]])
|
||||
|
||||
AT_CHECK([$PERL -w ./gengram.pl $2 || exit 77], 0, [stdout])
|
||||
AT_CHECK(["$PERL" -w ./gengram.pl $2 || exit 77], 0, [stdout])
|
||||
mv stdout $1
|
||||
AT_BISON_OPTION_POPDEFS
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user