Update for hppa*w -> hppa*64* configure name change.
[external/binutils.git] / gas / testsuite / gas / hppa / unsorted / unsorted.exp
1 # Copyright (C) 1993, 1997 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 # DejaGnu@cygnus.com
19
20 # Written by the Center for Software Science at the University of Utah
21 # and by Cygnus Support.
22
23 proc do_subspace_align_test {} {
24     set testname "ss_align.s: Test subspace alignment (part 2)"
25     set x 0
26
27     if {[istarget hppa*64*-*-*]
28         || [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then {
29       return 
30     }
31
32     if [gas_test_old "ss_align.s" "" "subspace alignment (part 1)"] then {
33         objdump_start_no_subdir "a.out" "-h"
34
35     # Check the headers for the correct alignment value for the
36     # the $DATA$ subspace (som).
37         while 1 {
38             expect  {
39                 -re "DATA\[^\n\]* 2..6\[^\n\]*\n"       { set x 1 }
40                 -re "\[^\n\]*\n"                                { }
41                 timeout                 { perror "timeout\n"; break }
42                 eof                             { break }
43             }
44         }
45
46         # This was intended to do any cleanup necessary.  It kinda looks like it
47         # isn't needed, but just in case, please keep it in for now.
48         objdump_finish
49
50         # Did we find what we were looking for?  If not, flunk it.
51         if [expr $x==1] then { pass $testname } else { fail $testname }
52     }
53 }
54
55 proc do_local_label_test {} {
56     set testname "locallabel.s: Elimination of local labels (part 2)"
57     set x 0
58
59     if [gas_test_old "locallabel.s" "" "Elimination of local labels (part1)"] {
60         objdump_start_no_subdir "a.out" "-t"
61
62         while 1 {
63             expect {
64                 -re "^00000000\[^\n\]*Label\[^\n\]*\n"          { set x 1 }
65                 -re "^00000000\[^\n\]*L\$01234\[^\n\]*\n"       { set x 0 }
66                 -re "\[^\n\]*\n"                                { }
67                 timeout                         { perror "timeout\n"; break }
68                 eof                             { break }
69             }
70         }
71
72         # This was intended to do any cleanup necessary.  It kinda looks like it
73         # isn't needed, but just in case, please keep it in for now.
74         objdump_finish
75
76         # Did we find what we were looking for?  If not, flunk it.
77         if [expr $x==1] then { pass $testname } else { fail $testname }
78     }
79 }
80
81 proc do_frchain_test {} {
82     set testname "fragbug.s: Test bug in frag chaining (part 2)"
83     set x 0
84
85     if [gas_test_old "fragbug.s" "" "Test bug in frag chaining (part1)"] {
86         objdump_start_no_subdir "a.out" "--prefix-addresses -d"
87
88         while 1 {
89             expect {
90                 -re "^0x00000000\[^\n\]*nop\[^\n\]*\n"          { set x 1 }
91                 -re "^0x00000004\[^\n\]*nop\[^\n\]*\n"          { set x 0 }
92                 -re "\[^\n\]*\n"                                { }
93                 timeout                         { perror "timeout\n"; break }
94                 eof                             { break }
95             }
96         }
97
98         # This was intended to do any cleanup necessary.  It kinda looks like it
99         # isn't needed, but just in case, please keep it in for now.
100         objdump_finish
101
102         # Did we find what we were looking for?  If not, flunk it.
103         if [expr $x==1] then { pass $testname } else { fail $testname }
104     }
105 }
106
107 proc do_align3_test {} {
108     set testname "align3.s: Test for alignment bug when switching subspaces (part2)"
109     set x 0
110
111     if {[istarget hppa*64*-*-*]
112         || [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then {
113       return 
114     }
115
116     if [gas_test_old "align3.s" "" "Test for alignment bug when switching subspaces (part1)"] {
117         objdump_start_no_subdir "a.out" "--prefix-addresses -d"
118
119         while 1 {
120             expect {
121                 -re "\[^\n\]* <main> nop\[^\n\]*\n"             { set x 1 }
122                 -re "\[^\n\]* <.*end_main> nop\[^\n\]*\n"               { set x 1 }
123                 -re "\[^\n\]* <main+.*> nop\[^\n\]*\n"          { set x 0 }
124                 -re "\[^\n\]*\n"                                { }
125                 timeout                         { perror "timeout\n"; break }
126                 eof                             { break }
127             }
128         }
129
130         # This was intended to do any cleanup necessary.  It kinda looks like it
131         # isn't needed, but just in case, please keep it in for now.
132         objdump_finish
133
134         # Did we find what we were looking for?  If not, flunk it.
135         if [expr $x==1] then { pass $testname } else { fail $testname }
136     }
137 }
138
139 proc do_align4_test {} {
140     set testname "align4.s: More subspace alignment tests (part2)"
141     set x 0
142
143     if {[istarget hppa*64*-*-*]
144         || [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then {
145       return 
146     }
147
148     if [gas_test_old "align4.s" "" "More subspace alignment tests (part1)"] {
149         objdump_start_no_subdir "a.out" "-h"
150
151         while 1 {
152             expect {
153                 -re "\[^\n\]*MILLICODE\[^\n\]*2..6\[^\n\]*\n"
154                         { set x [expr $x+1] }
155                 -re "\[^\n\]*YABBA\[^\n\]*2..3\[^\n\]*\n"
156                         { set x [expr $x+1] }
157                 timeout                         { perror "timeout\n"; break }
158                 eof                             { break }
159             }
160         }
161
162         # This was intended to do any cleanup necessary.  It kinda looks like it
163         # isn't needed, but just in case, please keep it in for now.
164         objdump_finish
165
166         # Did we find what we were looking for?  If not, flunk it.
167         if [expr $x==2] then { pass $testname } else { fail $testname }
168     }
169 }
170
171 proc do_import_test {} {
172     set testname "importbug.s: Test for bug in .import directive (part2)"
173     set x 0
174
175     if [gas_test_old "importbug.s" "" "Test for bug in .import directive (part1)"] {
176         objdump_start_no_subdir "a.out" "--syms"
177
178         while 1 {
179             expect {
180                 -re "\[^\n\]*.DATA..foo\[^\n\]*\n"              { set x 1 }
181                 -re "\[^\n\]*.data.*foo\[^\n\]*\n"              { set x 1 }
182                 -re "\[^\n\]*\n"                                { }
183                 timeout                         { perror "timeout\n"; break }
184                 eof                             { break }
185             }
186         }
187
188         # This was intended to do any cleanup necessary.  It kinda looks like it
189         # isn't needed, but just in case, please keep it in for now.
190         objdump_finish
191
192         # Did we find what we were looking for?  If not, flunk it.
193         if [expr $x==1] then { pass $testname } else { fail $testname }
194     }
195 }
196
197 proc do_common_test {} {
198     # linux has a different .comm syntax
199     if [istarget hppa*-*-linux*] then {
200         return;
201     }
202
203     set testname "common.s: Test for bug in .comm handling (part2)"
204     set x 0
205
206     if [gas_test_old "common.s" "" "Test for bug in .comm handling (part1)"] {
207         objdump_start_no_subdir "a.out" "--syms"
208
209         while 1 {
210             expect {
211                 -re "\[^\n\]*.COM.*common_symbol\[^\n\]*\n"     { set x 1 }
212                 -re "\[^\n\]*\n"                                { }
213                 timeout                         { perror "timeout\n"; break }
214                 eof                             { break }
215             }
216         }
217
218         # This was intended to do any cleanup necessary.  It kinda looks like it
219         # isn't needed, but just in case, please keep it in for now.
220         objdump_finish
221
222         # Did we find what we were looking for?  If not, flunk it.
223         if [expr $x==1] then { pass $testname } else { fail $testname }
224     }
225 }
226
227 if [istarget hppa*-*-*] then {
228     # Make sure subspace alignment requests from the subspace directives
229     # are honored
230     do_subspace_align_test
231
232     # Make sure the correct labels end up in the symbol table
233     do_local_label_test
234
235     # GAS-1.36 choked on this file.
236     gas_test "labeldiffs.s" "" "" "Difference of labels"
237
238     # Test a recent bug where frag chaining wasn't working correctly.
239     do_frchain_test
240
241     # Test bug where switching between subspaces creates bogus alignments
242     do_align3_test
243
244     # Test bug where switching between subspaces creates bogus alignments
245     do_align4_test
246
247     # Test a problem where $global$ is defined, then used within the
248     # same source file.
249     setup_xfail hppa*-*-*
250     gas_test "globalbug.s" "" "" "Use \$global\$ in file which defines it"
251
252     # Test that importing a defined symbol doesn't screw up the symbol's
253     # space/subspace.
254     do_import_test
255
256     # Test for a buglet in the handling of common symbols
257     do_common_test
258
259     # Test for an off-by-2 bug in range check for conditional branches
260     gas_test_error "brlenbug.s" "" "Check for error(s) in branch length"
261 }