automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Modernize, improve and/or extend tests `colon*.test.


From: Stefano Lattarini
Subject: [PATCH] Modernize, improve and/or extend tests `colon*.test.
Date: Sat, 12 Jun 2010 23:48:15 +0200
User-agent: KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.4; i686; ; )

Another patch tweaking scripts in the testsuite.

Regards,
    Stefano

-*-*-*-

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.
* tests/colon4.test: Enable the `errexit' shell flag, and
related changes.  Also, 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.  Also, improve the generated `configure.in' file.
* tests/colon2.test: Likewise.  Also, add some new checks.
* tests/colon5.test: Improve the generated `configure.in' file.
Add new, much deeper checks.
* tests/colon6.test: Likewise.
* tests/colon3.test: Improve the generated `configure.in' file.
Prefer 'test ! -s FILE' over 'test -z "`cat FILE`"' to verify
that a file is empty.  Prefer perl over pipelined grep.  Made
stricter.  Other changes (cosmetic and not).
---
 ChangeLog         |   20 ++++++++++++++++++++
 tests/colon.test  |    8 +++-----
 tests/colon2.test |   26 ++++++++++++++++----------
 tests/colon3.test |   36 ++++++++++++++++++------------------
 tests/colon4.test |   16 +++++++++-------
 tests/colon5.test |   27 +++++++++++++++++++++------
 tests/colon6.test |   27 ++++++++++++++++++++++-----
 tests/colon7.test |   15 +++++++++------
From 44f10fe8c6fa5f6ff42f7efeb6963b927d4cbd1d Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 11 Jun 2010 19:01:00 +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.
* tests/colon4.test: Enable the `errexit' shell flag, and
related changes.  Also, 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.  Also, improve the generated `configure.in' file.
* tests/colon2.test: Likewise.  Also, add some new checks.
* tests/colon5.test: Improve the generated `configure.in' file.
Add new, much deeper checks.
* tests/colon6.test: Likewise.
* tests/colon3.test: Improve the generated `configure.in' file.
Prefer 'test ! -s FILE' over 'test -z "`cat FILE`"' to verify
that a file is empty.  Prefer perl over pipelined grep.  Made
stricter.  Other changes (cosmetic and not).
---
 ChangeLog         |   20 ++++++++++++++++++++
 tests/colon.test  |    8 +++-----
 tests/colon2.test |   26 ++++++++++++++++----------
 tests/colon3.test |   36 ++++++++++++++++++------------------
 tests/colon4.test |   16 +++++++++-------
 tests/colon5.test |   27 +++++++++++++++++++++------
 tests/colon6.test |   27 ++++++++++++++++++++++-----
 tests/colon7.test |   15 +++++++++------
 8 files changed, 118 insertions(+), 57 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c4e69a5..309b3e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2010-06-12  Stefano Lattarini  <address@hidden>
+
+       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.
+       * tests/colon4.test: Enable the `errexit' shell flag, and
+       related changes.  Also, 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.  Also, improve the generated `configure.in' file.
+       * tests/colon2.test: Likewise.  Also, add some new checks.
+       * tests/colon5.test: Improve the generated `configure.in' file.
+       Add new, much deeper checks.
+       * tests/colon6.test: Likewise.
+       * tests/colon3.test: Improve the generated `configure.in' file.
+       Prefer 'test ! -s FILE' over 'test -z "`cat FILE`"' to verify
+       that a file is empty.  Prefer perl over pipelined grep.  Made
+       stricter.  Other changes (cosmetic and not).
+
 2010-06-12  Ralf Wildenhues  <address@hidden>
 
        Remove a couple of unneeded conditionals from tests.
diff --git a/tests/colon.test b/tests/colon.test
index da7a9da..269e6b8 100755
--- a/tests/colon.test
+++ b/tests/colon.test
@@ -22,15 +22,13 @@
 
 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 ebb2bfe..a52dfa8 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 <<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
+
+:
diff --git a/tests/colon3.test b/tests/colon3.test
index 6fed8b9..3f37548 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 <<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; }
+
+# Makefile should depend on two.in and three.in.
+grep '^Makefile:.* \$(srcdir)/two\.in' zardoz.in
+grep '^Makefile:.* \$(srcdir)/three\.in' zardoz.in
+
+:
diff --git a/tests/colon4.test b/tests/colon4.test
index cec3c86..97a4479 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 <<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
diff --git a/tests/colon5.test b/tests/colon5.test
index fe97f99..26f10e4 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 <<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;; \
+         *) 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
+
+:
diff --git a/tests/colon6.test b/tests/colon6.test
index 99877c5..4fb738e 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 <<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
+
+:
diff --git a/tests/colon7.test b/tests/colon7.test
index 4df6a13..9c6f1a6 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,11 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AC_INIT([colon7], [1.0])
+AM_INIT_AUTOMAKE
 AC_OUTPUT(subdir/bar:subdir/foo \
    Makefile \
    subdir/Makefile
@@ -34,8 +37,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 +46,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
+:
-- 
1.6.5


reply via email to

[Prev in Thread] Current Thread [Next in Thread]