diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ChangeLog | 16 | ||||
| -rwxr-xr-x | tests/run-disasm-x86-64.sh | 5 | ||||
| -rwxr-xr-x | tests/run-disasm-x86.sh | 5 | ||||
| -rwxr-xr-x | tests/run-dwfllines.sh | 5 | ||||
| -rwxr-xr-x | tests/run-elf_cntl_gelf_getshdr.sh | 5 | ||||
| -rwxr-xr-x | tests/run-elflint-self.sh | 5 | ||||
| -rwxr-xr-x | tests/run-low_high_pc.sh | 6 | ||||
| -rwxr-xr-x | tests/run-native-test.sh | 5 | ||||
| -rwxr-xr-x | tests/run-nm-self.sh | 5 | ||||
| -rwxr-xr-x | tests/run-readelf-self.sh | 5 | ||||
| -rwxr-xr-x | tests/run-strip-reloc.sh | 5 | ||||
| -rwxr-xr-x | tests/run-strip-strmerge.sh | 5 | ||||
| -rw-r--r-- | tests/test-nlist.c | 6 |
13 files changed, 77 insertions, 1 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index d5bda6d2..a9bc6faa 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,5 +1,21 @@ 2017-04-28 Ulf Hermann <[email protected]> + * run-disasm-x86-64.sh: Disable if the native binary format is not + ELF. + * run-disasm-x86.sh: Likewise. + * run-dwfllines.sh: Likewise. + * run-elf_cntl_gelf_getshdr.sh: Likewise. + * run-elflint-self.sh: Likewise. + * run-low_high_pc.sh: Likewise. + * run-native-test.sh: Likewise. + * run-nm-self.sh: Likewise. + * run-readelf-self.sh: Likewise. + * run-strip-reloc.sh: Likewise. + * run-strip-strmerge.sh: Likewise. + * test-nlist.c: Likewise. + +2017-04-28 Ulf Hermann <[email protected]> + * Makefile.am: Use the predefined names for libelf, libdw, libasm, rather than hardcoding to the elf conventions and add the right extension to deleted-lib.<libext>. diff --git a/tests/run-disasm-x86-64.sh b/tests/run-disasm-x86-64.sh index a6be62bb..c5256b78 100755 --- a/tests/run-disasm-x86-64.sh +++ b/tests/run-disasm-x86-64.sh @@ -17,6 +17,11 @@ . $srcdir/test-subr.sh +if ! grep -q -F '#define LIBEXT ".so"' ${abs_top_builddir}/config.h; then + echo "only works with native ELF binaries." + exit 77 +fi + # Run x86-64 test. case "`uname -m`" in x86_64) diff --git a/tests/run-disasm-x86.sh b/tests/run-disasm-x86.sh index 28a3df74..e0b6ee3e 100755 --- a/tests/run-disasm-x86.sh +++ b/tests/run-disasm-x86.sh @@ -17,6 +17,11 @@ . $srcdir/test-subr.sh +if ! grep -q -F '#define LIBEXT ".so"' ${abs_top_builddir}/config.h; then + echo "only works with native ELF binaries." + exit 77 +fi + # Run x86 test. case "`uname -m`" in x86_64 | i?86 ) diff --git a/tests/run-dwfllines.sh b/tests/run-dwfllines.sh index b384de09..c228d7db 100755 --- a/tests/run-dwfllines.sh +++ b/tests/run-dwfllines.sh @@ -83,6 +83,11 @@ mod: CU: [9e4] m.c time: 0, len: 0, idx: 0, b: 1, e: 1, pe: 0, eb: 0, block: 0, isa: 0, disc: 0 EOF +if ! grep -q -F '#define LIBEXT ".so"' ${abs_top_builddir}/config.h; then + echo "self tests only work with native ELF binaries." + exit 77 +fi + testrun_on_self_quiet ${abs_builddir}/dwfllines -e exit 0 diff --git a/tests/run-elf_cntl_gelf_getshdr.sh b/tests/run-elf_cntl_gelf_getshdr.sh index 94b477c7..6cf93afb 100755 --- a/tests/run-elf_cntl_gelf_getshdr.sh +++ b/tests/run-elf_cntl_gelf_getshdr.sh @@ -17,6 +17,11 @@ . $srcdir/test-subr.sh +if ! grep -q -F '#define LIBEXT ".so"' ${abs_top_builddir}/config.h; then + echo "self tests only work with native ELF binaries." + exit 77 +fi + tempfiles test_shdr.out # However we open the elf file, the shdrs should be the same. diff --git a/tests/run-elflint-self.sh b/tests/run-elflint-self.sh index 58fa7d0f..fe6b0a46 100755 --- a/tests/run-elflint-self.sh +++ b/tests/run-elflint-self.sh @@ -18,5 +18,10 @@ . $srcdir/test-subr.sh +if ! grep -q -F '#define LIBEXT ".so"' ${abs_top_builddir}/config.h; then + echo "only works with native ELF binaries." + exit 77 +fi + testrun_on_self ${abs_top_builddir}/src/elflint --quiet --gnu-ld testrun_on_self_compressed ${abs_top_builddir}/src/elflint --quiet --gnu-ld diff --git a/tests/run-low_high_pc.sh b/tests/run-low_high_pc.sh index ab5f2c37..db5b0976 100755 --- a/tests/run-low_high_pc.sh +++ b/tests/run-low_high_pc.sh @@ -26,6 +26,12 @@ testfiles testfile_low_high_pc testrun ${abs_builddir}/low_high_pc -e ./testfile_low_high_pc + +if ! grep -q -F '#define LIBEXT ".so"' ${abs_top_builddir}/config.h; then + echo "self tests only work with native ELF binaries." + exit 77 +fi + testrun ${abs_builddir}/low_high_pc -e ${abs_builddir}/low_high_pc testrun ${abs_builddir}/low_high_pc -e ${abs_top_builddir}/src/strip testrun ${abs_builddir}/low_high_pc -e ${abs_top_builddir}/src/strip.o diff --git a/tests/run-native-test.sh b/tests/run-native-test.sh index d19007f2..4adef49f 100755 --- a/tests/run-native-test.sh +++ b/tests/run-native-test.sh @@ -18,6 +18,11 @@ . $srcdir/test-subr.sh +if ! grep -q -F '#define LIBEXT ".so"' ${abs_top_builddir}/config.h; then + echo "only works with native ELF binaries." + exit 77 +fi + # This tests all the miscellaneous components of backend support # against whatever this build is running on. A platform will fail # this test if it is missing parts of the backend implementation. diff --git a/tests/run-nm-self.sh b/tests/run-nm-self.sh index 6a31afcf..a062c37d 100755 --- a/tests/run-nm-self.sh +++ b/tests/run-nm-self.sh @@ -17,6 +17,11 @@ . $srcdir/test-subr.sh +if ! grep -q -F '#define LIBEXT ".so"' ${abs_top_builddir}/config.h; then + echo "only works with native ELF binaries." + exit 77 +fi + # Test different command line combinations on the nm binary itself. # Test on nm ET_REL, ET_EXEC and ET_DYN files. ET_REL=${abs_top_builddir}/src/nm.o diff --git a/tests/run-readelf-self.sh b/tests/run-readelf-self.sh index 7ffb3577..f645a148 100755 --- a/tests/run-readelf-self.sh +++ b/tests/run-readelf-self.sh @@ -17,5 +17,10 @@ . $srcdir/test-subr.sh +if ! grep -q -F '#define LIBEXT ".so"' ${abs_top_builddir}/config.h; then + echo "only works with native ELF binaries." + exit 77 +fi + # Just makes sure readelf doesn't crash testrun_on_self_quiet ${abs_top_builddir}/src/readelf -a -w diff --git a/tests/run-strip-reloc.sh b/tests/run-strip-reloc.sh index e587eab3..50dddbf8 100755 --- a/tests/run-strip-reloc.sh +++ b/tests/run-strip-reloc.sh @@ -104,6 +104,11 @@ runtest hello_s390.ko 1 runtest hello_aarch64.ko 1 runtest hello_m68k.ko 1 +if ! grep -q -F '#define LIBEXT ".so"' ${abs_top_builddir}/config.h; then + echo "only works with native ELF binaries." + exit 77 +fi + # self test, shouldn't impact non-ET_REL files at all. runtest ${abs_top_builddir}/src/strip 0 runtest ${abs_top_builddir}/src/strip.o 1 diff --git a/tests/run-strip-strmerge.sh b/tests/run-strip-strmerge.sh index aa9c1eb9..d9d75fd9 100755 --- a/tests/run-strip-strmerge.sh +++ b/tests/run-strip-strmerge.sh @@ -17,6 +17,11 @@ . $srcdir/test-subr.sh +if ! grep -q -F '#define LIBEXT ".so"' ${abs_top_builddir}/config.h; then + echo "only works with native ELF binaries." + exit 77 +fi + # Generate a file with merged .shstrtab/.strtab table. # strip and unstrip it. Check all files with elflint. diff --git a/tests/test-nlist.c b/tests/test-nlist.c index 679c911b..06163980 100644 --- a/tests/test-nlist.c +++ b/tests/test-nlist.c @@ -15,10 +15,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <config.h> #include <nlist.h> #include <stdio.h> #include <stdlib.h> - +#include <string.h> int var = 1; @@ -34,6 +35,9 @@ foo (int a) int main (int argc, char *argv[] __attribute__ ((unused))) { + if (strcmp(LIBEXT, ".so") != 0) + return 77; // test-nlist needs to be an ELF binary for this. + struct nlist nl[6] = { [0] = { .n_name = "var" }, |
