summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2012-08-01 15:39:11 +0200
committerMark Wielaard <mjw@redhat.com>2012-08-03 23:19:55 +0200
commitbf707b5170a78b28e5310bbaa079cc226af73378 (patch)
tree37b502cef49e8e4fbeb49203a8e6b62b2058fa0e
parent94e387f693dae334d0b8c713c27a23bd88bc1fc1 (diff)
downloadelfutils-bf707b5170a78b28e5310bbaa079cc226af73378.tar.gz
tests: Add run-nm-self.sh and run-readelf-self.sh tests.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
-rw-r--r--tests/ChangeLog8
-rw-r--r--tests/Makefile.am2
-rwxr-xr-xtests/run-nm-self.sh26
-rwxr-xr-xtests/run-readelf-self.sh21
-rw-r--r--tests/test-subr.sh18
5 files changed, 73 insertions, 2 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 0f8d10ff..8c2547c3 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 a8b0f164..06158692 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 00000000..0fe0ec62
--- /dev/null
+++ b/tests/run-nm-self.sh
@@ -0,0 +1,26 @@
+#! /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
+
+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
diff --git a/tests/run-readelf-self.sh b/tests/run-readelf-self.sh
new file mode 100755
index 00000000..4602712c
--- /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 5621cf1b..ff29136f 100644
--- a/tests/test-subr.sh
+++ b/tests/test-subr.sh
@@ -115,8 +115,22 @@ testrun_on_self()
exit_status=0
for file in $self_test_files; do
- testrun "$@" $file \
- || { echo "*** failure in $@ $file"; exit_status=1; }
+ testrun $* $file \
+ || { echo "*** failure in $* $file"; exit_status=1; }
+ done
+
+ # 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