2 # Copyright (C) 2005-2012 Red Hat, Inc.
3 # This file is part of elfutils.
5 # 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.
10 # elfutils is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # 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/>.
19 # This file is sourced by ". $srcdir/test-subr.sh" at the start of
20 # each test script. It defines some functions they use and sets up
21 # canonical sh state for test runs.
29 trap 'rm -f $remove_files' 0
33 remove_files="$remove_files $*"
39 bunzip2 -c $srcdir/${file}.bz2 > ${file} 2>/dev/null || exit 77
40 remove_files="$remove_files $file"
48 remove_files="$remove_files $outfile"
49 testrun "$@" > $outfile 2>&1 || :
54 outfile="${1##*/}.out"
55 testrun_out $outfile "$@"
57 # diff's exit status will kill the script.
66 # See test-wrapper.sh, which sets the environment for this.
69 ${elfutils_testrun}_testrun "$@"
74 LD_LIBRARY_PATH="${built_library_path}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"\
84 if [ "x$elfutils_tests_rpath" != xno ]; then
85 echo >&2 installcheck not possible with --enable-tests-rpath
90 program=${bindir}/`program_transform ${program##*/}`
93 if [ "${libdir}" != /usr/lib ] && [ "${libdir}" != /usr/lib64 ]; then
94 LD_LIBRARY_PATH="${libdir}:${libdir}/elfutils\
95 ${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" \
104 echo "$*" | sed "${program_transform_name}"
107 self_test_files=`echo ../src/addr2line ../src/elfcmp ../src/elflint \
108 ../src/findtextrel ../src/ld ../src/nm ../src/objdump ../src/readelf \
109 ../src/size ../src/strip ../libelf/libelf.so ../libdw/libdw.so \
110 ../libasm/libasm.so ../backends/libebl_*.so`
112 # Provide a command to run on all self-test files with testrun.
117 for file in $self_test_files; do
119 || { echo "*** failure in $* $file"; exit_status=1; }
122 # Only exit if something failed
123 if test $exit_status != 0; then exit $exit_status; fi
126 # Same as above, but redirects stdout to /dev/null
127 testrun_on_self_quiet()
131 for file in $self_test_files; do
132 testrun $* $file > /dev/null \
133 || { echo "*** failure in $* $file"; exit_status=1; }
136 # Only exit if something failed
137 if test $exit_status != 0; then exit $exit_status; fi