automake-patches
[Top][All Lists]
Advanced

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

[FYI] {maint} tests: merge, tweak and modernize few test scripts


From: Stefano Lattarini
Subject: [FYI] {maint} tests: merge, tweak and modernize few test scripts
Date: Sat, 27 Oct 2012 16:13:53 +0200

Basically an adjusted-and-improved cherry-pick from Automake-NG
commit v1.12.1-343-gff30f83.

* t/specflg.sh, t/specflg2.sh, t/specflg3.sh: Merged into ...
* t/per-target-flags.sh: ... this test.
* t/fo.sh: Remove, its weak grepping checks well superseded by
the semantic checks in 't/fort4.sh'.
* t/cxxo.sh: Remove, its weak grepping checks well superseded
by the semantic checks in 't/cxx-demo.sh'.
* t/cxxcpp.sh: Enhance a little.
* t/empty.sh: Renamed ...
* t/empty-data-primary.sh: ... to this.  Add trailing ':' command.
* t/empty2.sh, t/empty3.sh, t/empty4.sh: Merged ...
* t/empty-sources-primary.tap: ... into this new test.
* t/no-outdir-option.sh: Remove.  A test to check than an obsolete
and now deleted option ("--output-dir") stays deleted is way too
much even for the most test-infected person ;-)
* t/list-of-tests.mk: Adjust.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 t/cxxcpp.sh                                |   4 +-
 t/cxxo.sh                                  |  34 ----------
 t/{empty.sh => empty-data-primary.sh}      |   0
 t/{empty4.sh => empty-sources-primary.tap} |  27 +++++---
 t/empty2.sh                                |  35 ----------
 t/empty3.sh                                |  32 ---------
 t/fo.sh                                    |  36 -----------
 t/list-of-tests.mk                         |  13 +---
 t/no-outdir-option.sh                      |  29 ---------
 t/per-target-flags.sh                      | 100 +++++++++++++++++++++++++++++
 t/specflg.sh                               |  51 ---------------
 t/specflg2.sh                              |  59 -----------------
 t/specflg3.sh                              |  43 -------------
 13 files changed, 125 insertions(+), 338 deletions(-)
 delete mode 100755 t/cxxo.sh
 rename t/{empty.sh => empty-data-primary.sh} (100%)
 rename t/{empty4.sh => empty-sources-primary.tap} (63%)
 delete mode 100755 t/empty2.sh
 delete mode 100755 t/empty3.sh
 delete mode 100755 t/fo.sh
 delete mode 100755 t/no-outdir-option.sh
 create mode 100755 t/per-target-flags.sh
 delete mode 100755 t/specflg.sh
 delete mode 100755 t/specflg2.sh
 delete mode 100755 t/specflg3.sh

diff --git a/t/cxxcpp.sh b/t/cxxcpp.sh
index f2bb75a..cd5d392 100755
--- a/t/cxxcpp.sh
+++ b/t/cxxcpp.sh
@@ -27,4 +27,6 @@ END
 $ACLOCAL
 $AUTOMAKE
 
-grep '^CXXCPP' Makefile.in
+grep '^CXXCPP =' Makefile.in
+
+:
diff --git a/t/cxxo.sh b/t/cxxo.sh
deleted file mode 100755
index 4a02131..0000000
--- a/t/cxxo.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1996-2012 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Make sure C++ files are rewritten to ".o" and not just "o".
-. ./defs || exit 1
-
-cat >> configure.ac << 'END'
-AC_PROG_CXX
-END
-
-cat > Makefile.am << 'END'
-sbin_PROGRAMS = anonymous
-anonymous_SOURCES = doe.C
-END
-
-: > doe.C
-
-$ACLOCAL
-$AUTOMAKE
-
-$FGREP 'doe.$(OBJEXT)' Makefile.in
diff --git a/t/empty.sh b/t/empty-data-primary.sh
similarity index 100%
rename from t/empty.sh
rename to t/empty-data-primary.sh
diff --git a/t/empty4.sh b/t/empty-sources-primary.tap
similarity index 63%
rename from t/empty4.sh
rename to t/empty-sources-primary.tap
index 1233f40..3e5b3f4 100755
--- a/t/empty4.sh
+++ b/t/empty-sources-primary.tap
@@ -14,25 +14,36 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure empty _SOURCES works.
-# From Paul Berrevoets.
+# A test for missing _SOURCES variable.  Also test to make sure empty
+# _SOURCES suppresses assumption about default name.
 
 . ./defs || exit 1
 
