automake-ng
[Top][All Lists]
Advanced

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

[Automake-NG] [PATCH] [ng] tests: merge, tweak and modernize few test sc


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH] [ng] tests: merge, tweak and modernize few test scripts
Date: Sat, 9 Jun 2012 20:51:10 +0200

* 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 ever for the most test-infected person ;-)

Signed-off-by: Stefano Lattarini <address@hidden>
---
 
 I intend to push this by tomorrow.

 Regards,
   Stefano

 t/cxxcpp.sh                                |    4 +-
 t/cxxo.sh                                  |   34 ----------
 t/{empty.sh => empty-data-primary.sh}      |    2 +
 t/{empty4.sh => empty-sources-primary.tap} |   27 +++++---
 t/empty2.sh                                |   36 -----------
 t/empty3.sh                                |   34 ----------
 t/fo.sh                                    |   36 -----------
 t/no-outdir-option.sh                      |   29 ---------
 t/per-target-flags.sh                      |   96 ++++++++++++++++++++++++++++
 t/specflg.sh                               |   53 ---------------
 t/specflg2.sh                              |   62 ------------------
 t/specflg3.sh                              |   43 -------------
 12 files changed, 120 insertions(+), 336 deletions(-)
 delete mode 100755 t/cxxo.sh
 rename t/{empty.sh => empty-data-primary.sh} (99%)
 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 cc69163..2eaefad 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 a754701..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 99%
rename from t/empty.sh
rename to t/empty-data-primary.sh
index 795f922..368b556 100755
--- a/t/empty.sh
+++ b/t/empty-data-primary.sh
@@ -27,3 +27,5 @@ $AUTOCONF
 $AUTOMAKE
 ./configure --prefix "`pwd`/inst"
 $MAKE install
+
+:
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 8106426..87f5348 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 224c26d..0000000
--- a/t/empty2.sh
+++ /dev/null
@@ -1,36 +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\.' Makefile.in && Exit 1
-
-:
diff --git a/t/empty3.sh b/t/empty3.sh
deleted file mode 100755
index 4721db5..0000000
--- a/t/empty3.sh
+++ /dev/null
@@ -1,34 +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
-
-$FGREP ' pavel.c' Makefile.in
-
-:
diff --git a/t/fo.sh b/t/fo.sh
deleted file mode 100755
index 50b4f4a..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/no-outdir-option.sh b/t/no-outdir-option.sh
deleted file mode 100755
index 6212534..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..fa2dda3
--- /dev/null
+++ b/t/per-target-flags.sh
@@ -0,0 +1,96 @@
+#! /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
+
+cat > configure.ac << END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([-Wno-extra-portability])
+AC_CONFIG_FILES([Makefile libMakefile Makefile2 libMakefile2])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_CXX
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+$ACLOCAL
+
+makefiles='Makefile libMakefile Makefile2 libMakefile2'
+
+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
+
+: > compile
+$AUTOMAKE
+
+# 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 && Exit 1
+grep 'COMPILE. .[^c]' $makefiles && 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 6cb6b36..0000000
--- a/t/specflg.sh
+++ /dev/null
@@ -1,53 +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
-
-$FGREP 'foo-foo.$(OBJEXT)' Makefile.in
-
-# Watch against "$(COMPILE) -c" in "%.o: %.c" rule.
-grep 'COMPILE. [^-]' Makefile.in && Exit 1
-
-# Watch against "foo.$(OBJEXT)", "foo.o" and "foo.obj".
-grep '[^-]foo\.[o$]' Makefile.in && Exit 1
-
-# Regression test for missing space.
-$FGREP ')-c' Makefile.in && Exit 1
-
-:
diff --git a/t/specflg2.sh b/t/specflg2.sh
deleted file mode 100755
index aff03b8..0000000
--- a/t/specflg2.sh
+++ /dev/null
@@ -1,62 +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
-
-$FGREP 'libfoo_a-foo.$(OBJEXT)' Makefile.in
-$FGREP 'libfoo_a-bar.$(OBJEXT)' Makefile.in
-
-# Watch against "$(COMPILE) -c" in the "%.o: %c" rule.
-grep 'COMPILE. [^-]' Makefile.in && Exit 1
-
-# Watch against "foo.$(OBJEXT)", "foo.o" and "foo.obj".
-grep foo Makefile.in
-grep '[^-]foo\.[o$]' Makefile.in && Exit 1
-
-# Watch against "bar.$(OBJEXT)", "bar.o" and "bar.obj".
-grep bar Makefile.in
-grep '[^-]bar\.[o$]' Makefile.in && Exit 1
-
-:
diff --git a/t/specflg3.sh b/t/specflg3.sh
deleted file mode 100755
index 78cf237..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 'foo-foo.$(OBJEXT)' Makefile.in
-$FGREP 'foo.o.o' Makefile.in && Exit 1
-$FGREP 'foo.$(OBJEXT).$(OBJEXT)' Makefile.in && Exit 1
-$FGREP '$(foo_CFLAGS)' Makefile.in
-
-:
-- 
1.7.9.5




reply via email to

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