From: Mark Wielaard Date: Wed, 1 Aug 2012 13:39:11 +0000 (+0200) Subject: tests: Add run-nm-self.sh and run-readelf-self.sh tests. X-Git-Tag: elfutils-0.155~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bf707b5170a78b28e5310bbaa079cc226af73378;p=thirdparty%2Felfutils.git tests: Add run-nm-self.sh and run-readelf-self.sh tests. Signed-off-by: Mark Wielaard --- diff --git a/tests/ChangeLog b/tests/ChangeLog index 0f8d10ffe..8c2547c3c 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,11 @@ +2012-08-01 Mark Wielaard + + * 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 * test-subr.sh (self_test_files): New list of files. diff --git a/tests/Makefile.am b/tests/Makefile.am index a8b0f1649..061586923 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 000000000..0fe0ec622 --- /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 . + +. $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 000000000..4602712c5 --- /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 . + +. $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 5621cf1bd..ff29136fb 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