diff options
| author | Josh Stone <[email protected]> | 2011-01-10 21:28:46 -0800 |
|---|---|---|
| committer | Roland McGrath <[email protected]> | 2011-01-10 21:28:46 -0800 |
| commit | ffa02004b21f24b14281c30045139be61075b73f (patch) | |
| tree | 6d4b2e644ba49e5898eb5b4ea92ace0e76eecac0 | |
| parent | 9777cc4208595ef22b06e2d23c6df22f84320b09 (diff) | |
Test cases for libdwfl vs prelink.
| -rw-r--r-- | tests/ChangeLog | 10 | ||||
| -rw-r--r-- | tests/Makefile.am | 7 | ||||
| -rwxr-xr-x | tests/run-prelink-addr-test.sh | 87 | ||||
| -rwxr-xr-x | tests/testfile52.prelink.so.bz2 | bin | 0 -> 1826 bytes | |||
| -rwxr-xr-x | tests/testfile52.so.bz2 | bin | 0 -> 1444 bytes | |||
| -rwxr-xr-x | tests/testfile52.so.debug.bz2 | bin | 0 -> 1672 bytes | |||
| -rwxr-xr-x | tests/testfile53.bz2 | bin | 0 -> 1687 bytes | |||
| -rwxr-xr-x | tests/testfile53.debug.bz2 | bin | 0 -> 1897 bytes | |||
| -rwxr-xr-x | tests/testfile53.prelink.bz2 | bin | 0 -> 2192 bytes |
9 files changed, 102 insertions, 2 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 0176fb49..f6aee50b 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,13 @@ +2011-01-10 Josh Stone <[email protected]> + + * run-prelink-addr-test.sh: New test for prelinked addrs. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + * testfile52.so.bz2, testfile52.so.debug.bz2: New data files. + * testfile52.prelink.so.bz2: New data file, shows REL->RELA. + * testfile53.bz2, testfile53.debug.bz2: New data files. + * testfile53.prelink.bz2: New data file, shows ET_EXEC remap. + * Makefile.am (EXTRA_DIST): Add them. + 2010-06-04 Roland McGrath <[email protected]> * run-unstrip-test.sh: Also test modifying the file in place. diff --git a/tests/Makefile.am b/tests/Makefile.am index 008008ac..4650a59e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -83,7 +83,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ run-dwfl-bug-offline-rel.sh run-dwfl-addr-sect.sh \ run-disasm-x86.sh run-disasm-x86-64.sh \ run-early-offscn.sh run-dwarf-getmacros.sh \ - run-test-flag-nobits.sh + run-test-flag-nobits.sh run-prelink-addr-test.sh # run-show-ciefde.sh if !STANDALONE @@ -139,7 +139,10 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ testfile44.S.bz2 testfile44.expect.bz2 run-disasm-x86.sh \ testfile45.S.bz2 testfile45.expect.bz2 run-disasm-x86-64.sh \ testfile46.bz2 testfile47.bz2 testfile48.bz2 testfile48.debug.bz2 \ - testfile49.bz2 testfile50.bz2 testfile51.bz2 + testfile49.bz2 testfile50.bz2 testfile51.bz2 \ + run-prelink-addr-test.sh testfile52.so.bz2 testfile52.so.debug.bz2 \ + testfile52.prelink.so.bz2 testfile53.bz2 testfile53.debug.bz2 \ + testfile53.prelink.bz2 installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \ bindir=$(DESTDIR)$(bindir) \ diff --git a/tests/run-prelink-addr-test.sh b/tests/run-prelink-addr-test.sh new file mode 100755 index 00000000..9c19988c --- /dev/null +++ b/tests/run-prelink-addr-test.sh @@ -0,0 +1,87 @@ +#! /bin/sh +# Copyright (C) 2011 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + + +# testfile52.c: +# #include <stdlib.h> +# int foo() { exit(0); } +# +# gcc -m32 -g -shared testfile52.c -o testfile52.so +# eu-strip -f testfile52.so.debug testfile52.so +# cp testfile52.so testfile52.prelink.so +# prelink -N testfile52.prelink.so + +testfiles testfile52.so testfile52.prelink.so testfile52.so.debug +tempfiles testmaps52 + +cat > testmaps52 <<EOF +00110000-00111000 r-xp 00000000 00:00 0 [vdso] +00111000-00112000 r-xp 00000000 fd:01 1 `pwd`/testfile52.so +00112000-00113000 rw-p 00000000 fd:01 1 `pwd`/testfile52.so +41000000-41001000 r-xp 00000000 fd:01 2 `pwd`/testfile52.prelink.so +41001000-41002000 rw-p 00000000 fd:01 2 `pwd`/testfile52.prelink.so +4718e000-47191000 rw-p 00000000 00:00 0 +f7fda000-f7fdb000 rw-p 00000000 00:00 0 +f7ffd000-f7ffe000 rw-p 00000000 00:00 0 +fffdd000-ffffe000 rw-p 00000000 00:00 0 [stack] +EOF + +# Prior to commit 1743d7f, libdwfl would fail on the second address, +# because it didn't notice that prelink added a 0x20-byte offset from +# what the .debug file reports. +testrun_compare ../src/addr2line -S -M testmaps52 0x11140c 0x4100042d <<\EOF +foo +/home/jistone/src/elfutils/tests/testfile52.c:2 +foo+0x1 +/home/jistone/src/elfutils/tests/testfile52.c:2 +EOF + + +# testfile53.c: +# char foo[2000]; +# int main() { return 0; } +# +# gcc -g testfile53.c -o testfile53 +# eu-strip -f testfile53.debug testfile53 +# cp testfile53 testfile53.prelinked +# prelink -N testfile53.prelinked +testfiles testfile53 testfile53.prelink testfile53.debug + +testrun_compare ../src/addr2line -S -e testfile53 0x400474 0x400475 <<\EOF +main +/home/jistone/src/elfutils/tests/testfile53.c:2 +main+0x1 +/home/jistone/src/elfutils/tests/testfile53.c:2 +EOF + +# prelink shuffled some of the sections, but .text is in the same place. +testrun_compare ../src/addr2line -S -e testfile53.prelink 0x400476 0x400477 <<\EOF +main+0x2 +/home/jistone/src/elfutils/tests/testfile53.c:2 +main+0x3 +/home/jistone/src/elfutils/tests/testfile53.c:2 +EOF diff --git a/tests/testfile52.prelink.so.bz2 b/tests/testfile52.prelink.so.bz2 Binary files differnew file mode 100755 index 00000000..b0e3d3fc --- /dev/null +++ b/tests/testfile52.prelink.so.bz2 diff --git a/tests/testfile52.so.bz2 b/tests/testfile52.so.bz2 Binary files differnew file mode 100755 index 00000000..453759cd --- /dev/null +++ b/tests/testfile52.so.bz2 diff --git a/tests/testfile52.so.debug.bz2 b/tests/testfile52.so.debug.bz2 Binary files differnew file mode 100755 index 00000000..38088a67 --- /dev/null +++ b/tests/testfile52.so.debug.bz2 diff --git a/tests/testfile53.bz2 b/tests/testfile53.bz2 Binary files differnew file mode 100755 index 00000000..2e0e74c8 --- /dev/null +++ b/tests/testfile53.bz2 diff --git a/tests/testfile53.debug.bz2 b/tests/testfile53.debug.bz2 Binary files differnew file mode 100755 index 00000000..ec36e982 --- /dev/null +++ b/tests/testfile53.debug.bz2 diff --git a/tests/testfile53.prelink.bz2 b/tests/testfile53.prelink.bz2 Binary files differnew file mode 100755 index 00000000..b2f4dea9 --- /dev/null +++ b/tests/testfile53.prelink.bz2 |
