]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Modernize, improve and/or extend tests `colon*.test.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 18 Jun 2010 10:12:54 +0000 (12:12 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 10 Aug 2010 17:39:22 +0000 (19:39 +0200)
* 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
tests/colon.test
tests/colon2.test
tests/colon3.test
tests/colon4.test
tests/colon5.test
tests/colon6.test
tests/colon7.test

index b18c57127511754bc610a78ed26d3a1a91a198e8..eff021293fde09d427cb7fed1a3bebc70619eaf8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
 2010-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       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
index da7a9da3ee74287d84d4baa17b24928b72e44a65..22b5ed3358c0705b50dfd04469ade1f35034768d 100755 (executable)
 
 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
+
+:
index ebb2bfee14555981e97bdddfaaebce2d3476d98a..a52dfa8659b3ea680d5aaa9f5bfeb0b656f4a5d7 100755 (executable)
@@ -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
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(Makefile:zardoz.in)
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile:zardoz.in])
+AC_OUTPUT
 END
 
-: > 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
+
+:
index 6fed8b96b258b77f32dbe3c5a4df802c0483ce14..151d0150a6d2f5bd0340a2626690e5948162803a 100755 (executable)
@@ -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
 
 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
@@ -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' \
+  <zardoz.in | $FGREP 'zardoz' && Exit 1
+
+# FIXME: Do something like this after planned enahncements to tests/defs.
+# FIXME: Or even do proper functional testing.
+## Also, Makefile should depend on two.in and three.in.
+# extract_makefile_deps Makefile zardoz.in > 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
+
+:
index cec3c86153ca1876688d3bb98d972721390310e8..97a447914c44d211a55bbcf6c582714753611473 100755 (executable)
@@ -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
 
 . ./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 <<END
+AC_CONFIG_FILES([zardoz:two:three])
+AC_OUTPUT
 END
 
 : > 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
index fe97f99cea5e3add2c9c65600f9cab7677328425..c53910e67dcb54fd5e638f843ed45b20c8e782c0 100755 (executable)
 
 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 '*|*' 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.in >Makefile.sed
+$MAKE -f Makefile.sed SHELL=$SHELL test
+
+:
index 99877c5f6c9f96d3115dae3ce980122f659044dc..4fb738e68ffda5550bcb6421c8468c8c78e49968 100755 (executable)
 
 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 <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([demo/Makefile demo/version.good:demo/version.gin])
+AC_OUTPUT
 END
 
 mkdir demo
 
-: > 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' <demo/Makefile.in >Makefile.sed
+$MAKE -f Makefile.sed SHELL=$SHELL test
+
+:
index 4df6a1302313e3f11c8faedd6035494d16041d96..4195188a2398e98ccdda4c8cc6280f3ad59a0766 100755 (executable)
@@ -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
 
 . ./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
+: