Remove arc sanitization.
[external/binutils.git] / binutils / testsuite / binutils-all / objdump.exp
1 #   Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-dejagnu@prep.ai.mit.edu
19
20 # This file was written by Rob Savoye <rob@cygnus.com>
21 # and rewritten by Ian Lance Taylor <ian@cygnus.com>
22
23 if {[which $OBJDUMP] == 0} then {
24     perror "$OBJDUMP does not exist"
25     return
26 }
27
28 send_user "Version [binutil_version $OBJDUMP]"
29
30 # Simple test of objdump -i
31
32 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -i"]
33
34 set cpus_expected "(a29k|alliant|alpha|arc|arm|convex|d10v|h8|hppa|i386|i860|i960|m32r|m68k|m88k|mips|mn10200|mn10300|ns32k|powerpc|pyramid|romp|rs6000|sh|sparc|tahoe|vax|we32k|z8k|z8001|z8002)"
35 # start-sanitize-d30v
36 set cpus_expected "(a29k|alliant|alpha|arm|convex|d10v|h8|hppa|i386|i860|i960|d30v|m32r|m68k|m88k|mips|mn10200|mn10300|ns32k|powerpc|pyramid|romp|rs6000|sh|sparc|tahoe|vax|we32k|z8k|z8001|z8002)"
37 # end-sanitize-d30v
38
39 set want "BFD header file version.*srec.*header .* endian.*, data .* endian.*$cpus_expected"
40
41 if [regexp $want $got] then {
42     pass "objdump -i"
43 } else {
44     fail "objdump -i"
45 }
46
47 # The remaining tests require a test file.
48
49
50 if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then {
51     return
52 }
53 if [is_remote host] {
54     set testfile [remote_download host tmpdir/bintest.o]
55 } else {
56     set testfile tmpdir/bintest.o
57 }
58
59 # Test objdump -f
60
61 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f $testfile"]
62
63 set want "$testfile:\[  \]*file format.*architecture:\[         \]*${cpus_expected}.*HAS_RELOC.*HAS_SYMS"
64
65 if ![regexp $want $got] then {
66     fail "objdump -f"
67 } else {
68     pass "objdump -f"
69 }
70
71 # Test objdump -h
72
73 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h $testfile"]
74
75 set want "$testfile:\[  \]*file format.*Sections.*\[0-9\]+\[    \]+\[^  \]*(text|TEXT|\\\$CODE\\\$)\[^  \]*\[   \]*(\[0-9a-fA-F\]+).*\[0-9\]+\[         \]+\[^  \]*(data|DATA)\[^       \]*\[   \]*(\[0-9a-fA-F\]+)"
76
77 if ![regexp $want $got all text_name text_size data_name data_size] then {
78     fail "objdump -h"
79 } else {
80     verbose "text name is $text_name size is $text_size"
81     verbose "data name is $data_name size is $data_size"
82     if {[expr "0x$text_size"] < 8 || [expr "0x$data_size"] < 4} then {
83         send_log "sizes too small\n"
84         fail "objdump -h"
85     } else {
86         pass "objdump -h"
87     }
88 }
89
90 # Test objdump -t
91
92 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -t $testfile"]
93
94 if [info exists vars] then { unset vars }
95 while {[regexp "(\[a-z\]*_symbol)(.*)" $got all symbol rest]} {
96     set vars($symbol) 1
97     set got $rest
98 }
99
100 if {![info exists vars(text_symbol)] \
101      || ![info exists vars(data_symbol)] \
102      || ![info exists vars(common_symbol)] \
103      || ![info exists vars(external_symbol)]} then {
104     fail "objdump -t"
105 } else {
106     pass "objdump -t"
107 }
108
109 # Test objdump -r
110
111 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r $testfile"]
112
113 set want "$testfile:\[  \]*file format.*RELOCATION RECORDS FOR \\\[\[^\]\]*(text|TEXT|\\\$CODE\\\$)\[^\]\]*\\\].*external_symbol"
114
115 if [regexp $want $got] then {
116     pass "objdump -r"
117 } else {
118     fail "objdump -r"
119 }
120
121 # Test objdump -s
122
123 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s $testfile"]
124
125 set want "$testfile:\[  \]*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)"
126
127 if [regexp $want $got] then {
128     pass "objdump -s"
129 } else {
130     fail "objdump -s"
131 }
132
133 # Options which are not tested: -a -d -D -R -T -x -l --stabs
134 # I don't see any generic way to test any of these other than -a.
135 # Tests could be written for specific targets, and that should be done
136 # if specific problems are found.