diff options
author | Ken Raeburn <raeburn@cygnus> | 1995-07-07 22:49:42 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@cygnus> | 1995-07-07 22:49:42 +0000 |
commit | 943fbd5bd520934ca3a26abb2d5cfbdd2a7659ec (patch) | |
tree | b240b5f343d4689d462e4b642626afbefc87c9f0 /binutils/testsuite | |
parent | c71a604ae102994ad081cb57be24586126048ba6 (diff) | |
download | gdb-943fbd5bd520934ca3a26abb2d5cfbdd2a7659ec.zip gdb-943fbd5bd520934ca3a26abb2d5cfbdd2a7659ec.tar.gz gdb-943fbd5bd520934ca3a26abb2d5cfbdd2a7659ec.tar.bz2 |
fsf address update, but not in COPYING files
Diffstat (limited to 'binutils/testsuite')
-rw-r--r-- | binutils/testsuite/binutils-all/hppa/objdump.exp | 11 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/nm.exp | 101 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/objcopy.exp | 2 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/objdump.exp | 17 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/size.exp | 70 | ||||
-rw-r--r-- | binutils/testsuite/config/default.exp | 55 | ||||
-rw-r--r-- | binutils/testsuite/lib/utils-lib.exp | 116 |
7 files changed, 348 insertions, 24 deletions
diff --git a/binutils/testsuite/binutils-all/hppa/objdump.exp b/binutils/testsuite/binutils-all/hppa/objdump.exp index d4c5a06..bc119af 100644 --- a/binutils/testsuite/binutils-all/hppa/objdump.exp +++ b/binutils/testsuite/binutils-all/hppa/objdump.exp @@ -12,7 +12,7 @@ # # 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. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@prep.ai.mit.edu @@ -20,7 +20,7 @@ # This file was written by Rob Savoye <rob@cygnus.com> # and rewritten by Ian Lance Taylor <ian@cygnus.com> -if [istarget hppa*-*-*] then { +if ![istarget hppa*-*-*] then { return } @@ -39,7 +39,12 @@ if {![binutils_assemble $AS $srcdir$subdir/addendbug.s tmpdir/addendbug.o]} then set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r tmpdir/addendbug.o"] -set want "00000000 R_DP_RELATIVE\[ \]+is_idchar\\+0xffffffe0.*" +if [istarget hppa*-*-*elf*] then { + set want "00000000 R_PARISC_DPREL21L\[ \]+is_idchar\\+0xffffffe0.*" +} else { + set want "00000000 R_DP_RELATIVE\[ \]+is_idchar\\+0xffffffe0.*" +} + if [regexp $want $got] then { pass "addendbug test" diff --git a/binutils/testsuite/binutils-all/nm.exp b/binutils/testsuite/binutils-all/nm.exp new file mode 100644 index 0000000..2abc9df --- /dev/null +++ b/binutils/testsuite/binutils-all/nm.exp @@ -0,0 +1,101 @@ +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 <rob@cygnus.com> +# and rewritten by Ian Lance Taylor <ian@cygnus.com> + +if {[which $NM] == 0} then { + perror "$NM does not exist" + return +} + +send_user "Version [binutil_version $NM]" + + +if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then { + return +} + +# Test nm with no arguments. + +# This test does not work correctly on ECOFF targets, because ECOFF +# stores most symbols twice, which messes up the nm output. +setup_xfail "alpha*-*-osf*" "alpha*-*-netware*" +setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*" +setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" + +set got [binutils_run $NM "$NMFLAGS tmpdir/bintest.o"] + +if [info exists vars] then { unset vars } +while {[regexp "(\[a-zA-Z\]) (\[a-z\]*_symbol)(.*)" $got all type symbol rest]} { + set vars($symbol) $type + set got $rest +} + +if {![info exists vars(text_symbol)] \ + || $vars(text_symbol) != "t" \ + || ![info exists vars(data_symbol)] \ + || $vars(data_symbol) != "d" \ + || ![info exists vars(common_symbol)] \ + || $vars(common_symbol) != "C" \ + || ![info exists vars(external_symbol)] \ + || $vars(external_symbol) != "U"} then { + fail "nm (no arguments)" +} else { + pass "nm (no arguments)" +} + +# Test nm -g + +set got [binutils_run $NM "$NMFLAGS -g 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 "nm -g" +} else { + pass "nm -g" +} + +# Test nm -P + +# This test does not work correctly on ECOFF targets, because ECOFF +# stores most symbols twice, which messes up the nm output. +setup_xfail "alpha*-*-osf*" "alpha*-*-netware*" +setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*" +setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" + +set got [binutils_run $NM "$NMFLAGS -P tmpdir/bintest.o"] + +set want "common_symbol C \[0\]*4.*data_symbol d \[0-9a-fA-F\]*.*external_symbol U.*text_symbol t \[0-9a-fA-F\]*" + +if [regexp $want $got] then { + pass "nm -P" +} else { + fail "nm -P" +} + +# There are certainly other tests that could be run. diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp index 039b24b..9a32672 100644 --- a/binutils/testsuite/binutils-all/objcopy.exp +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -12,7 +12,7 @@ # # 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. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@prep.ai.mit.edu diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp index acf5360..c039dad 100644 --- a/binutils/testsuite/binutils-all/objdump.exp +++ b/binutils/testsuite/binutils-all/objdump.exp @@ -12,7 +12,7 @@ # # 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. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@prep.ai.mit.edu @@ -32,6 +32,9 @@ send_user "Version [binutil_version $OBJDUMP]" set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -i"] set cpus_expected "(a29k|alliant|alpha|arm|convex|h8|hppa|i386|i860|i960|m68k|m88k|mips|ns32k|powerpc|pyramid|romp|rs6000|sh|sparc|tahoe|vax|we32k|z8k)" +# start-sanitize-arc +set cpus_expected "(a29k|alliant|alpha|arc|arm|convex|h8|hppa|i386|i860|i960|m68k|m88k|mips|ns32k|powerpc|pyramid|romp|rs6000|sh|sparc|tahoe|vax|we32k|z8k)" +# end-sanitize-arc set want "BFD header file version.*srec.*header .* endian, data .* endian.*$cpus_expected" @@ -43,6 +46,7 @@ if [regexp $want $got] then { # The remaining tests require a test file. + if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then { return } @@ -63,15 +67,16 @@ if ![regexp $want $got] then { 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\]+)\[ \]*" +set want "tmpdir/bintest.o:\[ \]*file format.*SECTION\[ ]*\[0-9\]+\[ \]*\\\[\[^\]\]*(text|TEXT|CODE)\[^\]\]*\\\]\[ :\]*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)" + if {[expr "0x$text_size"] < 8 || [expr "0x$data_size"] < 4} then { + send_log "sizes too small\n" + fail "objdump -h" } else { pass "objdump -h" } @@ -100,7 +105,7 @@ if {![info exists vars(text_symbol)] \ set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r tmpdir/bintest.o"] -set want "tmpdir/bintest.o:\[ \]*file format.*RELOCATION RECORDS FOR \\\[\[^\]\]*(text|TEXT)\[^\]\]*\\\].*external_symbol" +set want "tmpdir/bintest.o:\[ \]*file format.*RELOCATION RECORDS FOR \\\[\[^\]\]*(text|TEXT|CODE)\[^\]\]*\\\].*external_symbol" if [regexp $want $got] then { pass "objdump -r" @@ -112,7 +117,7 @@ if [regexp $want $got] then { 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)" +set want "tmpdir/bintest.o:\[ \]*file format.*Contents.*(text|TEXT|CODE)\[^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" diff --git a/binutils/testsuite/binutils-all/size.exp b/binutils/testsuite/binutils-all/size.exp new file mode 100644 index 0000000..1a07dd9 --- /dev/null +++ b/binutils/testsuite/binutils-all/size.exp @@ -0,0 +1,70 @@ +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 <rob@cygnus.com> +# and rewritten by Ian Lance Taylor <ian@cygnus.com> + +if {[which $SIZE] == 0} then { + perror "$SIZE does not exist" + return +} + +send_user "Version [binutil_version $SIZE]" + + +if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then { + return +} + +set dec "\[0-9\]+" +set hex "\[0-9a-fA-F\]+" + +# Test size with no arguments + +set got [binutils_run $SIZE "$SIZEFLAGS tmpdir/bintest.o"] + +set want "($dec)\[ \]+($dec)\[ \]+($dec)\[ \]+($dec)\[ \]+($hex)\[ \]+tmpdir/bintest.o" + +if ![regexp $want $got all text data bss dtot hextot] then { + fail "size (no arguments)" +} else { + if {$text < 8 || $data < 4} then { + fail "size (no arguments)" + } else { + pass "size (no arguments)" + } +} + +# Test size -A + +set got [binutils_run $SIZE "$SIZEFLAGS -A tmpdir/bintest.o"] + +set want "tmpdir/bintest.o.*(text|TEXT)\[^\n\r\]*\[ \]($dec)\[ \]+$dec.*(data|DATA)\[^\n\r\]*\[ \]($dec)\[ \]+$dec" + +if ![regexp $want $got all textname textsize dataname datasize] then { + fail "size -A" +} else { + verbose "text size: $textsize" + verbose "data size: $datasize" + if {$textsize < 8 || $datasize < 4} then { + fail "size -A" + } else { + pass "size -A" + } +} diff --git a/binutils/testsuite/config/default.exp b/binutils/testsuite/config/default.exp index 4f4d7b3..6de8538 100644 --- a/binutils/testsuite/config/default.exp +++ b/binutils/testsuite/config/default.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc. +# 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 @@ -12,7 +12,7 @@ # # 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. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@prep.ai.mit.edu @@ -20,32 +20,62 @@ # This file was written by Rob Savoye. (rob@cygnus.com) load_lib util-defs.exp +load_lib utils-lib.exp + +if ![info exists AS] then { + set AS [findfile $base_dir/../gas/as.new $base_dir/../gas/as.new [transform as]] +} +if ![info exists ASFLAGS] then { + set ASFLAGS "" +} -global NM if ![info exists NM] then { - set NM [findfile $base_dir/../nm] + set NM [findfile $base_dir/nm.new $base_dir/nm.new [transform nm]] } -global NMFLAGS if ![info exists NMFLAGS] then { set NMFLAGS "" } -global SIZE + if ![info exists SIZE] then { - set SIZE [findfile $base_dir/../size] + set SIZE [findfile $base_dir/size] } -global SIZEFLAGS if ![info exists SIZEFLAGS] then { set SIZEFLAGS "" } -global OBJDUMP + if ![info exists OBJDUMP] then { - set OBJDUMP [findfile $base_dir/../objdump] + set OBJDUMP [findfile $base_dir/objdump] } -global OBJDUMPFLAGS if ![info exists OBJDUMPFLAGS] then { set OBJDUMPFLAGS "" } +if ![info exists OBJCOPY] then { + set OBJCOPY [findfile $base_dir/objcopy] +} +if ![info exists OBJCOPYFLAGS] then { + set OBJCOPYFLAGS "" +} + +if ![file isdirectory tmpdir] {catch "exec mkdir tmpdir" status} + +# +# binutils_run +# run a program, returning the output +# sets binutils_run_failed if the program does not exist +# +proc binutils_run { prog progargs } { + default_binutils_run $prog $progargs +} + +# +# binutils_assemble +# assemble a file +# +proc binutils_assemble { as source object } { + default_binutils_assemble $as $source $object +} + # # add some basic error trapping. These mostly catch programming error's # within the tests themselves @@ -54,6 +84,3 @@ expect_before { buffer_full { perror "internal buffer is full." } "can't open '*'" { perror "Can't open test file." } } - - - diff --git a/binutils/testsuite/lib/utils-lib.exp b/binutils/testsuite/lib/utils-lib.exp new file mode 100644 index 0000000..2eb6821 --- /dev/null +++ b/binutils/testsuite/lib/utils-lib.exp @@ -0,0 +1,116 @@ +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 <rob@cygnus.com> +# and extended by Ian Lance Taylor <ian@cygnus.com> + +proc binutil_version { prog } { + if {[which $prog] == 0} then { + perror "$prog can't be run, file not found." + return "" + } + catch "exec $prog --version" tmp + # Should find a way to discard constant parts, keep whatever's + # left, so the version string could be almost anything at all... + regexp "version (cygnus-|)\[-0-9.a-zA-Z-\]+" $tmp version + if ![info exists version] then { + return "[which $prog] (no version number)\n" + } + set tmp $version + return "[which $prog] $version\n" +} + +# +# default_binutils_run +# run a program, returning the output +# sets binutils_run_failed if the program does not exist +# +proc default_binutils_run { prog progargs } { + global binutils_run_failed + + set binutils_run_failed 0 + + if {[which $prog] == 0} then { + perror "$prog does not exist" + set binutils_run_failed 1 + return "" + } + + send_log "$prog $progargs\n" + verbose "$prog $progargs" + + # This used to be + # catch "exec $prog $progargs" exec_output + # but that would evaluate $progargs twice, which would fail if + # any arguments started with `$'. This is a dismal hack to avoid + # this problem. I tried using + # catch { exec $prog $progargs } exec_output + # but that failed because $progargs was not split into words by + # exec. I don't know if this operation can be done correctly. No + # matter how hard I try, I can not convince myself that TCL is a + # language. + regsub -all "\\$" $progargs "\\$" progq + catch "exec $prog $progq" exec_output + if {![string match "" $exec_output]} then { + send_log "$exec_output\n" + verbose "$exec_output" + } + return $exec_output +} + +# +# default_binutils_assemble +# assemble a file +# +proc default_binutils_assemble { as source object } { + global ASFLAGS + global srcdir + + if {[which $as] == 0} then { + perror "$as does not exist" + return 0 + } + + if ![info exists ASFLAGS] { set ASFLAGS "" } + + # The HPPA assembler syntax is a little different than most, to make + # the test source file assemble we need to run it through sed. + # + # This is a hack in that it won't scale well if other targets need + # similar transformations to assemble. We'll generalize the hack + # if/when other targets need similar handling. + if [istarget "hppa*-*-*" ] then { + send_log "sed -f $srcdir/config/hppa.sed < $source | $as $ASFLAGS -o $object\n" + verbose "sed -f $srcdir/config/hppa.sed < $source | $as $ASFLAGS -o $object" + catch "exec sed -f $srcdir/config/hppa.sed < $source | $as $ASFLAGS -o $object" exec_output + } else { + send_log "$as $ASFLAGS -o $object $source\n" + verbose "$as $ASFLAGS -o $object $source" + catch "exec $as $ASFLAGS -o $object $source" exec_output + } + + if [string match "" $exec_output] then { + return 1 + } else { + send_log "$exec_output\n" + verbose "$exec_output" + perror "$source: assembly failed" + return 0 + } +} |