From: Stefano Lattarini Date: Tue, 1 Mar 2011 09:25:26 +0000 (+0100) Subject: Merge branch 'maint' X-Git-Tag: ng-0.5a~228 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7d37f153d2f5005c73364500f9fa2bf15e2c464;p=thirdparty%2Fautomake.git Merge branch 'maint' --- a7d37f153d2f5005c73364500f9fa2bf15e2c464 diff --cc ChangeLog index 5ef0c0d87,6f67d36cf..a624ea44e --- a/ChangeLog +++ b/ChangeLog @@@ -1,29 -1,28 +1,54 @@@ + 2011-03-01 Peter Rosin + + test defs: unindent without temporary file + * tests/defs.in (commented_sed_unindent_prog): Commented Sed program + that strips the "proper" amount of leading whitespace. + (unindent): Lazily strip comments from the above program and use it + to unindent without using a temporary file. + + 2011-02-26 Stefano Lattarini + + libtool: suggest LT_INIT if LTLIBRARIES primary is used + When the LTLIBRARIES primary was used, but $(LIBTOOL) wasn't + defined, automake suggested to add a call to AC_PROG_LIBTOOL + in configure.ac. But that macro is deprecated since Libtool + version 1.9b (2004-08-29), in favor of the newer LT_INIT. So + suggest the use of this latter macro instead. + * lib/Automake/Variable.pm (%_am_macro_for_var): Pair 'LIBTOOL' + with 'LT_INIT', not with 'AC_PROG_LIBTOOL'. + * libtool4.test: Adjust and extend. Also, add a call to macro + AC_PROG_CC in configure.in, to help ensuring that automake does + not fail for the wrong reasons. + * ltinit.test: New test, ensure that automake's libtool support + works with LT_INIT-based interface. + Thanks to Jack Kelly for the suggestion. + +2011-02-25 Stefano Lattarini + + tests: add testcases sanity-checking the testsuite + Helper subroutines, variables and other pieces of code defined + in the `tests/defs' and used by many testcases are non-obvious, + and tricky to get to work portably; but until now, they weren't + tested at all in a clear and self-contained way. + This change should remedy to the situation. + * tests/self-check-cleanup.test: New test, check removal of + temporary test working directory by `./defs'. + * tests/self-check-dir.test: New test, check that tests using + `./defs' create a proper temporary directory, and run in it. + * tests/self-check-exit.test: New test, check that, in case of + failing commands, the correct exit status is passed to the exit + trap installed by the `./defs' script. + * tests/self-check-is_newest.test: New test, checking the + `is_newest' subroutine. + * tests/self-check-me.test: New test, checking that $me gets + defined automatically by `tests/defs' if not set, and that it + can be overridden from either the shell or the environment. + * tests/self-check-sanity.test: New test, check that the sanity + checks performed by the `tests/defs' script works correctly. + * tests/self-check-unindent.test: New test, checking the + `unindent' subroutine. + * tests/Makefile.am (TESTS): Update. + 2011-02-20 Stefano Lattarini tests: tempdirs with restrictive permissions are cleaned correctly diff --cc tests/defs index 99c9b3fe8,2685112ed..cf0b49504 --- a/tests/defs +++ b/tests/defs @@@ -55,127 -46,60 +55,138 @@@ nl= # is defined initially, so that saving and restoring $IFS works. IFS=$sp$tab$nl -# Ensure we are running from the right directory. -test -f ./defs || { - echo "defs: not found in current directory" 1>&2 - exit 1 +# Ensure $testsrcdir is set correctly. +test -f "$testsrcdir/defs-static.in" || { + echo "$me: $testsrcdir/defs-static.in not found, check \$testsrcdir" >&2 + exit 99 +} + +# Ensure $testbuilddir is set correctly. +test -f "$testbuilddir/defs-static" || { + echo "$me: $testbuilddir/defs-static not found, check \$testbuilddir" >&2 + exit 99 +} + +# Unset some MAKE... variables that may cause $MAKE to act like a +# recursively invoked sub-make. Any $MAKE invocation in a test is +# conceptually an independent invocation, not part of the main +# 'automake' build. +unset MFLAGS MAKEFLAGS AM_MAKEFLAGS MAKELEVEL __MKLVL__ MAKE_JOBS_FIFO +# Unset verbosity flag. +unset V +# Also unset variables that will let `make -e install' divert +# files into unwanted directories. +unset DESTDIR +unset prefix exec_prefix bindir datarootdir datadir docdir dvidir +unset htmldir includedir infodir libdir libexecdir localedir mandir +unset oldincludedir pdfdir psdir sbindir sharedstatedir sysconfdir +# The tests call `make -e' but we do not want $srcdir from the environment +# to override the definition from the Makefile. +unset srcdir +# Also unset variables that control our test driver. While not +# conceptually independent, they cause some changed semantics we +# need to control (and test for) in some of the tests to ensure +# backward-compatible behavior. +unset TESTS_ENVIRONMENT +unset DISABLE_HARD_ERRORS +unset TESTS +unset TEST_LOG_COMPILER +unset TEST_LOGS +unset RECHECK_LOGS +unset VERBOSE + + +## ---------------------------- ## +## Auxiliary shell functions. ## +## ---------------------------- ## + +# We use a trap below for cleanup. This requires us to go through +# hoops to get the right exit status transported through the signal. +# So use `Exit STATUS' instead of `exit STATUS' inside of the tests. +# Turn off errexit here so that we don't trip the bug with OSF1/Tru64 +# sh inside this function. +Exit () +{ + set +e + (exit $1) + exit $1 +} + +# is_newest FILE FILES +# -------------------- +# Return false if any file in FILES is newer than FILE. +# Resolve ties in favor of FILE. +is_newest () +{ + is_newest_files=`find "$@" -newer "$1"` + test -z "$is_newest_files" +} + +# AUTOMAKE_run status [options...] +# -------------------------------- +# Run Automake with OPTIONS, and fail if automake +# does not exit with STATUS. +AUTOMAKE_run () +{ + expected_exitcode=$1 + shift + exitcode=0 + $AUTOMAKE ${1+"$@"} >stdout 2>stderr || exitcode=$? + cat stderr >&2 + cat stdout + test $exitcode = $expected_exitcode || Exit 1 } -if test -z "$srcdir"; then - # compute $srcdir. - srcdir=`echo "$0" | sed -e 's,/[^\\/]*$,,'` - test "$srcdir" = $0 && srcdir=. -else :; fi +# AUTOMAKE_fails [options...] +# --------------------------- +# Run Automake with OPTIONS, and fail if automake +# does not exit with STATUS. +AUTOMAKE_fails () +{ + AUTOMAKE_run 1 ${1+"$@"} +} -# Ensure $srcdir is set correctly. -test -f "$srcdir/defs.in" || { - echo "$srcdir/defs.in not found, check \$srcdir" 1>&2 - exit 1 ++commented_sed_unindent_prog=' ++ /^$/b # Nothing to do for empty lines. ++ x # Get x into pattern space. ++ /^$/{ # No prior x, go prepare it. ++ g # Copy this 1st non-blank line into pattern space. ++ s/^\(['"$tab"' ]*\).*/x\1/ # Prepare x in pattern space. ++ } # Now: x in pattern and in hold. ++ G # Build x\n in pattern space, and ++ h # duplicate it into hold space. ++ s/\n.*$// # Restore x in pattern space, and ++ x # exchange with the above duplicate in hold space. ++ s/^x\(.*\)\n\1// # Remove leading from . ++ s/^x.*\n// # Restore when there is no leading . ++' ++ +# unindent [input files...] +# ------------------------- +# Remove the "proper" amount of leading whitespace from the given files, +# and output the result on stdout. That amount is determined by looking +# at the leading whitespace of the first non-blank line in the input +# files. If no input file is specified, standard input is implied. +unindent () +{ - cat ${1+"$@"} > deindent.tmp - indentation=`sed > configure.in <<'END' + AC_PROG_CC + END + cat > Makefile.am << 'END' EXTRA_LTLIBRARIES = liblib.la END