Blame tests/test-wrapper.sh

Packit 032894
#! /bin/sh
Packit 032894
# Copyright (C) 2005-2012 Red Hat, Inc.
Packit 032894
# This file is part of elfutils.
Packit 032894
#
Packit 032894
# This file is free software; you can redistribute it and/or modify
Packit 032894
# it under the terms of the GNU General Public License as published by
Packit 032894
# the Free Software Foundation; either version 3 of the License, or
Packit 032894
# (at your option) any later version.
Packit 032894
#
Packit 032894
# elfutils is distributed in the hope that it will be useful, but
Packit 032894
# WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 032894
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 032894
# GNU General Public License for more details.
Packit 032894
#
Packit 032894
# You should have received a copy of the GNU General Public License
Packit 032894
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 032894
Packit 032894
Packit 032894
# We don't compile in an rpath because we want "make installcheck" to
Packit 032894
# use the installed libraries.  So for local test runs we need to point
Packit 032894
# the library path at this build.
Packit 032894
Packit 032894
# This wrapper script is called by the makefile, in one of two ways:
Packit 032894
#	$(srcdir)/test-wrapper.sh ../libelf:... run-test.sh ...
Packit 032894
# or:
Packit 032894
#	$(srcdir)/test-wrapper.sh installed s,^,eu-, run-test.sh ...
Packit 032894
Packit 032894
if [ "$1" = installed ]; then
Packit 032894
  shift
Packit 032894
  elfutils_tests_rpath=$1
Packit 032894
  shift
Packit 032894
  program_transform_name="$1"
Packit 032894
  shift
Packit 032894
  elfutils_testrun=installed
Packit 032894
else
Packit 032894
  built_library_path="$1"
Packit 032894
  shift
Packit 032894
  elfutils_testrun=built
Packit 032894
fi
Packit 032894
Packit 032894
old_path="${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
Packit 032894
Packit 032894
case "$1" in
Packit 032894
*.sh)
Packit 032894
  export built_library_path program_transform_name elfutils_testrun
Packit 032894
  export elfutils_tests_rpath
Packit 032894
  ;;
Packit 032894
*)
Packit 032894
  if [ $elfutils_testrun = built ]; then
Packit 032894
    LD_LIBRARY_PATH="$built_library_path$old_path"
Packit 032894
  elif [ $elfutils_tests_rpath = yes ]; then
Packit 032894
    echo >&2 installcheck not possible with --enable-tests-rpath
Packit 032894
    exit 77
Packit 032894
  elif [ "x$libdir" != x/usr/lib ] && [ "x$libdir" != x/usr/lib64 ]; then
Packit 032894
    LD_LIBRARY_PATH="${libdir}:${libdir}/elfutils$old_path"
Packit 032894
  fi
Packit 032894
  export LD_LIBRARY_PATH
Packit 032894
  ;;
Packit 032894
esac
Packit 032894
Packit 032894
if [ "x$VALGRIND_CMD" != "x" ]; then
Packit 032894
  export VALGRIND_CMD
Packit 032894
fi
Packit 032894
Packit 032894
exec "$@"