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