Initial revision
[binutils.git] / gas / testsuite / gas / hppa / parse / parse.exp
blobda4c2a7486d45c69f01d572e8f0115960ffd6f2a
1 # Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
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.
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.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # DejaGnu@cygnus.com
20 # Written by the Center for Software Science at the University of Utah
21 # and by Cygnus Support.
23 proc do_string_tests {} {
24 set testname "stringer.s: Test embedded quotes and octal escapes in strings"
25 set x 0
27 gas_start "stringer.s" "-al"
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 }
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
50 # Did we find what we were looking for? If not, flunk it.
51 if [expr $x==6] then { pass $testname } else { fail $testname }
54 proc do_lsel_test {} {
55 set testname "lselbugs.s: lselbug"
56 set x 0
58 gas_start "lselbug.s" "-al"
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 }
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
77 # Did we find what we were looking for? If not, flunk it.
78 if [expr $x==4] then { pass $testname } else { fail $testname }
81 proc do_valid_align_tests {} {
82 set testname "align1.s: valid alignment tests"
83 set x 0
85 gas_start "align1.s" "-al"
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 }
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
117 # Did we find what we were looking for? If not, flunk it.
118 if [expr $x==10] then { pass $testname } else { fail $testname }
121 if [istarget hppa*-*-*] then {
122 # GAS-2.0 does not always parse ! as a line separator when it should.
123 setup_xfail hppa*-*-*
124 gas_test "linesepbug.s" "" "" "line separator bug"
126 # Make sure GAS accepts syntax for accessing static data.
127 gas_test "global.s" "" "" "check for sym-\$global\$ acceptance"
129 # GAS-2.0 (and 1.36 for that matter) can not handle a .proc which
130 # has no label before it.
131 gas_test "procbug.s" "" "" "Label following .proc"
133 # One is required to explicitly IMPORT any non-local symbol used
134 # in an assembly file. Make sure we give an error if we use
135 # an undefined symbol.
136 setup_xfail hppa*-*-*
137 gas_test_error "undefbug.s" "" "Check for error when using undefined symbol"
139 # This file has code and assembler directives before switching into any
140 # space/subspace pair. This should report an error for SOM (it is not
141 # an error for ELF. The file also has mismatched entry/exit and
142 # proc/procend pairs which are errors for both SOM and ELF.
143 gas_test_error "nosubspace.s" "" "Check for error(s) in input file "
145 # This file should return errors for both the ENTRY_GR and ENTRY_FR
146 # directives (they are out-of-range)
147 gas_test_error "entrybug.s" "" "Check for error on entry_gr and entry_fr"
149 # Make sure embedded quotes and octal escapes in strings work
150 do_string_tests
152 # Make sure we do not die on a .version directive
153 gas_test "versionbug.s" "" "" ".version directive"
155 # Make sure we give an error on a bogus .space directive.
156 # recent version of gas2 went into infinite loops printing
157 # errors on this test.
158 gas_test_error "spacebug.s" "" "Check for error on bogus .space directive"
160 # GAS should give an error for this test.
161 gas_test_error "calldatabug.s" "" "Check for invalid aguments on .call"
163 # Old versions of gas incorrectly gave errors on some valid .EXPORT lines
164 gas_test "exportbug.s" "" "" "syntax check for an old .EXPORT bug"
166 # Old versions of gas choked on this file for some reason
167 gas_test "fixup7bug.s" "" "" "check for old \"fixup7\" gas bug"
169 # Test an L% selector parsing bug which existed in gas-1.36
170 do_lsel_test
172 # First check how some valid alignments are handled.
173 do_valid_align_tests
175 # Now check to make sure an invalid argument is flagged as an error.
176 gas_test_error "align2.s" "" "Check for error on bogus argument to .align"
178 # GAS can't handle upper bound for a PA .block[z] directive
179 setup_xfail hppa*-*-*
180 gas_test "block1.s" "" "" "Check min/max values for .block"
182 # Now check for an invalid argument
183 gas_test_error "block2.s" "" "Check for error on bogus argument to .block"
185 # GAS-1.36 choked on this file.
186 # FIXME. Should check relocations made for this test!
187 gas_test "exprbug.s" "" "" "Check for sym1-sym2 acceptance"
189 # Bad things happen in the PA ELF backend (others too?) if a non-default
190 # section is created...
191 setup_xfail hppa*-*-*elf*
192 gas_test "ssbug.s" "" "" "Check for acceptance of non-default subspaces"
194 # To be compatable with certain "features" of the HP compiler
195 # non-existant registers should default to %r0.
196 gas_test "defbug.s" "" "" "Missing register should default to %%r0"
198 # Make sure GAS understands a reasonable set of standard predefined
199 # registers. eg %rp, %dp, %sp, etc.
200 gas_test "stdreg.s" "" "" "Test standard predefined registers"
202 # Make sure GAS will accept a label without a colon.
203 gas_test "labelbug.s" "" "" "Test label without colon"
205 # Make sure we grok # line directives.
206 gas_test "appbug.s" "" "" "Test acceptance of #line directives"
208 # Make sure we give errors if a floating point format is specified
209 # for an xmpyu instruction (integer multiple)
210 gas_test_error "xmpyubug.s" "" "Check for error on bogus argument to xmpyu"
212 # Make sure gas handles various kinds of .reg pseudo-ops
213 gas_test "regpopbug.s" "" "" "Test for bugs in .reg pseudo-op"
215 # Check some bugs that have appeared in parsing .callinfo directives
216 gas_test "callinfobug.s" "" "" "Test for bugs in .callinfo directive"
218 # Check for bogus registers in single precision fmpyadd/fmpysub
219 # instructions
220 gas_test_error "badfmpyadd.s" "" "Check for error on bad fmpyadd insn"