+plan_ 5
+
 cat >> configure.ac << 'END'
 AC_PROG_CC
-AC_SUBST(ZOO_OBJ)
+AC_SUBST([zoo_obj])
 END
 
 cat > Makefile.am << 'END'
+sbin_PROGRAMS = pavel
+
+bin_PROGRAMS = pavel2
+pavel2_SOURCES =
+
 noinst_PROGRAMS = zoo
 zoo_SOURCES =
 EXTRA_zoo_SOURCES = bar.c foo.c
-zoo_DEPENDENCIES = $(ZOO_OBJ)
+zoo_DEPENDENCIES = $(zoo_obj)
 zoo_LDADD = $(zoo_DEPENDENCIES)
 END
 
-$ACLOCAL
-$AUTOMAKE
-$FGREP zoo. Makefile.in && exit 1
-exit 0
+command_ok_ "aclocal" $ACLOCAL
+command_ok_ "automake" $AUTOMAKE
+
+command_ok_ "default _SOURCES" $FGREP ' pavel.c' Makefile.in
+command_ok_ "empty _SOURCES (basic)" not $FGREP 'pavel2.' Makefile.in
+command_ok_ "empty _SOURCES (elaborate)" not $FGREP 'zoo.' Makefile.in
+
+:
diff --git a/t/empty2.sh b/t/empty2.sh
deleted file mode 100755
index 47a0792..0000000
--- a/t/empty2.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1999-2012 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Test to make sure empty _SOURCES suppresses assumption about default
-# name.  Report from Pavel Roskin.
-
-. ./defs || exit 1
-
-cat >> configure.ac << 'END'
-AC_PROG_CC
-END
-
-cat > Makefile.am << 'END'
-bin_PROGRAMS = pavel
-pavel_SOURCES =
-END
-
-$ACLOCAL
-$AUTOMAKE
-
-grep 'pavel\.[co]' Makefile.in && exit 1
-exit 0
diff --git a/t/empty3.sh b/t/empty3.sh
deleted file mode 100755
index f77f439..0000000
--- a/t/empty3.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1999-2012 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# A test for missing _SOURCES variable.
-
-. ./defs || exit 1
-
-cat >> configure.ac << 'END'
-AC_PROG_CC
-END
-
-cat > Makefile.am << 'END'
-bin_PROGRAMS = pavel
-END
-
-$ACLOCAL
-$AUTOMAKE
-
-grep 'pavel\.[co]' Makefile.in
diff --git a/t/fo.sh b/t/fo.sh
deleted file mode 100755
index 4ca1a05..0000000
--- a/t/fo.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1998-2012 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Make sure Fortran 77 files are rewritten to ".o" and not just "o".
-# Matthew D. Langston <address@hidden>
-
-. ./defs || exit 1
-
-cat >> configure.ac << 'END'
-AC_PROG_F77
-END
-
-cat > Makefile.am << 'END'
-sbin_PROGRAMS = anonymous
-anonymous_SOURCES = doe.f
-END
-
-: > doe.f
-
-$ACLOCAL
-$AUTOMAKE
-
-$FGREP 'doe.$(OBJEXT)' Makefile.in
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 84788e0..e38e7ff 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -341,7 +341,6 @@ t/cxx-lt-demo.sh \
 t/cxxlibobj.sh \
 t/cxxlink.sh \
 t/cxxnoc.sh \
-t/cxxo.sh \
 t/cygnus-deprecation.sh \
 t/cygnus-check-without-all.sh \
 t/cygnus-dependency-tracking.sh \
@@ -428,10 +427,8 @@ t/dollarvar2.sh \
 t/double.sh \
 t/dup2.sh \
 t/else.sh \
-t/empty.sh \
-t/empty2.sh \
-t/empty3.sh \
-t/empty4.sh \
+t/empty-data-primary.sh \
+t/empty-sources-primary.tap \
 t/exdir.sh \
 t/exdir2.sh \
 t/exdir3.sh \
