blob: 09b4d49f624a3ed31698defde30d9f92aba560a8 [file] [log] [blame]
Roland McGrath1b8b4462005-11-16 01:33:38 +00001#! /bin/sh
Roland McGrathe3b15682012-02-21 11:12:46 -08002# Copyright (C) 2005-2012 Red Hat, Inc.
Mark Wielaardde2ed972012-06-05 17:15:16 +02003# This file is part of elfutils.
Roland McGrath1b8b4462005-11-16 01:33:38 +00004#
Mark Wielaardde2ed972012-06-05 17:15:16 +02005# This file is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
Roland McGrath1b8b4462005-11-16 01:33:38 +00009#
Mark Wielaardde2ed972012-06-05 17:15:16 +020010# elfutils is distributed in the hope that it will be useful, but
Ulrich Drepper361df7d2006-04-04 21:38:57 +000011# WITHOUT ANY WARRANTY; without even the implied warranty of
Mark Wielaardde2ed972012-06-05 17:15:16 +020012# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
Ulrich Drepper361df7d2006-04-04 21:38:57 +000014#
Mark Wielaardde2ed972012-06-05 17:15:16 +020015# You should have received a copy of the GNU General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
Ulrich Drepper361df7d2006-04-04 21:38:57 +000017
Roland McGrath1b8b4462005-11-16 01:33:38 +000018
19# We don't compile in an rpath because we want "make installcheck" to
20# use the installed libraries. So for local test runs we need to point
21# the library path at this build.
22
23# This wrapper script is called by the makefile, in one of two ways:
24# $(srcdir)/test-wrapper.sh ../libelf:... run-test.sh ...
25# or:
26# $(srcdir)/test-wrapper.sh installed s,^,eu-, run-test.sh ...
27
28if [ "$1" = installed ]; then
29 shift
30 elfutils_tests_rpath=$1
31 shift
32 program_transform_name="$1"
33 shift
34 elfutils_testrun=installed
35else
36 built_library_path="$1"
37 shift
38 elfutils_testrun=built
39fi
40
Roland McGrathe3b15682012-02-21 11:12:46 -080041old_path="${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
42
Roland McGrath1b8b4462005-11-16 01:33:38 +000043case "$1" in
44*.sh)
45 export built_library_path program_transform_name elfutils_testrun
46 export elfutils_tests_rpath
47 ;;
48*)
49 if [ $elfutils_testrun = built ]; then
Roland McGrathe3b15682012-02-21 11:12:46 -080050 LD_LIBRARY_PATH="$built_library_path$old_path"
Roland McGrath1b8b4462005-11-16 01:33:38 +000051 elif [ $elfutils_tests_rpath = yes ]; then
52 echo >&2 installcheck not possible with --enable-tests-rpath
53 exit 77
Roland McGrath9365d2c2005-11-18 23:55:47 +000054 elif [ "x$libdir" != x/usr/lib ] && [ "x$libdir" != x/usr/lib64 ]; then
Roland McGrathe3b15682012-02-21 11:12:46 -080055 LD_LIBRARY_PATH="${libdir}:${libdir}/elfutils$old_path"
Roland McGrath1b8b4462005-11-16 01:33:38 +000056 fi
Roland McGrathe3b15682012-02-21 11:12:46 -080057 export LD_LIBRARY_PATH
Roland McGrath1b8b4462005-11-16 01:33:38 +000058 ;;
59esac
60
Mark Wielaarde3e3ee22012-10-01 16:14:12 +020061if [ "x$VALGRIND_CMD" != "x" ]; then
62 export VALGRIND_CMD
63fi
64
Roland McGrath1b8b4462005-11-16 01:33:38 +000065exec "$@"