automake-patches
[Top][All Lists]
Advanced

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

[PATCH] Modernize, improve and/or tweak various test scripts.


From: Stefano Lattarini
Subject: [PATCH] Modernize, improve and/or tweak various test scripts.
Date: Sun, 27 Jun 2010 19:27:03 +0200
User-agent: KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.4; i686; ; )

And another round of testsuite tweaking.

Regards,
    Stefano

-*-*-*-

Modernize, improve and/or tweak various test scripts.

* tests/depend2.test: Cosmetic changes.
* tests/spy.test: Likewise.
* tests/stamph2.test: Likewise, and improve m4 quoting in
`configure.in'.
* tests/syntax.test: Escape literal dots in grep regexps.
* tests/copy.test: Enable `errexit' shell flag.  Extend test by
checking with `test' utility that the script `install-sh' is
copied, but not symlinked.
* tests/depdist.test: Move setting of `errexit' shell flag earlier
in the script (just after inclusion of ./defs).  Avoid obsoleted
constructs in generated `configure.in'.  To ensure that the script
`config/depcomp' is distributed, get and grep the contents of the
$(DIST_COMMON) variable in Makefile.in, rather than simply grepping
the Makefile.in.
* tests/target-cflags: Move setting of `errexit' shell flag
earlier in the script (just after inclusion of ./defs). Use the
`configure.in' stub created by `./defs', rather than writing it
from scratch.
* tests/target-clash: Do not uselessly run autoconf.
* tests/ctarget1.test: Renamed ...
* tests/cond1.test: ... to this. Use the `configure.in' stub
created by `./defs', rather than writing it from scratch.
Move setting of `errexit' shell flag earlier in the script (just
after inclusion of ./defs).  Other minor cosmetic changes.
* tests/Makefile.am (TESTS): Updated.
---
 ChangeLog                           |   29 ++++++++++++++++++++++++++
 tests/Makefile.am                   |    2 +-
 tests/Makefile.in                   |    2 +-
 tests/{ctarget1.test => cond1.test} |   20 +++++++++---------
 tests/copy.test                     |   11 ++++++++-
 tests/depdist.test                  |   39 ++++++++++++++++++++++++----------
 tests/depend2.test                  |    5 ++-
 tests/spy.test                      |    4 ++-
 tests/stamph2.test                  |   18 ++++++++--------
 tests/syntax.test                   |    7 ++++-
 tests/target-cflags.test            |   12 +++++-----
 tests/targetclash.test              |    5 ++-
 12 files changed, 106 insertions(+), 48 deletions(-)
 rename tests/{ctarget1.test => cond1.test} (81%)
From 0e79f7782b0207debc5df22faa72fdda43b34167 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Mon, 21 Jun 2010 18:07:09 +0200
Subject: [PATCH] Modernize, improve and/or tweak various test scripts.

* tests/depend2.test: Cosmetic changes.
* tests/spy.test: Likewise.
* tests/stamph2.test: Likewise, and improve m4 quoting in
`configure.in'.
* tests/syntax.test: Escape literal dots in grep regexps.
* tests/copy.test: Enable `errexit' shell flag.  Extend test by
checking with `test' utility that the script `install-sh' is
copied, but not symlinked.
* tests/depdist.test: Move setting of `errexit' shell flag earlier
in the script (just after inclusion of ./defs).  Avoid obsoleted
constructs in generated `configure.in'.  To ensure that the script
`config/depcomp' is distributed, get and grep the contents of the
$(DIST_COMMON) variable in Makefile.in, rather than simply grepping
the Makefile.in.
* tests/target-cflags: Move setting of `errexit' shell flag
earlier in the script (just after inclusion of ./defs). Use the
`configure.in' stub created by `./defs', rather than writing it
from scratch.
* tests/target-clash: Do not uselessly run autoconf.
* tests/ctarget1.test: Renamed ...
* tests/cond1.test: ... to this. Use the `configure.in' stub
created by `./defs', rather than writing it from scratch.
Move setting of `errexit' shell flag earlier in the script (just
after inclusion of ./defs).  Other minor cosmetic changes.
* tests/Makefile.am (TESTS): Updated.
---
 ChangeLog                           |   29 ++++++++++++++++++++++++++
 tests/Makefile.am                   |    2 +-
 tests/Makefile.in                   |    2 +-
 tests/{ctarget1.test => cond1.test} |   20 +++++++++---------
 tests/copy.test                     |   11 ++++++++-
 tests/depdist.test                  |   39 ++++++++++++++++++++++++----------
 tests/depend2.test                  |    5 ++-
 tests/spy.test                      |    4 ++-
 tests/stamph2.test                  |   18 ++++++++--------
 tests/syntax.test                   |    7 ++++-
 tests/target-cflags.test            |   12 +++++-----
 tests/targetclash.test              |    5 ++-
 12 files changed, 106 insertions(+), 48 deletions(-)
 rename tests/{ctarget1.test => cond1.test} (81%)

diff --git a/ChangeLog b/ChangeLog
index 4366381..9bf0b16 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2010-06-27  Stefano Lattarini  <address@hidden>
+
+       Modernize, improve and/or tweak various test scripts.
+       * tests/depend2.test: Cosmetic changes.
+       * tests/spy.test: Likewise.
+       * tests/stamph2.test: Likewise, and improve m4 quoting in
+       `configure.in'.
+       * tests/syntax.test: Escape literal dots in grep regexps.
+       * tests/copy.test: Enable `errexit' shell flag.  Extend test by
+       checking with `test' utility that the script `install-sh' is
+       copied, but not symlinked.
+       * tests/depdist.test: Move setting of `errexit' shell flag earlier
+       in the script (just after inclusion of ./defs).  Avoid obsoleted
+       constructs in generated `configure.in'.  To ensure that the script
+       `config/depcomp' is distributed, get and grep the contents of the
+       $(DIST_COMMON) variable in Makefile.in, rather than simply grepping
+       the Makefile.in.
+       * tests/target-cflags: Move setting of `errexit' shell flag
+       earlier in the script (just after inclusion of ./defs). Use the
+       `configure.in' stub created by `./defs', rather than writing it
+       from scratch.
+       * tests/target-clash: Do not uselessly run autoconf.
+       * tests/ctarget1.test: Renamed ...
+       * tests/cond1.test: ... to this. Use the `configure.in' stub
+       created by `./defs', rather than writing it from scratch.
+       Move setting of `errexit' shell flag earlier in the script (just
+       after inclusion of ./defs).  Other minor cosmetic changes.
+       * tests/Makefile.am (TESTS): Updated.
+
 2010-06-26  Ralf Wildenhues  <address@hidden>
 
        Update program --help output to match current GCS.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index af20d3e..1c97c24 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -180,6 +180,7 @@ compile2.test \
 compile_f90_c_cxx.test \
 compile_f_c_cxx.test \
 cond.test \
+cond1.test \
 cond2.test \
 cond3.test \
 cond4.test \
@@ -252,7 +253,6 @@ copy.test \
 cscope.test \
 cscope2.test \
 cscope3.test \
-ctarget1.test \
 cxx.test \
 cxx2.test \
 cxxansi.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 592faa0..0e504d9 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -391,6 +391,7 @@ compile2.test \
 compile_f90_c_cxx.test \
 compile_f_c_cxx.test \
 cond.test \
+cond1.test \
 cond2.test \
 cond3.test \
 cond4.test \
@@ -463,7 +464,6 @@ copy.test \
 cscope.test \
 cscope2.test \
 cscope3.test \
-ctarget1.test \
 cxx.test \
 cxx2.test \
 cxxansi.test \
diff --git a/tests/ctarget1.test b/tests/cond1.test
similarity index 81%
rename from tests/ctarget1.test
rename to tests/cond1.test
index d2191f6..0609ec1 100755
--- a/tests/ctarget1.test
+++ b/tests/cond1.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 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,11 +18,11 @@
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AM_CONDITIONAL(TEST, true)
-AC_OUTPUT(Makefile)
+set -e
+
+cat >> configure.in << 'END'
+AM_CONDITIONAL([TEST], [true])
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -34,11 +34,11 @@ target: false
 endif
 END
 
-set -e
-
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
+
 grep 'address@hidden@target: true' Makefile.in
 grep 'address@hidden@  action' Makefile.in
 grep 'address@hidden@target: false' Makefile.in
-Exit 0
+
+:
diff --git a/tests/copy.test b/tests/copy.test
index 770ae51..e4199a1 100755
--- a/tests/copy.test
+++ b/tests/copy.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1999, 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,8 +18,15 @@
 
 . ./defs || Exit 1
 
+set -e
+
 : > Makefile.am
 rm -f install-sh
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE -c -a
+
+test -f install-sh
+test ! -h install-sh
+
+:
diff --git a/tests/depdist.test b/tests/depdist.test
index f36eb47..744ae3a 100755
--- a/tests/depdist.test
+++ b/tests/depdist.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 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,21 +19,24 @@
 
 . ./defs || Exit 1
 
+set -e
+
 rm -f configure.in
 
 mkdir config
 for i in *; do
-   if test $i != "config"; then
-      mv $i config
+   if test "$i" != "config"; then
+      mv -f "$i" config
    fi
 done
 
-cat > configure.in << 'END'
-AC_INIT(subdir/foo.c)
-AC_CONFIG_AUX_DIR(config)
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+cat > configure.in << END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([config])
+AM_INIT_AUTOMAKE
 AC_PROG_CC
-AC_OUTPUT(subdir/Makefile Makefile)
+AC_CONFIG_FILES([subdir/Makefile Makefile])
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -48,9 +51,21 @@ bin_PROGRAMS = foo
 foo_SOURCES = foo.c
 END
 
-set -e
-
 $ACLOCAL
 $AUTOMAKE --add-missing
-$AUTOCONF
-grep config/depcomp Makefile.in
+
+sed -n -e '/^DIST_COMMON =.*\\$/ {
+   :loop
+   p
+   n
+   t clear
+   :clear
+   s/\\$/\\/
+   t loop
+   p
+   n
+   }' -e '/^DIST_COMMON =/p' Makefile.in > dc.txt
+cat dc.txt # useful for debugging
+$FGREP config/depcomp dc.txt
+
+:
diff --git a/tests/depend2.test b/tests/depend2.test
index 57d87d7..b3b0a19 100755
--- a/tests/depend2.test
+++ b/tests/depend2.test
@@ -52,9 +52,10 @@ $AUTOCONF
 $AUTOMAKE -a
 
 # Ignore user CFLAGS.
-CFLAGS=
-export CFLAGS
+unset CFLAGS
 
 ./configure --disable-dependency-tracking
 
 $MAKE
+
+:
diff --git a/tests/spy.test b/tests/spy.test
index c4993c6..7edecdc 100755
--- a/tests/spy.test
+++ b/tests/spy.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -92,3 +92,5 @@ $sleep
 touch c
 $MAKE
 test "`cat a`" = rule2
+
+:
diff --git a/tests/stamph2.test b/tests/stamph2.test
index cb96d27..aa07743 100755
--- a/tests/stamph2.test
+++ b/tests/stamph2.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -20,14 +20,14 @@
 set -e
 
 cat >> configure.in << END
-AM_CONFIG_HEADER(1.h
-                 2.h:config.hin
-                 3.h:sdir1/config1.hin)
+AM_CONFIG_HEADER([1.h
+                  2.h:config.hin
+                  3.h:sdir1/config1.hin])
 # AM_CONFIG_HEADER and AC_CONFIG_HEADERS should be synonyms.
-AC_CONFIG_HEADERS(sdir1/4.h
-                  sdir1/5.h:config.hin
-                  sdir1/6.h:sdir1/config1.hin
-                  sdir1/7.h:sdir2/config2.hin)
+AC_CONFIG_HEADERS([sdir1/4.h
+                   sdir1/5.h:config.hin
+                   sdir1/6.h:sdir1/config1.hin
+                   sdir1/7.h:sdir2/config2.hin])
 AC_OUTPUT
 END
 
@@ -68,4 +68,4 @@ test ! -f sdir1/stamp-h5
 test ! -f sdir1/stamp-h6
 test -f sdir1/stamp-h7
 
-Exit 0
+:
diff --git a/tests/syntax.test b/tests/syntax.test
index 505486f..3b2a4e5 100755
--- a/tests/syntax.test
+++ b/tests/syntax.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1998, 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
@@ -28,4 +29,6 @@ END
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'Makefile.am:2:.*blank line' stderr
+grep 'Makefile\.am:2:.*blank line' stderr
+
+:
diff --git a/tests/target-cflags.test b/tests/target-cflags.test
index b324568..f3ac9cc 100755
--- a/tests/target-cflags.test
+++ b/tests/target-cflags.test
@@ -21,12 +21,12 @@
 required=gcc
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT(foo.c)
-AM_INIT_AUTOMAKE(target-cflags,0.0)
+set -e
+
+cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
-AC_OUTPUT(Makefile)
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -54,8 +54,6 @@ int main(void)
 #endif
 END
 
-set -e
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
@@ -72,3 +70,5 @@ cd ..
 $MAKE
 ./foo
 ./bar
+
+:
diff --git a/tests/targetclash.test b/tests/targetclash.test
index 0433b41..87e37a8 100755
--- a/tests/targetclash.test
+++ b/tests/targetclash.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -30,6 +30,7 @@ bin_PROGRAMS = ctags
 END
 
 $ACLOCAL
-$AUTOCONF
 AUTOMAKE_fails -a
 grep 'redefinition.*ctags' stderr
+
+:
-- 
1.6.5


reply via email to

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