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 2/4] tests: Add run-num-self.sh and run-readelf-self.sh tests.


Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 tests/ChangeLog           |  8 ++++++++
 tests/Makefile.am         |  2 ++
 tests/run-nm-self.sh      | 29 +++++++++++++++++++++++++++++
 tests/run-readelf-self.sh | 21 +++++++++++++++++++++
 tests/test-subr.sh        | 14 ++++++++++++++
 5 files changed, 74 insertions(+)
 create mode 100755 tests/run-nm-self.sh
 create mode 100755 tests/run-readelf-self.sh

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 61031eb..9834b4a 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,13 @@
 2012-08-01  Mark Wielaard  <mjw@redhat.com>
 
+	* run-nm-self.sh: New test.
+	* run-readelf-self.sh: Likewise.
+	* test-subr.sh (testrun_on_self_quiet): New function.
+	* Makefile.am (TESTS): Add run-nm-self.sh and run-readelf-self.sh.
+	(EXTRA_DIST): Likewise.
+
+2012-08-01  Mark Wielaard  <mjw@redhat.com>
+
 	* test-subr.sh (self_test_files): New list of files.
 	(testrun_on_self): New function.
 	* run-elflint-self.sh: Use testrun_on_self.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a8b0f16..0615869 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -70,6 +70,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
 	run-ranlib-test2.sh run-ranlib-test3.sh run-ranlib-test4.sh \
 	run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \
 	run-find-prologues.sh run-allregs.sh \
+	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 \
@@ -113,6 +114,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
 	     run-elflint-self.sh run-ranlib-test.sh run-ranlib-test2.sh \
 	     run-ranlib-test3.sh run-ranlib-test4.sh \
 	     run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \
+	     run-nm-self.sh run-readelf-self.sh \
 	     run-find-prologues.sh run-allregs.sh run-native-test.sh \
 	     run-addrname-test.sh run-dwfl-bug-offline-rel.sh \
 	     run-dwfl-addr-sect.sh run-early-offscn.sh \
diff --git a/tests/run-nm-self.sh b/tests/run-nm-self.sh
new file mode 100755
index 0000000..efe0846
--- /dev/null
+++ b/tests/run-nm-self.sh
@@ -0,0 +1,29 @@
+#! /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
+
+status=0
+for what_arg in "--debug-syms" "--defined-only" "--dynamic" "--extern-only"; do
+    for format_arg in "--format=bsd" "--format=sysv" "--format=posix"; do
+	for out_arg in "--numeric-sort" "--no-sort" "--reverse-sort"; do
+	    testrun_on_self_quiet ../src/nm $what_arg $format_arg $out_arg
+	done
+    done
+done
+
+exit $status
diff --git a/tests/run-readelf-self.sh b/tests/run-readelf-self.sh
new file mode 100755
index 0000000..4602712
--- /dev/null
+++ b/tests/run-readelf-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
+
+# Just makes sure readelf doesn't crash
+testrun_on_self_quiet ../src/readelf -a -w
diff --git a/tests/test-subr.sh b/tests/test-subr.sh
index a514bff..93c82b4 100644
--- a/tests/test-subr.sh
+++ b/tests/test-subr.sh
@@ -122,3 +122,17 @@ testrun_on_self()
   # Only exit if something failed
   if test $exit_status != 0; then exit $exit_status; fi
 }
+
+# Same as above, but redirects stdout to /dev/null
+testrun_on_self_quiet()
+{
+  exit_status=0
+
+  for file in $self_test_files; do
+      testrun "$@" $file > /dev/null \
+	  || { echo "*** failure in $@ $file"; exit_status=1; }
+  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]