From f9fe878b53bca8297dbb6df861a99632f2f9b5b3 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Fri, 18 Jun 2010 12:12:54 +0200 Subject: [PATCH] Modernize, improve and/or extend tests `colon*.test. * tests/colon.test: Rely on the `configure.in' stub created by `./defs', rather than writing one from scratch. Do not create a useless dummy file. Add trailing `:' command. * tests/colon4.test: Enable the `errexit' shell flag, and related changes. Rely on the `configure.in' stub created by `./defs', rather than writing one from scratch. * tests/colon7.test: Enable `errexit' shell flag, and related changes. Improve the generated `configure.in' file. Add trailing `:' command. * tests/colon2.test: Likewise. Also, add some new checks. * tests/colon5.test: Improve the generated `configure.in' file. Add new, much deeper checks. Add trailing `:' command. * tests/colon6.test: Likewise. * tests/colon3.test: Improve the generated `configure.in' file. Prefer perl over pipelined grep. Made stricter. Other changes, cosmetic and not. --- ChangeLog | 19 +++++++++++++++++++ tests/colon.test | 10 +++++----- tests/colon2.test | 26 ++++++++++++++++---------- tests/colon3.test | 36 +++++++++++++++++++++--------------- tests/colon4.test | 16 +++++++++------- tests/colon5.test | 27 +++++++++++++++++++++------ tests/colon6.test | 27 ++++++++++++++++++++++----- tests/colon7.test | 16 ++++++++++------ 8 files changed, 123 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index b18c57127..eff021293 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,24 @@ 2010-08-08 Stefano Lattarini + Modernize, improve and/or extend tests `colon*.test. + * tests/colon.test: Rely on the `configure.in' stub created by + `./defs', rather than writing one from scratch. Do not create + a useless dummy file. Add trailing `:' command. + * tests/colon4.test: Enable the `errexit' shell flag, and + related changes. Rely on the `configure.in' stub created by + `./defs', rather than writing one from scratch. + * tests/colon7.test: Enable `errexit' shell flag, and related + changes. Improve the generated `configure.in' file. Add + trailing `:' command. + * tests/colon2.test: Likewise. Also, add some new checks. + * tests/colon5.test: Improve the generated `configure.in' file. + Add new, much deeper checks. Add trailing `:' command. + * tests/colon6.test: Likewise. + * tests/colon3.test: Add trailing `:' command. Remove useless + comments and echos. Improve the generated `configure.in' file. + make some grepping tests stricter. Add a "FIXME" comments about + planned improvements. + Improve and extend tests `asm*.test'. * tests/asm.test: Use configure.in stub generated by ./defs, and avoid obsoleted autoconf constructs. Make grepping of diff --git a/tests/colon.test b/tests/colon.test index da7a9da3e..22b5ed335 100755 --- a/tests/colon.test +++ b/tests/colon.test @@ -22,15 +22,15 @@ set -e -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) -AC_OUTPUT(Makefile foo.h:foo.hin) +cat >> configure.in <<'END' +AC_CONFIG_FILES([foo.h:foo.hin]) +AC_OUTPUT END : > Makefile.am : > foo.hin -: > stamp-h.in $ACLOCAL $AUTOMAKE + +: diff --git a/tests/colon2.test b/tests/colon2.test index ebb2bfee1..a52dfa865 100755 --- a/tests/colon2.test +++ b/tests/colon2.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1996, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996, 2000, 2001, 2002, 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 @@ -18,18 +19,23 @@ . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) -AC_OUTPUT(Makefile:zardoz.in) +set -e + +cat > configure.in < zardoz.am +echo 'dummy:' > zardoz.am -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE # We actually check several things here. -test -f zardoz.in || Exit 1 +test -f zardoz.in grep '^zardoz:' zardoz.in && Exit 1 -Exit 0 +grep '^dummy:' zardoz.in + +: diff --git a/tests/colon3.test b/tests/colon3.test index 6fed8b96b..151d0150a 100755 --- 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 < zardoz.am @@ -35,21 +36,26 @@ END $ACLOCAL $AUTOMAKE -# We actually check several things here. # Automake should have created zardoz.in. 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`" - +sed -e 's|zardoz\.am|zrdz.am|g' \ + -e 's|zardoz\.in|zrdz.in|g' \ + deps +#$FGREP ' $(srcdir)/two.in ' deps +#$FGREP ' $(srcdir)/three.in ' deps +# +# FIXME: for the moment, we content ourselves with these inferior tests. # 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 + +: diff --git a/tests/colon4.test b/tests/colon4.test index cec3c8615..97a447914 100755 --- a/tests/colon4.test +++ b/tests/colon4.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1998, 2000, 2001, 2002, 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 @@ -20,10 +21,11 @@ . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) -AC_OUTPUT(Makefile zardoz:one:two:three) +set -e + +cat >> configure.in < Makefile.am @@ -31,8 +33,8 @@ END : > two : > three -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE # The rule should regenerate the file "zardoz". grep '^zardoz:one:two' Makefile.in && Exit 1 diff --git a/tests/colon5.test b/tests/colon5.test index fe97f99ce..c53910e67 100755 --- 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 < Makefile.am : > Makefile.dep +cat > Makefile.am <<'END' +.PHONY: test +test: + case ' $(DIST_COMMON) ' in \ + *' $(srcdir)/Makefile.dep '*|*' Makefile.dep '*) exit 0;; \ + *) 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.sed +$MAKE -f Makefile.sed SHELL=$SHELL test + +: diff --git a/tests/colon6.test b/tests/colon6.test index 99877c5f6..4fb738e68 100755 --- a/tests/colon6.test +++ b/tests/colon6.test @@ -21,16 +21,33 @@ set -e -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) -AC_OUTPUT(demo/Makefile demo/version.good:demo/version.gin) +cat > configure.in < demo/Makefile.am : > demo/version.gin +cat > demo/Makefile.am <<'END' +.PHONY: test +test: + case ' $(DIST_COMMON) ' in \ + *' $(srcdir)/version.gin '*) exit 0;; \ + *) exit 1;; \ + esac +END + $ACLOCAL $AUTOMAKE + +$EGREP 'Makefile:.*(demo|version)' demo/Makefile.in && Exit 1 +grep 'version\.good:.*version\.gin' demo/Makefile.in + +sed '/@SET_MAKE@/d' Makefile.sed +$MAKE -f Makefile.sed SHELL=$SHELL test + +: diff --git a/tests/colon7.test b/tests/colon7.test index 4df6a1302..4195188a2 100755 --- a/tests/colon7.test +++ b/tests/colon7.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1998, 2000, 2001, 2002, 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 @@ -19,9 +20,12 @@ . ./defs || Exit 1 +set -e + cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) +AC_INIT([colon7], [1.0]) +AM_INIT_AUTOMAKE +dnl: Please do not add proper m4 quoting here. AC_OUTPUT(subdir/bar:subdir/foo \ Makefile \ subdir/Makefile @@ -34,8 +38,8 @@ mkdir subdir : > subdir/Makefile.am : > subdir/foo -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE # shouldn't have any bar.in grep 'bar.in' subdir/Makefile.in && Exit 1 @@ -43,4 +47,4 @@ grep 'bar.in' subdir/Makefile.in && Exit 1 # DIST_COMMON should have foo, not subdir/foo grep 'DIST_COMMON.*subdir/foo' subdir/Makefile.in && Exit 1 -Exit 0 +: -- 2.47.2