From: Stefano Lattarini Date: Fri, 5 Nov 2010 20:29:17 +0000 (+0100) Subject: Tests defs: move static definitions in a new file `defs-static'. X-Git-Tag: ng-0.5a~343^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5e533390ea8c3d2952f5a5c57a514274dee9fd2;p=thirdparty%2Fautomake.git Tests defs: move static definitions in a new file `defs-static'. The new file is meant to be idempotent w.r.t. mutiple inclusions. * tests/defs.in: Removed, its contents split among ... * tests/defs-static.in: ... this new file ... * tests/defs: ... and this new file, including the former. * configure.ac (AC_CONFIG_FILES): Remove `tests/defs', add `tests/defs-static'. (AC_CONFIG_LINKS): Add `tests/defs'. * tests/Makefile.am ($(parallel_tests)): Update. ($(instspc_tests)): Likewise. * tests/.gitignore: Update. --- diff --git a/ChangeLog b/ChangeLog index 587e91e20..7d439bb21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2010-11-10 Stefano Lattarini + Tests defs: move static definitions in a new file `defs-static'. + The new file is meant to be idempotent w.r.t. mutiple inclusions. + * tests/defs.in: Removed, its contents split among ... + * tests/defs-static.in: ... this new file ... + * tests/defs: ... and this new file, including the former. + * configure.ac (AC_CONFIG_FILES): Remove `tests/defs', add + `tests/defs-static'. + (AC_CONFIG_LINKS): Add `tests/defs'. + * tests/Makefile.am ($(parallel_tests)): Update. + ($(instspc_tests)): Likewise. + * tests/.gitignore: Update. + Tests defs: $testsbuilddir is now AC_SUBST'ed. * tests/defs.in ($testsbuilddir): Substitute from @abs_builddir@. Add sanity check on $testsbuilddir, similar to those on diff --git a/configure b/configure index 169d82dc7..024b620af 100755 --- a/configure +++ b/configure @@ -2783,7 +2783,9 @@ $as_echo "$as_me: WARNING: \`cd tests && ${MAKE-make} clean-local-check'" >&2;} sh_errexit_works=$am_cv_sh_errexit_works -ac_config_files="$ac_config_files Makefile doc/Makefile lib/Automake/Makefile lib/Automake/tests/Makefile lib/Makefile lib/am/Makefile m4/Makefile tests/Makefile tests/defs" +ac_config_files="$ac_config_files Makefile doc/Makefile lib/Automake/Makefile lib/Automake/tests/Makefile lib/Makefile lib/am/Makefile m4/Makefile tests/Makefile tests/defs-static" + +ac_config_links="$ac_config_links tests/defs:tests/defs" ac_config_files="$ac_config_files tests/aclocal-${APIVERSION}:tests/aclocal.in" @@ -3375,6 +3377,7 @@ esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" +config_links="$ac_config_links" _ACEOF @@ -3399,6 +3402,9 @@ Usage: $0 [OPTION]... [TAG]... Configuration files: $config_files +Configuration links: +$config_links + Report bugs to . GNU Automake home page: . General help using GNU software: ." @@ -3533,7 +3539,8 @@ do "lib/am/Makefile") CONFIG_FILES="$CONFIG_FILES lib/am/Makefile" ;; "m4/Makefile") CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; - "tests/defs") CONFIG_FILES="$CONFIG_FILES tests/defs" ;; + "tests/defs-static") CONFIG_FILES="$CONFIG_FILES tests/defs-static" ;; + "tests/defs") CONFIG_LINKS="$CONFIG_LINKS tests/defs:tests/defs" ;; "tests/aclocal-${APIVERSION}") CONFIG_FILES="$CONFIG_FILES tests/aclocal-${APIVERSION}:tests/aclocal.in" ;; "tests/automake-${APIVERSION}") CONFIG_FILES="$CONFIG_FILES tests/automake-${APIVERSION}:tests/automake.in" ;; @@ -3548,6 +3555,7 @@ done # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links fi # Have a temporary directory for convenience. Make it in the build tree @@ -3736,7 +3744,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" -eval set X " :F $CONFIG_FILES " +eval set X " :F $CONFIG_FILES :L $CONFIG_LINKS " shift for ac_tag do @@ -3956,7 +3964,38 @@ which seems to be undefined. Please make sure it is defined" >&2;} || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + :L) + # + # CONFIG_LINK + # + + if test "$ac_source" = "$ac_file" && test "$srcdir" = '.'; then + : + else + # Prefer the file from the source tree if names are identical. + if test "$ac_source" = "$ac_file" || test ! -r "$ac_source"; then + ac_source=$srcdir/$ac_source + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5 +$as_echo "$as_me: linking $ac_source to $ac_file" >&6;} + + if test ! -r "$ac_source"; then + as_fn_error $? "$ac_source: file not found" "$LINENO" 5 + fi + rm -f "$ac_file" + + # Try a relative symlink, then a hard link, then a copy. + case $ac_source in + [\\/$]* | ?:[\\/]* ) ac_rel_source=$ac_source ;; + *) ac_rel_source=$ac_top_build_prefix$ac_source ;; + esac + ln -s "$ac_rel_source" "$ac_file" 2>/dev/null || + ln "$ac_source" "$ac_file" 2>/dev/null || + cp -p "$ac_source" "$ac_file" || + as_fn_error $? "cannot link or copy $ac_source to $ac_file" "$LINENO" 5 + fi + ;; esac diff --git a/configure.ac b/configure.ac index 079525d62..577541cb4 100644 --- a/configure.ac +++ b/configure.ac @@ -203,8 +203,9 @@ AC_CONFIG_FILES([ lib/am/Makefile m4/Makefile tests/Makefile - tests/defs + tests/defs-static ]) +AC_CONFIG_LINKS([tests/defs:tests/defs]) AC_CONFIG_FILES([tests/aclocal-${APIVERSION}:tests/aclocal.in], [chmod +x tests/aclocal-${APIVERSION}], [APIVERSION=$APIVERSION]) diff --git a/tests/.gitignore b/tests/.gitignore index ff89b406c..026e261e4 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,6 +1,6 @@ aclocal-* automake-* -defs +defs-static instspc-tests.am parallel-tests.am *.dir diff --git a/tests/Makefile.am b/tests/Makefile.am index d5ae6221d..816883e7c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -39,8 +39,7 @@ $(parallel_tests): Makefile.am echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \ echo; \ echo '# Ensure proper definition of $$testsrcdir.'; \ - echo 'am_skip_defs=yes'; \ - echo '. ./defs || exit 99'; \ + echo '. ./defs-static || exit 99'; \ echo 'test -n "$$testsrcdir" || exit 99 # sanity check'; \ echo; \ echo "# Run the test with Automake's parallel-tests driver enabled."; \ @@ -76,8 +75,7 @@ $(instspc_tests): Makefile.am echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \ echo; \ echo '# Ensure proper definition of $$testsrcdir.'; \ - echo 'am_skip_defs=yes'; \ - echo '. ./defs || exit 99'; \ + echo '. ./defs-static || exit 99'; \ echo 'test -n "$$testsrcdir" || exit 99 # sanity check'; \ echo; \ echo "instspc_test_name='$$name'"; \ diff --git a/tests/Makefile.in b/tests/Makefile.in index deab171a1..66f867d0d 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -49,8 +49,9 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/aclocal.in $(srcdir)/automake.in $(srcdir)/defs.in \ - $(srcdir)/instspc-tests.am $(srcdir)/parallel-tests.am + $(srcdir)/aclocal.in $(srcdir)/automake.in $(srcdir)/defs \ + $(srcdir)/defs-static.in $(srcdir)/instspc-tests.am \ + $(srcdir)/parallel-tests.am subdir = tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \ @@ -64,8 +65,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/lib/mkinstalldirs -CONFIG_CLEAN_FILES = defs aclocal-${APIVERSION} automake-${APIVERSION} -CONFIG_CLEAN_VPATH_FILES = +CONFIG_CLEAN_FILES = defs-static aclocal-${APIVERSION} \ + automake-${APIVERSION} +CONFIG_CLEAN_VPATH_FILES = defs AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; @@ -1177,7 +1179,7 @@ $(top_srcdir)/configure: $(am__configure_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): -defs: $(top_builddir)/config.status $(srcdir)/defs.in +defs-static: $(top_builddir)/config.status $(srcdir)/defs-static.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ aclocal-${APIVERSION}: $(top_builddir)/config.status $(srcdir)/aclocal.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ @@ -1496,8 +1498,7 @@ $(parallel_tests): Makefile.am echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \ echo; \ echo '# Ensure proper definition of $$testsrcdir.'; \ - echo 'am_skip_defs=yes'; \ - echo '. ./defs || exit 99'; \ + echo '. ./defs-static || exit 99'; \ echo 'test -n "$$testsrcdir" || exit 99 # sanity check'; \ echo; \ echo "# Run the test with Automake's parallel-tests driver enabled."; \ @@ -1527,8 +1528,7 @@ $(instspc_tests): Makefile.am echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \ echo; \ echo '# Ensure proper definition of $$testsrcdir.'; \ - echo 'am_skip_defs=yes'; \ - echo '. ./defs || exit 99'; \ + echo '. ./defs-static || exit 99'; \ echo 'test -n "$$testsrcdir" || exit 99 # sanity check'; \ echo; \ echo "instspc_test_name='$$name'"; \ diff --git a/tests/defs.in b/tests/defs similarity index 76% rename from tests/defs.in rename to tests/defs index 5124d2d40..50d074eb3 100644 --- a/tests/defs.in +++ b/tests/defs @@ -1,5 +1,4 @@ # -*- shell-script -*- -# @configure_input@ # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. @@ -17,112 +16,36 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Defines for Automake testing environment. -# Tom Tromey - - -## --------------------------------------------------------------------- ## -## Shell and environment sanitizing (plus some early initializations). ## -## --------------------------------------------------------------------- ## - -# Absolutely necessary variable(s). -testsrcdir='@abs_srcdir@' -top_testsrcdir='@abs_top_srcdir@' -testbuilddir='@abs_builddir@' - -# Protect this file against multiple inclusion, useful for generated tests. -if test x"$am_skip_defs" = xyes; then - unset am_skip_defs - -else # Do proper testcase setup. - -# Be more Bourne compatible. -# (Snippet copied from configure's initialization in Autoconf 2.64) -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi - -# The name of the current test (without the `.test' suffix.) -me=`echo "$0" | sed -e 's,.*[\\/],,;s/\.test$//'` - - -## ----------------------------------------------------------- ## -## Initialization: AC_SUBST'ed and/or environment variables. ## -## ----------------------------------------------------------- ## - -APIVERSION='@APIVERSION@' -PATH_SEPARATOR='@PATH_SEPARATOR@' - -# Make sure we override the user shell. -SHELL='@SHELL@'; export SHELL -# User can override various tools used. -test -z "$PERL" && PERL='@PERL@' -test -z "$MAKE" && MAKE=make -test -z "$AUTOCONF" && AUTOCONF="@am_AUTOCONF@" -test -z "$AUTOHEADER" && AUTOHEADER="@am_AUTOHEADER@" -test -z "$AUTOUPDATE" && AUTOUPDATE=autoupdate -test -z "$MISSING" && MISSING=$top_testsrcdir/lib/missing -# Use -Werror because this also turns some Perl warnings into error. -# (Tests for which this is inappropriate should use -Wno-error.) -test -z "$ACLOCAL" && ACLOCAL="aclocal-$APIVERSION -Werror" -# Extra flags to pass to aclocal before all other flags added by this script. -ACLOCAL_TESTSUITE_FLAGS=''; export ACLOCAL_TESTSUITE_FLAGS - -# See how Automake should be run. We put --foreign as the default -# strictness to avoid having to create lots and lots of files. A test -# can override this by specifying a different strictness. Use -Wall -# -Werror by default. Tests for which this is inappropriate -# (e.g. when testing that a warning is enabled by a specific switch) -# should use -Wnone or/and -Wno-error -test -z "$AUTOMAKE" && AUTOMAKE="automake-$APIVERSION --foreign -Werror -Wall" - -# POSIX no longer requires 'egrep' and 'fgrep', -# but some hosts lack 'grep -E' and 'grep -F'. -EGREP='@EGREP@' -FGREP='@FGREP@' - -# The amount we should wait after modifying files depends on the platform. -# For instance, Windows '95, '98 and ME have 2-second granularity -# and can be up to 3 seconds in the future w.r.t. the system clock. -sleep='sleep @MODIFICATION_DELAY@' - -# An old timestamp that can be given to a file, in "touch -t" format. -# The time stamp should be portable to all file systems of interest. -# Just for fun, choose the exact time of the announcement of the GNU project -# in UTC; see . -old_timestamp=198309271735.59 - -# Make our wrapper scripts accessible by default. -PATH="$testbuilddir$PATH_SEPARATOR$PATH"; export PATH - - ## -------------------------------------------------------- ## -## Initialization: sanity checks and environment cleanup. ## +## Source static setup and definitions for the testsuite. ## ## -------------------------------------------------------- ## # Ensure we are running from the right directory. -test -f ./defs || { - echo "$me: ./defs: not found in current directory" >&2 +test -f ./defs-static || { + echo "$0: ./defs-static: not found in current directory" >&2 exit 1 } +# Source the shell sanitization and variables' definitions. +. ./defs-static || exit 99 + +# The name of the current test (without the `.test' suffix.) +me=`echo "$0" | sed -e 's,.*[\\/],,;s/\.test$//'` + + +## ---------------------------------------- ## +## Sanity checks and environment cleanup. ## +## ---------------------------------------- ## + # Ensure $testsrcdir is set correctly. -test -f "$testsrcdir/defs.in" || { - echo "$me: $testsrcdir/defs.in not found, check \$testsrcdir" >&2 +test -f "$testsrcdir/defs-static.in" || { + echo "$me: $testsrcdir/defs-static.in not found, check \$testsrcdir" >&2 exit 1 } # Ensure $testbuilddir is set correctly. -test -f "$testbuilddir/defs" || { - echo "$me: $testbuilddir/defs not found, check \$testbuilddir" >&2 +test -f "$testbuilddir/defs-static" || { + echo "$me: $testbuilddir/defs-static not found, check \$testbuilddir" >&2 exit 1 } @@ -347,7 +270,7 @@ do tex) # No all versions of Tex support `--version', so we use # a configure check. - test -n "@TEX@" || exit 77 + test -n "$TEX" || exit 77 ;; texi2dvi-o) # Texi2dvi supports `-o' since Texinfo 4.1. @@ -371,7 +294,7 @@ done # some third-party .m4 file is underquoted. case " $required " in *' libtool '* | *' libtoolize '* | *' gettext '* ) - aclocaldir='@prefix@/share/aclocal' + aclocaldir=$testprefix/share/aclocal extra_includes="" if test -f $aclocaldir/dirlist; then extra_includes=` @@ -427,7 +350,6 @@ mkdir $testSubDir cd ./$testSubDir -sh_errexit_works=@sh_errexit_works@ if test "$sh_errexit_works" = yes; then trap 'exit_status=$? set +e @@ -477,5 +399,3 @@ done set -x pwd - -fi # Proper testcase setup. diff --git a/tests/defs-static.in b/tests/defs-static.in new file mode 100644 index 000000000..2ca4b57b9 --- /dev/null +++ b/tests/defs-static.in @@ -0,0 +1,98 @@ +# -*- shell-script -*- +# @configure_input@ +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 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 +# 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 . + +# Defines and minimal setup for Automake testing environment. +# IMPORTANT: Multiple inclusions of this file should be idempotent! + +# Be more Bourne compatible. +# (Snippet copied from configure's initialization in Autoconf 2.64) +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi + +testsrcdir='@abs_srcdir@' +top_testsrcdir='@abs_top_srcdir@' +testbuilddir='@abs_builddir@' +testprefix='@prefix@' + +APIVERSION='@APIVERSION@' +PATH_SEPARATOR='@PATH_SEPARATOR@' + +# Make sure we override the user shell. +SHELL='@SHELL@'; export SHELL +# User can override various tools used. +test -z "$PERL" && PERL='@PERL@' +test -z "$MAKE" && MAKE=make +test -z "$AUTOCONF" && AUTOCONF="@am_AUTOCONF@" +test -z "$AUTOHEADER" && AUTOHEADER="@am_AUTOHEADER@" +test -z "$AUTOUPDATE" && AUTOUPDATE=autoupdate +test -z "$MISSING" && MISSING=$top_testsrcdir/lib/missing +# Use -Werror because this also turns some Perl warnings into error. +# (Tests for which this is inappropriate should use -Wno-error.) +test -z "$ACLOCAL" && ACLOCAL="aclocal-$APIVERSION -Werror" +# Extra flags to pass to aclocal before all other flags added by this script. +ACLOCAL_TESTSUITE_FLAGS=''; export ACLOCAL_TESTSUITE_FLAGS + +# See how Automake should be run. We put --foreign as the default +# strictness to avoid having to create lots and lots of files. A test +# can override this by specifying a different strictness. Use -Wall +# -Werror by default. Tests for which this is inappropriate +# (e.g. when testing that a warning is enabled by a specific switch) +# should use -Wnone or/and -Wno-error +test -z "$AUTOMAKE" && AUTOMAKE="automake-$APIVERSION --foreign -Werror -Wall" + +# POSIX no longer requires 'egrep' and 'fgrep', +# but some hosts lack 'grep -E' and 'grep -F'. +EGREP='@EGREP@' +FGREP='@FGREP@' + +# No all versions of Tex support `--version', so we use a configure +# check to decide if tex is available. This decision is embodied in +# this variable. +TEX='@TEX@' + +# Whether /bin/sh has working 'set -e' with exit trap. +sh_errexit_works='@sh_errexit_works@' + +# The amount we should wait after modifying files depends on the platform. +# For instance, Windows '95, '98 and ME have 2-second granularity +# and can be up to 3 seconds in the future w.r.t. the system clock. +sleep='sleep @MODIFICATION_DELAY@' + +# An old timestamp that can be given to a file, in "touch -t" format. +# The time stamp should be portable to all file systems of interest. +# Just for fun, choose the exact time of the announcement of the GNU project +# in UTC; see . +old_timestamp=198309271735.59 + +# Make our wrapper scripts accessible by default. And avoid to uselessly +# extend $PATH multiple times if this file is sourced multiple times. +case $PATH in + "$testbuilddir$PATH_SEPARATOR"*) ;; + *) PATH="$testbuilddir$PATH_SEPARATOR$PATH";; +esac +export PATH