OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.chill/] [gch981.exp] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
# Copyright (C) 1995, 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
# bug-gdb@prep.ai.mit.edu
19
 
20
# This file tests various Chill values, expressions, and types.
21
 
22
# This file was written by Wilfried Moser (moser@aut.alcatel.at)
23
#                          Kurt Fuchs (fuchs_k@aut.alcatel.at)
24
#
25
 
26
if $tracelevel then {
27
        strace $tracelevel
28
}
29
 
30
if [skip_chill_tests] then { continue }
31
 
32
set testfile "gch981"
33
set srcfile ${srcdir}/$subdir/${testfile}.ch
34
set binfile ${objdir}/${subdir}/${testfile}.exe
35
if  { [compile "${srcfile} -g -w -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } {
36
    perror "Couldn't compile ${srcfile}"
37
    return -1
38
}
39
 
40
# Set the current language to chill.  This counts as a test.  If it
41
# fails, then we skip the other tests.
42
 
43
proc set_lang_chill {} {
44
    global gdb_prompt
45
    global binfile objdir subdir
46
 
47
    verbose "loading file '$binfile'"
48
    gdb_load $binfile
49
    send_gdb "set language chill\n"
50
    gdb_expect {
51
        -re ".*$gdb_prompt $" {}
52
        timeout { fail "set language chill (timeout)" ; return 0 }
53
    }
54
 
55
    send_gdb "show language\n"
56
    gdb_expect {
57
        -re ".* source language is \"chill\".*$gdb_prompt $" {
58
            pass "set language to \"chill\""
59
            send_gdb "break xx_\n"
60
            gdb_expect {
61
                -re ".*$gdb_prompt $" {
62
                    send_gdb "run\n"
63
                    gdb_expect -re ".*$gdb_prompt $" {}
64
                    return 1
65
                }
66
                timeout {
67
                    fail "can't set breakpoint (timeout)"
68
                    return 0
69
                }
70
            }
71
        }
72
        -re ".*$gdb_prompt $" {
73
            fail "setting language to \"chill\""
74
            return 0
75
        }
76
        timeout {
77
            fail "can't show language (timeout)"
78
            return 0
79
        }
80
    }
81
}
82
 
83
# Testing printing of a specific value.  Increment passcount for
84
# success or issue fail message for failure.  In both cases, return
85
# a 1 to indicate that more tests can proceed.  However a timeout
86
# is a serious error, generates a special fail message, and causes
87
# a 0 to be returned to indicate that more tests are likely to fail
88
# as well.
89
#
90
# Args are:
91
#
92
#       First one is string to send_gdb to gdb
93
#       Second one is string to match gdb result to
94
#       Third one is an optional message to be printed
95
 
96
proc test_print_accept { args } {
97
    global gdb_prompt
98
    global passcount
99
    global verbose
100
 
101
    if [llength $args]==3 then {
102
        set message [lindex $args 2]
103
    } else {
104
        set message [lindex $args 0]
105
    }
106
    set sendthis [lindex $args 0]
107
    set expectthis [lindex $args 1]
108
    set result [gdb_test $sendthis ".* = ${expectthis}" $message]
109
    if $result==0 {incr passcount}
110
    return $result
111
}
112
 
113
proc test_power {} {
114
    global passcount gdb_prompt
115
 
116
    verbose "Testing some POWERSET Stuff"
117
    set passcount 0
118
 
119
    test_print_accept "print v1_power1" {\[e1:e5\]}
120
    test_print_accept "print v2_power1" {\[\]}
121
    test_print_accept "print SIZE(v1_power1)" "1"
122
 
123
    gdb_test "set v1_power1 := \[b1\]"  ""
124
#   if GDB has rejected the improper values, we have to gdb_expect the same!
125
    test_print_accept "print v1_power1" {\[e1:e5\]}
126
 
127
    gdb_test "set v1_power1 := \[a1,a2\]"  ""
128
    test_print_accept "print v1_power1" {\[e1:e5\]}
129
    gdb_test "set v1_power1 := \[b1,b2,b3,e4\]"  ""
130
    test_print_accept "print v1_power1" {\[e1:e5\]}
131
    gdb_test "set v1_power1 := \[e4:e5\]"  ""
132
    test_print_accept "print v1_power1" {\[e4:e5\]}
133
    gdb_test "set v1_power1 := \[e1, e2:e3, e5\]"  ""
134
    test_print_accept "print v1_power1" {\[e1:e3, e5\]}
135
    gdb_test "set v1_power1 := \[e1, e2:e4, e4:e5\]"  ""
136
    test_print_accept "print v1_power1" {\[e1:e5\]}
137
    gdb_test "set v1_power1 := \[e1, e1:e3, e1:e2, e2:e3\]"  ""
138
    test_print_accept "print v1_power1" {\[e1:e3\]}
139
 
140
    gdb_test "set v_power2 := \[e2\]"  ""
141
    test_print_accept "print v_power2" {\[\]}
142
    gdb_test "set v_power2 := \[1,2,3\]"  ""
143
    test_print_accept "print v_power2" {\[\]}
144
    gdb_test "set v_power2 := \[e2, b2, b1\]"  ""
145
    test_print_accept "print v_power2" {\[\]}
146
 
147
# Note, that this is a numbered SET, so a1:a3 contains all elements (exept a6)
148
    gdb_test "set v_power2 := \[a1:a3, a6:a4, a7:a9\]"  ""
149
    test_print_accept "print v_power2" {\[a6:a3\]}
150
    gdb_test "set v_power2 := \[a1, a4:a6, a9\]"  ""
151
    test_print_accept "print v_power2" {\[a1, a9\]}
152
    gdb_test "set v_power2 := \[a1:a2, a6, a9\]"  ""
153
    test_print_accept "print v_power2" {\[a6:a2, a9\]}
154
    gdb_test "set v_power2 := \[a1, a4, a7:a8, a9:a3\]"  ""
155
    test_print_accept "print v_power2" {\[a1, a4, a9:a8\]}
156
    gdb_test "set v_power2 := \[a1, a4:a8\]"  ""
157
    test_print_accept "print v_power2" {\[a1, a4:a8\]}
158
    gdb_test "set v_power2 := \[a8,a3,a7,a9,a5,a6\]"  ""
159
    test_print_accept "print v_power2" {\[a6, a5, a9, a7, a3, a8\]}
160
 
161
    gdb_test "set v_power3 := \[b1:b2,e1\]"  ""
162
    test_print_accept "print v_power3" {\[b1:b2\]}
163
    gdb_test "set v_power3 := \[b1, b3, b6:b7\]"  ""
164
    test_print_accept "print v_power3" {\[b1, b3, b6:b7\]}
165
    gdb_test "set v_power3 := \[b1, b3:b4, b7\]"  ""
166
    test_print_accept "print v_power3" {\[b1, b3:b4, b7\]}
167
    gdb_test "set v_power3 := \[b1, b4:b6, b7\]"  ""
168
    test_print_accept "print v_power3" {\[b1, b4:b7\]}
169
    gdb_test "set v_power3 := \[b1:b7\]"  ""
170
    test_print_accept "print v_power3" {\[b1:b7\]}
171
    gdb_test "set v_power3 := \[b5:b7, b1\]"  ""
172
    test_print_accept "print v_power3" {\[b1, b5:b7\]}
173
 
174
    gdb_test "set v_power4 := \[\"b\"\]" ""
175
    test_print_accept "print v_power4" {\['b':'x'\]}
176
    gdb_test "set v_power4 := \[5\]"  ""
177
    test_print_accept "print v_power4" {\['b':'x'\]}
178
    gdb_test "set v_power4 := \['c':'f','g':'h','o':'t'\]" ""
179
    test_print_accept "print v_power4" {\['c':'h', 'o':'t'\]}
180
    gdb_test "set v_power4 := \['a','b','c','d','e','f'\]" ""
181
    test_print_accept "print v_power4" {\['a':'f'\]}
182
    gdb_test "set v_power4 := \['\^(0)':'\^(200)'\]" ""
183
    test_print_accept "print v_power4" {\['\^\(0\)':'\^\(200\)'\]}
184
 
185
    gdb_test "set v_power5 := \[a8\]"  ""
186
    test_print_accept "print v_power5" {\[2:100\]}
187
    gdb_test "set v_power5 := \[4\]"  ""
188
    test_print_accept "print v_power5" {\[4\]}
189
    gdb_test "set v_power5 := \[3:95,9:100,10:107,200:250\]" ""
190
    test_print_accept "print v_power5" {\[3:107, 200:250\]}
191
    gdb_test "set v_power5 := \[2, 100:120, 350:400\]"  ""
192
    test_print_accept "print v_power5" {\[2, 100:120, 350:400\]}
193
    gdb_test "set v_power5 := \[2:64,65:127,128:256,256:399,400\]" ""
194
    test_print_accept "print v_power5" {\[2:400\]}
195
    gdb_test "set v_power5 := \[3:95, 99:100, 101:107, 200:250\]"  ""
196
    test_print_accept "print v_power5" {\[3:95, 99:107, 200:250\]}
197
 
198
    gdb_test "set v_power6 := \[a8\]"  ""
199
    test_print_accept "print v_power6" {\[\]}
200
    gdb_test "set v_power6 := \[4\]"  ""
201
    test_print_accept "print v_power6" {\[4\]}
202
    gdb_test "set v_power6 := \[3:95, 99:100, 101:107, 200:250\]"  ""
203
    test_print_accept "print v_power6" {\[3:95, 99:107, 200:250\]}
204
    gdb_test "set v_power6 := \[-111:0, 1:112, 11111:22222\]"  ""
205
    test_print_accept "print v_power6" {\[-111:112, 11111:22222\]}
206
    gdb_test "set v_power6 := \[0, 200:4000, 6666:9999\]"  ""
207
    test_print_accept "print v_power6" {\[0, 200:4000, 6666:9999\]}
208
 
209
#    gdb_test "set v_power7 := \[a8\]"  ""
210
#    test_print_accept "print v_power7" {\[2:100\]}
211
#    gdb_test "set v_power7 := \[4\]"  ""
212
#    test_print_accept "print v_power7" {\[4\]}
213
#    gdb_test "set v_power7 := \[3:95, 99:100, 101:107, 200:250\]" ""
214
#    test_print_accept "print v_power7" {\[3:95, 99:107, 200:250\]}
215
#    gdb_test "set v_power7 := \[0, 1000, 1000000, 10000000000\]"  ""
216
#    test_print_accept "print v_power7" {\[0, 1000, 1000000, 1000000000\]}
217
#    gdb_test "set v_power7 := \[-20000:100000, 111111:2222222\]"  ""
218
#    test_print_accept "print v_power7" {\[-20000:100000, 111111:2222222\]}
219
#    gdb_test "set v_power7 := \[\]"  ""
220
#    test_print_accept "print v_power7" {\[3:95, 99:107, 200:250\]}
221
#    gdb_test "set v_power7 := \[2:-500, -501:1, 20:370, -888:-920, 1000:2000, 1800:2500\]\ " ""
222
#    test_print_accept "print v_power7" {\[-920:-888, -501:2, 20:370, 1000:2500\]}
223
#    test_print_accept "print SIZE(v_power7)" ""
224
 
225
 
226
    runto 58
227
    test_print_accept "print v_set1 IN v1_power1" "TRUE"
228
    test_print_accept "print v_set1 IN v2_power1" "FALSE"
229
 
230
}
231
 
232
 
233
 
234
# Start with a fresh gdb.
235
 
236
gdb_exit
237
gdb_start
238
gdb_reinitialize_dir $srcdir/$subdir
239
 
240
gdb_test "set print sevenbit-strings" ".*"
241
 
242
 
243
if [set_lang_chill] then {
244
    # test builtins as described in chapter 6.20.3 Z.200
245
 
246
    test_power
247
} else {
248
    warning "$test_name tests suppressed."
249
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.