]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Add test suite
authorPetr Machata <pmachata@redhat.com>
Wed, 18 Aug 2010 17:14:19 +0000 (19:14 +0200)
committerPetr Machata <pmachata@redhat.com>
Wed, 18 Aug 2010 17:14:19 +0000 (19:14 +0200)
... the first test being for the bugfix of the previous commit

dwarflint/Makefile.am
dwarflint/tests/debug_abbrev-duplicate-attribute.bz2 [new file with mode: 0644]
dwarflint/tests/run-debug_abbrev-duplicate-attribute.sh [new file with mode: 0755]

index cb0d2b8fd58cc40316e80e1ab3ebfe01b019fda1..a3bfed6bbe00096f8425a921876f77f588eb7a10 100644 (file)
@@ -66,6 +66,26 @@ dwarflint_SOURCES = main.cc \
                    check_dups_abstract_origin.cc \
                    ../src/dwarfstrings.c
 
+TESTS = tests/run-debug_abbrev-duplicate-attribute.sh
+
+EXTRA_DIST = tests/run-debug_abbrev-duplicate-attribute.sh tests/run-debug_abbrev-duplicate-attribute.bz2
+
+installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \
+                             bindir=$(DESTDIR)$(bindir) \
+                             $(top_srcdir)/tests/test-wrapper.sh \
+                             installed $(tests_rpath) \
+                             $(program_transform_name)
+if STANDALONE
+TESTS_ENVIRONMENT = $(installed_TESTS_ENVIRONMENT)
+else !STANDALONE
+TESTS_ENVIRONMENT = $(top_srcdir)/tests/test-wrapper.sh \
+                   ../libdw:../backends:../libelf:../libasm
+
+installcheck-local:
+       $(MAKE) $(AM_MAKEFLAGS) \
+               TESTS_ENVIRONMENT='$(installed_TESTS_ENVIRONMENT)' check-TESTS
+endif !STANDALONE
+
 if BUILD_STATIC
 libasm = ../libasm/libasm.a
 libdw = ../libdw/libdw.a $(zip_LIBS) $(libelf) $(libebl) -ldl
diff --git a/dwarflint/tests/debug_abbrev-duplicate-attribute.bz2 b/dwarflint/tests/debug_abbrev-duplicate-attribute.bz2
new file mode 100644 (file)
index 0000000..119c399
Binary files /dev/null and b/dwarflint/tests/debug_abbrev-duplicate-attribute.bz2 differ
diff --git a/dwarflint/tests/run-debug_abbrev-duplicate-attribute.sh b/dwarflint/tests/run-debug_abbrev-duplicate-attribute.sh
new file mode 100755 (executable)
index 0000000..a750863
--- /dev/null
@@ -0,0 +1,37 @@
+#! /bin/sh
+# Copyright (C) 2010 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/../tests/test-subr.sh
+
+srcdir=$srcdir/tests
+
+testfiles debug_abbrev-duplicate-attribute
+
+testrun_compare ./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).
+error: .debug_line: table 0: sequence of opcodes not terminated with DW_LNE_end_sequence.
+EOF