# execute-mode.at -- libtool --mode=execute -*- Autotest -*- # # Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. # Written by Ralf Wildenhues, 2008 # # This file is part of GNU Libtool. # # GNU Libtool 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 of # the License, or (at your option) any later version. # # GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #### AT_SETUP([execute mode]) AT_KEYWORDS([libtool]) eval `$LIBTOOL --config | $EGREP '^(FGREP)='` AT_DATA([foo], [[#! /bin/sh if test $# -gt 0; then for arg do printf %s\\n "$arg" done else : fi ]]) AT_DATA([lt-wrapper], [[#! /bin/sh # Generated by GNU libtool. # fake wrapper script. program=lt-real progdir=. if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then # Run the actual program with our arguments. exec "$progdir/$program" ${1+"$@"} echo "$0: cannot exec $program $*" >&2 exit 1 fi ]]) AT_DATA([lt-real], [[#! /bin/sh for arg do printf %s\\n "$arg" done cat ]]) AT_DATA([libfakelib.la], [[# libfakelib.la - a libtool library file # Generated by ltmain.sh (GNU libtool 1.2605 2008/03/04 22:31:32) 2.3a # # Please DO NOT delete this file! # It is necessary for linking the library. dlname='' library_names='' old_library='libfakelib.a' inherited_linker_flags='' dependency_libs='' weak_library_names='' current= age= revision= installed=no shouldnotlink=yes dlopen='' dlpreopen='' libdir='' ]]) mkdir sub cp foo sub/foo chmod +x foo sub/foo lt-wrapper lt-real AT_DATA([liba.c], [[int a () { return 0; } ]]) AT_DATA([main.c], [[#include extern int a (); int main (int argc, char **argv) { int i; for (i=1; i' \ '' '' do if test -z "$arg1"; then arg1=$arg2; continue fi AT_CHECK([$LIBTOOL --mode=execute ./foo abc "$arg1" "$arg2" xyz], [], [stdout], [ignore]) AT_CHECK([$FGREP "$arg1" stdout], [], [ignore]) AT_CHECK([test -z "$arg2" || $FGREP "$arg2" stdout], [], [ignore]) AT_CHECK([test `sed -n '/^abc$/,/^xyz$/p' stdout | wc -l` -eq 4]) AT_CHECK([$LIBTOOL --mode=execute ./lt-wrapper abc "$arg1" "$arg2" xyz