Edit

kc3-lang/automake/bootstrap

Branch :

  • Show log

    Commit

  • Author : Stefano Lattarini
    Date : 2010-06-06 18:38:27
    Hash : e1181261
    Message : Overhauled and modularized tests in `instspc.test'. The test `instspc.test' was way too big and fragile. Its running time was very long. It also produced a log that was nearly unreadable due to its length, making it very difficult to find out the reason for failures. Also, it was too much monolithic, with a single (maybe spurious) failure in a corner case causing the whole test to fail (even if everything worked as expected in the other 99% of cases). The present change should solve these problems, by separating `instspc.test' into many smaller, self-contained, auto-generated tests. * tests/instspc.test: Removed. * tests/instspc-tests.sh: New script, fullfilling a double role: 1. it generates a Makefile.am snippet `tests/instspc-tests.am', containing the definition of a list of new tests which will take over the older `instspc.test', and 2. it is sourced by said generated tests with proper parameters pre-set, to run the "meat" of the checks. This apparent abuse is indeed required because the test generation code and test execution code are inevitably interwined. * tests/Makefile.am ($(srcdir)/instspc-tests.am): Include this snippet, which (among the other things) defines ... (instspc_tests): ... this new macro, containing the list of the newly generated `instspc*.test' tests, and ... (instspc_xfail_tests): ... this new macro, containing the list of the `instspc*.test' tests expected to fail. ($(instspc_tests)): New rule, generates the `instspc*.test' tests. ($(instspc_tests:.test=.log)): New rule, registers the dependency of all `instspc*.test' tests on the `instspc-tests.sh' script. (TESTS): Add `$(instspc_tests)', remove `instspc.test'. (XFAIL_TESTS): Add `$(xfail_instspc_tests)'. (EXTRA_DIST): Distribute instspc-tests.sh. (MAINTAINERCLEANFILES): Added $(instspc_tests). Other minor cosmetic changes. * bootstrap: Generate instspc-tests.am. * tests/.gitignore: Updated.

  • bootstrap
  • #! /bin/sh
    
    # This script helps bootstrap automake, when checked out from git.
    #
    # Copyright (C) 2002, 2003, 2004, 2007, 2008, 2010 Free Software
    # Foundation, Inc.
    # Originally written by Pavel Roskin <proski@gnu.org> September 2002.
    #
    # 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 <http://www.gnu.org/licenses/>.
    
    # Don't ignore failures.
    set -e
    
    # Set program basename.
    me=`echo "$0" | sed 's,^.*/,,'`
    
    # Let user choose which version of autoconf, autom4te and perl to use.
    : ${AUTOCONF=autoconf}
    export AUTOCONF  # might be used by aclocal and/or automake
    : ${AUTOM4TE=autom4te}
    export AUTOM4TE  # ditto
    : ${PERL=perl}
    
    # Variables to substitute.
    VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.ac`
    PACKAGE=automake
    datadir=.
    PERL_THREADS=0
    
    # Override SHELL.  This is required on DJGPP so that Perl's system()
    # uses bash, not COMMAND.COM which doesn't quote arguments properly.
    # It's not used otherwise.
    if test -n "$DJDIR"; then
      BOOTSTRAP_SHELL=/dev/env/DJDIR/bin/bash.exe
    else
      BOOTSTRAP_SHELL=/bin/sh
    fi
    
    # Read the rule for calculating APIVERSION and execute it.
    apiver_cmd=`sed -ne 's/\[\[/[/g;s/\]\]/]/g;/^APIVERSION=/p' configure.ac`
    eval "$apiver_cmd"
    
    # Sanity checks.
    if test -z "$VERSION"; then
      echo "$me: cannot find VERSION" >&2
      exit 1
    fi
    
    if test -z "$APIVERSION"; then
      echo "$me: cannot find APIVERSION" >&2
      exit 1
    fi
    
    # Make a dummy versioned directory for aclocal.
    rm -rf aclocal-$APIVERSION
    mkdir aclocal-$APIVERSION
    if test -d automake-$APIVERSION; then
      find automake-$APIVERSION -exec chmod u+wx '{}' ';'
    fi
    rm -rf automake-$APIVERSION
    # Can't use `ln -s lib automake-$APIVERSION', that would create a
    # lib.exe stub under DJGPP 2.03.
    mkdir automake-$APIVERSION
    cp -rf lib/* automake-$APIVERSION
    
    dosubst ()
    {
      rm -f $2
      in=`echo $1 | sed 's,^.*/,,'`
      sed -e "s%@APIVERSION@%$APIVERSION%g" \
          -e "s%@PACKAGE@%$PACKAGE%g" \
          -e "s%@PERL@%$PERL%g" \
          -e "s%@PERL_THREADS@%$PERL_THREADS%g" \
          -e "s%@SHELL@%$BOOTSTRAP_SHELL%g" \
          -e "s%@VERSION@%$VERSION%g" \
          -e "s%@datadir@%$datadir%g" \
          -e "s%@configure_input@%Generated from $in; do not edit by hand.%g" \
          $1 > $2
      chmod a-w $2
    }
    
    # Create temporary replacement for lib/Automake/Config.pm.
    dosubst automake-$APIVERSION/Automake/Config.in \
            automake-$APIVERSION/Automake/Config.pm
    
    # Create temporary replacement for aclocal.
    dosubst aclocal.in aclocal.tmp
    
    # Overwrite amversion.m4.
    dosubst m4/amversion.in m4/amversion.m4
    
    # Create temporary replacement for automake.
    dosubst automake.in automake.tmp
    
    # Create required makefile snippets.
    cd tests
    $BOOTSTRAP_SHELL ./gen-parallel-tests > parallel-tests.am
    $BOOTSTRAP_SHELL ./instspc-tests.sh --generate-makefile > instspc-tests.am
    cd ..
    
    # Run the autotools.
    $PERL ./aclocal.tmp -I m4
    $AUTOCONF
    $PERL ./automake.tmp
    
    # Remove temporary files and directories.
    rm -rf aclocal-$APIVERSION automake-$APIVERSION
    rm -f aclocal.tmp automake.tmp