Hi Didier,
This time, it's sed portability issues.
# -*- compilation -*-
174. calc.at:630: testing Calculator ...
./calc.at:630: bison -o calc.c calc.y
./calc.at:630: $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS
stderr:
stdout:
./calc.at:630: sed -ne '/./q;=;p;' calc.c
./calc.at:630: sed -ne '${/^$/{=;p;};}' calc.c
0a1
> sed: There are too many '{'.
./calc.at:630: exit code was 2, expected 0
174. calc.at:630: 174. Calculator (calc.at:630): FAILED (calc.at:630)
I expect you do have perl on your machine, right? I have
installed this series of patches on maint. The second one is actually
cherry-picked from master.
commit a727e7124d0d9f8da52e0f5092b05b356cf03deb
Author: Akim Demaille <[email protected]>
Date: Fri Oct 5 09:20:30 2012 +0200
tests: fix sed portability issues
Reported by Didier Godefroy,
<http://lists.gnu.org/archive/html/bug-bison/2012-10/msg00005.html>.
* tests/calc.at (AT_CHECK_SPACES): Use Perl.
diff --git a/tests/calc.at b/tests/calc.at
index 3aab868..a1c11e5 100644
--- a/tests/calc.at
+++ b/tests/calc.at
@@ -503,12 +503,15 @@ 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],
-[# No initial empty lines.
-AT_CHECK([sed -ne '/./q;=;p;' $1])
-# No trailing spaces.
-# FIXME: For 2.7: AT_CHECK([sed -ne '/[ ]$/{=;p;}' $1])
-# No final empty lines.
-AT_CHECK([sed -ne '${/^$/{=;p;};}' $1])
+[AT_CHECK([perl -ne '
+ chomp;
+ print "$.: {$_}\n"
+ if (# No starting/ending empty lines.
+ (eof || $. == 1) && /^\s*$/
+ # No trailing space. FIXME: not ready for "maint".
+ # || /\s$/
+ )' $1
+])dnl
])
commit 45fdfd8108084c2c3505d584d8dcc7e534ae77a2
Author: Akim Demaille <[email protected]>
Date: Sun Apr 8 08:58:43 2012 +0200
build: look for Perl in configure.
Bison uses "/usr/bin/perl" or "perl" in several places, and it does
not appear to be a problem. But, at least to make it simpler to
change PERL on the make command line, check for perl in configure.
* configure.ac (PERL): New.
* doc/Doxyfile.in, doc/Makefile.am, tests/bison.in: Use it.
diff --git a/configure.ac b/configure.ac
index b9d2ea6..4cc9ef9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -123,6 +123,10 @@ AC_PROG_GNU_M4
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
AC_DEFINE_UNQUOTED([M4_GNU_OPTION], ["$M4_GNU"], [Define to "-g" if GNU M4
supports -g, otherwise to "".])
+AC_PATH_PROG([PERL], [perl])
+if test -z "$PERL"; then
+ AC_MSG_ERROR([perl not found])
+fi
AM_MISSING_PROG([HELP2MAN], [help2man])
AC_PATH_PROG([XSLTPROC], [xsltproc])
AC_SUBST([XSLTPROC])
diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in
index b555751..e36a1ce 100644
--- a/doc/Doxyfile.in
+++ b/doc/Doxyfile.in
@@ -940,7 +940,7 @@ EXTERNAL_GROUPS = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of `which perl').
-PERL_PATH = /usr/bin/perl
+PERL_PATH = @PERL@
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
diff --git a/doc/Makefile.am b/doc/Makefile.am
index d87f00f..f695e22 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -30,7 +30,7 @@ $(srcdir)/cross-options.texi: $(top_srcdir)/src/getargs.c
$(CROSS_OPTIONS_PL)
$(AM_V_at)rm -f [email protected]
$(AM_V_at)cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) bison
$(AM_V_at)$(top_builddir)/src/bison --help \
- | perl $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l >[email protected]
+ | $(PERL) $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l >[email protected]
$(AM_V_at)diff -u $@~ [email protected] || true
$(AM_V_at)mv [email protected] $@
MAINTAINERCLEANFILES = $(srcdir)/cross-options.texi
diff --git a/tests/bison.in b/tests/bison.in
index 4dfeb79..f21b2bc 100644
--- a/tests/bison.in
+++ b/tests/bison.in
@@ -19,7 +19,7 @@
abs_top_srcdir='@abs_top_srcdir@'
abs_top_builddir='@abs_top_builddir@'
-: ${PERL=perl}
+: ${PERL='@PERL@'}
# Use the shipped files, not those installed.
BISON_PKGDATADIR=$abs_top_srcdir/data
commit ff020c3061aeab8a20a4a6fd48c434e3e5aeb29b
Author: Akim Demaille <[email protected]>
Date: Fri Oct 5 09:24:59 2012 +0200
tests: use $PERL instead of perl
* tests/atlocal.in (PERL): New.
Sort.
* tests/calc.at, tests/input.at, tests/local.at, tests/regression.at,
* tests/skeletons.at, tests/synclines.at, tests/torture.at: here.
diff --git a/tests/atlocal.in b/tests/atlocal.in
index d059d63..9a2d19f 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -63,24 +63,26 @@ fi
## Other. ##
## ------- ##
-# Are special link options needed?
-LDFLAGS='@LDFLAGS@'
-
-# Are special libraries needed?
-LIBS="$abs_top_builddir/lib/libbison.a @LIBS@ @INTLLIBS@"
-
# Empty if no javac was found
CONF_JAVAC='@CONF_JAVAC@'
# Empty if no Java VM was found
CONF_JAVA='@CONF_JAVA@'
-# Empty if no xsltproc was found
-: ${XSLTPROC='@XSLTPROC@'}
-
# We need egrep.
: ${EGREP='@EGREP@'}
# Use simple quotes (lib/quote.c).
LC_CTYPE=C
export LC_CTYPE
+
+# Are special link options needed?
+LDFLAGS='@LDFLAGS@'
+
+# Are special libraries needed?
+LIBS="$abs_top_builddir/lib/libbison.a @LIBS@ @INTLLIBS@"
+
+# Empty if no xsltproc was found
+: ${XSLTPROC='@XSLTPROC@'}
+
+: ${PERL='@PERL@'}
diff --git a/tests/calc.at b/tests/calc.at
index a1c11e5..9518c3c 100644
--- a/tests/calc.at
+++ b/tests/calc.at
@@ -503,7 +503,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 "$.: {$_}\n"
if (# No starting/ending empty lines.
diff --git a/tests/input.at b/tests/input.at
index 86a955d..16a9308 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -1195,7 +1195,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([empty.y], [1], [],
[[empty.y:2.8-9: warning: empty character literal
@@ -1210,7 +1210,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
@@ -1225,7 +1225,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
@@ -1254,7 +1254,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], [],
diff --git a/tests/local.at b/tests/local.at
index 5c9b865..2362e76 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -38,7 +38,7 @@ m4_define([m4_null_if],
# 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
diff --git a/tests/regression.at b/tests/regression.at
index 617a675..c44b9f8 100644
--- a/tests/regression.at
+++ b/tests/regression.at
@@ -1481,17 +1481,17 @@ 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]])
# 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]])
AT_BISON_OPTION_POPDEFS
diff --git a/tests/skeletons.at b/tests/skeletons.at
index ec8170c..7b5b8f2 100644
--- a/tests/skeletons.at
+++ b/tests/skeletons.at
@@ -315,7 +315,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"
diff --git a/tests/synclines.at b/tests/synclines.at
index e2b7005..041ae19 100644
--- a/tests/synclines.at
+++ b/tests/synclines.at
@@ -64,7 +64,7 @@ m4_define([AT_SYNCLINES_COMPILE],
# distcc[35882] (dcc_connect_by_name) ERROR: failed to look up host
"chrisimac": Unknown host
# distcc[35882] Warning: failed to distribute input.c to chrisimac/4,
running locally instead
-AT_CHECK([[perl -p -0777 - stderr <<\EOF
+AT_CHECK([[$PERL -p -0777 - stderr <<\EOF
s/^distcc\[\d+\] .*\n//gm;
s/^([^:]+:\d+)[.:][^:]+:(.+)$/$][1:$][2/gm;
s/^([^:]+:\d+):[^#]*( #error)/$][1:$][2/gm;
diff --git a/tests/torture.at b/tests/torture.at
index 705e131..a5e244b 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -125,7 +125,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
])
@@ -214,7 +214,7 @@ main (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
])
@@ -350,7 +350,7 @@ main (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
])