]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Add support for dwarflint testing
authorDjordje Todorovic <djordje.todorovic@rt-rk.com>
Thu, 28 Sep 2017 07:33:40 +0000 (09:33 +0200)
committerMark Wielaard <mark@klomp.org>
Fri, 6 Oct 2017 19:38:48 +0000 (21:38 +0200)
* dwarflint/tests: Update all scripts and makefiles to work
with current test environment.
* dwarflint/Makefile.am: Add support for dwarflint testing.
* tests/test-subr.sh: Update to be used in dwarflint/tests.
* tests/test-wrapper.sh: Likewise.
* tests/run-dwarflint-self.sh: Return back into tests/.

Signed-off-by: Djordje Todorovic <djordje.todorovic@rt-rk.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
19 files changed:
dwarflint/Makefile.am
dwarflint/tests/run-DW_AT-later-version.sh
dwarflint/tests/run-DW_AT_high_pc-below.sh
dwarflint/tests/run-DW_AT_high_pc-relative.sh
dwarflint/tests/run-aranges_terminate_early.sh
dwarflint/tests/run-bad.sh
dwarflint/tests/run-check_debug_info_refs.sh
dwarflint/tests/run-check_duplicate_DW_tag_variable.sh
dwarflint/tests/run-check_range_out_of_scope.sh
dwarflint/tests/run-check_self_referential_die.sh
dwarflint/tests/run-debug_abbrev-duplicate-attribute.sh
dwarflint/tests/run-libdl-2.12.so.debug.sh
dwarflint/tests/run-location-leaks.sh
dwarflint/tests/run-nodebug.sh
dwarflint/tests/run-test-all-dies-it.sh
dwarflint/tests/run-upper.sh
tests/run-dwarflint-self.sh [new file with mode: 0755]
tests/test-subr.sh
tests/test-wrapper.sh

index 1f10a5fb708ce4893383456d100189f8c620229a..58b3ed1aab87885076ac7429a91933bd895e79f0 100644 (file)
@@ -55,7 +55,7 @@ dwarflint_SOURCES = \
        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 \
@@ -127,11 +127,14 @@ EXTRA_DIST = $(EXTRA_TESTS) \
        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 \
@@ -154,18 +157,36 @@ EXTRA_DIST = $(EXTRA_TESTS) \
 
 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
index d662502b3fb0b9053cd0cb642d84982dcd8d63e0..57fef1129e74319c386e9f8dc88cc2ba533393f7 100755 (executable)
@@ -19,9 +19,9 @@
 
 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
index 4b4d6eac6beaeb21dd0c2d8163968c4c6e2c9a35..1556705012e23dfb82fb9384de2bcfeed20a9443 100755 (executable)
@@ -21,8 +21,8 @@ srcdir=$srcdir/tests
 
 # 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
index 8757ba0e64fcf4111cf20975038a179456aca957..b292566558c6b4b39ff6aa7fd21345340573da0b 100755 (executable)
@@ -21,8 +21,8 @@ srcdir=$srcdir/tests
 
 # 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
index 43b2ec2c0f2b08c0283192b7e097f239ae6f6412..40753239cbf87125d5294e2750ca50ee224fc66a 100755 (executable)
@@ -21,14 +21,14 @@ srcdir=$srcdir/tests
 
 # 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
index ebe3873a9542298b1401a19606319ac6c1b0af94..255eca909b152fe765f8c001ad3d3f6634f8e4b3 100755 (executable)
 
 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.
@@ -38,39 +38,39 @@ error: .debug_info: DIE 0xa4: 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.
@@ -78,31 +78,31 @@ error: .debug_abbrev: abbr. 0x13, attr. frame_base: attribute with invalid form
 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>).
@@ -119,7 +119,7 @@ error: .debug_line: table 0: header claims that it has a size of 542, but in fac
 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.
index 4e790b880c39bea29bcf1cb259c816db8db7ce60..74c685711c5e489f18aad3fdc17817e15345ad33 100755 (executable)
 
 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
index c5622872c3d6576942276d24ec49bd89680aec47..1a5bc5aacfff76a706dca101e5ad55c92b82f37d 100755 (executable)
@@ -19,9 +19,9 @@
 
 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.
index fa3b2de2004b63f603aa5026d6a04adaee84c9f2..902fcf3d1da736f844898e2ad8959e6d96bc7a7c 100755 (executable)
@@ -19,9 +19,9 @@
 
 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
index 7fe83c633ccb77b8394c93990af3e1a7b7c3c8da..b1ce9c1e6d46d1e856dd93b8639c0886c94fbbd1 100755 (executable)
@@ -19,8 +19,8 @@
 
 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
index b189bee466599a3945cc6eeb2fdd2a32ef6ae63a..9edb4a007e46cb5d5f05a6307544d737ca3dffdd 100755 (executable)
@@ -19,9 +19,9 @@
 
 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).
index f9f33635b18edfbbc282eccee1c52899cb7902a2..977e7b74fc7e0e458936a5ef78529f1d6b89d149 100755 (executable)
 
 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.
@@ -35,7 +35,7 @@ warning: .debug_info: CU 56524: no aranges table is associated with this CU.
 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.
index a8eb63f9c04a105028e7c02cbe7c56cce584213f..b2213bfaefc135d91031abed9f78f933fc377673 100755 (executable)
@@ -19,9 +19,9 @@
 
 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).
index 1b67a7063c1ba1eaefb4f4d03956235950d9d92f..1335794c22a9247de69aec92b0ae63eb295f33f3 100755 (executable)
 
 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.
@@ -54,7 +54,7 @@ nodebug:
 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:
 
@@ -62,12 +62,12 @@ 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
index fdcf63fd847285d0aa6fcd95a9ef319de69daab3..5d21edb4a3c0fdcbfd27f028c38ee89e3a9f44ba 100755 (executable)
 
 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
index d1ed96ac5861d900a3d2ce058f86ea527ff87300..e85b227749084efc8a6a9fc68f8e7d73b51ea838 100755 (executable)
@@ -42,7 +42,7 @@ srcdir=$srcdir/tests
 # }
 #
 # 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
diff --git a/tests/run-dwarflint-self.sh b/tests/run-dwarflint-self.sh
new file mode 100755 (executable)
index 0000000..6796a54
--- /dev/null
@@ -0,0 +1,46 @@
+#! /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
index a765db6395e9764c95dbdc2a270ee7ebfc1280f7..0856ac02ee7eb4772d5bfb255a621b9967617d16 100644 (file)
@@ -47,8 +47,9 @@ tempfiles()
 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
 }
 
index 09b4d49f624a3ed31698defde30d9f92aba560a8..376b03e4487a256839d39e0fbfe7cd130468bb5f 100755 (executable)
@@ -55,6 +55,8 @@ case "$1" in
     LD_LIBRARY_PATH="${libdir}:${libdir}/elfutils$old_path"
   fi
   export LD_LIBRARY_PATH
+  export elfutils_testrun program_transform_name
+  export elfutils_tests_rpath
   ;;
 esac