Edit

kc3-lang/automake/defs

Branch :

  • Show log

    Commit

  • Author : Stefano Lattarini
    Date : 2012-06-23 13:42:10
    Hash : 3a714959
    Message : tests: fix automatic re-execution of tests with Zsh * defs: Use '$argv0' instead of '$0'. With Zsh not started right away in Bourne-compatibility mode, the latter will be the path not of the test script itself, but of the file it's currently sourcing -- i.e., in our case, './defs'. This would cause the automatic re-execution code to execute './defs' (basically a no-op) rather than re-run the test correctly. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>

  • defs
  • # -*- shell-script -*-
    #
    # Copyright (C) 1996-2012 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 <http://www.gnu.org/licenses/>.
    
    # *** IMPORTANT NOTE ***
    # This file should execute correctly with any system's /bin/sh (which
    # might be just a Bourne shell, non POSIX-conforming, like on Solaris
    # up to version 11 at least).
    
    # Source the shell static setup and variable definitions.
    . ./defs-static
    test $? -eq 0 || exit 99
    
    # Make sure we run with the shell detected at configure time or forced
    # by the user (unless the user forbids it).  That is assumed to be a
    # proper POSIX shell.
    case ${AM_TESTS_REEXEC-yes} in
      n|no|false|0)
        ;;
      *)
        # Ensure we can find ourselves.
        if test ! -f "$argv0"; then
          echo "$argv0: unable to find myself" >&2
          exit 99
        fi
        AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
        # Cannot simply do "opts=$-", since the content of $- is not
        # portable among different shells.  So try to propagate only
        # the portable and interesting options.
        case $- in
          *x*v*|*v*x) opts=-vx;;
          *v*) opts=-v;;
          *x*) opts=-x;;
          *) opts=;;
        esac
        echo exec $AM_TEST_RUNNER_SHELL $opts "$argv0" "$*"
        exec $AM_TEST_RUNNER_SHELL $opts "$argv0" ${1+"$@"}
        # This should be dead code, unless some strange error happened. 
        echo "$argv0: failed to re-execute with $AM_TEST_RUNNER_SHELL" >&2
        exit 99
        ;;
    esac
    
    # Source the actual test initialization and setup code, and return
    # control to the test script that is sourcing us.
    . "$am_testauxdir/test-init.sh"