summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-06-09 20:49:09 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-10-27 16:10:42 +0200
commit9a2796ad854c70c221c9d19956264246d9783430 (patch)
treea080d421c5fd30e2d64c3d6a9877f7476e45aba0 /t
parent44d202536a5fd0ac670eef7f43326093c8c9bc5b (diff)
downloadautomake-9a2796ad854c70c221c9d19956264246d9783430.tar.gz
tests: merge, tweak and modernize few test scripts
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 <stefano.lattarini@gmail.com>
Diffstat (limited to 't')
-rwxr-xr-xt/cxxcpp.sh4
-rwxr-xr-xt/cxxo.sh34
-rwxr-xr-xt/empty-data-primary.sh (renamed from t/empty.sh)0
-rwxr-xr-xt/empty-sources-primary.tap (renamed from t/empty4.sh)27
-rwxr-xr-xt/empty2.sh35
-rwxr-xr-xt/empty3.sh32
-rwxr-xr-xt/fo.sh36
-rw-r--r--t/list-of-tests.mk13
-rwxr-xr-xt/no-outdir-option.sh29
-rwxr-xr-xt/per-target-flags.sh100
-rwxr-xr-xt/specflg.sh51
-rwxr-xr-xt/specflg2.sh59
-rwxr-xr-xt/specflg3.sh43
13 files changed, 125 insertions, 338 deletions
diff --git a/t/cxxcpp.sh b/t/cxxcpp.sh
index f2bb75a60..cd5d392a9 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 4a021311d..000000000
--- 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
index a8e1b1678..a8e1b1678 100755
--- a/t/empty.sh
+++ b/t/empty-data-primary.sh
diff --git a/t/empty4.sh b/t/empty-sources-primary.tap
index 1233f4097..3e5b3f400 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 47a079256..000000000
--- 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 f77f4396a..000000000
--- 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 4ca1a0562..000000000
--- 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 <langston@SLAC.Stanford.EDU>
-
-. ./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 84788e0a6..e38e7ffb9 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 59987b59d..000000000
--- 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 000000000..e5278fb27
--- /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 c56c6aa59..000000000
--- 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 4560715c1..000000000
--- 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 9c56acaf5..000000000
--- 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
-
-: