summaryrefslogtreecommitdiff
path: root/gas/testsuite/gas/hppa/unsorted/unsorted.exp
blob: c9fc9b8a62e0252c36e3e8483b53325d0ecc2c79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# Copyright (C) 1993-2022 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 3 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  

# Please email any bugs, comments, and/or additions to this file to:
# dejagnu@gnu.org

# Written by the Center for Software Science at the University of Utah
# and by Cygnus Support.

proc do_subspace_align_test {} {
    set testname "ss_align.s: Test subspace alignment (part 2)"
    set x 0

    if {[istarget hppa*64*-*-*]
	|| [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then {
      return 
    }

    if [gas_test_old "ss_align.s" "" "subspace alignment (part 1)"] then {
	objdump_start_no_subdir "a.out" "-h"

    # Check the headers for the correct alignment value for the
    # the $DATA$ subspace (som).
	while 1 {
	    expect  {
		-re "DATA\[^\n\]* 2..6\[^\n\]*\n"	{ set x 1 }
		-re "\[^\n\]*\n"				{ }
		timeout			{ perror "timeout\n"; break }
		eof				{ break }
	    }
	}

	# This was intended to do any cleanup necessary.  It kinda looks like it
	# isn't needed, but just in case, please keep it in for now.
	objdump_finish

	# Did we find what we were looking for?  If not, flunk it.
	if [expr $x==1] then { pass $testname } else { fail $testname }
    }
}

proc do_local_label_test {} {
    set testname "locallabel.s: Elimination of local labels (part 2)"
    set x 0

    if [gas_test_old "locallabel.s" "" "Elimination of local labels (part1)"] {
	objdump_start_no_subdir "a.out" "-t"

	while 1 {
	    expect {
		-re "^00000000\[^\n\]*Label\[^\n\]*\n"		{ set x 1 }
		-re "^00000000\[^\n\]*L\$01234\[^\n\]*\n"	{ set x 0 }
		-re "\[^\n\]*\n"				{ }
		timeout				{ perror "timeout\n"; break }
		eof				{ break }
	    }
	}

	# This was intended to do any cleanup necessary.  It kinda looks like it
	# isn't needed, but just in case, please keep it in for now.
	objdump_finish

	# Did we find what we were looking for?  If not, flunk it.
	if [expr $x==1] then { pass $testname } else { fail $testname }
    }
}

proc do_frchain_test {} {
    set testname "fragbug.s: Test bug in frag chaining (part 2)"
    set x 0

    if [gas_test_old "fragbug.s" "" "Test bug in frag chaining (part1)"] {
	objdump_start_no_subdir "a.out" "--prefix-addresses -d"

	while 1 {
	    expect {
		-re "^0x00000000\[^\n\]*nop\[^\n\]*\n"		{ set x 1 }
		-re "^0x00000004\[^\n\]*nop\[^\n\]*\n"		{ set x 0 }
		-re "\[^\n\]*\n"				{ }
		timeout				{ perror "timeout\n"; break }
		eof				{ break }
	    }
	}

	# This was intended to do any cleanup necessary.  It kinda looks like it
	# isn't needed, but just in case, please keep it in for now.
	objdump_finish

	# Did we find what we were looking for?  If not, flunk it.
	if [expr $x==1] then { pass $testname } else { fail $testname }
    }
}

proc do_align3_test {} {
    set testname "align3.s: Test for alignment bug when switching subspaces (part2)"
    set x 0

    if {[istarget hppa*64*-*-*]
	|| [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then {
      return 
    }

    if [gas_test_old "align3.s" "" "Test for alignment bug when switching subspaces (part1)"] {
	objdump_start_no_subdir "a.out" "--prefix-addresses -d"

	while 1 {
	    expect {
		-re "\[^\n\]* <main> nop\[^\n\]*\n"		{ set x 1 }
		-re "\[^\n\]* <.*end_main> nop\[^\n\]*\n"		{ set x 1 }
		-re "\[^\n\]* <main+.*> nop\[^\n\]*\n"		{ set x 0 }
		-re "\[^\n\]*\n"				{ }
		timeout				{ perror "timeout\n"; break }
		eof				{ break }
	    }
	}

	# This was intended to do any cleanup necessary.  It kinda looks like it
	# isn't needed, but just in case, please keep it in for now.
	objdump_finish

	# Did we find what we were looking for?  If not, flunk it.
	if [expr $x==1] then { pass $testname } else { fail $testname }
    }
}

proc do_align4_test {} {
    set testname "align4.s: More subspace alignment tests (part2)"
    set x 0

    if {[istarget hppa*64*-*-*]
	|| [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then {
      return 
    }

    if [gas_test_old "align4.s" "" "More subspace alignment tests (part1)"] {
	objdump_start_no_subdir "a.out" "-h"

	while 1 {
	    expect {
		-re "\[^\n\]*MILLICODE\[^\n\]*2..6\[^\n\]*\n"
			{ set x [expr $x+1] }
		-re "\[^\n\]*YABBA\[^\n\]*2..3\[^\n\]*\n"
			{ set x [expr $x+1] }
		timeout				{ perror "timeout\n"; break }
		eof				{ break }
	    }
	}

	# This was intended to do any cleanup necessary.  It kinda looks like it
	# isn't needed, but just in case, please keep it in for now.
	objdump_finish

	# Did we find what we were looking for?  If not, flunk it.
	if [expr $x==2] then { pass $testname } else { fail $testname }
    }
}

proc do_import_test {} {
    set testname "importbug.s: Test for bug in .import directive (part2)"
    set x 0

    if [gas_test_old "importbug.s" "" "Test for bug in .import directive (part1)"] {
	objdump_start_no_subdir "a.out" "--syms"

	while 1 {
	    expect {
		-re "\[^\n\]*.DATA..foo\[^\n\]*\n"		{ set x 1 }
		-re "\[^\n\]*.data.*foo\[^\n\]*\n"		{ set x 1 }
		-re "\[^\n\]*\n"				{ }
		timeout				{ perror "timeout\n"; break }
		eof				{ break }
	    }
	}

	# This was intended to do any cleanup necessary.  It kinda looks like it
	# isn't needed, but just in case, please keep it in for now.
	objdump_finish

	# Did we find what we were looking for?  If not, flunk it.
	if [expr $x==1] then { pass $testname } else { fail $testname }
    }
}

proc do_common_test {} {
    # linux has a different .comm syntax
    if [istarget hppa*-*-linux*] then {
	return
    }

    set testname "common.s: Test for bug in .comm handling (part2)"
    set x 0

    if [gas_test_old "common.s" "" "Test for bug in .comm handling (part1)"] {
	objdump_start_no_subdir "a.out" "--syms"

	while 1 {
	    expect {
		-re "\[^\n\]*.COM.*common_symbol\[^\n\]*\n"	{ set x 1 }
		-re "\[^\n\]*\n"				{ }
		timeout				{ perror "timeout\n"; break }
		eof				{ break }
	    }
	}

	# This was intended to do any cleanup necessary.  It kinda looks like it
	# isn't needed, but just in case, please keep it in for now.
	objdump_finish

	# Did we find what we were looking for?  If not, flunk it.
	if [expr $x==1] then { pass $testname } else { fail $testname }
    }
}

if [istarget hppa*-*-*] then {
    # Make sure subspace alignment requests from the subspace directives
    # are honored
    do_subspace_align_test

    # Make sure the correct labels end up in the symbol table
    do_local_label_test

    # GAS-1.36 choked on this file.
    gas_test "labeldiffs.s" "" "" "Difference of labels"

    # Test a recent bug where frag chaining wasn't working correctly.
    do_frchain_test

    # Test bug where switching between subspaces creates bogus alignments
    do_align3_test

    # Test bug where switching between subspaces creates bogus alignments
    do_align4_test

    if { ([istarget *-*-osf*] || [istarget *-*-hpux*] || [istarget *-*-bsd*]
	  || [istarget *-*-mpeix*] || [istarget *-*-hiux*])
	 && ![istarget hppa*64*-*-hpux11*] } {
	# Test a problem where $global$ is defined, then used within the
	# same source file.
	gas_test "globalbug.s" "" "" "Use \$global\$ in file which defines it"
    }
    # Test that importing a defined symbol doesn't screw up the symbol's
    # space/subspace.
    do_import_test

    # Test for a buglet in the handling of common symbols
    do_common_test

    # Test for an off-by-2 bug in range check for conditional branches
    # The labels in brlenbug.s lack colons and are not linux compatible.
    if {! [istarget *-*-linux*]} then {
	gas_test_error "brlenbug.s" "" "Check for error(s) in branch length"
    }
}