* Stefano Lattarini wrote on Sat, Jun 12, 2010 at 11:48:15PM CEST: > Another patch tweaking scripts in the testsuite.
Thanks, most of this is uncontroversial, but a couple of things I don't understand: > --- a/tests/colon3.test > +++ b/tests/colon3.test > @@ -1,6 +1,6 @@ > #! /bin/sh > -# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003 > -# Free Software Foundation, Inc. > +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2010 Free Software > +# Foundation, Inc. > # > # This program is free software; you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by > @@ -22,10 +22,11 @@ > > set -e > > -cat > configure.in << 'END' > -AC_INIT > -AM_INIT_AUTOMAKE(nonesuch, nonesuch) > -AC_OUTPUT(Makefile:zardoz.in:two.in:three.in) > +cat > configure.in <<END > +AC_INIT([$me], [1.0]) > +AM_INIT_AUTOMAKE > +AC_CONFIG_FILES([Makefile:zardoz.in:two.in:three.in]) > +AC_OUTPUT > END > > : > zardoz.am > @@ -41,15 +42,14 @@ test -f zardoz.in > > # The generated file should refer to zardoz.in and zardoz.am, but > # never just "zardoz". > -echo Grep1 > -grep zardoz zardoz.in | $FGREP -v 'zardoz.in' | $FGREP -v 'zardoz.am' > O || > : > -# We cat the output file so we see in when verbose. > -cat O > -test -z "`cat O`" > - > -# Makefile should depend on two.in. > -echo Grep2 > -grep '^Makefile:.* \$(srcdir)/two.in' zardoz.in > -# Likewise three.in. > -echo Grep3 > -grep '^Makefile:.* \$(srcdir)/three.in' zardoz.in > +$PERL -ne ' > + s/\bzardoz\.(in|am)\b/zrdz.$1/g; > + print if /zardoz/; > +' <zardoz.in >out > +test ! -s out || { cat out; Exit 1; } Your changes seem to have valued efficiency so far. But calling perl is bound to be more expensive than a couple of greps. The change looks good to me, how come you went this way though? Just curious. > +# Makefile should depend on two.in and three.in. > +grep '^Makefile:.* \$(srcdir)/two\.in' zardoz.in > +grep '^Makefile:.* \$(srcdir)/three\.in' zardoz.in FYI, such greps can break in the future, if the dependency lines happen to be line-wrapped. Yes, this has been there before. > --- a/tests/colon5.test > +++ b/tests/colon5.test > @@ -21,16 +21,31 @@ > > set -e > > -cat > configure.in << 'END' > -AC_INIT > -AM_INIT_AUTOMAKE(nonesuch, nonesuch) > -AC_OUTPUT(Makefile:Makefile.in:Makefile.dep) > +cat > configure.in <<END > +AC_INIT([$me], [1.0]) > +AM_INIT_AUTOMAKE > +AC_CONFIG_FILES([Makefile:Makefile.in:Makefile.dep]) > +AC_OUTPUT > END > > -: > Makefile.am > : > Makefile.dep > > +cat > Makefile.am <<'END' > +.PHONY: test > +test: > + case ' $(DIST_COMMON) ' in \ > + *' $(srcdir)/Makefile.dep '*) exit 0;; \ Hmm. The variable might just as validly list Makefile.dep, without preceding `$(srcdir)/'. That is really necessary only if the file is listed both as a prerequisite and as a target somewhere in the makefile. > + *) exit 1;; \ > + esac > +END > + > $ACLOCAL > $AUTOMAKE > > -grep 'Makefile:Makefile.in' Makefile.in > +grep 'Makefile:Makefile\.in' Makefile.in > +grep '^Makefile:.* \$(srcdir)/Makefile\.dep' Makefile.in > + > +sed '/@SET_MAKE@/d' <Makefile.in >Makefile.sed > +$MAKE -f Makefile.sed SHELL=$SHELL test I see this idiom is used a couple of times in the testsuite. How come? Because running ./configure is a bit more expensive than sed? Thanks, Ralf