Commit | Line | Data |
---|---|---|
ef44eed1 SS |
1 | # Copyright (C) 1988, 1990, 1991, 1992 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., 675 Mass Ave, Cambridge, MA 02139, 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 was written by Rob Savoye. (rob@cygnus.com) | |
21 | ||
22 | if $tracelevel then { | |
23 | strace $tracelevel | |
24 | } | |
25 | ||
26 | # | |
27 | # test running programs | |
28 | # | |
29 | set prms_id 0 | |
30 | set bug_id 0 | |
31 | ||
32 | set binfile "setvar" | |
33 | ||
34 | if ![file exists $objdir/$subdir/$binfile] then { | |
35 | perror "$objdir/$subdir/$binfile does not exist." | |
36 | return 0 | |
37 | } | |
38 | ||
39 | gdb_exit | |
40 | gdb_start | |
41 | gdb_reinitialize_dir $srcdir/$subdir | |
42 | gdb_load $objdir/$subdir/$binfile | |
43 | ||
44 | # | |
45 | # set it up at a breakpoint so we canplay with the variable values | |
46 | # | |
47 | send "set print sevenbit-strings\n" ; expect -re "$prompt $" | |
48 | ||
49 | if ![runto main] then { | |
50 | perror "couldn't run to breakpoint" | |
51 | continue | |
52 | } | |
53 | ||
54 | # Determine expected output for unsigned long variables, | |
55 | # the output varies with sizeof (unsigned long). | |
56 | ||
57 | set ulong_minus_1 4294967295 | |
58 | set ulong_minus_456 4294966840 | |
59 | send "print sizeof (unsigned long)\n" | |
60 | expect { | |
61 | -re ".\[0-9\]* = 4.*$prompt $" {} | |
62 | -re ".\[0-9\]* = 8.*$prompt $" { | |
63 | set ulong_minus_1 18446744073709551615 | |
64 | set ulong_minus_456 18446744073709551160 | |
65 | } | |
66 | -re ".*$prompt $" { | |
67 | fail "getting sizeof unsigned long" | |
68 | } | |
69 | default { fail "(timeout) getting sizeof unsigned long" } | |
70 | } | |
71 | ||
72 | # | |
73 | # test "set variable" for type "char" | |
74 | # | |
75 | # Because bare char types can be either signed or unsigned, we just test the | |
76 | # range of values that are common to both (0-127). | |
77 | # | |
78 | send "set variable v_char=0\n" | |
79 | expect { | |
80 | -re "$prompt $"\ | |
81 | { | |
82 | send "print v_char\n" | |
83 | expect { | |
84 | -re ".\[0-9\]* = 0 \'.000\'.*$prompt $" { pass "set variable char=0" } | |
85 | -re "$prompt $" { fail "set variable char=0" } | |
86 | timeout { fail "(timeout) set variable char=0" } | |
87 | } | |
88 | } | |
89 | -re "$prompt $" { fail "set variable char=0" } | |
90 | timeout { fail "(timeout) set variable char=0" } | |
91 | } | |
92 | ||
93 | ||
94 | send "set variable v_char=1\n" | |
95 | expect { | |
96 | -re "$prompt $"\ | |
97 | { | |
98 | send "print v_char\n" | |
99 | expect { | |
100 | -re ".\[0-9\]* = 1 \'.001\'.*$prompt $" { pass "set variable char=1" } | |
101 | -re "$prompt $" { fail "set variable char=1" } | |
102 | timeout { fail "(timeout) set variable char=1" } | |
103 | } | |
104 | } | |
105 | -re "$prompt $" { fail "set variable char=1" } | |
106 | timeout { fail "(timeout) set variable char=1" } | |
107 | } | |
108 | ||
109 | ||
110 | send "set variable v_char=27\n" | |
111 | expect { | |
112 | -re "$prompt $"\ | |
113 | { | |
114 | send "print v_char\n" | |
115 | expect { | |
116 | -re ".\[0-9\]* = 27 \'.e\'.*$prompt $" { pass "set variable char=27 (Esc)" } | |
117 | -re "$prompt $" { fail "set variable char=27 (Esc)" } | |
118 | timeout { fail "(timeout) set variable char=27 (Esc)" } | |
119 | } | |
120 | } | |
121 | -re "$prompt $" { fail "set variable char=27 (Esc)" } | |
122 | timeout { fail "(timeout) set variable char=27 (Esc)" } | |
123 | } | |
124 | ||
125 | ||
126 | send "set variable v_char=32\n" | |
127 | expect { | |
128 | -re "$prompt $"\ | |
129 | { | |
130 | send "print v_char\n" | |
131 | expect { | |
132 | -re ".\[0-9\]* = 32 \' \'.*$prompt $" { pass "set variable char=32 (SPC)" } | |
133 | -re "$prompt $" { fail "set variable char=32 (SPC)" } | |
134 | timeout { fail "(timeout) set variable char=32 (SPC)" } | |
135 | } | |
136 | } | |
137 | -re "$prompt $" { fail "set variable char=32 (SPC)" } | |
138 | timeout { fail "(timeout) set variable char=32 (SPC)" } | |
139 | } | |
140 | ||
141 | ||
142 | send "set variable v_char=65\n" | |
143 | expect { | |
144 | -re "$prompt $"\ | |
145 | { | |
146 | send "print v_char\n" | |
147 | expect { | |
148 | -re ".\[0-9\]* = 65 \'A\'.*$prompt $" { pass "set variable char=65 ('A')" } | |
149 | -re "$prompt $" { fail "set variable char=65 ('A')" } | |
150 | timeout { fail "(timeout) set variable char=65 ('A')" } | |
151 | } | |
152 | } | |
153 | -re "$prompt $" { fail "set variable char=65 ('A')" } | |
154 | timeout { fail "(timeout) set variable char=65 ('A')" } | |
155 | } | |
156 | ||
157 | ||
158 | send "set variable v_char=97\n" | |
159 | expect { | |
160 | -re "$prompt $"\ | |
161 | { | |
162 | send "print v_char\n" | |
163 | expect { | |
164 | -re ".\[0-9\]* = 97 \'a\'.*$prompt $" { pass "set variable char=97 ('a')" } | |
165 | -re "$prompt $" { fail "set variable char=97 ('a')" } | |
166 | timeout { fail "(timeout) set variable char=97 ('a')" } | |
167 | } | |
168 | } | |
169 | -re "$prompt $" { fail "set variable char=97 ('a')" } | |
170 | timeout { fail "(timeout) set variable char=97 ('a')" } | |
171 | } | |
172 | ||
173 | ||
174 | send "set variable v_char=126\n" | |
175 | expect { | |
176 | -re "$prompt $"\ | |
177 | { | |
178 | send "print v_char\n" | |
179 | expect { | |
180 | -re ".\[0-9\]* = 126 \'~\'.*$prompt $" { pass "set variable char=126 ('~')" } | |
181 | -re "$prompt $" { fail "set variable char=126 ('~')" } | |
182 | timeout { fail "(timeout) set variable char=126 ('~')" } | |
183 | } | |
184 | } | |
185 | -re "$prompt $" { fail "set variable char=126 ('~')" } | |
186 | timeout { fail "(timeout) set variable char=126 ('~')" } | |
187 | } | |
188 | ||
189 | ||
190 | send "set variable v_char=127\n" | |
191 | expect { | |
192 | -re "$prompt $"\ | |
193 | { | |
194 | send "print v_char\n" | |
195 | expect { | |
196 | -re ".\[0-9\]* = 127 \'.177\'.*$prompt $" { pass "set variable char=127 (8-bit)" } | |
197 | -re "$prompt $" { fail "set variable char=127 (8-bit)" } | |
198 | timeout { fail "(timeout) set variable char=127 (8-bit)" } | |
199 | } | |
200 | } | |
201 | -re "$prompt $" { fail "set variable char=127 (8-bit)" } | |
202 | timeout { fail "(timeout) set variable char=127 (8-bit)" } | |
203 | } | |
204 | ||
205 | ||
206 | # | |
207 | # test "set variable" for type "signed char" | |
208 | # | |
209 | send "set variable v_char=0\n" | |
210 | expect { | |
211 | -re "$prompt $"\ | |
212 | { | |
213 | send "print v_signed_char\n" | |
214 | expect { | |
215 | -re ".\[0-9\]* = 0 \'.000\'.*$prompt $" { pass "set variable signed char=0" } | |
216 | -re "$prompt $" { fail "set variable signed char=0" } | |
217 | timeout { fail "(timeout) set variable signed char=0" } | |
218 | } | |
219 | } | |
220 | -re "$prompt $" { fail "set variable signed char=0" } | |
221 | timeout { fail "(timeout) set variable signed char=0" } | |
222 | } | |
223 | ||
224 | ||
225 | send "set variable v_signed_char=1\n" | |
226 | expect { | |
227 | -re "$prompt $"\ | |
228 | { | |
229 | send "print v_signed_char\n" | |
230 | expect { | |
231 | -re ".\[0-9\]* = 1 \'.001\'.*$prompt $" { pass "set variable signed char=1" } | |
232 | -re "$prompt $" { fail "set variable signed char=1" } | |
233 | timeout { fail "(timeout) set variable signed char=1" } | |
234 | } | |
235 | } | |
236 | -re "$prompt $" { fail "set variable signed char=1" } | |
237 | timeout { fail "(timeout) set variable signed char=1" } | |
238 | } | |
239 | ||
240 | ||
241 | send "set variable v_signed_char=27\n" | |
242 | expect { | |
243 | -re "$prompt $"\ | |
244 | { | |
245 | send "print v_signed_char\n" | |
246 | expect { | |
247 | -re ".\[0-9\]* = 27 \'.e\'.*$prompt $" { pass "set variable signed char=27 (Esc)" } | |
248 | -re "$prompt $" { fail "set variable signed char=27 (Esc)" } | |
249 | timeout { fail "(timeout) set variable signed char=27 (Esc)" } | |
250 | } | |
251 | } | |
252 | -re "$prompt $" { fail "set variable signed char=27 (Esc)" } | |
253 | timeout { fail "(timeout) set variable signed char=27 (Esc)" } | |
254 | } | |
255 | ||
256 | ||
257 | send "set variable v_signed_char=32\n" | |
258 | expect { | |
259 | -re "$prompt $"\ | |
260 | { | |
261 | send "print v_signed_char\n" | |
262 | expect { | |
263 | -re ".\[0-9\]* = 32 \' \'.*$prompt $" { pass "set variable signed char=32 (SPC)" } | |
264 | -re "$prompt $" { fail "set variable signed char=32 (SPC)" } | |
265 | timeout { fail "(timeout) set variable signed char=32 (SPC)" } | |
266 | } | |
267 | } | |
268 | -re "$prompt $" { fail "set variable signed char=32 (SPC)" } | |
269 | timeout { fail "(timeout) set variable signed char=32 (SPC)" } | |
270 | } | |
271 | ||
272 | ||
273 | send "set variable v_signed_char=65\n" | |
274 | expect { | |
275 | -re "$prompt $"\ | |
276 | { | |
277 | send "print v_signed_char\n" | |
278 | expect { | |
279 | -re ".\[0-9\]* = 65 \'A\'.*$prompt $" { pass "set variable signed char=65 ('A')" } | |
280 | -re "$prompt $" { fail "set variable signed char=65 ('A')" } | |
281 | timeout { fail "(timeout) set variable signed char=65 ('A')" } | |
282 | } | |
283 | } | |
284 | -re "$prompt $" { fail "set variable signed char=65 ('A')" } | |
285 | timeout { fail "(timeout) set variable signed char=65 ('A')" } | |
286 | } | |
287 | ||
288 | ||
289 | send "set variable v_signed_char=97\n" | |
290 | expect { | |
291 | -re "$prompt $"\ | |
292 | { | |
293 | send "print v_signed_char\n" | |
294 | expect { | |
295 | -re ".\[0-9\]* = 97 \'a\'.*$prompt $" { pass "set variable signed char=97 ('a')" } | |
296 | -re "$prompt $" { fail "set variable signed char=97 ('a')" } | |
297 | timeout { fail "(timeout) set variable signed char=97 ('a')" } | |
298 | } | |
299 | } | |
300 | -re "$prompt $" { fail "set variable signed char=97 ('a')" } | |
301 | timeout { fail "(timeout) set variable signed char=97 ('a')" } | |
302 | } | |
303 | ||
304 | ||
305 | send "set variable v_signed_char=126\n" | |
306 | expect { | |
307 | -re "$prompt $"\ | |
308 | { | |
309 | send "print v_signed_char\n" | |
310 | expect { | |
311 | -re ".\[0-9\]* = 126 \'~\'.*$prompt $" { pass "set variable signed char=126 ('~')" } | |
312 | -re "$prompt $" { fail "set variable signed char=126 ('~')" } | |
313 | timeout { fail "(timeout) set variable signed char=126 ('~')" } | |
314 | } | |
315 | } | |
316 | -re "$prompt $" { fail "set variable signed char=126 ('~')" } | |
317 | timeout { fail "(timeout) set variable signed char=126 ('~')" } | |
318 | } | |
319 | ||
320 | ||
321 | send "set variable v_signed_char=127\n" | |
322 | expect { | |
323 | -re "$prompt $"\ | |
324 | { | |
325 | send "print v_signed_char\n" | |
326 | expect { | |
327 | -re ".\[0-9\]* = 127 \'.177\'.*$prompt $" { pass "set variable signed char=127 (8-bit)" } | |
328 | -re "$prompt $" { fail "set variable signed char=127 (8-bit)" } | |
329 | timeout { fail "(timeout) set variable signed char=127 (8-bit)" } | |
330 | } | |
331 | } | |
332 | -re "$prompt $" { fail "set variable signed char=127 (8-bit)" } | |
333 | timeout { fail "(timeout) set variable signed char=127 (8-bit)" } | |
334 | } | |
335 | ||
336 | ||
337 | send "set variable v_signed_char=-1\n" | |
338 | expect { | |
339 | -re "$prompt $"\ | |
340 | { | |
341 | send "print v_signed_char\n" | |
342 | expect { | |
343 | -re ".\[0-9\]* = -1 \'.377\'.*$prompt $" { pass "set variable signed char=-1 (-1)" } | |
344 | -re "$prompt $" { fail "set variable signed char=-1 (minus)" } | |
345 | timeout { fail "(timeout) set variable signed char=-1 (minus)" } | |
346 | } | |
347 | } | |
348 | -re "$prompt $" { fail "set variable signed char=-1 (minus)" } | |
349 | timeout { fail "(timeout) set variable signed char=-1 (minus)" } | |
350 | } | |
351 | ||
352 | ||
353 | send "set variable v_signed_char=0xFF\n" | |
354 | expect { | |
355 | -re "$prompt $"\ | |
356 | { | |
357 | send "print v_signed_char\n" | |
358 | expect { | |
359 | -re ".\[0-9\]* = -1 \'.377\'.*$prompt $" { pass "set variable signed char=0xFF (0xFF)" } | |
360 | -re "$prompt $" { fail "set variable signed char=0xFF (hex)" } | |
361 | timeout { fail "(timeout) set variable signed char=0xFF (hex)" } | |
362 | } | |
363 | } | |
364 | -re "$prompt $" { fail "set variable signed char=0xFF (hex)" } | |
365 | timeout { fail "(timeout) set variable signed char=0xFF (hex)" } | |
366 | } | |
367 | ||
368 | ||
369 | # | |
370 | # test "set variable" for type "unsigned char" | |
371 | # | |
372 | send "set variable v_unsigned_char=0\n" | |
373 | expect { | |
374 | -re "$prompt $"\ | |
375 | { | |
376 | send "print v_unsigned_char\n" | |
377 | expect { | |
378 | -re ".\[0-9\]* = 0 \'.000\'.*$prompt $" { pass "set variable unsigned char=0" } | |
379 | -re "$prompt $" { fail "set variable unsigned char=0" } | |
380 | timeout { fail "(timeout) set variable unsigned char=0" } | |
381 | } | |
382 | } | |
383 | -re "$prompt $" { fail "set variable unsigned char=0" } | |
384 | timeout { fail "(timeout) set variable unsigned char=0" } | |
385 | } | |
386 | ||
387 | ||
388 | send "set variable v_unsigned_char=1\n" | |
389 | expect { | |
390 | -re "$prompt $"\ | |
391 | { | |
392 | send "print v_unsigned_char\n" | |
393 | expect { | |
394 | -re ".\[0-9\]* = 1 \'.001\'.*$prompt $" { pass "set variable unsigned char=1" } | |
395 | -re "$prompt $" { fail "set variable unsigned char=1" } | |
396 | timeout { fail "(timeout) set variable unsigned char=1" } | |
397 | } | |
398 | } | |
399 | -re "$prompt $" { fail "set variable unsigned char=1" } | |
400 | timeout { fail "(timeout) set variable unsigned char=1" } | |
401 | } | |
402 | ||
403 | ||
404 | send "set variable v_unsigned_char=27\n" | |
405 | expect { | |
406 | -re "$prompt $"\ | |
407 | { | |
408 | send "print v_unsigned_char\n" | |
409 | expect { | |
410 | -re ".\[0-9\]* = 27 \'.e\'.*$prompt $" { pass "set variable unsigned char=27 (Esc)" } | |
411 | -re "$prompt $" { fail "set variable unsigned char=27 (Esc)" } | |
412 | timeout { fail "(timeout) set variable unsigned char=27 (Esc)" } | |
413 | } | |
414 | } | |
415 | -re "$prompt $" { fail "set variable unsigned char=27 (Esc)" } | |
416 | timeout { fail "(timeout) set variable unsigned char=27 (Esc)" } | |
417 | } | |
418 | ||
419 | ||
420 | send "set variable v_unsigned_char=32\n" | |
421 | expect { | |
422 | -re "$prompt $"\ | |
423 | { | |
424 | send "print v_unsigned_char\n" | |
425 | expect { | |
426 | -re ".\[0-9\]* = 32 \' \'.*$prompt $" { pass "set variable unsigned char=32 (SPC)" } | |
427 | -re "$prompt $" { fail "set variable unsigned char=32 (SPC)" } | |
428 | timeout { fail "(timeout) set variable unsigned char=32 (SPC)" } | |
429 | } | |
430 | } | |
431 | -re "$prompt $" { fail "set variable unsigned char=32 (SPC)" } | |
432 | timeout { fail "(timeout) set variable unsigned char=32 (SPC)" } | |
433 | } | |
434 | ||
435 | ||
436 | send "set variable v_unsigned_char=65\n" | |
437 | expect { | |
438 | -re "$prompt $"\ | |
439 | { | |
440 | send "print v_unsigned_char\n" | |
441 | expect { | |
442 | -re ".\[0-9\]* = 65 \'A\'.*$prompt $" { pass "set variable unsigned char=65 ('A')" } | |
443 | -re "$prompt $" { fail "set variable unsigned char=65 ('A')" } | |
444 | timeout { fail "(timeout) set variable unsigned char=65 ('A')" } | |
445 | } | |
446 | } | |
447 | -re "$prompt $" { fail "set variable unsigned char=65 ('A')" } | |
448 | timeout { fail "(timeout) set variable unsigned char=65 ('A')" } | |
449 | } | |
450 | ||
451 | ||
452 | send "set variable v_unsigned_char=97\n" | |
453 | expect { | |
454 | -re "$prompt $"\ | |
455 | { | |
456 | send "print v_unsigned_char\n" | |
457 | expect { | |
458 | -re ".\[0-9\]* = 97 \'a\'.*$prompt $" { pass "set variable unsigned char=97 ('a')" } | |
459 | -re "$prompt $" { fail "set variable unsigned char=97 ('a')" } | |
460 | timeout { fail "(timeout) set variable unsigned char=97 ('a')" } | |
461 | } | |
462 | } | |
463 | -re "$prompt $" { fail "set variable unsigned char=97 ('a')" } | |
464 | timeout { fail "(timeout) set variable unsigned char=97 ('a')" } | |
465 | } | |
466 | ||
467 | ||
468 | send "set variable v_unsigned_char=126\n" | |
469 | expect { | |
470 | -re "$prompt $"\ | |
471 | { | |
472 | send "print v_unsigned_char\n" | |
473 | expect { | |
474 | -re ".\[0-9\]* = 126 \'~\'.*$prompt $" { pass "set variable unsigned char=126 ('~')" } | |
475 | -re "$prompt $" { fail "set variable unsigned char=126 ('~')" } | |
476 | timeout { fail "(timeout) set variable unsigned char=126 ('~')" } | |
477 | } | |
478 | } | |
479 | -re "$prompt $" { fail "set variable unsigned char=126 ('~')" } | |
480 | timeout { fail "(timeout) set variable unsigned char=126 ('~')" } | |
481 | } | |
482 | ||
483 | ||
484 | send "set variable v_unsigned_char=~0\n" | |
485 | expect { | |
486 | -re "$prompt $"\ | |
487 | { | |
488 | send "print v_unsigned_char\n" | |
489 | expect { | |
490 | -re ".\[0-9\]* = 255 \'.377\'.*$prompt $" { pass "set variable unsigned char=255 (8-bit)" } | |
491 | -re "$prompt $" { fail "set variable unsigned char=255 (8-bit)" } | |
492 | timeout { fail "(timeout) set variable unsigned char=255 (8-bit)" } | |
493 | } | |
494 | } | |
495 | -re "$prompt $" { fail "set variable unsigned char=255 (8-bit)" } | |
496 | timeout { fail "(timeout) set variable unsigned char=255 (8-bit)" } | |
497 | } | |
498 | ||
499 | ||
500 | # | |
501 | # test "set variable" for type "short" | |
502 | # | |
503 | send "set variable v_short=0\n" | |
504 | expect { | |
505 | -re "$prompt $"\ | |
506 | { | |
507 | send "print v_short\n" | |
508 | expect { | |
509 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable short=0" } | |
510 | -re "$prompt $" { fail "set variable short=0" } | |
511 | timeout { fail "(timeout) set variable short=0" } | |
512 | } | |
513 | } | |
514 | -re "$prompt $" { fail "set variable short=0" } | |
515 | timeout { fail "(timeout) set variable short=0" } | |
516 | } | |
517 | ||
518 | ||
519 | send "set variable v_short=1\n" | |
520 | expect { | |
521 | -re "$prompt $"\ | |
522 | { | |
523 | send "print v_short\n" | |
524 | expect { | |
525 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable short=1" } | |
526 | -re "$prompt $" { fail "set variable short=1" } | |
527 | timeout { fail "(timeout) set variable short=1" } | |
528 | } | |
529 | } | |
530 | -re "$prompt $" { fail "set variable short=1" } | |
531 | timeout { fail "(timeout) set variable short=1" } | |
532 | } | |
533 | ||
534 | ||
535 | send "set variable v_short=-1\n" | |
536 | expect { | |
537 | -re "$prompt $"\ | |
538 | { | |
539 | send "print v_short\n" | |
540 | expect { | |
541 | -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable short=-1 (minus)" } | |
542 | -re "$prompt $" { fail "set variable short=-1 (minus)" } | |
543 | timeout { fail "(timeout) set variable signed short=-1 (minus)" } | |
544 | } | |
545 | } | |
546 | -re "$prompt $" { fail "set variable short=-1 (minus)" } | |
547 | timeout { fail "(timeout) set variable short=-1 (minus)" } | |
548 | } | |
549 | ||
550 | ||
551 | # | |
552 | # test "set variable" for type "signed short" | |
553 | # | |
554 | send "set variable v_signed_short=0\n" | |
555 | expect { | |
556 | -re "$prompt $"\ | |
557 | { | |
558 | send "print v_signed_short\n" | |
559 | expect { | |
560 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable signed short=0" } | |
561 | -re "$prompt $" { fail "set variable signed short=0" } | |
562 | timeout { fail "(timeout) set variable signed short=0" } | |
563 | } | |
564 | } | |
565 | -re "$prompt $" { fail "set variable signed short=0" } | |
566 | timeout { fail "(timeout) set variable signed short=0" } | |
567 | } | |
568 | ||
569 | ||
570 | send "set variable v_signed_short=1\n" | |
571 | expect { | |
572 | -re "$prompt $"\ | |
573 | { | |
574 | send "print v_signed_short\n" | |
575 | expect { | |
576 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable signed short=1" } | |
577 | -re "$prompt $" { fail "set variable signed short=1" } | |
578 | timeout { fail "(timeout) set variable signed short=1" } | |
579 | } | |
580 | } | |
581 | -re "$prompt $" { fail "set variable signed short=1" } | |
582 | timeout { fail "(timeout) set variable signed short=1" } | |
583 | } | |
584 | ||
585 | ||
586 | send "set variable v_signed_short=-1\n" | |
587 | expect { | |
588 | -re "$prompt $"\ | |
589 | { | |
590 | send "print v_signed_short\n" | |
591 | expect { | |
592 | -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable signed short=-1 (minus)" } | |
593 | -re "$prompt $" { fail "set variable signed short=-1 (minus)" } | |
594 | timeout { fail "(timeout) set variable signed short=-1 (minus)" } | |
595 | } | |
596 | } | |
597 | -re "$prompt $" { fail "set variable signed short=-1 (minus)" } | |
598 | timeout { fail "(timeout) set variable signed short=-1 (minus)" } | |
599 | } | |
600 | ||
601 | ||
602 | # | |
603 | # test "set variable" for type "unsigned short" | |
604 | # | |
605 | send "set variable v_unsigned_short=0\n" | |
606 | expect { | |
607 | -re "$prompt $"\ | |
608 | { | |
609 | send "print v_unsigned_short\n" | |
610 | expect { | |
611 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable unsigned short=0" } | |
612 | -re "$prompt $" { fail "set variable unsigned short=0" } | |
613 | timeout { fail "(timeout) set variable unsigned short=0" } | |
614 | } | |
615 | } | |
616 | -re "$prompt $" { fail "set variable unsigned short=0" } | |
617 | timeout { fail "(timeout) set variable unsigned short=0" } | |
618 | } | |
619 | ||
620 | ||
621 | send "set variable v_unsigned_short=1\n" | |
622 | expect { | |
623 | -re "$prompt $"\ | |
624 | { | |
625 | send "print v_unsigned_short\n" | |
626 | expect { | |
627 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable unsigned short=1" } | |
628 | -re "$prompt $" { fail "set variable unsigned short=1" } | |
629 | timeout { fail "(timeout) set variable unsigned short=1" } | |
630 | } | |
631 | } | |
632 | -re "$prompt $" { fail "set variable unsigned short=1" } | |
633 | timeout { fail "(timeout) set variable unsigned short=1" } | |
634 | } | |
635 | ||
636 | ||
637 | send "set variable v_unsigned_short=~0\n" | |
638 | expect { | |
639 | -re "$prompt $"\ | |
640 | { | |
641 | send "print v_unsigned_short\n" | |
642 | expect { | |
643 | -re ".\[0-9\]* = 65535.*$prompt $" { pass "set variable unsigned short=~0 (minus)" } | |
644 | -re "$prompt $" { fail "set variable unsigned short=~0 (minus)" } | |
645 | timeout { fail "(timeout) set variable unsigned short=~0 (minus)" } | |
646 | } | |
647 | } | |
648 | -re "$prompt $" { fail "set variable unsigned short=~0 (minus)" } | |
649 | timeout { fail "(timeout) set variable unsigned short=~0 (minus)" } | |
650 | } | |
651 | ||
652 | ||
653 | # | |
654 | # test "set variable" for type "int" | |
655 | # | |
656 | send "set variable v_int=0\n" | |
657 | expect { | |
658 | -re "$prompt $"\ | |
659 | { | |
660 | send "print v_int\n" | |
661 | expect { | |
662 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable int=0" } | |
663 | -re "$prompt $" { fail "set variable int=0" } | |
664 | timeout { fail "(timeout) set variable int=0" } | |
665 | } | |
666 | } | |
667 | -re "$prompt $" { fail "set variable int=0" } | |
668 | timeout { fail "(timeout) set variable int=0" } | |
669 | } | |
670 | ||
671 | ||
672 | send "set variable v_int=1\n" | |
673 | expect { | |
674 | -re "$prompt $"\ | |
675 | { | |
676 | send "print v_int\n" | |
677 | expect { | |
678 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable int=1" } | |
679 | -re "$prompt $" { fail "set variable int=1" } | |
680 | timeout { fail "(timeout) set variable int=1" } | |
681 | } | |
682 | } | |
683 | -re "$prompt $" { fail "set variable int=1" } | |
684 | timeout { fail "(timeout) set variable int=1" } | |
685 | } | |
686 | ||
687 | ||
688 | send "set variable v_int=-1\n" | |
689 | expect { | |
690 | -re "$prompt $"\ | |
691 | { | |
692 | send "print v_int\n" | |
693 | expect { | |
694 | -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable int=-1 (minus)" } | |
695 | -re "$prompt $" { fail "set variable int=-1 (minus)" } | |
696 | timeout { fail "(timeout) set variable signed int=-1 (minus)" } | |
697 | } | |
698 | } | |
699 | -re "$prompt $" { fail "set variable int=-1 (minus)" } | |
700 | timeout { fail "(timeout) set variable int=-1 (minus)" } | |
701 | } | |
702 | ||
703 | ||
704 | # | |
705 | # test "set variable" for type "signed int" | |
706 | # | |
707 | send "set variable v_signed_int=0\n" | |
708 | expect { | |
709 | -re "$prompt $"\ | |
710 | { | |
711 | send "print v_signed_int\n" | |
712 | expect { | |
713 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable signed int=0" } | |
714 | -re "$prompt $" { fail "set variable signed int=0" } | |
715 | timeout { fail "(timeout) set variable signed int=0" } | |
716 | } | |
717 | } | |
718 | -re "$prompt $" { fail "set variable signed int=0" } | |
719 | timeout { fail "(timeout) set variable signed int=0" } | |
720 | } | |
721 | ||
722 | ||
723 | send "set variable v_signed_int=1\n" | |
724 | expect { | |
725 | -re "$prompt $"\ | |
726 | { | |
727 | send "print v_signed_int\n" | |
728 | expect { | |
729 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable signed int=1" } | |
730 | -re "$prompt $" { fail "set variable signed int=1" } | |
731 | timeout { fail "(timeout) set variable signed int=1" } | |
732 | } | |
733 | } | |
734 | -re "$prompt $" { fail "set variable signed int=1" } | |
735 | timeout { fail "(timeout) set variable signed int=1" } | |
736 | } | |
737 | ||
738 | ||
739 | send "set variable v_signed_int=-1\n" | |
740 | expect { | |
741 | -re "$prompt $"\ | |
742 | { | |
743 | send "print v_signed_int\n" | |
744 | expect { | |
745 | -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable signed int=-1 (minus)" } | |
746 | -re "$prompt $" { fail "set variable signed int=-1 (minus)" } | |
747 | timeout { fail "(timeout) set variable signed int=-1 (minus)" } | |
748 | } | |
749 | } | |
750 | -re "$prompt $" { fail "set variable signed int=-1 (minus)" } | |
751 | timeout { fail "(timeout) set variable signed int=-1 (minus)" } | |
752 | } | |
753 | ||
754 | ||
755 | # | |
756 | # test "set variable" for type "unsigned int" | |
757 | # | |
758 | send "set variable v_unsigned_int=0\n" | |
759 | expect { | |
760 | -re "$prompt $"\ | |
761 | { | |
762 | send "print v_unsigned_int\n" | |
763 | expect { | |
764 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable unsigned int=0" } | |
765 | -re "$prompt $" { fail "set variable unsigned int=0" } | |
766 | timeout { fail "(timeout) set variable unsigned int=0" } | |
767 | } | |
768 | } | |
769 | -re "$prompt $" { fail "set variable unsigned int=0" } | |
770 | timeout { fail "(timeout) set variable unsigned int=0" } | |
771 | } | |
772 | ||
773 | ||
774 | send "set variable v_unsigned_int=1\n" | |
775 | expect { | |
776 | -re "$prompt $"\ | |
777 | { | |
778 | send "print v_unsigned_int\n" | |
779 | expect { | |
780 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable unsigned int=1" } | |
781 | -re "$prompt $" { fail "set variable unsigned int=1" } | |
782 | timeout { fail "(timeout) set variable unsigned int=1" } | |
783 | } | |
784 | } | |
785 | -re "$prompt $" { fail "set variable unsigned int=1" } | |
786 | timeout { fail "(timeout) set variable unsigned int=1" } | |
787 | } | |
788 | ||
789 | ||
790 | send "set variable v_unsigned_int=~0\n" | |
791 | expect { | |
792 | -re "$prompt $"\ | |
793 | { | |
794 | send "print v_unsigned_int\n" | |
795 | expect { | |
796 | -re ".\[0-9\]* = 4294967295.*$prompt $" { pass "set variable unsigned int=~0 (minus)" } | |
797 | -re "$prompt $" { fail "set variable unsigned int=~0 (minus)" } | |
798 | timeout { fail "(timeout) set variable unsigned int=~0 (minus)" } | |
799 | } | |
800 | } | |
801 | -re "$prompt $" { fail "set variable unsigned int=~0 (minus)" } | |
802 | timeout { fail "(timeout) set variable unsigned int=~0 (minus)" } | |
803 | } | |
804 | ||
805 | ||
806 | # | |
807 | # test "set variable" for type "long" | |
808 | # | |
809 | send "set variable v_long=0\n" | |
810 | expect { | |
811 | -re "$prompt $"\ | |
812 | { | |
813 | send "print v_long\n" | |
814 | expect { | |
815 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable long=0" } | |
816 | -re "$prompt $" { fail "set variable long=0" } | |
817 | timeout { fail "(timeout) set variable long=0" } | |
818 | } | |
819 | } | |
820 | -re "$prompt $" { fail "set variable long=0" } | |
821 | timeout { fail "(timeout) set variable long=0" } | |
822 | } | |
823 | ||
824 | ||
825 | send "set variable v_long=1\n" | |
826 | expect { | |
827 | -re "$prompt $"\ | |
828 | { | |
829 | send "print v_long\n" | |
830 | expect { | |
831 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable long=1" } | |
832 | -re "$prompt $" { fail "set variable long=1" } | |
833 | timeout { fail "(timeout) set variable long=1" } | |
834 | } | |
835 | } | |
836 | -re "$prompt $" { fail "set variable long=1" } | |
837 | timeout { fail "(timeout) set variable long=1" } | |
838 | } | |
839 | ||
840 | ||
841 | send "set variable v_long=-1\n" | |
842 | expect { | |
843 | -re "$prompt $"\ | |
844 | { | |
845 | send "print v_long\n" | |
846 | expect { | |
847 | -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable long=-1 (minus)" } | |
848 | -re "$prompt $" { fail "set variable long=-1 (minus)" } | |
849 | timeout { fail "(timeout) set variable signed long=-1 (minus)" } | |
850 | } | |
851 | } | |
852 | -re "$prompt $" { fail "set variable long=-1 (minus)" } | |
853 | timeout { fail "(timeout) set variable long=-1 (minus)" } | |
854 | } | |
855 | ||
856 | ||
857 | # | |
858 | # test "set variable" for type "signed long" | |
859 | # | |
860 | send "set variable v_signed_long=0\n" | |
861 | expect { | |
862 | -re "$prompt $"\ | |
863 | { | |
864 | send "print v_signed_long\n" | |
865 | expect { | |
866 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable signed long=0" } | |
867 | -re "$prompt $" { fail "set variable signed long=0" } | |
868 | timeout { fail "(timeout) set variable signed long=0" } | |
869 | } | |
870 | } | |
871 | -re "$prompt $" { fail "set variable signed long=0" } | |
872 | timeout { fail "(timeout) set variable signed long=0" } | |
873 | } | |
874 | ||
875 | ||
876 | send "set variable v_signed_long=1\n" | |
877 | expect { | |
878 | -re "$prompt $"\ | |
879 | { | |
880 | send "print v_signed_long\n" | |
881 | expect { | |
882 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable signed long=1" } | |
883 | -re "$prompt $" { fail "set variable signed long=1" } | |
884 | timeout { fail "(timeout) set variable signed long=1" } | |
885 | } | |
886 | } | |
887 | -re "$prompt $" { fail "set variable signed long=1" } | |
888 | timeout { fail "(timeout) set variable signed long=1" } | |
889 | } | |
890 | ||
891 | ||
892 | send "set variable v_signed_long=-1\n" | |
893 | expect { | |
894 | -re "$prompt $"\ | |
895 | { | |
896 | send "print v_signed_long\n" | |
897 | expect { | |
898 | -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable signed long=-1 (minus)" } | |
899 | -re "$prompt $" { fail "set variable signed long=-1 (minus)" } | |
900 | timeout { fail "(timeout) set variable signed long=-1 (minus)" } | |
901 | } | |
902 | } | |
903 | -re "$prompt $" { fail "set variable signed long=-1 (minus)" } | |
904 | timeout { fail "(timeout) set variable signed long=-1 (minus)" } | |
905 | } | |
906 | ||
907 | ||
908 | # | |
909 | # test "set variable" for type "unsigned long" | |
910 | # | |
911 | send "set variable v_unsigned_long=0\n" | |
912 | expect { | |
913 | -re "$prompt $"\ | |
914 | { | |
915 | send "print v_unsigned_long\n" | |
916 | expect { | |
917 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable unsigned long=0" } | |
918 | -re "$prompt $" { fail "set variable unsigned long=0" } | |
919 | timeout { fail "(timeout) set variable unsigned long=0" } | |
920 | } | |
921 | } | |
922 | -re "$prompt $" { fail "set variable unsigned long=0" } | |
923 | timeout { fail "(timeout) set variable unsigned long=0" } | |
924 | } | |
925 | ||
926 | ||
927 | send "set variable v_unsigned_long=1\n" | |
928 | expect { | |
929 | -re "$prompt $"\ | |
930 | { | |
931 | send "print v_unsigned_long\n" | |
932 | expect { | |
933 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable unsigned long=1" } | |
934 | -re "$prompt $" { fail "set variable unsigned long=1" } | |
935 | timeout { fail "(timeout) set variable unsigned long=1" } | |
936 | } | |
937 | } | |
938 | -re "$prompt $" { fail "set variable unsigned long=1" } | |
939 | timeout { fail "(timeout) set variable unsigned long=1" } | |
940 | } | |
941 | ||
942 | ||
943 | send "set variable v_unsigned_long=~0\n" | |
944 | expect { | |
945 | -re "$prompt $"\ | |
946 | { | |
947 | send "print v_unsigned_long\n" | |
948 | expect { | |
949 | -re ".\[0-9\]* = $ulong_minus_1.*$prompt $" { pass "set variable unsigned long=~0 (minus)" } | |
950 | -re "$prompt $" { fail "set variable unsigned long=~0 (minus)" } | |
951 | timeout { fail "(timeout) set variable unsigned long=~0 (minus)" } | |
952 | } | |
953 | } | |
954 | -re "$prompt $" { fail "set variable unsigned long=~0 (minus)" } | |
955 | timeout { fail "(timeout) set variable unsigned long=~0 (minus)" } | |
956 | } | |
957 | ||
958 | ||
959 | # | |
960 | # test "set variable" for type "float" | |
961 | # | |
962 | send "set variable v_float=0.0\n" | |
963 | expect { | |
964 | -re "$prompt $"\ | |
965 | { | |
966 | send "print v_float\n" | |
967 | expect { | |
968 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable float=0" } | |
969 | -re "$prompt $" { fail "set variable float=0" } | |
970 | timeout { fail "(timeout) set variable float=0" } | |
971 | } | |
972 | } | |
973 | -re "$prompt $" { fail "set variable float=0" } | |
974 | timeout { fail "(timeout) set variable float=0" } | |
975 | } | |
976 | ||
977 | ||
978 | send "set variable v_float=1.0\n" | |
979 | expect { | |
980 | -re "$prompt $"\ | |
981 | { | |
982 | send "print v_float\n" | |
983 | expect { | |
984 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable float=1" } | |
985 | -re "$prompt $" { fail "set variable float=1" } | |
986 | timeout { fail "(timeout) set variable float=1" } | |
987 | } | |
988 | } | |
989 | -re "$prompt $" { fail "set variable float=1" } | |
990 | timeout { fail "(timeout) set variable float=1" } | |
991 | } | |
992 | ||
993 | ||
994 | send "set variable v_float=-1.0\n" | |
995 | expect { | |
996 | -re "$prompt $"\ | |
997 | { | |
998 | send "print v_float\n" | |
999 | expect { | |
1000 | -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable float=-1 (minus)" } | |
1001 | -re "$prompt $" { fail "set variable float=-1 (minus)" } | |
1002 | timeout { fail "(timeout) set variable signed float=-1 (minus)" } | |
1003 | } | |
1004 | } | |
1005 | -re "$prompt $" { fail "set variable float=-1 (minus)" } | |
1006 | timeout { fail "(timeout) set variable float=-1 (minus)" } | |
1007 | } | |
1008 | ||
1009 | ||
1010 | # | |
1011 | # test "set variable" for type "double" | |
1012 | # | |
1013 | send "set variable v_double=0.0\n" | |
1014 | expect { | |
1015 | -re "$prompt $"\ | |
1016 | { | |
1017 | send "print v_double\n" | |
1018 | expect { | |
1019 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable double=0" } | |
1020 | -re "$prompt $" { fail "set variable double=0" } | |
1021 | timeout { fail "(timeout) set variable double=0" } | |
1022 | } | |
1023 | } | |
1024 | -re "$prompt $" { fail "set variable double=0" } | |
1025 | timeout { fail "(timeout) set variable double=0" } | |
1026 | } | |
1027 | ||
1028 | ||
1029 | send "set variable v_double=1.0\n" | |
1030 | expect { | |
1031 | -re "$prompt $"\ | |
1032 | { | |
1033 | send "print v_double\n" | |
1034 | expect { | |
1035 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable double=1" } | |
1036 | -re "$prompt $" { fail "set variable double=1" } | |
1037 | timeout { fail "(timeout) set variable double=1" } | |
1038 | } | |
1039 | } | |
1040 | -re "$prompt $" { fail "set variable double=1" } | |
1041 | timeout { fail "(timeout) set variable double=1" } | |
1042 | } | |
1043 | ||
1044 | ||
1045 | send "set variable v_double=-1.0\n" | |
1046 | expect { | |
1047 | -re "set.*$prompt $"\ | |
1048 | { | |
1049 | send "print v_double\n" | |
1050 | expect { | |
1051 | -re "print.*.\[0-9\]* = -1.*$prompt $" { pass "set variable double=-1 (minus)" } | |
1052 | -re "$prompt $" { fail "set variable double=-1 (minus)" } | |
1053 | timeout { fail "(timeout) set variable double=-1 (minus)" } | |
1054 | } | |
1055 | } | |
1056 | -re "$prompt $" { fail "set variable double=-1 (minus)" } | |
1057 | timeout { fail "(timeout) set variable double=-1 (minus)" } | |
1058 | } | |
1059 | ||
1060 | ||
1061 | # | |
1062 | # test "set variable" for "char array[2]" | |
1063 | # | |
1064 | send "set variable v_char_array\[0\]='h'\n" | |
1065 | expect -re "$prompt $" | |
1066 | send "set variable v_char_array\[1\]='i'\n" | |
1067 | expect { | |
1068 | -re "set.*$prompt $"\ | |
1069 | { | |
1070 | send "print v_char_array\n" | |
1071 | expect { | |
1072 | -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { pass "set variable char array=\"hi\" (string)" } | |
1073 | -re "$prompt $" { fail "set variable char array=\"hi\" (string)" } | |
1074 | timeout { fail "(timeout) set variable char array=\"hi\" (string)" } | |
1075 | } | |
1076 | } | |
1077 | -re "$prompt $" { fail "set variable char array=\"hi\" (string)" } | |
1078 | timeout { fail "(timeout) set variable char array=\"hi\" (string)" } | |
1079 | } | |
1080 | ||
1081 | ||
1082 | # | |
1083 | # test "set variable" for "signed char array[2]" | |
1084 | # | |
1085 | send "set variable v_signed_char_array\[0\]='h'\n" | |
1086 | expect -re "$prompt $" | |
1087 | send "set variable v_signed_char_array\[1\]='i'\n" | |
1088 | expect { | |
1089 | -re "set.*$prompt $"\ | |
1090 | { | |
1091 | send "print v_signed_char_array\n" | |
1092 | expect { | |
1093 | -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { pass "set variable signed char array=\"hi\" (string)" } | |
1094 | -re "$prompt $" { fail "set variable signed char array=\"hi\" (string)" } | |
1095 | timeout { fail "(timeout) set variable signed char array=\"hi\" (string)" } | |
1096 | } | |
1097 | } | |
1098 | -re "$prompt $" { fail "set variable signed char array=\"hi\" (string)" } | |
1099 | timeout { fail "(timeout) set variable signed char array=\"hi\" (string)" } | |
1100 | } | |
1101 | ||
1102 | ||
1103 | # | |
1104 | # test "set variable" for "unsigned char array[2]" | |
1105 | # | |
1106 | send "set variable v_unsigned_char_array\[0\]='h'\n" | |
1107 | expect -re "$prompt $" | |
1108 | send "set variable v_unsigned_char_array\[1\]='i'\n" | |
1109 | expect { | |
1110 | -re "set.*$prompt $"\ | |
1111 | { | |
1112 | send "print v_unsigned_char_array\n" | |
1113 | expect { | |
1114 | -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { pass "set variable unsigned char array=\"hi\" (string)" } | |
1115 | -re "$prompt $" { fail "set variable unsigned char array=\"hi\" (string)" } | |
1116 | timeout { fail "(timeout) set variable unsigned char array=\"hi\" (string)" } | |
1117 | } | |
1118 | } | |
1119 | -re "$prompt $" { fail "set variable unsigned char array=\"hi\" (string)" } | |
1120 | timeout { fail "(timeout) set variable unsigned char array=\"hi\" (string)" } | |
1121 | } | |
1122 | ||
1123 | ||
1124 | # | |
1125 | # test "set variable" for "short array[2]" | |
1126 | # | |
1127 | send "set variable v_short_array\[0\]=123\n" | |
1128 | expect -re "$prompt $" | |
1129 | send "set variable v_short_array\[1\]=-456\n" | |
1130 | expect { | |
1131 | -re "set.*$prompt $"\ | |
1132 | { | |
1133 | send "print v_short_array\n" | |
1134 | expect { | |
1135 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable short array" } | |
1136 | -re "$prompt $" { fail "set variable short array" } | |
1137 | timeout { fail "(timeout) set variable short array" } | |
1138 | } | |
1139 | } | |
1140 | -re "$prompt $" { fail "set variable short array" } | |
1141 | timeout { fail "(timeout) set variable short array" } | |
1142 | } | |
1143 | ||
1144 | ||
1145 | # | |
1146 | # test "set variable" for "signed short array[2]" | |
1147 | # | |
1148 | send "set variable v_signed_short_array\[0\]=123\n" | |
1149 | expect -re "$prompt $" | |
1150 | send "set variable v_signed_short_array\[1\]=-456\n" | |
1151 | expect { | |
1152 | -re "set.*$prompt $"\ | |
1153 | { | |
1154 | send "print v_signed_short_array\n" | |
1155 | expect { | |
1156 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable signed short array" } | |
1157 | -re "$prompt $" { fail "set variable signed short array" } | |
1158 | timeout { fail "(timeout) set variable signed short array" } | |
1159 | } | |
1160 | } | |
1161 | -re "$prompt $" { fail "set variable signed short array" } | |
1162 | timeout { fail "(timeout) set variable signed short array" } | |
1163 | } | |
1164 | ||
1165 | ||
1166 | # | |
1167 | # test "set variable" for "unsigned short array[2]" | |
1168 | # | |
1169 | send "set variable v_unsigned_short_array\[0\]=123\n" | |
1170 | expect -re "$prompt $" | |
1171 | send "set variable v_unsigned_short_array\[1\]=-456\n" | |
1172 | expect { | |
1173 | -re "set.*$prompt $"\ | |
1174 | { | |
1175 | send "print v_unsigned_short_array\n" | |
1176 | expect { | |
1177 | -re "print.*.\[0-9\]* =.*\{123,.*65080\}.*$prompt $" { pass "set variable unsigned short array" } | |
1178 | -re "$prompt $" { fail "set variable unsigned short array" } | |
1179 | timeout { fail "(timeout) set variable unsigned short array" } | |
1180 | } | |
1181 | } | |
1182 | -re "$prompt $" { fail "set variable unsigned short array" } | |
1183 | timeout { fail "(timeout) set variable unsigned short array" } | |
1184 | } | |
1185 | ||
1186 | ||
1187 | # | |
1188 | # test "set variable" for "int array[2]" | |
1189 | # | |
1190 | send "set variable v_int_array\[0\]=123\n" | |
1191 | expect -re "$prompt $" | |
1192 | send "set variable v_int_array\[1\]=-456\n" | |
1193 | expect { | |
1194 | -re "set.*$prompt $"\ | |
1195 | { | |
1196 | send "print v_int_array\n" | |
1197 | expect { | |
1198 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable int array" } | |
1199 | -re "$prompt $" { fail "set variable int array" } | |
1200 | timeout { fail "(timeout) set variable int array" } | |
1201 | } | |
1202 | } | |
1203 | -re "$prompt $" { fail "set variable int array" } | |
1204 | timeout { fail "(timeout) set variable int array" } | |
1205 | } | |
1206 | ||
1207 | ||
1208 | # | |
1209 | # test "set variable" for "signed int array[2]" | |
1210 | # | |
1211 | send "set variable v_signed_int_array\[0\]=123\n" | |
1212 | expect -re "$prompt $" | |
1213 | send "set variable v_signed_int_array\[1\]=-456\n" | |
1214 | expect { | |
1215 | -re "set.*$prompt $"\ | |
1216 | { | |
1217 | send "print v_signed_int_array\n" | |
1218 | expect { | |
1219 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable signed int array" } | |
1220 | -re "$prompt $" { fail "set variable signed int array" } | |
1221 | timeout { fail "(timeout) set variable signed int array" } | |
1222 | } | |
1223 | } | |
1224 | -re "$prompt $" { fail "set variable signed int array" } | |
1225 | timeout { fail "(timeout) set variable signed int array" } | |
1226 | } | |
1227 | ||
1228 | ||
1229 | ||
1230 | # | |
1231 | # test "set variable" for "unsigned int array[2]" | |
1232 | # | |
1233 | send "set variable v_unsigned_int_array\[0\]=123\n" | |
1234 | expect -re "$prompt $" | |
1235 | send "set variable v_unsigned_int_array\[1\]=-456\n" | |
1236 | expect { | |
1237 | -re "set.*$prompt $"\ | |
1238 | { | |
1239 | send "print v_unsigned_int_array\n" | |
1240 | expect { | |
1241 | -re "print.*.\[0-9\]* =.*\{123,.*4294966840\}.*$prompt $" { pass "set variable unsigned int array" } | |
1242 | -re "$prompt $" { fail "set variable unsigned int array" } | |
1243 | timeout { fail "(timeout) set variable unsigned int array" } | |
1244 | } | |
1245 | } | |
1246 | -re "$prompt $" { fail "set variable unsigned int array" } | |
1247 | timeout { fail "(timeout) set variable unsigned int array" } | |
1248 | } | |
1249 | ||
1250 | ||
1251 | # | |
1252 | # test "set variable" for "long array[2]" | |
1253 | # | |
1254 | send "set variable v_long_array\[0\]=123\n" | |
1255 | expect -re "$prompt $" | |
1256 | send "set variable v_long_array\[1\]=-456\n" | |
1257 | expect { | |
1258 | -re "set.*$prompt $"\ | |
1259 | { | |
1260 | send "print v_long_array\n" | |
1261 | expect { | |
1262 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable long array" } | |
1263 | -re "$prompt $" { fail "set variable long array" } | |
1264 | timeout { fail "(timeout) set variable long array" } | |
1265 | } | |
1266 | } | |
1267 | -re "$prompt $" { fail "set variable long array" } | |
1268 | timeout { fail "(timeout) set variable long array" } | |
1269 | } | |
1270 | ||
1271 | ||
1272 | # | |
1273 | # test "set variable" for "signed long array[2]" | |
1274 | # | |
1275 | send "set variable v_signed_long_array\[0\]=123\n" | |
1276 | expect -re "$prompt $" | |
1277 | send "set variable v_signed_long_array\[1\]=-456\n" | |
1278 | expect { | |
1279 | -re "set.*$prompt $"\ | |
1280 | { | |
1281 | send "print v_signed_long_array\n" | |
1282 | expect { | |
1283 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable signed long array" } | |
1284 | -re "$prompt $" { fail "set variable signed long array" } | |
1285 | timeout { fail "(timeout) set variable signed long array" } | |
1286 | } | |
1287 | } | |
1288 | -re "$prompt $" { fail "set variable signed long array" } | |
1289 | timeout { fail "(timeout) set variable signed long array" } | |
1290 | } | |
1291 | ||
1292 | ||
1293 | ||
1294 | # | |
1295 | # test "set variable" for "unsigned long array[2]" | |
1296 | # | |
1297 | send "set variable v_unsigned_long_array\[0\]=123\n" | |
1298 | expect -re "$prompt $" | |
1299 | send "set variable v_unsigned_long_array\[1\]=-456\n" | |
1300 | expect { | |
1301 | -re "$prompt $"\ | |
1302 | { | |
1303 | send "print v_unsigned_long_array\n" | |
1304 | expect { | |
1305 | -re "print.*.\[0-9\]* =.*\{123,.*$ulong_minus_456\}.*$prompt $" { pass "set variable unsigned long array" } | |
1306 | -re "$prompt $" { fail "set variable unsigned long array" } | |
1307 | timeout { fail "(timeout) set variable unsigned long array" } | |
1308 | } | |
1309 | } | |
1310 | -re "$prompt $" { fail "set variable unsigned long array" } | |
1311 | timeout { fail "(timeout) set variable unsigned long array" } | |
1312 | } | |
1313 | ||
1314 | ||
1315 | # | |
1316 | # test "set variable" for "float array[2]" | |
1317 | # | |
1318 | send "set variable v_float_array\[0\]=123.0\n" | |
1319 | expect -re "$prompt $" | |
1320 | send "set variable v_float_array\[1\]=-456.0\n" | |
1321 | expect { | |
1322 | -re "$prompt $"\ | |
1323 | { | |
1324 | send "print v_float_array\n" | |
1325 | expect { | |
1326 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable float array" } | |
1327 | -re "$prompt $" { fail "set variable float array" } | |
1328 | timeout { fail "(timeout) set variable float array" } | |
1329 | } | |
1330 | } | |
1331 | -re "$prompt $" { fail "set variable float array" } | |
1332 | timeout { fail "(timeout) set variable float array" } | |
1333 | } | |
1334 | ||
1335 | ||
1336 | # | |
1337 | # test "set variable" for "double array[2]" | |
1338 | # | |
1339 | send "set variable v_double_array\[0\]=123.0\n" | |
1340 | expect -re "$prompt $" | |
1341 | send "set variable v_double_array\[1\]=-456.0\n" | |
1342 | expect { | |
1343 | -re "$prompt $"\ | |
1344 | { | |
1345 | send "print v_double_array\n" | |
1346 | expect { | |
1347 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable double array" } | |
1348 | -re "$prompt $" { fail "set variable double array" } | |
1349 | timeout { fail "(timeout) set variable double array" } | |
1350 | } | |
1351 | } | |
1352 | -re "$prompt $" { fail "set variable double array" } | |
1353 | timeout { fail "(timeout) set variable double array" } | |
1354 | } | |
1355 | ||
1356 | ||
1357 | # | |
1358 | # test "set variable" for type "char *" | |
1359 | # | |
1360 | send "set v_char_pointer=v_char_array\n" | |
1361 | expect -re "set.*$prompt $" | |
1362 | send "set variable *(v_char_pointer)='h'\n" | |
1363 | expect -re "set.*$prompt $" | |
1364 | send "set variable *(v_char_pointer+1)='i'\n" | |
1365 | expect { | |
1366 | -re "set.*$prompt $" { | |
1367 | send "print v_char_array\n" | |
1368 | expect { | |
1369 | -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { | |
1370 | send "print *(v_char_pointer+1)\n" | |
1371 | expect { | |
1372 | -re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $" { pass "set variable char pointer=\"hi\" (string)" } | |
1373 | -re "$prompt $" { fail "set variable char pointer=\"hi\" (string)" } | |
1374 | timeout { fail "(timeout) set variable char pointer=\"hi\" (string)" } | |
1375 | ||
1376 | } | |
1377 | } | |
1378 | -re "$prompt $" { fail "set variable char pointer=\"hi\" (string)" } | |
1379 | timeout { fail "(timeout) set variable char pointer=\"hi\" (string)" } | |
1380 | } | |
1381 | } | |
1382 | -re "$prompt $" { fail "set variable char pointer=\"hi\" (string)" } | |
1383 | timeout { fail "(timeout) set variable char pointer=\"hi\" (string)" } | |
1384 | } | |
1385 | ||
1386 | ||
1387 | # | |
1388 | # test "set variable" for type "signed char *" | |
1389 | # | |
1390 | send "set v_signed_char_pointer=v_signed_char_array\n" | |
1391 | expect -re "set.*$prompt $" | |
1392 | send "set variable *(v_signed_char_pointer)='h'\n" | |
1393 | expect -re "set.*$prompt $" | |
1394 | send "set variable *(v_signed_char_pointer+1)='i'\n" | |
1395 | expect { | |
1396 | -re "set.*$prompt $" { | |
1397 | send "print v_signed_char_array\n" | |
1398 | expect { | |
1399 | -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { | |
1400 | send "print *(v_signed_char_pointer+1)\n" | |
1401 | expect { | |
1402 | -re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $" { pass "set variable signed char pointer=\"hi\" (string)" } | |
1403 | -re "$prompt $" { fail "set variable signed char pointer=\"hi\" (string)" } | |
1404 | timeout { fail "(timeout) set variable signed char pointer=\"hi\" (string)" } | |
1405 | ||
1406 | } | |
1407 | } | |
1408 | -re "$prompt $" { fail "set variable signed char pointer=\"hi\" (string)" } | |
1409 | timeout { fail "(timeout) set variable signed char pointer=\"hi\" (string)" } | |
1410 | } | |
1411 | } | |
1412 | -re "$prompt $" { fail "set variable signed char pointer=\"hi\" (string)" } | |
1413 | timeout { fail "(timeout) set variable signed char pointer=\"hi\" (string)" } | |
1414 | } | |
1415 | ||
1416 | ||
1417 | # | |
1418 | # test "set variable" for type "unsigned char *" | |
1419 | # | |
1420 | send "set v_unsigned_char_pointer=v_unsigned_char_array\n" | |
1421 | expect -re "set.*$prompt $" | |
1422 | send "set variable *(v_unsigned_char_pointer)='h'\n" | |
1423 | expect -re "set.*$prompt $" | |
1424 | send "set variable *(v_unsigned_char_pointer+1)='i'\n" | |
1425 | expect { | |
1426 | -re "set.*$prompt $" { | |
1427 | send "print v_unsigned_char_array\n" | |
1428 | expect { | |
1429 | -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { | |
1430 | send "print *(v_unsigned_char_pointer+1)\n" | |
1431 | expect { | |
1432 | -re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $" { pass "set variable unsigned char pointer=\"hi\" (string)" } | |
1433 | -re "$prompt $" { fail "set variable unsigned char pointer=\"hi\" (string)" } | |
1434 | timeout { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" } | |
1435 | ||
1436 | } | |
1437 | } | |
1438 | -re "$prompt $" { fail "set variable unsigned char pointer=\"hi\" (string)" } | |
1439 | timeout { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" } | |
1440 | } | |
1441 | } | |
1442 | -re "$prompt $" { fail "set variable unsigned char pointer=\"hi\" (string)" } | |
1443 | timeout { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" } | |
1444 | } | |
1445 | ||
1446 | ||
1447 | # | |
1448 | # test "set variable" for type "short *" | |
1449 | # | |
1450 | send "set v_short_pointer=v_short_array\n" | |
1451 | expect -re "set.*$prompt $" | |
1452 | send "set variable *(v_short_pointer)=123\n" | |
1453 | expect -re "set.*$prompt $" | |
1454 | send "set variable *(v_short_pointer+1)=-456\n" | |
1455 | expect { | |
1456 | -re "set.*$prompt $" { | |
1457 | send "print v_short_array\n" | |
1458 | expect { | |
1459 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { | |
1460 | send "print *(v_short_pointer+1)\n" | |
1461 | expect { | |
1462 | -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable short pointer" } | |
1463 | -re "$prompt $" { fail "set variable short pointer" } | |
1464 | timeout { fail "(timeout) set variable short pointer" } | |
1465 | ||
1466 | } | |
1467 | } | |
1468 | -re "$prompt $" { fail "set variable short pointer" } | |
1469 | timeout { fail "(timeout) set variable short pointer" } | |
1470 | } | |
1471 | } | |
1472 | -re "$prompt $" { fail "set variable short pointer" } | |
1473 | timeout { fail "(timeout) set variable short pointer" } | |
1474 | } | |
1475 | ||
1476 | ||
1477 | # | |
1478 | # test "set variable" for type "signed short *" | |
1479 | # | |
1480 | send "set v_signed_short_pointer=v_signed_short_array\n" | |
1481 | expect -re "set.*$prompt $" | |
1482 | send "set variable *(v_signed_short_pointer)=123\n" | |
1483 | expect -re "set.*$prompt $" | |
1484 | send "set variable *(v_signed_short_pointer+1)=-456\n" | |
1485 | expect { | |
1486 | -re "set.*$prompt $" { | |
1487 | send "print v_signed_short_array\n" | |
1488 | expect { | |
1489 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { | |
1490 | send "print *(v_signed_short_pointer+1)\n" | |
1491 | expect { | |
1492 | -re "print.*.\[0-9\]*.*=.*-456.*$prompt $" { pass "set variable signed short pointer" } | |
1493 | -re "$prompt $" { fail "set variable signed short pointer (FIXME)" } | |
1494 | timeout { fail "(timeout) set variable signed short pointer (FIXME)" } | |
1495 | ||
1496 | } | |
1497 | } | |
1498 | -re "$prompt $" { fail "set variable signed short pointer (FIXME)" } | |
1499 | timeout { fail "(timeout) set variable signed short pointer (FIXME)" } | |
1500 | } | |
1501 | } | |
1502 | -re "$prompt $" { fail "set variable signed short pointer (FIXME)" } | |
1503 | timeout { fail "(timeout) set variable signed short pointer (FIXME)" } | |
1504 | } | |
1505 | ||
1506 | ||
1507 | # | |
1508 | # test "set variable" for type "unsigned short *" | |
1509 | # | |
1510 | send "set v_unsigned_short_pointer=v_unsigned_short_array\n" | |
1511 | expect -re "set.*$prompt $" | |
1512 | send "set variable *(v_unsigned_short_pointer)=123\n" | |
1513 | expect -re "set.*$prompt $" | |
1514 | send "set variable *(v_unsigned_short_pointer+1)=-456\n" | |
1515 | expect { | |
1516 | -re "set.*$prompt $" { | |
1517 | send "print v_unsigned_short_array\n" | |
1518 | expect { | |
1519 | -re "print.*.\[0-9\]* =.*\{123,.*65080\}.*$prompt $" { | |
1520 | send "print *(v_unsigned_short_pointer+1)\n" | |
1521 | expect { | |
1522 | -re "print.*.\[0-9\]* = 65080.*$prompt $" { pass "set variable unsigned short pointer" } | |
1523 | -re "$prompt $" { fail "set variable unsigned short pointer (FIXME)" } | |
1524 | timeout { fail "(timeout) set variable unsigned short pointer (FIXME)" } | |
1525 | ||
1526 | } | |
1527 | } | |
1528 | -re "$prompt $" { fail "set variable unsigned short pointer (FIXME)" } | |
1529 | timeout { fail "(timeout) set variable unsigned short pointer (FIXME)" } | |
1530 | } | |
1531 | } | |
1532 | -re "$prompt $" { fail "set variable unsigned short pointer (FIXME)" } | |
1533 | timeout { fail "(timeout) set variable unsigned short pointer (FIXME)" } | |
1534 | } | |
1535 | ||
1536 | ||
1537 | # | |
1538 | # test "set variable" for type "int *" | |
1539 | # | |
1540 | send "set v_int_pointer=v_int_array\n" | |
1541 | expect -re "set.*$prompt $" | |
1542 | send "set variable *(v_int_pointer)=123\n" | |
1543 | expect -re "set.*$prompt $" | |
1544 | send "set variable *(v_int_pointer+1)=-456\n" | |
1545 | expect { | |
1546 | -re "set.*$prompt $" { | |
1547 | send "print v_int_array\n" | |
1548 | expect { | |
1549 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { | |
1550 | send "print *(v_int_pointer+1)\n" | |
1551 | expect { | |
1552 | -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable int pointer" } | |
1553 | -re "$prompt $" { fail "set variable int pointer" } | |
1554 | timeout { fail "(timeout) set variable int pointer" } | |
1555 | ||
1556 | } | |
1557 | } | |
1558 | -re "$prompt $" { fail "set variable int pointer" } | |
1559 | timeout { fail "(timeout) set variable int pointer" } | |
1560 | } | |
1561 | } | |
1562 | -re "$prompt $" { fail "set variable int pointer" } | |
1563 | timeout { fail "(timeout) set variable int pointer" } | |
1564 | } | |
1565 | ||
1566 | ||
1567 | # | |
1568 | # test "set variable" for type "signed int *" | |
1569 | # | |
1570 | send "set v_signed_int_pointer=v_signed_int_array\n" | |
1571 | expect -re "set.*$prompt $" | |
1572 | send "set variable *(v_signed_int_pointer)=123\n" | |
1573 | expect -re "set.*$prompt $" | |
1574 | send "set variable *(v_signed_int_pointer+1)=-456\n" | |
1575 | expect { | |
1576 | -re "set.*$prompt $" { | |
1577 | send "print v_signed_int_array\n" | |
1578 | expect { | |
1579 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { | |
1580 | send "print *(v_signed_int_pointer+1)\n" | |
1581 | expect { | |
1582 | -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable signed int pointer" } | |
1583 | -re "$prompt $" { fail "set variable signed int pointer" } | |
1584 | timeout { fail "(timeout) set variable signed int pointer" } | |
1585 | ||
1586 | } | |
1587 | } | |
1588 | -re "$prompt $" { fail "set variable signed int pointer" } | |
1589 | timeout { fail "(timeout) set variable signed int pointer" } | |
1590 | } | |
1591 | } | |
1592 | -re "$prompt $" { fail "set variable signed int pointer" } | |
1593 | timeout { fail "(timeout) set variable signed int pointer" } | |
1594 | } | |
1595 | ||
1596 | ||
1597 | # | |
1598 | # test "set variable" for type "unsigned int *" | |
1599 | # | |
1600 | send "set v_unsigned_int_pointer=v_unsigned_int_array\n" | |
1601 | expect -re "set.*$prompt $" | |
1602 | send "set variable *(v_unsigned_int_pointer)=123\n" | |
1603 | expect -re "set.*$prompt $" | |
1604 | send "set variable *(v_unsigned_int_pointer+1)=-456\n" | |
1605 | expect { | |
1606 | -re "set.*$prompt $" { | |
1607 | send "print v_unsigned_int_array\n" | |
1608 | expect { | |
1609 | -re "print.*.\[0-9\]* =.*\{123,.*4294966840\}.*$prompt $" { | |
1610 | send "print *(v_unsigned_int_pointer+1)\n" | |
1611 | expect { | |
1612 | -re "print.*.\[0-9\]* = 4294966840.*$prompt $" { pass "set variable unsigned int pointer" } | |
1613 | -re "$prompt $" { fail "set variable unsigned int pointer" } | |
1614 | timeout { fail "(timeout) set variable unsigned int pointer" } | |
1615 | ||
1616 | } | |
1617 | } | |
1618 | -re "$prompt $" { fail "set variable unsigned int pointer" } | |
1619 | timeout { fail "(timeout) set variable unsigned int pointer" } | |
1620 | } | |
1621 | } | |
1622 | -re "$prompt $" { fail "set variable unsigned int pointer" } | |
1623 | timeout { fail "(timeout) set variable unsigned int pointer" } | |
1624 | } | |
1625 | ||
1626 | ||
1627 | # | |
1628 | # test "set variable" for type "long *" | |
1629 | # | |
1630 | send "set v_long_pointer=v_long_array\n" | |
1631 | expect -re "set.*$prompt $" | |
1632 | send "set variable *(v_long_pointer)=123\n" | |
1633 | expect -re "set.*$prompt $" | |
1634 | send "set variable *(v_long_pointer+1)=-456\n" | |
1635 | expect { | |
1636 | -re "set.*$prompt $" { | |
1637 | send "print v_long_array\n" | |
1638 | expect { | |
1639 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { | |
1640 | send "print *(v_long_pointer+1)\n" | |
1641 | expect { | |
1642 | -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable long pointer" } | |
1643 | -re "$prompt $" { fail "set variable long pointer" } | |
1644 | timeout { fail "(timeout) set variable long pointer" } | |
1645 | ||
1646 | } | |
1647 | } | |
1648 | -re "$prompt $" { fail "set variable long pointer" } | |
1649 | timeout { fail "(timeout) set variable long pointer" } | |
1650 | } | |
1651 | } | |
1652 | -re "$prompt $" { fail "set variable long pointer" } | |
1653 | timeout { fail "(timeout) set variable long pointer" } | |
1654 | } | |
1655 | ||
1656 | ||
1657 | # | |
1658 | # test "set variable" for type "signed long *" | |
1659 | # | |
1660 | send "set v_signed_long_pointer=v_signed_long_array\n" | |
1661 | expect -re "set.*$prompt $" | |
1662 | send "set variable *(v_signed_long_pointer)=123\n" | |
1663 | expect -re "set.*$prompt $" | |
1664 | send "set variable *(v_signed_long_pointer+1)=-456\n" | |
1665 | expect { | |
1666 | -re "set.*$prompt $" { | |
1667 | send "print v_signed_long_array\n" | |
1668 | expect { | |
1669 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { | |
1670 | send "print *(v_signed_long_pointer+1)\n" | |
1671 | expect { | |
1672 | -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable signed long pointer" } | |
1673 | -re "$prompt $" { fail "set variable signed long pointer" } | |
1674 | timeout { fail "(timeout) set variable signed long pointer" } | |
1675 | ||
1676 | } | |
1677 | } | |
1678 | -re "$prompt $" { fail "set variable signed long pointer" } | |
1679 | timeout { fail "(timeout) set variable signed long pointer" } | |
1680 | } | |
1681 | } | |
1682 | -re "$prompt $" { fail "set variable signed long pointer" } | |
1683 | timeout { fail "(timeout) set variable signed long pointer" } | |
1684 | } | |
1685 | ||
1686 | ||
1687 | # | |
1688 | # test "set variable" for type "unsigned long *" | |
1689 | # | |
1690 | send "set v_unsigned_long_pointer=v_unsigned_long_array\n" | |
1691 | expect -re "set.*$prompt $" | |
1692 | send "set variable *(v_unsigned_long_pointer)=123\n" | |
1693 | expect -re "set.*$prompt $" | |
1694 | send "set variable *(v_unsigned_long_pointer+1)=-456\n" | |
1695 | expect { | |
1696 | -re "set.*$prompt $" { | |
1697 | send "print v_unsigned_long_array\n" | |
1698 | expect { | |
1699 | -re "print.*.\[0-9\]* =.*\{123,.*$ulong_minus_456\}.*$prompt $" { | |
1700 | send "print *(v_unsigned_long_pointer+1)\n" | |
1701 | expect { | |
1702 | -re "print.*.\[0-9\]* = $ulong_minus_456.*$prompt $" { pass "set variable unsigned long pointer" } | |
1703 | -re "$prompt $" { fail "set variable unsigned long pointer" } | |
1704 | timeout { fail "(timeout) set variable unsigned long pointer" } | |
1705 | ||
1706 | } | |
1707 | } | |
1708 | -re "$prompt $" { fail "set variable unsigned long pointer" } | |
1709 | timeout { fail "(timeout) set variable unsigned long pointer" } | |
1710 | } | |
1711 | } | |
1712 | -re "$prompt $" { fail "set variable unsigned long pointer" } | |
1713 | timeout { fail "(timeout) set variable unsigned long pointer" } | |
1714 | } | |
1715 | ||
1716 | ||
1717 | # | |
1718 | # test "set variable" for type "float *" | |
1719 | # | |
1720 | send "set v_float_pointer=v_float_array\n" | |
1721 | expect -re "set.*$prompt $" | |
1722 | send "set variable *(v_float_pointer)=123.0\n" | |
1723 | expect -re "set.*$prompt $" | |
1724 | send "set variable *(v_float_pointer+1)=-456.0\n" | |
1725 | expect { | |
1726 | -re "set.*$prompt $" { | |
1727 | send "print v_float_array\n" | |
1728 | expect { | |
1729 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { | |
1730 | send "print *(v_float_pointer+1)\n" | |
1731 | expect { | |
1732 | -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable float pointer" } | |
1733 | -re "$prompt $" { fail "set variable float pointer" } | |
1734 | timeout { fail "(timeout) set variable float pointer" } | |
1735 | ||
1736 | } | |
1737 | } | |
1738 | -re "$prompt $" { fail "set variable float pointer" } | |
1739 | timeout { fail "(timeout) set variable float pointer" } | |
1740 | } | |
1741 | } | |
1742 | -re "$prompt $" { fail "set variable float pointer" } | |
1743 | timeout { fail "(timeout) set variable float pointer" } | |
1744 | } | |
1745 | ||
1746 | ||
1747 | # | |
1748 | # test "set variable" for type "double *" | |
1749 | # | |
1750 | send "set v_double_pointer=v_double_array\n" | |
1751 | expect -re "set.*$prompt $" | |
1752 | send "set variable *(v_double_pointer)=123.0\n" | |
1753 | expect -re "set.*$prompt $" | |
1754 | send "set variable *(v_double_pointer+1)=-456.0\n" | |
1755 | expect { | |
1756 | -re "set.*$prompt $" { | |
1757 | send "print v_double_array\n" | |
1758 | expect { | |
1759 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { | |
1760 | send "print *(v_double_pointer+1)\n" | |
1761 | expect { | |
1762 | -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable double pointer" } | |
1763 | -re "$prompt $" { fail "set variable double pointer" } | |
1764 | timeout { fail "(timeout) set variable double pointer" } | |
1765 | ||
1766 | } | |
1767 | } | |
1768 | -re "$prompt $" { fail "set variable double pointer" } | |
1769 | timeout { fail "(timeout) set variable double pointer" } | |
1770 | } | |
1771 | } | |
1772 | -re "$prompt $" { fail "set variable double pointer" } | |
1773 | timeout { fail "(timeout) set variable double pointer" } | |
1774 | } | |
1775 | ||
1776 | ||
1777 | # | |
1778 | # test "set variable" for struct members | |
1779 | # | |
1780 | send "set variable v_struct1.v_char_member='h'\n" | |
1781 | expect { | |
1782 | -re "set.*$prompt $"\ | |
1783 | { | |
1784 | send "print v_struct1.v_char_member\n" | |
1785 | expect { | |
1786 | -re "print.*.\[0-9\]* = 104 \'h\'.*$prompt $" { pass "set variable structure char member" } | |
1787 | -re "$prompt $" { fail "set variable structure char member" } | |
1788 | timeout { fail "(timeout) set variable structure char member" } | |
1789 | } | |
1790 | } | |
1791 | -re "$prompt $" { fail "set variable structure char member" } | |
1792 | timeout { fail "(timeout) set variable structure char member" } | |
1793 | } | |
1794 | ||
1795 | ||
1796 | send "set variable v_struct1.v_short_member=1\n" | |
1797 | expect { | |
1798 | -re "set.*$prompt $"\ | |
1799 | { | |
1800 | send "print v_struct1.v_short_member\n" | |
1801 | expect { | |
1802 | -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "set variable structure short member" } | |
1803 | -re "$prompt $" { fail "set variable structure short member" } | |
1804 | timeout { fail "(timeout) set variable structure short member" } | |
1805 | } | |
1806 | } | |
1807 | -re "$prompt $" { fail "set variable structure short member" } | |
1808 | timeout { fail "(timeout) set variable structure short member" } | |
1809 | } | |
1810 | ||
1811 | ||
1812 | send "set variable v_struct1.v_int_member=2\n" | |
1813 | expect { | |
1814 | -re "set.*$prompt $"\ | |
1815 | { | |
1816 | send "print v_struct1.v_int_member\n" | |
1817 | expect { | |
1818 | -re "print.*.\[0-9\]* = 2.*$prompt $" { pass "set variable structure int member" } | |
1819 | -re "$prompt $" { fail "set variable structure int member" } | |
1820 | timeout { fail "(timeout) set variable structure int member" } | |
1821 | } | |
1822 | } | |
1823 | -re "$prompt $" { fail "set variable structure int member" } | |
1824 | timeout { fail "(timeout) set variable structure int member" } | |
1825 | } | |
1826 | ||
1827 | ||
1828 | send "set variable v_struct1.v_long_member=3\n" | |
1829 | expect { | |
1830 | -re "set.*$prompt $"\ | |
1831 | { | |
1832 | send "print v_struct1.v_long_member\n" | |
1833 | expect { | |
1834 | -re "print.*.\[0-9\]* = 3.*$prompt $" { pass "set variable structure long member" } | |
1835 | -re "$prompt $" { fail "set variable structure long member" } | |
1836 | timeout { fail "(timeout) set variable structure long member" } | |
1837 | } | |
1838 | } | |
1839 | -re "$prompt $" { fail "set variable structure long member" } | |
1840 | timeout { fail "(timeout) set variable structure long member" } | |
1841 | } | |
1842 | ||
1843 | ||
1844 | send "set variable v_struct1.v_float_member=4.0\n" | |
1845 | expect { | |
1846 | -re "set.*$prompt $"\ | |
1847 | { | |
1848 | send "print v_struct1.v_float_member\n" | |
1849 | expect { | |
1850 | -re "print.*.\[0-9\]* = 4.*$prompt $" { pass "set variable structure float member" } | |
1851 | -re "$prompt $" { fail "set variable structure float member" } | |
1852 | timeout { fail "(timeout) set variable structure float member" } | |
1853 | } | |
1854 | } | |
1855 | -re "$prompt $" { fail "set variable structure float member" } | |
1856 | timeout { fail "(timeout) set variable structure float member" } | |
1857 | } | |
1858 | ||
1859 | ||
1860 | send "set variable v_struct1.v_double_member=5.0\n" | |
1861 | expect { | |
1862 | -re "set.*$prompt $"\ | |
1863 | { | |
1864 | send "print v_struct1.v_double_member\n" | |
1865 | expect { | |
1866 | -re "print.*.\[0-9\]* = 5.*$prompt $" { pass "set variable structure double member" } | |
1867 | -re "$prompt $" { fail "set variable structure double member" } | |
1868 | timeout { fail "(timeout) set variable structure double member" } | |
1869 | } | |
1870 | } | |
1871 | -re "$prompt $" { fail "set variable structure double member" } | |
1872 | timeout { fail "(timeout) set variable structure double member" } | |
1873 | } | |
1874 | ||
1875 | ||
1876 | ||
1877 | send "print v_struct1\n" | |
1878 | expect { | |
1879 | -re "print.*.\[0-9\]* = \{.*v_char_member = 104 \'h\',.*v_short_member = 1,.*v_int_member = 2,.*\ | |
1880 | v_long_member = 3,.*v_float_member = 4,.*v_double_member = 5.*\}.*$prompt $"\ | |
1881 | { pass "set print structure" } | |
1882 | -re "$prompt $" { fail "set print structure" } | |
1883 | timeout { fail "(timeout) set print structure" } | |
1884 | } | |
1885 | ||
1886 | if [istarget "a29k-*-udi"] then { | |
1887 | # FIXME: If PR 2415 is fixed, this is not needed. | |
1888 | gdb_target_udi | |
1889 | } |