2010-06-09 Stefano Lattarini <stefano.lattarini@gmail.com>
+ Modernize, improve and/or fix various test scripts.
+ * tests/sanity.test: Rely on the `configure.in' stub created by
+ `./defs', rather than writing one from scratch.
+ * tests/depend2.test: Likewise. Also, call `set -e' just after
+ the inclusion of `./defs', instead that later in the script.
+ * tests/canon5.test: Avoid a useless `|| Exit 1' after a call to
+ $AUTOMAKE, and improve the positioning of an $ACLOCAL call.
+ * tests/exeext4.test: Use $FGREP instead of grep, where possible.
+ Make auxiliary rules in the generated Makefile more silent.
+ These changes make some checks slighty stricter.
+ * tests/ext2.test: Call `Exit 1' if inclusion of `./defs' fails.
+ * tests/gettext2.test: Place final `:' at the end of the script,
+ rather than in the middle.
+ * tests/exeext.test: Call `set -e' just after the inclusion of
+ `./defs', instead that later in the script.
+ * tests/extra5.test: Likewise.
+ * tests/confdeps.test: Likewise. Also, prefer `mv -f' over
+ plain `mv', just to be sure.
+ * tests/depcomp.test: Enable `errexit' shell flag, with related
+ changes. Also, modernize the generated configure.in.
+ * tests/cond9.test: Likewise. Also, rely on the `configure.in'
+ stub created by `./defs', rather than writing one from scratch.
+ * tests/cond10.test: Likewise.
+ * tests/depcomp2.test: Likewise.
+ * tests/depend3.test: Likewise.
+ * tests/distcom7.test: Likewise.
+ * tests/fortdep.test: Likewise. Also, remove definition of
+ AUTOMAKE_OPTIONS to `foreign' in the generated Makefile.am,
+ since that flag is already provided by $AUTOMAKE.
+ * tests/mdate.test: Made stricter, by checking that Automake
+ actually failed, and by making a stricter grep on the error
+ message. Also, set shell `errexit flag'.
+ * tests/python2.test: Improved verbose messages.
+
Make test `ammissing.test' stricter.
* tests/ammissing.test: Fail if $ACLOCAL succeds unexpectedly.
Enable `errexit' shell flag.
#! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
echo AC_PROG_CC >> configure.in
+$ACLOCAL
+
cat > Makefile.am << 'END'
bin_PROGRAMS = 123test
123test_SOURCES = 123.c
END
-$ACLOCAL
-$AUTOMAKE || Exit 1
+$AUTOMAKE
cat > Makefile.am << 'END'
bin_PROGRAMS = _foo
#! /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
. ./defs || Exit 1
-cat > configure.in << 'END'
-AC_INIT(Makefile.am)
-AM_INIT_AUTOMAKE(foo,0.0)
+set -e
+
+cat >> configure.in << 'END'
AC_PROG_CC
AM_CONDITIONAL(USE_A,[test x = y])
AM_CONDITIONAL(USE_B,[test x = z])
-AC_OUTPUT(Makefile)
+AC_OUTPUT
END
cat > Makefile.am << 'END'
foo_SOURCES=foo.c $(out)
END
-$ACLOCAL \
- && $AUTOMAKE -a \
- && grep 'USE_A_FALSE.*USE_B_FALSE.*output_c\...OBJEXT.' Makefile.in
+$ACLOCAL
+$AUTOMAKE -a
+grep 'USE_A_FALSE.*USE_B_FALSE.*output_c\...OBJEXT.' Makefile.in
#! /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
. ./defs || Exit 1
-cat > configure.in << 'END'
-AC_INIT(Makefile.am)
-AM_INIT_AUTOMAKE(foo,0.0)
+set -e
+
+cat >> configure.in << 'END'
AM_CONDITIONAL(WRONG, [test x = y])
-AC_OUTPUT(Makefile)
+AC_OUTPUT
END
cat > Makefile.am << 'END'
echo '$(this)'
END
-$ACLOCAL \
- && $AUTOCONF \
- && $AUTOMAKE -a \
- && ./configure \
- && $MAKE echo-something | grep interesting > /dev/null
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+./configure
+$MAKE echo-something | grep interesting > /dev/null
#! /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
. ./defs || Exit 1
-echo "FOO = foo" > Makefile.am
set -e
-echo "$me: Generated by aclocal..."
+echo "FOO = foo" > Makefile.am
+
$ACLOCAL
+
+echo "$me: Generated by aclocal..."
$AUTOMAKE
grep '^\$(ACLOCAL_M4):' Makefile.in
# Pretend it is not from aclocal (remove the signature),
# but keep it correct, i.e., with AM_INIT_AUTOMAKE etc.
sed -n '3,$p' aclocal.m4 >aclocal.m4t
-mv aclocal.m4t aclocal.m4
+mv -f aclocal.m4t aclocal.m4
$AUTOMAKE
grep '^\$(ACLOCAL_M4):' Makefile.in && Exit 1
#! /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
. ./defs || Exit 1
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+set -e
+
+cat > configure.in << END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([subdir/Makefile subdir2/Makefile])
AC_PROG_CC
-AC_OUTPUT(subdir/Makefile subdir2/Makefile)
+AC_OUTPUT
END
rm -f depcomp
: > subdir/foo.c
: > subdir2/foo.c
-$ACLOCAL || Exit 1
-$AUTOMAKE --add-missing || Exit 1
+$ACLOCAL
+$AUTOMAKE --add-missing
# There used to be a bug where this was created in the first subdir with C
# sources in it instead of in $top_srcdir or $ac_auxdir
-test -f depcomp || Exit 1
+test -f depcomp
#! /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
required=gcc
. ./defs || Exit 1
-cat > configure.in << 'END'
-AC_INIT(subdir/foo.c)
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([subdir/Makefile])
AC_PROG_CC
-AC_OUTPUT(Makefile subdir/Makefile)
+AC_OUTPUT
END
cat > Makefile.am << 'END'
CFLAGS=
export CFLAGS
-$ACLOCAL || Exit 1
-$AUTOMAKE --add-missing || Exit 1
-$AUTOCONF || Exit 1
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
./configure CC='gcc' 2>error.log
test -z "`cat error.log`"
#! /bin/sh
-# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 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
required=gcc
. ./defs || Exit 1
-cat > configure.in << 'END'
-AC_INIT(hello.c)
-AM_INIT_AUTOMAKE(hello,0.23)
+set -e
+
+cat >> configure.in << 'END'
AC_PROG_CC
-AC_OUTPUT(Makefile)
+AC_OUTPUT
END
cat > Makefile.am << 'END'
}
END
-set -e
-
$ACLOCAL
$AUTOCONF
$AUTOMAKE -a
#! /bin/sh
-# Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1997, 1998, 2000, 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
. ./defs || Exit 1
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+set -e
+
+cat >> configure.in << 'END'
AC_PROG_CC
AC_SUBST(DEPS)
-AC_OUTPUT(Makefile)
END
cat > Makefile.am << 'END'
TerraVision_DEPENDENCIES = $(DEPS)
END
-$ACLOCAL || Exit 1
+$ACLOCAL
$AUTOMAKE
#! /bin/sh
-# Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2009, 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
. ./defs || Exit 1
-cat > configure.in << 'END'
-AC_INIT(subdir/foo.c)
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([subdir/Makefile])
AC_PROG_CC
-AC_OUTPUT(Makefile subdir/Makefile)
+AC_OUTPUT
END
cat > Makefile.am << 'END'
#! /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
. ./defs || Exit 1
+set -e
+
cat >> configure.in << 'END'
AC_PROG_CC
AM_CONDITIONAL([WANT_MT], [test -z "$revert"])
@echo 4BEG: $(libexec_PROGRAMS) :END4
END
-set -e
-
$ACLOCAL
$AUTOCONF
$AUTOMAKE
#! /bin/sh
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 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
TESTS = prg1 prg3 prg4 $(BAZ)
print-bin:
- echo BEG: $(bin_PROGRAMS) :END
+ @echo BEG: $(bin_PROGRAMS) :END
print-extra:
- echo BEG: $(EXTRA_PROGRAMS) :END
+ @echo BEG: $(EXTRA_PROGRAMS) :END
print-tests:
- echo BEG: $(TESTS) :END
+ @echo BEG: $(TESTS) :END
print-barbaz:
- echo BEG: $(BAR) $(BAZ) :END
+ @echo BEG: $(BAR) $(BAZ) :END
END
$ACLOCAL
./configure
$MAKE print-bin > output
cat output
-grep 'prg1.bin prg2.bin prg1.bin prg2.bin prg3.bin' output
+$FGREP 'prg1.bin prg2.bin prg1.bin prg2.bin prg3.bin' output
$MAKE print-extra > output
cat output
-grep 'prg1.bin prg2.bin prg3.bin' output
+$FGREP 'prg1.bin prg2.bin prg3.bin' output
$MAKE print-tests > output
cat output
-grep 'prg1.bin prg3.bin prg4' output
+$FGREP 'prg1.bin prg3.bin prg4' output
./configure cond=yes
$MAKE print-bin > output
cat output
-grep 'prg1.bin prg2.bin prg1.bin prg2.bin prg3.bin bar.bin baz.bin' output
+$FGREP 'prg1.bin prg2.bin prg1.bin prg2.bin prg3.bin bar.bin baz.bin' output
$MAKE print-tests > output
cat output
-grep 'prg1.bin prg3.bin prg4 baz.bin bar.bin' output
+$FGREP 'prg1.bin prg3.bin prg4 baz.bin bar.bin' output
$MAKE print-barbaz > output
cat output
-grep 'bar baz bar' output
+$FGREP 'bar baz bar' output
# Only two am__EXEEXT_* variables are needed here: one for BAR, and one
# BAZ. The latter must use the former.
# Using different extensions for the same language should not
# output the build rules several times.
-. ./defs
+. ./defs || Exit 1
set -e
#! /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
. ./defs || Exit 1
+set -e
+
echo AC_OUTPUT >> configure.in
cat > Makefile.am << 'END'
touch foo/bar
END
-set -e
-
$ACLOCAL
$AUTOMAKE
$AUTOCONF
#! /bin/sh
-# Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 2000, 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
. ./defs || Exit 1
-cat > configure.in << 'END'
-AC_INIT(foo, 1.0, martin@tropos.de)
-AM_INIT_AUTOMAKE(foo, 1.0)
-AC_CONFIG_SRCDIR(foo.f)
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_SRCDIR([foo.f])
AC_PROG_F77
-AC_OUTPUT(Makefile)
+AC_OUTPUT
END
cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS=foo
foo_SOURCES=foo.f
END
: > foo.f
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
grep 'foo\.Po' Makefile.in && Exit 1
Exit 0
#! /bin/sh
-# Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2006, 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
# Don't try running ./configure --with-included-gettext if the
# user is using AM_GNU_GETTEXT([external]).
grep 'with-included-gettext' Makefile.in && Exit 1
-:
# intl/ isn't wanted with AM_GNU_GETTEXT([external]).
echo 'SUBDIRS = po intl' >Makefile.am
AUTOMAKE_fails --add-missing
grep 'intl.*AM_GNU_GETTEXT' stderr
+
+:
# Required when using Texinfo.
: > texinfo.tex
-$ACLOCAL || Exit 1
+$ACLOCAL
AUTOMAKE_fails
-grep 'required file.*mdate-sh' stderr
+grep 'required file.*mdate-sh.*not found' stderr
+
+:
#! /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
set -e
-echo 1
-# pythondir not defined
+
+echo 1. pythondir not defined
cat > Makefile.am <<'END'
PYTHON = x
AUTOMAKE_fails -a
grep AM_PATH_PYTHON stderr
-echo 2
-# pkgpythondir not defined
+
+echo 2. pkgpythondir not defined
cat > Makefile.am <<'END'
PYTHON = x
grep AM_PATH_PYTHON stderr
-echo 3
-# pyexecdir not defined
+echo 3. pyexecdir not defined
cat > Makefile.am <<'END'
PYTHON = x
grep AM_PATH_PYTHON stderr
-echo 4
-# pkgpyexecdir not defined
+echo 4. pkgpyexecdir not defined
cat > Makefile.am <<'END'
PYTHON = x
grep AM_PATH_PYTHON stderr
-echo 5
-# PYTHON not defined.
+echo 5. PYTHON not defined.
cat > Makefile.am <<'END'
pkgpyexecdir = /here/we/go
grep AM_PATH_PYTHON stderr
-echo 6
-# Ok.
+echo 6. Ok.
cat > Makefile.am <<'END'
PYTHON = x
test -f py-compile
-echo 7
-# Ok.
+echo 7. Ok again.
cat > Makefile.am <<'END'
PYTHON = x
#! /bin/sh
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
mkdir 'unsafe$'
cd 'unsafe$'
-cat > configure.in << 'END'
-AC_INIT([sanity], [1.0])
-AM_INIT_AUTOMAKE([foreign])
-AC_OUTPUT(Makefile)
-END
-
-cp ../install-sh ../missing .
+mv ../configure.in .
+mv ../install-sh ../missing .
: > Makefile.am
$AUTOCONF
$AUTOMAKE
./configure 2>stderr && { cat stderr >&2; Exit 1; }
-cat stderr
+cat stderr >&2
grep 'unsafe absolute working directory' stderr
cd ..
mkdir build
cd build
../unsafe$/configure 2>stderr && { cat stderr >&2; Exit 1; }
-cat stderr
+cat stderr >&2
grep 'unsafe srcdir' stderr
+
: