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
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
+
+:
#! /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
+
+:
#! /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
$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
+
+:
#! /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
: > 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
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
+
+:
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
+
+:
#! /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
: > 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
# DIST_COMMON should have foo, not subdir/foo
grep 'DIST_COMMON.*subdir/foo' subdir/Makefile.in && Exit 1
-Exit 0
+: