From ef1ad8ab8e90d39ea3a30a6e25c78f084765b2c3 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Thu, 8 Dec 1994 19:55:05 +0000 Subject: [PATCH] * binutils-all/objdump.exp (cpus_expected): New variable, taken from objdump -i test, added ns32k, sorted. (objdump -i, -f tests): Use $cpus_expected. * binutils-all/objcopy.exp: For simple-copy test, expect failure for sh-coff. --- binutils/testsuite/ChangeLog | 14 +++ binutils/testsuite/binutils-all/objcopy.exp | 9 +- binutils/testsuite/binutils-all/objdump.exp | 126 ++++++++++++++++++++ 3 files changed, 147 insertions(+), 2 deletions(-) create mode 100644 binutils/testsuite/binutils-all/objdump.exp diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index 9e6a1c1c022..bc9ceb07766 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,17 @@ +Thu Dec 8 14:36:15 1994 Ken Raeburn + + * binutils-all/objdump.exp (cpus_expected): New variable, taken + from objdump -i test, added ns32k, sorted. + (objdump -i, -f tests): Use $cpus_expected. + + * binutils-all/objcopy.exp: For simple-copy test, expect failure + for sh-coff. + +Tue Oct 25 16:00:14 1994 Ian Lance Taylor + + * binutils-all/objcopy.exp: Adjust --adjust-section-vma tests for + new S-record section handling. + Tue Oct 18 11:18:21 1994 Ian Lance Taylor * binutils-all/nm.exp: nm with no arguments and nm -P do not work diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp index 17d70ffbf85..b2032d00c05 100644 --- a/binutils/testsuite/binutils-all/objcopy.exp +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -32,6 +32,11 @@ if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then { # Test that objcopy does not modify a file when copying it. +# Since some versions of the assembler don't use BFD to generate the +# object file, we shouldn't assume that the version written by BFD will +# be bit-for-bit identical. It need merely be functionally identical. +setup_xfail "sh-*-coff" + set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o"] if ![string match "" $got] then { @@ -203,7 +208,7 @@ if {$low == "" || $origstart == ""} then { fail "objcopy --adjust-section-vma +" } else { set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h tmpdir/copy.srec"] - set want "file format srec.*vma\[ \]*(\[0-9a-fA-F\]+)" + set want "file format srec.*SECTION\[ \]*0\[^\n\r\]*vma\[ \]*(\[0-9a-fA-F\]+)" if ![regexp $want $got all vma] then { fail "objcopy --adjust-section-vma +" } else { @@ -222,7 +227,7 @@ if {$low == "" || $origstart == ""} then { fail "objcopy --adjust-section-vma =" } else { set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h tmpdir/copy.srec"] - set want "file format srec.*vma\[ \]*(\[0-9a-fA-F\]+)" + set want "file format srec.*SECTION\[ \]*0\[^\n\r\]*vma\[ \]*(\[0-9a-fA-F\]+)" if ![regexp $want $got all vma] then { fail "objcopy --adjust-section-vma =" } else { diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp new file mode 100644 index 00000000000..244dc3f34a7 --- /dev/null +++ b/binutils/testsuite/binutils-all/objdump.exp @@ -0,0 +1,126 @@ +# Copyright (C) 1993, 1994 Free Software Foundation, Inc. + +# This program 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 2 of the License, or +# (at your option) any later version. +# +# This program 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file was written by Rob Savoye +# and rewritten by Ian Lance Taylor + +if {[which $OBJDUMP] == 0} then { + perror "$OBJDUMP does not exist" + return +} + +send_user "Version [binutil_version $OBJDUMP]" + +# Simple test of objdump -i + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -i"] + +set cpus_expected "(a29k|alliant|alpha|arm|convex|h8|hppa|i386|i860|i960|m68k|m88k|mips|ns32k|pyramid|romp|rs6000|sh|sparc|tahoe|vax|we32k|z8k)" + +set want "BFD header file version.*srec.*header .* endian, data .* endian.*$cpus_expected" + +if [regexp $want $got] then { + pass "objdump -i" +} else { + fail "objdump -i" +} + +# The remaining tests require a test file. + +if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then { + return +} + +# Test objdump -f + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f tmpdir/bintest.o"] + +set want "tmpdir/bintest.o:\[ \]*file format.*architecture:\[ \]*${cpus_expected}.*HAS_RELOC.*HAS_SYMS" + +if ![regexp $want $got] then { + fail "objdump -f" +} else { + pass "objdump -f" +} + +# Test objdump -h + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h tmpdir/bintest.o"] + +set want "tmpdir/bintest.o:\[ \]*file format.*SECTION\[ ]*\[0-9\]+\[ \]*\\\[\[^\]\]*(text|TEXT)\[^\]\]*\\\]\[ :\]*size\[ \]*(\[0-9a-fA-F\]+)\[ \]*.*SECTION\[ \]*\[0-9\]+\[ \]*\\\[\[^\]\]*(data|DATA)\[^\]\]*\\\]\[ :\]*size\[ \]*(\[0-9a-fA-F\]+)\[ \]*" + +if ![regexp $want $got all text_name text_size data_name data_size] then { + fail "objdump -h" +} else { + verbose "text size is $text_size" + verbose "data size is $data_size" + if {$text_size < 8 || $data_size < 4} then { + fail "objdump -h (sizes too small)" + } else { + pass "objdump -h" + } +} + +# Test objdump -t + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -t tmpdir/bintest.o"] + +if [info exists vars] then { unset vars } +while {[regexp "(\[a-z\]*_symbol)(.*)" $got all symbol rest]} { + set vars($symbol) 1 + set got $rest +} + +if {![info exists vars(text_symbol)] \ + || ![info exists vars(data_symbol)] \ + || ![info exists vars(common_symbol)] \ + || ![info exists vars(external_symbol)]} then { + fail "objdump -t" +} else { + pass "objdump -t" +} + +# Test objdump -r + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r tmpdir/bintest.o"] + +set want "tmpdir/bintest.o:\[ \]*file format.*RELOCATION RECORDS FOR \\\[\[^\]\]*(text|TEXT)\[^\]\]*\\\].*external_symbol" + +if [regexp $want $got] then { + pass "objdump -r" +} else { + fail "objdump -r" +} + +# Test objdump -s + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s tmpdir/bintest.o"] + +set want "tmpdir/bintest.o:\[ \]*file format.*Contents.*(text|TEXT)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000001|01000000).*Contents.*(data|DATA)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000002|02000000)" + +if [regexp $want $got] then { + pass "objdump -s" +} else { + fail "objdump -s" +} + +# Options which are not tested: -a -d -D -R -T -x -l --stabs +# I don't see any generic way to test any of these other than -a. +# Tests could be written for specific targets, and that should be done +# if specific problems are found. -- 2.30.2