Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | # Copyright (C) 1993, 1996, 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_string_tests {} { | |
24 | set testname "stringer.s: Test embedded quotes and octal escapes in strings" | |
25 | set x 0 | |
26 | ||
27 | gas_start "stringer.s" "-al" | |
28 | ||
29 | # Instead of having a variable for each match string just increment the | |
30 | # total number of matches seen. That's simpler when testing large numbers | |
31 | # of instructions (as these tests to). | |
32 | while 1 { | |
33 | expect { | |
34 | -re "^ +\[0-9\]+ 0000 23696E63\[^\n\]*\n" { set x [expr $x+1] } | |
35 | -re "^ +\[0-9\]+ 6C756465\[^\n\]*\n" { set x [expr $x+1] } | |
36 | -re "^ +\[0-9\]+ 6B2E6465\[^\n\]*\n" { set x [expr $x+1] } | |
37 | -re "^ +\[0-9\]+ 66220A00\[^\n\]*\n" { set x [expr $x+1] } | |
38 | -re "^ +\[0-9\]+ 0014 09307831\[^\n\]*\n" { set x [expr $x+1] } | |
39 | -re "^ +\[0-9\]+ 3233\[^\n\]*\n" { set x [expr $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 | gas_finish | |
49 | ||
50 | # Did we find what we were looking for? If not, flunk it. | |
51 | if [expr $x==6] then { pass $testname } else { fail $testname } | |
52 | } | |
53 | ||
54 | proc do_lsel_test {} { | |
55 | set testname "lselbugs.s: lselbug" | |
56 | set x 0 | |
57 | ||
58 | gas_start "lselbug.s" "-al" | |
59 | ||
60 | # Make sure we correctly handle field selectors. | |
61 | while 1 { | |
62 | expect { | |
63 | -re "^ +\[0-9\]+ 0000 22A04000\[^\n\]*\n" { set x [expr $x+1] } | |
64 | -re "^ +\[0-9\]+ 0004 36B50100\[^\n\]*\n" { set x [expr $x+1] } | |
65 | -re "^ +\[0-9\]+ 0008 22A04000\[^\n\]*\n" { set x [expr $x+1] } | |
66 | -re "^ +\[0-9\]+ 000c 36B50100\[^\n\]*\n" { set x [expr $x+1] } | |
67 | -re "\[^\n\]*\n" { } | |
68 | timeout { perror "timeout\n"; break } | |
69 | eof { break } | |
70 | } | |
71 | } | |
72 | ||
73 | # This was intended to do any cleanup necessary. It kinda looks like it | |
74 | # isn't needed, but just in case, please keep it in for now. | |
75 | gas_finish | |
76 | ||
77 | # Did we find what we were looking for? If not, flunk it. | |
78 | if [expr $x==4] then { pass $testname } else { fail $testname } | |
79 | } | |
80 | ||
81 | proc do_valid_align_tests {} { | |
82 | set testname "align1.s: valid alignment tests" | |
83 | set x 0 | |
84 | ||
85 | gas_start "align1.s" "-al" | |
86 | ||
87 | # Make sure we correctly handle field selectors. | |
88 | while 1 { | |
89 | expect { | |
90 | -re "^ +\[0-9\]+ 0000 08000240\[^\n\]*\n" { set x [expr $x+1] } | |
91 | -re "^ +\[0-9\]+ 0008 08000240\[^\n\]*\n" { set x [expr $x+1] } | |
92 | -re "^ +\[0-9\]+ 1000 08000240\[^\n\]*\n" { set x [expr $x+1] } | |
93 | -re "^ +\[0-9\]+ 0000\[^\n\]*BLOCK\[^\n\]*1024\[^\n\]*\n" | |
94 | { set x [expr $x+1] } | |
95 | -re "^ +\[0-9\]+ 0400\[^\n\]*BLOCK\[^\n\]*1024\[^\n\]*\n" | |
96 | { set x [expr $x+1] } | |
97 | -re "^ +\[0-9\]+ 0800\[^\n\]*BLOCK\[^\n\]*4\[^\n\]*\n" | |
98 | { set x [expr $x+1] } | |
99 | -re "^ +\[0-9\]+ 0804\[^\n\]*ALIGN\[^\n\]*8\[^\n\]*\n" | |
100 | { set x [expr $x+1] } | |
101 | -re "^ +\[0-9\]+ 0808\[^\n\]*BLOCK\[^\n\]*30\[^\n\]*\n" | |
102 | { set x [expr $x+1] } | |
103 | -re "^ +\[0-9\]+ 0826\[^\n\]*ALIGN\[^\n\]*4\[^\n\]*\n" | |
104 | { set x [expr $x+1] } | |
105 | -re "^ +\[0-9\]+ 0828\[^\n\]*BLOCK\[^\n\]*4\[^\n\]*\n" | |
106 | { set x [expr $x+1] } | |
107 | -re "\[^\n\]*\n" { } | |
108 | timeout { perror "timeout\n"; break } | |
109 | eof { break } | |
110 | } | |
111 | } | |
112 | ||
113 | # This was intended to do any cleanup necessary. It kinda looks like it | |
114 | # isn't needed, but just in case, please keep it in for now. | |
115 | gas_finish | |
116 | ||
117 | # Did we find what we were looking for? If not, flunk it. | |
118 | if [expr $x==10] then { pass $testname } else { fail $testname } | |
119 | } | |
120 | ||
121 | if [istarget hppa*-*-*] then { | |
978ee720 L |
122 | if { ![istarget hppa*-*-linux*] |
123 | && ![istarget hppa*-*-netbsd*] } { | |
124 | # GAS-2.0 does not always parse ! as a line separator when it should. | |
125 | setup_xfail hppa*-*-* | |
126 | } | |
252b5132 RH |
127 | gas_test "linesepbug.s" "" "" "line separator bug" |
128 | ||
129 | # Make sure GAS accepts syntax for accessing static data. | |
130 | gas_test "global.s" "" "" "check for sym-\$global\$ acceptance" | |
131 | ||
132 | # GAS-2.0 (and 1.36 for that matter) can not handle a .proc which | |
133 | # has no label before it. | |
134 | gas_test "procbug.s" "" "" "Label following .proc" | |
135 | ||
136 | # One is required to explicitly IMPORT any non-local symbol used | |
137 | # in an assembly file. Make sure we give an error if we use | |
138 | # an undefined symbol. | |
139 | setup_xfail hppa*-*-* | |
140 | gas_test_error "undefbug.s" "" "Check for error when using undefined symbol" | |
141 | ||
142 | # This file has code and assembler directives before switching into any | |
143 | # space/subspace pair. This should report an error for SOM (it is not | |
144 | # an error for ELF. The file also has mismatched entry/exit and | |
145 | # proc/procend pairs which are errors for both SOM and ELF. | |
146 | gas_test_error "nosubspace.s" "" "Check for error(s) in input file " | |
147 | ||
148 | # This file should return errors for both the ENTRY_GR and ENTRY_FR | |
149 | # directives (they are out-of-range) | |
150 | gas_test_error "entrybug.s" "" "Check for error on entry_gr and entry_fr" | |
151 | ||
152 | # Make sure embedded quotes and octal escapes in strings work | |
153 | do_string_tests | |
154 | ||
155 | # Make sure we do not die on a .version directive | |
156 | gas_test "versionbug.s" "" "" ".version directive" | |
157 | ||
158 | # Make sure we give an error on a bogus .space directive. | |
159 | # recent version of gas2 went into infinite loops printing | |
160 | # errors on this test. | |
161 | gas_test_error "spacebug.s" "" "Check for error on bogus .space directive" | |
162 | ||
163 | # GAS should give an error for this test. | |
164 | gas_test_error "calldatabug.s" "" "Check for invalid aguments on .call" | |
165 | ||
166 | # Old versions of gas incorrectly gave errors on some valid .EXPORT lines | |
167 | gas_test "exportbug.s" "" "" "syntax check for an old .EXPORT bug" | |
168 | ||
169 | # Old versions of gas choked on this file for some reason | |
170 | gas_test "fixup7bug.s" "" "" "check for old \"fixup7\" gas bug" | |
171 | ||
172 | # Test an L% selector parsing bug which existed in gas-1.36 | |
173 | do_lsel_test | |
174 | ||
175 | # First check how some valid alignments are handled. | |
176 | do_valid_align_tests | |
177 | ||
178 | # Now check to make sure an invalid argument is flagged as an error. | |
179 | gas_test_error "align2.s" "" "Check for error on bogus argument to .align" | |
180 | ||
181 | # GAS can't handle upper bound for a PA .block[z] directive | |
182 | setup_xfail hppa*-*-* | |
183 | gas_test "block1.s" "" "" "Check min/max values for .block" | |
184 | ||
185 | # Now check for an invalid argument | |
186 | gas_test_error "block2.s" "" "Check for error on bogus argument to .block" | |
187 | ||
188 | # GAS-1.36 choked on this file. | |
189 | # FIXME. Should check relocations made for this test! | |
190 | gas_test "exprbug.s" "" "" "Check for sym1-sym2 acceptance" | |
191 | ||
192 | # Bad things happen in the PA ELF backend (others too?) if a non-default | |
193 | # section is created... | |
170cdc4f | 194 | setup_xfail "hppa*-*-*elf*" "hppa*-*-linux*" "hppa*64*-*-*" |
252b5132 RH |
195 | gas_test "ssbug.s" "" "" "Check for acceptance of non-default subspaces" |
196 | ||
197 | # To be compatable with certain "features" of the HP compiler | |
198 | # non-existant registers should default to %r0. | |
199 | gas_test "defbug.s" "" "" "Missing register should default to %%r0" | |
200 | ||
201 | # Make sure GAS understands a reasonable set of standard predefined | |
202 | # registers. eg %rp, %dp, %sp, etc. | |
203 | gas_test "stdreg.s" "" "" "Test standard predefined registers" | |
204 | ||
205 | # Make sure GAS will accept a label without a colon. | |
4b6341e9 | 206 | setup_xfail "hppa*-*-linux*" |
252b5132 RH |
207 | gas_test "labelbug.s" "" "" "Test label without colon" |
208 | ||
209 | # Make sure we grok # line directives. | |
210 | gas_test "appbug.s" "" "" "Test acceptance of #line directives" | |
211 | ||
212 | # Make sure we give errors if a floating point format is specified | |
213 | # for an xmpyu instruction (integer multiple) | |
214 | gas_test_error "xmpyubug.s" "" "Check for error on bogus argument to xmpyu" | |
215 | ||
216 | # Make sure gas handles various kinds of .reg pseudo-ops | |
217 | gas_test "regpopbug.s" "" "" "Test for bugs in .reg pseudo-op" | |
218 | ||
219 | # Check some bugs that have appeared in parsing .callinfo directives | |
220 | gas_test "callinfobug.s" "" "" "Test for bugs in .callinfo directive" | |
221 | ||
222 | # Check for bogus registers in single precision fmpyadd/fmpysub | |
223 | # instructions | |
224 | gas_test_error "badfmpyadd.s" "" "Check for error on bad fmpyadd insn" | |
225 | } | |
226 |