@@ -467,7 +464,6 @@ t/flibs.sh \
 t/fn99.sh \
 t/fn99subdir.sh \
 t/fnoc.sh \
-t/fo.sh \
 t/forcemiss.sh \
 t/forcemiss2.sh \
 t/fort1.sh \
@@ -701,7 +697,6 @@ t/mmode.sh \
 t/mmodely.sh \
 t/multlib.sh \
 t/no-extra-makefile-code.sh \
-t/no-outdir-option.sh \
 t/no-spurious-install-recursive.sh \
 t/nobase.sh \
 t/nobase-libtool.sh \
@@ -832,6 +827,7 @@ t/test-extensions-cond.sh \
 t/parse.sh \
 t/percent.sh \
 t/percent2.sh \
+t/per-target-flags.sh \
 t/phony.sh \
 t/pluseq.sh \
 t/pluseq2.sh \
@@ -991,9 +987,6 @@ t/silent-yacc-headers.sh \
 t/src-acsubst.sh \
 t/sourcefile-in-subdir.sh \
 t/space.sh \
-t/specflg.sh \
-t/specflg2.sh \
-t/specflg3.sh \
 t/specflg6.sh \
 t/specflg7.sh \
 t/specflg8.sh \
diff --git a/t/no-outdir-option.sh b/t/no-outdir-option.sh
deleted file mode 100755
index 59987b5..0000000
--- a/t/no-outdir-option.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2010-2012 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Check that the '-o' aka '--output-dir' option is not recognized anymore.
-
-. ./defs || exit 1
-
-: > Makefile.am
-
-AUTOMAKE_fails -Wno-error --output-dir=foo
-grep 'unrecognized option.*--output-dir' stderr
-
-AUTOMAKE_fails -Wno-error -o foo
-grep 'unrecognized option.*-o' stderr
-
-:
diff --git a/t/per-target-flags.sh b/t/per-target-flags.sh
new file mode 100755
index 0000000..e5278fb
--- /dev/null
+++ b/t/per-target-flags.sh
@@ -0,0 +1,100 @@
+#! /bin/sh
+# Copyright (C) 1999-2012 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test executable-specific and library-specific flags, both with
+# and without dependency tracking.
+
+. ./defs || Exit 1
+
+makefiles='Makefile libMakefile Makefile2 libMakefile2'
+
+cat > configure.ac << END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([-Wno-extra-portability])
+AC_CONFIG_FILES([$makefiles])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_CXX
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+$ACLOCAL
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+foo_SOURCES = foo.c
+foo_CFLAGS = -DBAR
+END
+
+cat > libMakefile.am << 'END'
+lib_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = foo.c bar.cc
+libfoo_a_CFLAGS = -DBAR
+libfoo_a_CXXFLAGS = -DZOT
+END
+
+cat - Makefile.am > Makefile2.am << 'END'
+AUTOMAKE_OPTIONS = no-dependencies
+END
+
+cat - libMakefile.am > libMakefile2.am << 'END'
+AUTOMAKE_OPTIONS = no-dependencies
+END
+
+# Make sure 'compile' is required.
+for m in $makefiles; do
+  AUTOMAKE_fails $m
+  $EGREP " required file.* '(compile|\./compile)'" stderr
+done
+
+makefiles=$(for mkf in $makefiles; do echo $mkf.in; done)
+
+: > compile
+$AUTOMAKE
+
+# Sanity check.
+for mkf in $makefiles; do test -f $mkf || exit 99; done
+
+# Regression test for missing space.
+$FGREP ')-c' $makefiles && exit 1
+
+# Regression test for botchedly transformed object names.
+$FGREP '.o.o' $makefiles && exit 1
+$FGREP '.obj.obj' $makefiles && exit 1
+$FGREP '.$(OBJEXT).$(OBJEXT)' $makefiles && exit 1
+
+# Watch against non-transformed "foo.$(OBJEXT)", "foo.o" and "foo.obj"
+# (and similarly for bar).
+$EGREP '[^-](foo|bar)\.[o$]' $makefiles && exit 1
+
+# All our programs and libraries have per-target flags, so all
+# the compilers invocations must use an explicit '-c' option.
+grep '\$.COMPILE' $makefiles | grep -v ' -c' && exit 1
+
+$FGREP 'foo-foo.$(OBJEXT)' Makefile.in
+$FGREP 'foo-foo.$(OBJEXT)' Makefile2.in
+$FGREP 'libfoo_a-foo.$(OBJEXT)' libMakefile.in
+$FGREP 'libfoo_a-foo.$(OBJEXT)' libMakefile2.in
+$FGREP 'libfoo_a-bar.$(OBJEXT)' libMakefile.in
+$FGREP 'libfoo_a-bar.$(OBJEXT)' libMakefile2.in
+
+$FGREP '$(foo_CFLAGS)' Makefile.in
+$FGREP '$(foo_CFLAGS)' Makefile2.in
+$FGREP '$(libfoo_a_CFLAGS)' libMakefile.in
+$FGREP '$(libfoo_a_CFLAGS)' libMakefile2.in
+
+:
diff --git a/t/specflg.sh b/t/specflg.sh
deleted file mode 100755
index c56c6aa..0000000
--- a/t/specflg.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1999-2012 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Test of flags specific to executable.
-
-. ./defs || exit 1
-
-cat >> configure.ac << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
-END
-
-cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = no-dependencies
-bin_PROGRAMS = foo
-foo_SOURCES = foo.c
-foo_CFLAGS = -DBAR
-END
-
-# Make sure 'compile' is required.
-$ACLOCAL
-AUTOMAKE_fails
-grep 'required.*compile' stderr
-
-: > compile
-
-$AUTOMAKE
-
-# Look for $(COMPILE) -c in .c.o rule.
-grep 'COMPILE. [^-]' Makefile.in && exit 1
-
-# Look for foo-foo.o.
-grep '[^-]foo\.o' Makefile.in && exit 1
-
-# Regression test for missing space.
-$FGREP ')-c' Makefile.in && exit 1
-
-exit 0
diff --git a/t/specflg2.sh b/t/specflg2.sh
deleted file mode 100755
index 4560715..0000000
--- a/t/specflg2.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1999-2012 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Test library-specific flags.
-
-. ./defs || exit 1
-
-cat >> configure.ac << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_PROG_CXX
-AM_PROG_AR
-AC_PROG_RANLIB
-END
-
-cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = no-dependencies
-lib_LIBRARIES = libfoo.a
-libfoo_a_SOURCES = foo.c bar.cc
-libfoo_a_CFLAGS = -DBAR
-libfoo_a_CXXFLAGS = -DZOT
-END
-
-: > ar-lib
-
-# Make sure 'compile' is required.
-$ACLOCAL
-AUTOMAKE_fails
-grep 'required.*compile' stderr
-
-: > compile
-
-$AUTOMAKE
-
-# Look for $(COMPILE) -c in .c.o rule.
-grep 'COMPILE. [^-]' Makefile.in && exit 1
-
-# Look for libfoo_a-foo.o.
-grep foo Makefile.in
-grep '[^-]foo\.o' Makefile.in && exit 1
-
-# Look for libfoo_a-bar.o.
-grep bar Makefile.in
-grep '[^-]bar\.o' Makefile.in && exit 1
-
-exit 0
diff --git a/t/specflg3.sh b/t/specflg3.sh
deleted file mode 100755
index 9c56aca..0000000
--- a/t/specflg3.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1999-2012 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Test exe-specific flags with dependency tracking.
-
-. ./defs || exit 1
-
-cat >> configure.ac << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-bin_PROGRAMS = foo
-foo_SOURCES = foo.c
-foo_CFLAGS = -DFOO
-END
-
-: > compile
-
-$ACLOCAL
-$AUTOMAKE
-
-$FGREP ' -o foo-foo' Makefile.in
-$FGREP 'foo.o.o' Makefile.in && exit 1
-$FGREP 'foo.$(OBJEXT).$(OBJEXT)' Makefile.in && exit 1
-$FGREP '$(foo_CFLAGS)' Makefile.in
-
-:
-- 
1.8.0




reply via email to

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