Ok, another try. I've constructed an ELF file with all the DT_* flags set, it is named testfile58. The .sh file just runs readelf -d like you suggested, so there isn't any .c file. With this test the function ebl_dynamic_tag_name is 100% covered. The unlovely thing is that the test depends on printf ("%s", NULL) printing "(null)" because this way it is a way simpler.
I've also fixed date in the last ChangeLog entry. All is available in branch mpolacek/ebl_dynamic_tag_name. Tested on x86_64. The patch is also attached. Ok?
Marek
Signed-off-by: Marek Polacek mpolacek@redhat.com --- tests/ChangeLog | 8 +++- tests/Makefile.am | 5 +- tests/run-ebl-dynamic-tag-name.sh | 103 +++++++++++++++++++++++++++++++++++++ tests/testfile58.bz2 | Bin 0 -> 299 bytes 4 files changed, 113 insertions(+), 3 deletions(-) create mode 100755 tests/run-ebl-dynamic-tag-name.sh create mode 100644 tests/testfile58.bz2
diff --git a/tests/ChangeLog b/tests/ChangeLog index 4ec3853..3c11635 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,4 +1,10 @@ -2011-04-02 Marek Polacek mpolacek@redhat.com +2011-03-25 Marek Polacek mpolacek@redhat.com + + * run-ebl-dynamic-tag-name.sh: New test. + * testfile58.bz2: New file, all DT_* flags set. + * Makefile.am (EXTRA_DIST): Add and update all. + +2011-03-02 Marek Polacek mpolacek@redhat.com
* dwarf-getstring.c: New test. * run-dwarf-getstring.sh: And its wrapper. diff --git a/tests/Makefile.am b/tests/Makefile.am index 70029f7..f1de41d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -84,7 +84,8 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ run-disasm-x86.sh run-disasm-x86-64.sh \ run-early-offscn.sh run-dwarf-getmacros.sh \ run-test-flag-nobits.sh run-prelink-addr-test.sh \ - run-dwarf-getstring.sh run-rerequest_tag.sh + run-dwarf-getstring.sh run-rerequest_tag.sh \ + run-ebl-dynamic-tag-name.sh # run-show-ciefde.sh
if !STANDALONE @@ -118,7 +119,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ run-addrname-test.sh run-dwfl-bug-offline-rel.sh \ run-dwfl-addr-sect.sh run-early-offscn.sh \ run-dwarf-getmacros.sh run-test-flag-nobits.sh \ - run-dwarf-getstring.sh \ + run-dwarf-getstring.sh run-ebl-dynamic-tag-name.sh \ testfile15.bz2 testfile15.debug.bz2 \ testfile16.bz2 testfile16.debug.bz2 \ testfile17.bz2 testfile17.debug.bz2 \ diff --git a/tests/run-ebl-dynamic-tag-name.sh b/tests/run-ebl-dynamic-tag-name.sh new file mode 100755 index 0000000..4e872fd --- /dev/null +++ b/tests/run-ebl-dynamic-tag-name.sh @@ -0,0 +1,103 @@ +#! /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 + +testfiles testfile58 + +testrun_compare ../src/readelf -d testfile58 <<\EOF + +Dynamic segment contains 66 entries: + Addr: 0x000001a0 Offset: 0x000078 Link to section: [ 0] '' + Type Value + NULL + NEEDED Shared library: [(null)] + PLTRELSZ 3735928559 (bytes) + PLTGOT 0xdeadbeef + HASH 0xdeadbeef + STRTAB 0xdeadbeef + SYMTAB 0xdeadbeef + RELA 0xdeadbeef + RELASZ 3735928559 (bytes) + RELAENT 3735928559 (bytes) + STRSZ 3735928559 (bytes) + SYMENT 3735928559 (bytes) + INIT 0xdeadbeef + FINI 0xdeadbeef + SONAME Library soname: [(null)] + RPATH Library rpath: [(null)] + SYMBOLIC 0xdeadbeef + REL 0xdeadbeef + RELSZ 3735928559 (bytes) + RELENT 3735928559 (bytes) + PLTREL ??? + DEBUG + TEXTREL + JMPREL 0xdeadbeef + BIND_NOW + INIT_ARRAY 0xdeadbeef + FINI_ARRAY 0xdeadbeef + INIT_ARRAYSZ 3735928559 (bytes) + FINI_ARRAYSZ 3735928559 (bytes) + RUNPATH Library runpath: [(null)] + FLAGS ORIGIN SYMBOLIC TEXTREL BIND_NOW 0xdeadbee0 + PREINIT_ARRAY 0xdeadbeef + PREINIT_ARRAY 0xdeadbeef + PREINIT_ARRAYSZ 0xdeadbeef + VERSYM 0xdeadbeef + GNU_PRELINKED 0xdeadbeef + GNU_CONFLICTSZ 3735928559 (bytes) + GNU_LIBLISTSZ 3735928559 (bytes) + CHECKSUM 0xdeadbeef + PLTPADSZ 3735928559 (bytes) + MOVEENT 3735928559 (bytes) + MOVESZ 3735928559 (bytes) + FEATURE_1 PARINIT CONFEXP 0xdeadbeec + POSFLAG_1 LAZYLOAD GROUPPERM 0xdeadbeec + SYMINSZ 3735928559 (bytes) + SYMINENT 3735928559 (bytes) + GNU_HASH 0xdeadbeef + TLSDESC_PLT 0xdeadbeef + TLSDESC_GOT 0xdeadbeef + GNU_CONFLICT 0xdeadbeef + GNU_LIBLIST 0xdeadbeef + CONFIG 0xdeadbeef + DEPAUDIT 0xdeadbeef + AUDIT 0xdeadbeef + PLTPAD 0xdeadbeef + MOVETAB 0xdeadbeef + SYMINFO 0xdeadbeef + RELACOUNT 3735928559 + RELCOUNT 3735928559 + FLAGS_1 NOW GLOBAL GROUP NODELETE INITFIRST NOOPEN ORIGIN TRANS INTERPOSE NODEFLIB NODUMP CONFALT DISPRELDNE DISPRELPND 0xdeac0000 + VERDEF 0xdeadbeef + VERDEFNUM 3735928559 + VERNEED 0xdeadbeef + VERNEEDNUM 3735928559 + AUXILIARY 0xdeadbeef + FILTER 0xdeadbeef +EOF + +exit 0 diff --git a/tests/testfile58.bz2 b/tests/testfile58.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..a74bed6ecb84319c5b8a11f31a3ee6a68db5fc32 GIT binary patch literal 299 zcmV+`0o49NT4*^jL0KkKS+@7zuK)nCef$6a|Nmk^1OP(>JY$?-fIt8QKmq^(00961 z!~d`V_8Sp0kT&&D28Nmd00E(<KmY+1J?bg8l=U8<00000000096oQ_hXagbYHj~se z9-*KIwL{bZ01_lAm(cxd3=Fg!f+a6XQ*53@CI~A^lGdA>4kMz*kE^Y(e+CVWovL>C zFx888vwF0QEhkfepwnpqQ%-0pcpxY-6}VaDAd)D>0!XQBjWf>zIORmF8*CeG7~rg8 zku=&9Z7nO%Ba<b)-CezQ_sbvQB}Df4(Rho>DS&y10^tB$APq^TKo<!qFR4l>-FtWO x=hwfVe*z_~YXATMioq~uW@bich=_;)AOHdKOYxbT#$XwL7ji{7P>{Cw->(lCcs>9C
literal 0 HcmV?d00001