1#! /bin/sh 2# Copyright (C) 2013 Red Hat, Inc. 3# This file is part of elfutils. 4# 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. 9# 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. 14# 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/>. 17 18. $srcdir/test-subr.sh 19 20testfiles testfile 21tempfiles good.out stdin.nl stdin.nl.out stdin.nonl stdin.nonl.out foo.out 22tempfiles addr2line.out 23 24cat > good.out <<\EOF 25foo 26/home/drepper/gnu/new-bu/build/ttt/f.c:3 27bar 28/home/drepper/gnu/new-bu/build/ttt/b.c:4 29foo 30/home/drepper/gnu/new-bu/build/ttt/f.c:3 31bar 32/home/drepper/gnu/new-bu/build/ttt/b.c:4 33foo 34/home/drepper/gnu/new-bu/build/ttt/f.c:3 35bar 36/home/drepper/gnu/new-bu/build/ttt/b.c:4 37foo 38/home/drepper/gnu/new-bu/build/ttt/f.c:3 39bar 40/home/drepper/gnu/new-bu/build/ttt/b.c:4 41EOF 42 43echo "# Everything on the command line" 44cat good.out | testrun_compare ${abs_top_builddir}/src/addr2line -f -e testfile 0x08048468 0x0804845c foo bar foo+0x0 bar+0x0 foo-0x0 bar-0x0 45 46cat > stdin.nl <<\EOF 470x08048468 480x0804845c 49foo 50bar 51foo+0x0 52bar+0x0 53foo-0x0 54bar-0x0 55EOF 56 57echo "# Everything from stdin (with newlines)." 58cat stdin.nl | testrun ${abs_top_builddir}/src/addr2line -f -e testfile > stdin.nl.out || exit 1 59cmp good.out stdin.nl.out || exit 1 60 61cat > foo.out <<\EOF 62foo 63/home/drepper/gnu/new-bu/build/ttt/f.c:3 64EOF 65 66echo "# stdin without newline address, just EOF." 67echo -n "0x08048468" | testrun ${abs_top_builddir}/src/addr2line -f -e testfile > stdin.nonl.out || exit 1 68cmp foo.out stdin.nonl.out || exit 1 69 70echo "# stdin without newline symbol, just EOF." 71echo -n "foo" | testrun ${abs_top_builddir}/src/addr2line -f -e testfile > stdin.nl.out || exit 1 72cmp foo.out stdin.nonl.out || exit 1 73 74exit 0 75