files.cc files.hh \
highlevel_check.cc highlevel_check.hh highlevel_check_i.hh \
locus.cc locus.hh \
- main.cc \
+ main.cc main.hh \
messages.cc messages.hh \
misc.cc misc.hh \
option.cc option.hh option_i.hh \
tests/crc7.ko.debug.bz2 \
tests/location-leaks.bz2 \
tests/nodebug.bz2 \
+ tests/null.o.bz2 \
tests/check_range_out_of_scope-1.bz2 \
tests/check_debug_info_refs-1.bz2 \
- tests/aranges_terminate_early.bz2
+ tests/check_debug_info_refs-2.bz2 \
+ tests/aranges_terminate_early.bz2 \
tests/libdl-2.12.so.debug.bz2 \
tests/hello.bad-1.bz2 \
+ tests/hello.bad-2.bz2 \
tests/hello.bad-3.bz2 \
tests/empty-1.bz2 \
tests/garbage-1.bz2 \
installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \
bindir=$(DESTDIR)$(bindir) \
- $(top_srcdir)/tests/test-wrapper.sh \
- installed $(tests_rpath) \
- $(program_transform_name)
+ LC_ALL=C; LANG=C; \
+ abs_srcdir=$(abs_srcdir); \
+ abs_builddir=$(abs_builddir); \
+ abs_top_builddir=$(abs_top_builddir); \
+ export abs_srcdir; export abs_builddir; \
+ export abs_top_builddir; \
+ export libdir; export bindir; \
+ export LC_ALL; export LANG; \
+ NM=$(NM); export NM;
+installed_LOG_COMPILER = $(top_srcdir)/tests/test-wrapper.sh \
+ installed $(tests_rpath) \
+ '$(program_transform_name)'
if STANDALONE
TESTS_ENVIRONMENT = $(installed_TESTS_ENVIRONMENT)
+LOG_COMPILER = $(installed_LOG_COMPILER)
else !STANDALONE
-TESTS_ENVIRONMENT = $(top_srcdir)/tests/test-wrapper.sh \
- ../libdw:../backends:../libelf:../libasm
+TESTS_ENVIRONMENT = LC_ALL=C; LANG=C; \
+ abs_srcdir=$(abs_srcdir); abs_builddir=$(abs_builddir); \
+ abs_top_builddir=$(abs_top_builddir); \
+ export abs_srcdir; export abs_builddir; \
+ export abs_top_builddir; \
+ export LC_ALL; export LANG; \
+ NM=$(NM); export NM;
+LOG_COMPILER = $(abs_srcdir)/../tests/test-wrapper.sh \
+ $(abs_top_builddir)/libdw:$(abs_top_builddir)/backends:$(abs_top_builddir)/libelf:$(abs_top_builddir)/libasm
installcheck-local:
$(MAKE) $(AM_MAKEFLAGS) \
- TESTS_ENVIRONMENT='$(installed_TESTS_ENVIRONMENT)' check-TESTS
+ TESTS_ENVIRONMENT="$(installed_TESTS_ENVIRONMENT)"
+ LOG_COMPILER="$(installed_LOG_COMPILER)" check-TESTS
endif !STANDALONE
if BUILD_STATIC
srcdir=$srcdir/tests
-testfiles DW_AT-later-version
+testfiles tests/DW_AT-later-version
-testrun_compare ./dwarflint --nognu DW_AT-later-version <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --nognu DW_AT-later-version <<EOF
warning: .debug_abbrev: abbr. 0x11, attr. endianity: attribute from later DWARF version.
warning: .debug_info: DIE 0xb: DW_AT_low_pc value not below DW_AT_high_pc.
warning: .debug_info: DIE 0x29: variable has decl_file, but NOT decl_line
# Hand-crafted file that has 0,0 pair in aranges presented before the
# actual end of the table.
-testfiles DW_AT_high_pc-below
+testfiles tests/DW_AT_high_pc-below
-testrun_compare ./dwarflint --check=@low DW_AT_high_pc-below <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --check=@low DW_AT_high_pc-below <<EOF
warning: .debug_info: DIE 0xb: DW_AT_low_pc value not below DW_AT_high_pc.
EOF
# Hand-crafted file that has 0,0 pair in aranges presented before the
# actual end of the table.
-testfiles DW_AT_high_pc-relative
+testfiles tests/DW_AT_high_pc-relative
-testrun_compare ./dwarflint --check=@low DW_AT_high_pc-relative <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --check=@low DW_AT_high_pc-relative <<EOF
No errors
EOF
# Hand-crafted file that has 0,0 pair in aranges presented before the
# actual end of the table.
-testfiles aranges_terminate_early
+testfiles tests/aranges_terminate_early
-testrun_compare ./dwarflint --strict aranges_terminate_early <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --strict aranges_terminate_early <<EOF
warning: .debug_aranges: [0x20, 0x30): unnecessary padding with zero bytes.
warning: .debug_aranges: addresses [0x400474, 0x400481) are covered with CU DIEs, but not with aranges.
EOF
-testrun_compare ./dwarflint --check=check_debug_aranges --strict aranges_terminate_early <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --check=check_debug_aranges --strict aranges_terminate_early <<EOF
warning: .debug_aranges: [0x20, 0x30): unnecessary padding with zero bytes.
warning: .debug_aranges: addresses [0x400474, 0x400481) are covered with CU DIEs, but not with aranges.
EOF
srcdir=$srcdir/tests
-testfiles hello.bad-1 hello.bad-3 empty-1 \
- garbage-1 garbage-2 garbage-3 garbage-4 \
- garbage-5 garbage-6 garbage-7 garbage-8 \
- garbage-9 garbage-10 garbage-11 garbage-12
+testfiles tests/hello.bad-1 tests/hello.bad-3 tests/empty-1 \
+ tests/garbage-1 tests/garbage-2 tests/garbage-3 tests/garbage-4 \
+ tests/garbage-5 tests/garbage-6 tests/garbage-7 tests/garbage-8 \
+ tests/garbage-9 tests/garbage-10 tests/garbage-11 tests/garbage-12
-testrun_compare ./dwarflint hello.bad-1 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint hello.bad-1 <<EOF
error: .debug_info: DIE 0x83: abbrev section at 0x0 doesn't contain code 83.
EOF
-testrun_compare ./dwarflint --check=@low hello.bad-3 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --check=@low hello.bad-3 <<EOF
error: .debug_info: DIE 0x2d: This DIE had children, but no DW_AT_sibling attribute.
error: .debug_info: DIE 0xb: This DIE had children, but no DW_AT_sibling attribute.
error: .debug_info: DIE 0x91: toplevel DIE chain contains more than one DIE.
error: .debug_info: DIE 0xab: toplevel DIE chain contains more than one DIE.
EOF
-testrun_compare ./dwarflint empty-1 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint empty-1 <<EOF
warning: .debug_info: DIE 0xb: DW_AT_low_pc value not below DW_AT_high_pc.
warning: .debug_line: table 0: no CU uses this line table.
error: .debug_info: DIE 0x29, attr. decl_file: references .debug_line table, but CU DIE lacks DW_AT_stmt_list.
EOF
-testrun_compare ./dwarflint garbage-1 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint garbage-1 <<EOF
error: Broken ELF: offset out of range.
error: .debug_abbrev: data not found.
error: .debug_info: data not found.
EOF
-testrun_compare ./dwarflint garbage-2 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint garbage-2 <<EOF
error: .debug_info: CU 0: toplevel DIE must be either compile_unit or partial_unit.
error: .debug_info: DIE 0xab: DIE chain not terminated with null entry.
EOF
-testrun_compare ./dwarflint --check=@low garbage-3 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --check=@low garbage-3 <<EOF
error: .debug_abbrev: abbr. attribute 0xc: invalid attribute code 0.
EOF
-testrun_compare ./dwarflint garbage-4 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint garbage-4 <<EOF
error: .debug_info: DIE 0x6c: this DIE claims that its sibling is 0x80000085 but it's actually 0x85.
error: .debug_info: DIE 0xab: DIE chain not terminated with null entry.
EOF
-testrun_compare ./dwarflint garbage-5 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint garbage-5 <<EOF
error: .debug_info: DIE 0xab: DIE chain not terminated with null entry.
error: .debug_line: offset 0x3e: not enough data to read an opcode of length 5.
error: .debug_info: DIE 0xb, attr. stmt_list: unresolved reference to .debug_line table 0x0.
EOF
-testrun_compare ./dwarflint garbage-6 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint garbage-6 <<EOF
error: .debug_info: CU 0: invalid address size: 9 (only 4 or 8 allowed).
error: .debug_info: couldn't load CU headers for processing .debug_abbrev; assuming latest DWARF flavor.
error: .debug_abbrev: abbr. 0x0, attr. stmt_list: attribute with invalid form DW_FORM_data4.
error: .debug_abbrev: abbr. 0x2c, attr. location: attribute with invalid form DW_FORM_block1.
EOF
-testrun_compare ./dwarflint garbage-7 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint garbage-7 <<EOF
warning: .debug_abbrev: abbr. attribute 0x7e: invalid or unknown name 0x703.
error: .debug_abbrev: abbr. 0x7a, attr. 0x703: invalid form 0x0.
error: .debug_abbrev: missing zero to mark end-of-table.
EOF
-testrun_compare ./dwarflint garbage-8 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint garbage-8 <<EOF
error: .debug_info: DIE 0x6c, attr. sibling: has a value of 0.
error: .debug_info: DIE 0x6c: This DIE had children, but no DW_AT_sibling attribute.
error: .debug_info: DIE 0xab: DIE chain not terminated with null entry.
EOF
-testrun_compare ./dwarflint garbage-9 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint garbage-9 <<EOF
error: .debug_info: DIE 0x84, attr. type: invalid reference outside the CU: 0xef00ab.
error: .debug_info: DIE 0x6c: is the last sibling in chain, but has a DW_AT_sibling attribute.
error: .debug_info: DIE 0xab: DIE chain not terminated with null entry.
EOF
-testrun_compare ./dwarflint garbage-10 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint garbage-10 <<EOF
warning: .rela 0xc of .debug_info: DIE 0xb, attr. producer: relocation formed using STT_SECTION symbol with non-zero value.
error: .rela 0x11 of .debug_info: DIE 0xb, attr. comp_dir: couldn't obtain symbol #7208969: invalid section index.
warning: .debug_info: DIE 0xb: DW_AT_low_pc value not below DW_AT_high_pc.
EOF
-testrun_compare ./dwarflint garbage-11 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint garbage-11 <<EOF
error: .rela 0x600 of .debug_info: invalid relocation 2560 (<INVALID RELOC>).
error: .rela 0xc00 of .debug_info: invalid relocation 2560 (<INVALID RELOC>).
error: .rela 0x1100 of .debug_info: invalid relocation 2560 (<INVALID RELOC>).
error: .debug_info: DIE 0xb, attr. stmt_list: unresolved reference to .debug_line table 0x0.
EOF
-testrun_compare ./dwarflint garbage-12 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint garbage-12 <<EOF
error: Broken ELF: invalid section header.
error: .debug_abbrev: data not found.
error: .debug_info: data not found.
srcdir=$srcdir/tests
-testfiles check_debug_info_refs-{1,2}
+testfiles tests/check_debug_info_refs-1
-testrun_compare ./dwarflint --check=check_debug_info_refs check_debug_info_refs-1 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --check=check_debug_info_refs check_debug_info_refs-1 <<EOF
error: .debug_aranges: table 48 (CU DIE 95): there has already been arange section for this CU.
warning: .debug_info: CU 0: no aranges table is associated with this CU.
EOF
-testrun_compare ./dwarflint --check=check_debug_info_refs check_debug_info_refs-1 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --check=check_debug_info_refs check_debug_info_refs-1 <<EOF
error: .debug_aranges: table 48 (CU DIE 95): there has already been arange section for this CU.
warning: .debug_info: CU 0: no aranges table is associated with this CU.
EOF
-testrun_compare ./dwarflint --check=check_debug_info_refs check_debug_info_refs-2 <<EOF
+testfiles tests/check_debug_info_refs-2
+
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --check=check_debug_info_refs check_debug_info_refs-2 <<EOF
warning: .debug_info: DIE 0xb: DW_AT_low_pc value not below DW_AT_high_pc.
warning: .debug_info: CU 0: no aranges table is associated with this CU.
EOF
srcdir=$srcdir/tests
-testfiles crc7.ko.debug
+testfiles tests/crc7.ko.debug
-testrun_compare ./dwarflint --dups=0 --check check_duplicate_DW_tag_variable crc7.ko.debug <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --dups=0 --check check_duplicate_DW_tag_variable crc7.ko.debug <<EOF
warning: .debug_info: DIE 0x40f1: DW_AT_low_pc value not below DW_AT_high_pc.
warning: .debug_info: CU 16614: no aranges table is associated with this CU.
warning: .debug_info: DIE 0x3d21: Redeclaration of variable 'console_printk', originally seen at DIE 37f3.
srcdir=$srcdir/tests
-testfiles check_range_out_of_scope-1
+testfiles tests/check_range_out_of_scope-1
-testrun_compare ./dwarflint --check=check_range_out_of_scope check_range_out_of_scope-1 <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --check=check_range_out_of_scope check_range_out_of_scope-1 <<EOF
error: .debug_info: DIE 0x8b: PC range [0x4004d0, 0x4004d1) is not a sub-range of containing scope.
error: .debug_info: DIE 0x7a: in this context: [0x4004d4, 0x4004db)
EOF
srcdir=$srcdir/tests
-testfiles check_self_referential_die
+testfiles tests/check_self_referential_die
-testrun_compare ./dwarflint --check=check_self_referential_die --ignore-bloat check_self_referential_die <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --check=check_self_referential_die --ignore-bloat check_self_referential_die <<EOF
warning: .debug_info: DIE 0x19dc2: structure_type attribute containing_type references DIE itself.
EOF
srcdir=$srcdir/tests
-testfiles debug_abbrev-duplicate-attribute
+testfiles tests/debug_abbrev-duplicate-attribute
-testrun_compare ./dwarflint debug_abbrev-duplicate-attribute <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint debug_abbrev-duplicate-attribute <<EOF
error: .debug_abbrev: abbr. attribute 0x19: duplicate attribute byte_size (first was at 0x13).
error: .debug_abbrev: abbr. attribute 0x1b: duplicate attribute decl_file (first was at 0x15).
error: .debug_abbrev: abbr. attribute 0x1d: duplicate attribute decl_line (first was at 0x17).
srcdir=$srcdir/tests
-testfiles libdl-2.12.so.debug
+testfiles tests/libdl-2.12.so.debug
# Here we test that dwarflint can tolerate invalid attribute name.
-testrun_compare ./dwarflint --check=@low --nognu --ignore-bloat libdl-2.12.so.debug <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --check=@low --nognu --ignore-bloat libdl-2.12.so.debug <<EOF
warning: .debug_abbrev: abbr. attribute 0xbe: invalid or unknown name 0x2107.
warning: .debug_abbrev: abbr. attribute 0x330: invalid or unknown name 0x2107.
warning: .debug_abbrev: abbr. attribute 0xa28: invalid or unknown name 0x2107.
EOF
# Here we test proper support for DW_AT_GNU_vector
-testrun_compare ./dwarflint --check=@low --ignore-bloat libdl-2.12.so.debug <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --check=@low --ignore-bloat libdl-2.12.so.debug <<EOF
warning: .debug_info: DIE 0xd9a8: DW_AT_low_pc value not below DW_AT_high_pc.
warning: .debug_info: DIE 0xdcd7: DW_AT_low_pc value not below DW_AT_high_pc.
warning: .debug_info: CU 55709: no aranges table is associated with this CU.
srcdir=$srcdir/tests
-testfiles location-leaks
+testfiles tests/location-leaks
-testrun_compare ./dwarflint location-leaks <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint location-leaks <<EOF
warning: .debug_loc: loclist 0x38: entry covers no range.
error: .debug_info: DIE 0x62: attribute \`location': PC range [0x400495, 0x40049a) outside containing scope.
error: .debug_info: DIE 0x51: in this context: [0x400498, 0x4004b2).
srcdir=$srcdir/tests
-testfiles nodebug null.o
+testfiles tests/nodebug tests/null.o
-testrun_compare ./dwarflint nodebug <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint nodebug <<EOF
error: .debug_abbrev: data not found.
error: .debug_info: data not found.
EOF
-testrun_compare ./dwarflint -i nodebug <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint -i nodebug <<EOF
No errors
EOF
-testrun_compare ./dwarflint -q -i nodebug <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint -q -i nodebug <<EOF
EOF
# This has nothing to do with the nodebug test, but we can just as
# well stick it in there.
-testrun_compare ./dwarflint --check=oentuh -q nodebug <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --check=oentuh -q nodebug <<EOF
warning: the rule \`oentuh' never matched.
EOF
# ... and since we are testing this here, also check that we don't get
# this message in situations where it makes no sense.
-LANG=C testrun_compare ./dwarflint --check=oentuh -q noeuht <<EOF
+LANG=C testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --check=oentuh -q noeuht <<EOF
error: Cannot open input file: No such file or directory.
EOF
-LANG=C testrun_compare ./dwarflint --check=oentuh -q noeuht nodebug <<EOF
+LANG=C testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --check=oentuh -q noeuht nodebug <<EOF
noeuht:
error: Cannot open input file: No such file or directory.
warning: the rule \`oentuh' never matched.
EOF
-LANG=C testrun_compare ./dwarflint --check=oentuh -q nodebug nodebug <<EOF
+LANG=C testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --check=oentuh -q nodebug nodebug <<EOF
nodebug:
warning: the rule \`oentuh' never matched.
EOF
-testrun_compare ./dwarflint null.o <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint null.o <<EOF
warning: .debug_abbrev: [0x0, 0x1): unnecessary padding with zero bytes.
warning: .debug_abbrev: no abbreviations.
error: .debug_info: data not found.
EOF
-testrun_compare ./dwarflint --ignore-bloat --nodebug:ignore null.o <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --ignore-bloat --nodebug:ignore null.o <<EOF
No errors
EOF
srcdir=$srcdir/tests
-testfiles hello.bad-2
+testfiles tests/hello.bad-2
-../src/readelf -winfo ./tests/test-all-dies-it | grep '^ \[ *[0-9a-f]*\]' |
+../../src/readelf -winfo ../tests/test-all-dies-it | grep '^ \[ *[0-9a-f]*\]' |
sed 's/ \[ *\([0-9a-f]\+\).*/0x\1/' |
- testrun_compare ./tests/test-all-dies-it ./tests/test-all-dies-it
+ testrun_compare ../tests/test-all-dies-it ../tests/test-all-dies-it
-testrun_compare ./tests/test-all-dies-it hello.bad-2 <<EOF
+testrun_compare ../tests/test-all-dies-it hello.bad-2 <<EOF
0xb
EOF
# }
#
# This would crash the low-level check_debug_info in the past.
-testfiles upper
+testfiles tests/upper
-testrun_compare ./dwarflint --quiet --check=@low upper <<EOF
+testrun_compare ${abs_top_builddir}/dwarflint/dwarflint --quiet --check=@low upper <<EOF
EOF
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2009, 2010 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
+
+status=0
+runtest()
+{
+ for file; do
+ if [ -f $file ]; then
+ testrun ../dwarflint/dwarflint -q -i --check=@low $file ||
+ { echo "*** failure in $file"; status=1; }
+ fi
+ done
+}
+
+runtest ../src/addr2line
+runtest ../src/dwarfcmp
+runtest ../src/elfcmp
+runtest ../src/elflint
+runtest ../src/findtextrel
+runtest ../src/ld
+runtest ../src/nm
+runtest ../src/objdump
+runtest ../src/readelf
+runtest ../src/size
+runtest ../src/strip
+runtest ../src/unstrip
+runtest ../*/*.so
+runtest ../dwarflint/dwarflint
+
+exit $status
testfiles()
{
for file; do
- bunzip2 -c ${abs_srcdir}/${file}.bz2 > ${file} || exit 77
- remove_files="$remove_files $file"
+ file_name=$(basename $file)
+ bunzip2 -c ${abs_srcdir}/${file}.bz2 > $file_name || exit 77
+ remove_files="$remove_files $file_name"
done
}
LD_LIBRARY_PATH="${libdir}:${libdir}/elfutils$old_path"
fi
export LD_LIBRARY_PATH
+ export elfutils_testrun program_transform_name
+ export elfutils_tests_rpath
;;
esac