From: Stefano Lattarini Date: Tue, 19 Apr 2011 20:47:48 +0000 (+0200) Subject: Merge branch 'me-override-fix' X-Git-Tag: v1.11b~366 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2aed42f2d3a4aeb938408ffc64859def583b25d5;p=platform%2Fupstream%2Fautomake.git Merge branch 'me-override-fix' --- 2aed42f2d3a4aeb938408ffc64859def583b25d5 diff --cc ChangeLog index a84daca,b139a98..4e4c220 --- a/ChangeLog +++ b/ChangeLog @@@ -1,20 -1,12 +1,29 @@@ 2011-04-18 Stefano Lattarini + tests: don't allow `$me' to be overridden from the environment + * tests/defs.in: Sanity check: abort if $me is in the environment. + * tests/self-check-me-in-env.test: New test. + * tests/Makefile.am (TESTS_ENVIRONMENT): Unset variable `me'. + (TESTS): Update. + Suggestion by Ralf Wildenhues. + ++2011-04-18 Stefano Lattarini ++ + check: rename AM_TESTS_SETUP -> AM_TESTS_ENVIRONMENT + The AM_TESTS_SETUP naming was not a good one after all. It may + be technically more correct than AM_TESTS_ENVIRONMENT, but the + latter is a better one simply because it is easier to remember, + and even if you've never heard of it and only know the semantics + of TESTS_ENVIRONMENT, you can have a straightforward way to + figure out how AM_TESTS_ENVIRONMENT would work. + * tests/check.am (am__check_pre): Update. + * doc/automake.in (Simple Tests using parallel-tests): Update. + * tests/parallel-tests-am_tests_setup.test: Renamed ... + * tests/parallel-tests-am_tests_environment.test: ... to this, + and updated. + * tests/Makefile.am (TESTS): Update. + Suggestion and motivation by Ralf Wildenhues. + 2011-04-17 Stefano Lattarini test defs: allow overriding of `$me' diff --cc tests/Makefile.am index d5a980a,cc25167..b95d54c --- a/tests/Makefile.am +++ b/tests/Makefile.am @@@ -33,72 -28,23 +33,76 @@@ txinfo5.tes include $(srcdir)/parallel-tests.am $(srcdir)/parallel-tests.am: gen-parallel-tests Makefile.am - (cd $(srcdir) && $(SHELL) ./gen-parallel-tests) >$@ + $(AM_V_GEN)($(am__cd) $(srcdir) && $(SHELL) ./gen-parallel-tests) >$@ + +$(parallel_tests): Makefile.am + $(AM_V_at)rm -f $@ $@-t + $(AM_V_GEN)input=`echo $@ | sed 's,.*/,,; s,-p.test$$,.test,'`; \ + { echo '#!/bin/sh'; \ + echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \ + echo; \ + echo '# Ensure proper definition of $$testsrcdir.'; \ + 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."; \ + echo 'parallel_tests=yes'; \ + echo "# In the spirit of VPATH, we prefer a test in the build tree"; \ + echo "# over one in the source tree."; \ + echo "if test -f \"./$$input\"; then"; \ + echo " . \"./$$input\""; \ + echo 'else'; \ + echo " . \"\$$testsrcdir/$$input\""; \ + echo 'fi'; \ + } > $@-t + $(AM_V_at)chmod a+rx $@-t && mv -f $@-t $@ + +MAINTAINERCLEANFILES += $(parallel_tests) +EXTRA_DIST += gen-parallel-tests + + +include $(srcdir)/instspc-tests.am -$(parallel_tests): $(parallel_tests:-p.test=.test) Makefile.am - input=`echo $@ | sed 's,.*/,,; s,-p.test$$,.test,'`; \ - sed 's|^\. \./defs.*|parallel_tests=yes; &|' \ - < $(srcdir)/$$input >$@ - chmod a+rx $@ +$(srcdir)/instspc-tests.am: instspc-tests.sh Makefile.am + $(AM_V_GEN)($(am__cd) $(srcdir) \ + && $(SHELL) ./instspc-tests.sh --generate-makefile) >$@ + +$(instspc_tests): Makefile.am + $(AM_V_at)rm -f $@ $@-t + $(AM_V_GEN) :; \ + base=`expr 'x/$@' : 'x.*/instspc-\(.*\)\.test$$'`; \ + name=`expr x"$$base" : x'\(.*\)-'`; \ + action=`expr x"$$base" : x'.*-\(.*\)'`; \ + { \ + echo '#!/bin/sh'; \ + echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \ + echo; \ + echo '# Ensure proper definition of $$testsrcdir.'; \ + echo '. ./defs-static || exit 99'; \ + echo 'test -n "$$testsrcdir" || exit 99 # sanity check'; \ + echo; \ + echo "instspc_test_name='$$name'"; \ + echo "instspc_action='test-$$action'"; \ + echo ". \$$testsrcdir/instspc-tests.sh"; \ + } > $@-t + $(AM_V_at)chmod a+rx $@-t && mv -f $@-t $@ + +# All instspc-*.test tests work by sourcing the `instspc-tests.sh' +# script. Also, they all use shared data generated by the helper +# test `instspc-data.test', for reasons of speed. +instspc-data.log: instspc-tests.sh +$(instspc_tests:.test=.log): instspc-tests.sh instspc-data.log + +MAINTAINERCLEANFILES += $(instspc_tests) +EXTRA_DIST += instspc-tests.sh +XFAIL_TESTS += $(instspc_xfail_tests) -MAINTAINERCLEANFILES = $(parallel_tests) + # The testsuite variable `$me' should be overridable from the + # test scripts, but not from the environment. + TESTS_ENVIRONMENT = test x"$$me" = x || unset me; + TESTS = \ -self-check-me-in-env.test \ -aclibobj.test \ aclocal.test \ aclocal3.test \ aclocal4.test \ @@@ -810,15 -656,7 +814,16 @@@ regex-obsolete.test req.test \ reqd.test \ reqd2.test \ +repeated-options.test \ rulepat.test \ +self-check-cleanup.test \ +self-check-dir.test \ +self-check-exit.test \ +self-check-is_newest.test \ +self-check-me.test \ ++self-check-me-in-env.test \ +self-check-sanity.test \ +self-check-unindent.test \ sanity.test \ scripts.test \ seenc.test \ diff --cc tests/Makefile.in index 794a7b7,9ccbdbd..9beb968 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@@ -284,85 -272,49 +284,89 @@@ target_alias = @target_alias top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -XFAIL_TESTS = \ -all.test \ -auxdir2.test \ -cond17.test \ -gcj6.test \ -pr8365-remake-timing.test \ -yacc-dist-nobuild-subdir.test \ -txinfo5.test - -parallel_tests = \ -check-exported-srcdir-p.test \ -check-tests-in-builddir-p.test \ -check-tests_environment-p.test \ -check-p.test \ -check10-p.test \ -check11-p.test \ -check2-p.test \ -check3-p.test \ -check4-p.test \ -check5-p.test \ -check6-p.test \ -check7-p.test \ -check8-p.test \ -check9-p.test \ -color-p.test \ -color2-p.test \ -comment9-p.test \ -dejagnu-p.test \ -exeext4-p.test \ -maken3-p.test \ -maken4-p.test \ -pr401-p.test \ -pr401b-p.test \ -pr401c-p.test - -MAINTAINERCLEANFILES = $(parallel_tests) +MAINTAINERCLEANFILES = $(parallel_tests) $(instspc_tests) +EXTRA_DIST = ChangeLog-old gen-parallel-tests instspc-tests.sh \ + $(TESTS) +XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test \ + override-conditional-2.test pr8365-remake-timing.test \ + yacc-dist-nobuild-subdir.test txinfo5.test \ + $(instspc_xfail_tests) +parallel_tests = backcompat5-p.test check-exported-srcdir-p.test \ + check-tests-in-builddir-p.test check-tests_environment-p.test \ + check-p.test check10-p.test check11-p.test check12-p.test \ + check2-p.test check3-p.test check4-p.test check5-p.test \ + check6-p.test check7-p.test check8-p.test check9-p.test \ + color-p.test color2-p.test comment9-p.test dejagnu-p.test \ + exeext4-p.test maken3-p.test maken4-p.test \ + posixsubst-tests-p.test pr401-p.test pr401b-p.test \ + pr401c-p.test +instspc_tests = instspc-squote-build.test instspc-squote-install.test \ + instspc-dquote-build.test instspc-dquote-install.test \ + instspc-bquote-build.test instspc-bquote-install.test \ + instspc-sharp-build.test instspc-sharp-install.test \ + instspc-dollar-build.test instspc-dollar-install.test \ + instspc-bang-build.test instspc-bang-install.test \ + instspc-bslash-build.test instspc-bslash-install.test \ + instspc-ampersand-build.test instspc-ampersand-install.test \ + instspc-percent-build.test instspc-percent-install.test \ + instspc-leftpar-build.test instspc-leftpar-install.test \ + instspc-rightpar-build.test instspc-rightpar-install.test \ + instspc-pipe-build.test instspc-pipe-install.test \ + instspc-caret-build.test instspc-caret-install.test \ + instspc-tilde-build.test instspc-tilde-install.test \ + instspc-qmark-build.test instspc-qmark-install.test \ + instspc-star-build.test instspc-star-install.test \ + instspc-plus-build.test instspc-plus-install.test \ + instspc-minus-build.test instspc-minus-install.test \ + instspc-comma-build.test instspc-comma-install.test \ + instspc-colon-build.test instspc-colon-install.test \ + instspc-semicol-build.test instspc-semicol-install.test \ + instspc-equal-build.test instspc-equal-install.test \ + instspc-less-build.test instspc-less-install.test \ + instspc-more-build.test instspc-more-install.test \ + instspc-at-build.test instspc-at-install.test \ + instspc-lqbrack-build.test instspc-lqbrack-install.test \ + instspc-rqbrack-build.test instspc-rqbrack-install.test \ + instspc-lcbrack-build.test instspc-lcbrack-install.test \ + instspc-rcbrack-build.test instspc-rcbrack-install.test \ + instspc-space-build.test instspc-space-install.test \ + instspc-tab-build.test instspc-tab-install.test \ + instspc-linefeed-build.test instspc-linefeed-install.test \ + instspc-backspace-build.test instspc-backspace-install.test \ + instspc-formfeed-build.test instspc-formfeed-install.test \ + instspc-carriageret-build.test \ + instspc-carriageret-install.test \ + instspc-quadrigraph0-build.test \ + instspc-quadrigraph0-install.test \ + instspc-quadrigraph1-build.test \ + instspc-quadrigraph1-install.test \ + instspc-quadrigraph2-build.test \ + instspc-quadrigraph2-install.test \ + instspc-quadrigraph3-build.test \ + instspc-quadrigraph3-install.test \ + instspc-quadrigraph4-build.test \ + instspc-quadrigraph4-install.test instspc-a_b-build.test \ + instspc-a_b-install.test instspc-a__b-build.test \ + instspc-a__b-install.test instspc-a_lf_b-build.test \ + instspc-a_lf_b-install.test instspc-dotdotdot-build.test \ + instspc-dotdotdot-install.test instspc-dosdrive-build.test \ + instspc-dosdrive-install.test instspc-miscglob1-build.test \ + instspc-miscglob1-install.test instspc-miscglob2-build.test \ + instspc-miscglob2-install.test +instspc_xfail_tests = instspc-squote-build.test \ + instspc-dquote-build.test instspc-bquote-build.test \ + instspc-sharp-build.test instspc-dollar-build.test \ + instspc-bslash-build.test instspc-ampersand-build.test \ + instspc-linefeed-build.test instspc-quadrigraph0-build.test \ + instspc-a_lf_b-build.test instspc-squote-install.test \ + instspc-dquote-install.test instspc-bquote-install.test \ + instspc-sharp-install.test instspc-dollar-install.test \ + instspc-linefeed-install.test instspc-a_lf_b-install.test + + # The testsuite variable `$me' should be overridable from the + # test scripts, but not from the environment. + TESTS_ENVIRONMENT = test x"$$me" = x || unset me; TESTS = \ -self-check-me-in-env.test \ -aclibobj.test \ aclocal.test \ aclocal3.test \ aclocal4.test \ @@@ -1074,15 -926,7 +1078,16 @@@ regex-obsolete.test req.test \ reqd.test \ reqd2.test \ +repeated-options.test \ rulepat.test \ +self-check-cleanup.test \ +self-check-dir.test \ +self-check-exit.test \ +self-check-is_newest.test \ +self-check-me.test \ ++self-check-me-in-env.test \ +self-check-sanity.test \ +self-check-unindent.test \ sanity.test \ scripts.test \ seenc.test \ diff --cc tests/defs index ae05b82,342e76d..6a8d06f --- a/tests/defs +++ b/tests/defs @@@ -17,35 -17,23 +17,38 @@@ # 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 - -# 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 +## -------------------------------------------------------- ## +## Source static setup and definitions for the testsuite. ## +## -------------------------------------------------------- ## + +# This code needs to be 'set -e' clean. + +# Ensure we are running from the right directory. +test -f ./defs-static || { + echo "$0: ./defs-static: not found in current directory" >&2 + exit 99 +} + +# Source the shell sanitization and variables' definitions. +. ./defs-static || exit 99 + +# The name of the current test (without the `.test' suffix). +# Test scripts can override it if they need to (but this should +# be done carefully, and *before* including ./defs). +if test -z "$me"; then + # Guard against failure to spawn sed (seen on MSYS), or empty $argv0. + me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.test$//'` \ + && test -n "$me" \ + || { echo "$argv0: failed to define \$me" >&2; exit 99; } ++elif env | grep '^me=' >/dev/null; then ++ echo "$0: variable \`me' is set in the environment: this is unsafe" >&2 ++ exit 99 fi +## ---------------------------------------- ## +## Sanity checks and environment cleanup. ## +## ---------------------------------------- ## + # A single whitespace character. sp=' ' # A tabulation character.