summaryrefslogtreecommitdiffstats
path: root/src/tests/run-addr2line-test.sh
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-02-25 17:00:18 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-02-25 17:00:18 +0000
commita963009a0b9d502ffe81e79c7c3b45b3cf58b044 (patch)
treea63e40b5dd9927bd04ec7427c8797975c2a71f85 /src/tests/run-addr2line-test.sh
parent46a0b252322932680dbaa86a42944fb822af924d (diff)
parent412f6b917fc658c24dd7d624bb82bf1a1e791b95 (diff)
downloadandroid_external_elfutils-a963009a0b9d502ffe81e79c7c3b45b3cf58b044.tar.gz
android_external_elfutils-a963009a0b9d502ffe81e79c7c3b45b3cf58b044.tar.bz2
android_external_elfutils-a963009a0b9d502ffe81e79c7c3b45b3cf58b044.zip
am 412f6b91: am 7401a30e: am 36e62782: Merge "Upgrade to elfutils 0.161."
* commit '412f6b917fc658c24dd7d624bb82bf1a1e791b95': Upgrade to elfutils 0.161.
Diffstat (limited to 'src/tests/run-addr2line-test.sh')
-rwxr-xr-xsrc/tests/run-addr2line-test.sh74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/tests/run-addr2line-test.sh b/src/tests/run-addr2line-test.sh
new file mode 100755
index 00000000..768006bf
--- /dev/null
+++ b/src/tests/run-addr2line-test.sh
@@ -0,0 +1,74 @@
+#! /bin/sh
+# Copyright (C) 2013 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file 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 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils 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 this program. If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/test-subr.sh
+
+testfiles testfile
+tempfiles good.out stdin.nl stdin.nl.out stdin.nonl stdin.nonl.out foo.out
+tempfiles addr2line.out
+
+cat > good.out <<\EOF
+foo
+/home/drepper/gnu/new-bu/build/ttt/f.c:3
+bar
+/home/drepper/gnu/new-bu/build/ttt/b.c:4
+foo
+/home/drepper/gnu/new-bu/build/ttt/f.c:3
+bar
+/home/drepper/gnu/new-bu/build/ttt/b.c:4
+foo
+/home/drepper/gnu/new-bu/build/ttt/f.c:3
+bar
+/home/drepper/gnu/new-bu/build/ttt/b.c:4
+foo
+/home/drepper/gnu/new-bu/build/ttt/f.c:3
+bar
+/home/drepper/gnu/new-bu/build/ttt/b.c:4
+EOF
+
+echo "# Everything on the command line"
+cat good.out | testrun_compare ${abs_top_builddir}/src/addr2line -f -e testfile 0x08048468 0x0804845c foo bar foo+0x0 bar+0x0 foo-0x0 bar-0x0
+
+cat > stdin.nl <<\EOF
+0x08048468
+0x0804845c
+foo
+bar
+foo+0x0
+bar+0x0
+foo-0x0
+bar-0x0
+EOF
+
+echo "# Everything from stdin (with newlines)."
+cat stdin.nl | testrun ${abs_top_builddir}/src/addr2line -f -e testfile > stdin.nl.out || exit 1
+cmp good.out stdin.nl.out || exit 1
+
+cat > foo.out <<\EOF
+foo
+/home/drepper/gnu/new-bu/build/ttt/f.c:3
+EOF
+
+echo "# stdin without newline address, just EOF."
+echo -n "0x08048468" | testrun ${abs_top_builddir}/src/addr2line -f -e testfile > stdin.nonl.out || exit 1
+cmp foo.out stdin.nonl.out || exit 1
+
+echo "# stdin without newline symbol, just EOF."
+echo -n "foo" | testrun ${abs_top_builddir}/src/addr2line -f -e testfile > stdin.nl.out || exit 1
+cmp foo.out stdin.nonl.out || exit 1
+
+exit 0