From: Stefano Lattarini Date: Sat, 9 Jun 2012 18:49:09 +0000 (+0200) Subject: [ng] tests: merge, tweak and modernize few test scripts X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=v1.12.1-343-gff30f83;p=thirdparty%2Fautomake.git [ng] tests: merge, tweak and modernize few test scripts * 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 ;-) Signed-off-by: Stefano Lattarini --- diff --git a/t/cxxcpp.sh b/t/cxxcpp.sh index cc69163ca..2eaefadc4 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 a754701d7..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 . - -# 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 795f92226..368b55601 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 810642607..87f534848 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 . -# 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 224c26dc1..000000000 --- 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 . - -# 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 4721db562..000000000 --- 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 . - -# 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 50b4f4a12..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 . - -# Make sure Fortran 77 files are rewritten to ".o" and not just "o". -# Matthew D. Langston - -. ./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 621253479..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 . - -# 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..fa2dda30f --- /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 . + +# 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 6cb6b363c..000000000 --- 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 . - -# 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 aff03b8c8..000000000 --- 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 . - -# 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 78cf237b2..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 . - -# 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 - -: