This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 3/4] tests: Add run-readelf-unknown-self.sh test to check for unknown DWARF codes.


Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 tests/ChangeLog                   |  6 ++++++
 tests/Makefile.am                 |  3 ++-
 tests/run-readelf-unknown-self.sh | 21 +++++++++++++++++++++
 tests/test-subr.sh                | 23 +++++++++++++++++++++++
 4 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100755 tests/run-readelf-unknown-self.sh

diff --git a/tests/ChangeLog b/tests/ChangeLog
index efc7305..33535d2 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+2012-07-19  Mark Wielaard  <mjw@redhat.com>
+
+	* run-readelf-unknown-self.sh: New test.
+	* Makefile.am (TESTS): Add run-readelf-unknown-self.sh.
+	(EXTRA_DIST): Likewise.
+
 2012-07-27  Mark Wielaard  <mjw@redhat.com>
 
 	* allregs.c (dwarf_encoding_string): Removed.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0615869..3585ce9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -73,7 +73,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
 	run-nm-self.sh run-readelf-self.sh \
 	run-readelf-test1.sh run-readelf-test2.sh run-readelf-test3.sh \
 	run-readelf-test4.sh run-readelf-twofiles.sh \
-	run-readelf-macro.sh \
+	run-readelf-unknown-self.sh run-readelf-macro.sh \
 	run-native-test.sh run-bug1-test.sh \
 	dwfl-bug-addr-overflow run-addrname-test.sh \
 	dwfl-bug-fd-leak dwfl-bug-report \
@@ -131,6 +131,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
 	     coverage.sh test-subr.sh test-wrapper.sh \
 	     run-readelf-test1.sh run-readelf-test2.sh run-readelf-test3.sh \
 	     run-readelf-test4.sh run-readelf-twofiles.sh \
+	     run-readelf-unknown-self.sh \
 	     run-bug1-test.sh testfile28.bz2 testfile28.rdwr.bz2 \
 	     testfile29.bz2 testfile29.rdwr.bz2 \
 	     testfile30.bz2 testfile31.bz2 testfile32.bz2 testfile33.bz2 \
diff --git a/tests/run-readelf-unknown-self.sh b/tests/run-readelf-unknown-self.sh
new file mode 100755
index 0000000..f24eaaf
--- /dev/null
+++ b/tests/run-readelf-unknown-self.sh
@@ -0,0 +1,21 @@
+#! /bin/sh
+# Copyright (C) 2012 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
+
+# Make sure there are no unknown DWARF codes.
+testrun_on_self_nomatch "unknown_0x[0-9a-f]+" ../src/readelf -N -w
diff --git a/tests/test-subr.sh b/tests/test-subr.sh
index ff29136..5637f62 100644
--- a/tests/test-subr.sh
+++ b/tests/test-subr.sh
@@ -136,3 +136,26 @@ testrun_on_self_quiet()
   # Only exit if something failed
   if test $exit_status != 0; then exit $exit_status; fi
 }
+
+# Make sure the testrun doesn't contain some regular expression output.
+# First argument is an egrep regular expression, the rest is the command
+# to run on all self test files.
+testrun_on_self_nomatch()
+{
+  pattern="$1"
+  shift
+
+  exit_status=0
+  tempfiles self_matches.out
+
+  for file in $self_test_files; do
+      testrun $* $file | egrep -o "$pattern" | sort -u > self_matches.out \
+	  || :
+      if test -s self_matches.out; then
+	  echo "*** failure in $* $file"; cat self_matches.out; exit_status=1;
+      fi
+  done
+
+  # Only exit if something failed
+  if test $exit_status != 0; then exit $exit_status; fi
+}
-- 
1.7.11.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]