]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
tests: Add run-nm-self.sh and run-readelf-self.sh tests.
authorMark Wielaard <mjw@redhat.com>
Wed, 1 Aug 2012 13:39:11 +0000 (15:39 +0200)
committerMark Wielaard <mjw@redhat.com>
Fri, 3 Aug 2012 21:19:55 +0000 (23:19 +0200)
Signed-off-by: Mark Wielaard <mjw@redhat.com>
tests/ChangeLog
tests/Makefile.am
tests/run-nm-self.sh [new file with mode: 0755]
tests/run-readelf-self.sh [new file with mode: 0755]
tests/test-subr.sh

index 0f8d10ffecc16a29cd1e1507ebbae4ea953d167c..8c2547c3cd6f61e84338db7c1838253e5df0bc59 100644 (file)
@@ -1,3 +1,11 @@
+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.
index a8b0f1649104e5afdab6ec3b468ddc2c94add3ec..06158692300a14981dcbdba2ae3cc86226052631 100644 (file)
@@ -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 (executable)
index 0000000..0fe0ec6
--- /dev/null
@@ -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 (executable)
index 0000000..4602712
--- /dev/null
@@ -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
index 5621cf1bd12b421d33a3f348acec1e7c1c8cefaa..ff29136fb97c100074e7540b0414334656b89bc5 100644 (file)
@@ -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