1999-09-12 Donn Terry <donn@interix.com>
[external/binutils.git] / gas / testsuite / gas / all / gas.exp
1 #
2 # These tests should be valid on all targets.
3 #
4
5 # I think currently all targets fail this one when listings are enabled.
6 gas_test "p2425.s" ""   "" "pcrel values in assignment"
7
8 # p1480.s uses a ".space" directive which for most assemblers means
9 # "allocate some space".  On the PA it means "switch into this space".
10 #
11 # Therefore this test (as it is currently written) is completely bogus
12 # for any PA target.  Do not bother trying to run it and just claim
13 # it fails.
14 if [istarget hppa*-*-*] then {
15     setup_xfail *-*-*
16     fail "simplifiable double subtraction"
17 } else {
18     gas_test "p1480.s" "" "-a>" "simplifiable double subtraction"
19 }
20
21 gas_test "float.s" ""   "" "simple FP constants"
22
23 # This test is meaningless for the PA; the difference of two undefined
24 # symbols is something that is (and must be) supported on the PA.
25 if ![istarget hppa*-*-*] then {
26     gas_test_error "diff1.s" "" "difference of two undefined symbols"
27 }
28
29 proc do_comment {} {
30     set testname "comment.s: comments in listings"
31     set x1 0
32     set x2 0
33     set x3 0
34     set white {[ \t]*}
35     gas_start "comment.s" "-al"
36     while 1 {
37 # Apparently CRLF is received when using ptys for subprocesses; hence the
38 # \r\n for line 3.
39         expect {
40             -re "^ +1\[ \t\]+# This\[^\n\]*\n"          { set x1 1 }
41             -re "^ +2\[ \t\]+# correctly\[^\n\]*\n"     { set x2 1 }
42             -re "^ +3\[ \t\]+/. C comments too. ./\r?\n" { set x3 1 }
43             -re "\[^\n\]*\n"                            { }
44             timeout                             { perror "timeout\n"; break }
45             eof                                 { break }
46         }
47     }
48     gas_finish
49     if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname }
50 }
51
52 do_comment
53
54 #
55 # Test x930509a -- correct assembly of differences involving forward
56 # references.
57 #
58
59 proc do_930509a {} {
60     set testname "difference between forward references"
61     set x 0
62     gas_start "x930509.s" "-al"
63     while 1 {
64 # We need to accomodate both byte orders here.
65 # If ".long" means an 8-byte value on some target someday, this test will have
66 # to be fixed.
67         expect {
68             -re "^ +1 .... 0000 *0000" { fail $testname; set x 1 }
69             -re "^ +1 .... 0400 *0000" { pass $testname; set x 1 }
70             -re "^ +1 .... 0000 *0004" { pass $testname; set x 1 }
71             -re "\[^\n\]*\n" { }
72             timeout { perror "timeout\n"; break }
73             eof { break }
74         }
75     }
76     gas_finish
77     if !$x then { fail $testname }
78 }
79
80 # This test is meaningless for the PA; the difference of two symbols
81 # must not be resolved by the assembler.
82 if ![istarget hppa*-*-*] then {
83     # the vax fails because VMS can apparently actually handle this
84     # case in relocs, so gas doesn't handle it itself.
85     setup_xfail "vax*-*-vms*"
86     setup_xfail "mn10300*-*-*"
87     setup_xfail "mn10200*-*-*"
88     do_930509a
89 }
90
91 case $target_triplet in {
92     { hppa*-*-* } { }
93     default {
94         run_dump_test struct
95         run_dump_test align
96     }
97 }
98
99 # This test is for any COFF target.
100 # We omit m88k COFF because it uses weird pseudo-op names.
101 # We omit the ARM toolchains because they define locals to
102 #  start with '.', which eliminates .eos, .text etc from the output.
103 if {   ([istarget *-*-coff*] && ![istarget m88*-*-*] && ![istarget *arm*-*-coff] && ![istarget thumb*-*-coff]) \
104      ||([istarget *-*-pe*] && ![istarget arm*-*-pe*] && ![istarget thumb*-*-pe*]) \
105      || [istarget a29k-*-udi*] \
106      || [istarget a29k-*-ebmon*] \
107      || [istarget a29k-*-sym*] \
108      || [istarget a29k-*-vxworks*] \
109      || [istarget i*86-*-aix*] \
110      || [istarget i*86-*-sco*] \
111      || [istarget i*86-*-isc*] \
112      || [istarget i*86-*-go32*] \
113      || [istarget i*86-*-cygwin*] \
114      || [istarget i*86-*-*nt] \
115      || [istarget i*86-*-interix*] \
116      || ([istarget i960-*-vxworks5.*] && ![istarget i960-*-vxworks5.0*]) } {
117     run_dump_test cofftag
118 }
119
120 # Test omitting conditionals from listings.
121 proc test_cond {} {
122     global comp_output
123     global srcdir
124     global subdir
125
126     set testname "conditional listings"
127     gas_run cond.s -alc ">dump.out"
128     if ![string match "" $comp_output] {
129         send_log "$comp_output\n"
130         fail $testname
131     } else {
132         if { [regexp_diff dump.out $srcdir/$subdir/cond.d] } {
133             fail $testname
134         } else {
135             pass $testname
136         }
137     }
138 }
139
140 test_cond
141
142 # FIXME: this is here cause of a bug in DejaGnu 1.1.1. When it is no longer
143 #        in use, then this can be removed.
144 if [info exists errorInfo] then {
145     unset errorInfo
146 }