1889 lines
68 KiB
Text
1889 lines
68 KiB
Text
# Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc.
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
|
# bug-gdb@prep.ai.mit.edu
|
|
|
|
# This file was written by Rob Savoye. (rob@cygnus.com)
|
|
|
|
if $tracelevel then {
|
|
strace $tracelevel
|
|
}
|
|
|
|
#
|
|
# test running programs
|
|
#
|
|
set prms_id 0
|
|
set bug_id 0
|
|
|
|
set binfile "setvar"
|
|
|
|
if ![file exists $objdir/$subdir/$binfile] then {
|
|
perror "$objdir/$subdir/$binfile does not exist."
|
|
return 0
|
|
}
|
|
|
|
gdb_exit
|
|
gdb_start
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
|
gdb_load $objdir/$subdir/$binfile
|
|
|
|
#
|
|
# set it up at a breakpoint so we canplay with the variable values
|
|
#
|
|
send "set print sevenbit-strings\n" ; expect -re "$prompt $"
|
|
|
|
if ![runto main] then {
|
|
perror "couldn't run to breakpoint"
|
|
continue
|
|
}
|
|
|
|
# Determine expected output for unsigned long variables,
|
|
# the output varies with sizeof (unsigned long).
|
|
|
|
set ulong_minus_1 4294967295
|
|
set ulong_minus_456 4294966840
|
|
send "print sizeof (unsigned long)\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 4.*$prompt $" {}
|
|
-re ".\[0-9\]* = 8.*$prompt $" {
|
|
set ulong_minus_1 18446744073709551615
|
|
set ulong_minus_456 18446744073709551160
|
|
}
|
|
-re ".*$prompt $" {
|
|
fail "getting sizeof unsigned long"
|
|
}
|
|
default { fail "(timeout) getting sizeof unsigned long" }
|
|
}
|
|
|
|
#
|
|
# test "set variable" for type "char"
|
|
#
|
|
# Because bare char types can be either signed or unsigned, we just test the
|
|
# range of values that are common to both (0-127).
|
|
#
|
|
send "set variable v_char=0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 0 \'.000\'.*$prompt $" { pass "set variable char=0" }
|
|
-re "$prompt $" { fail "set variable char=0" }
|
|
timeout { fail "(timeout) set variable char=0" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable char=0" }
|
|
timeout { fail "(timeout) set variable char=0" }
|
|
}
|
|
|
|
|
|
send "set variable v_char=1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 1 \'.001\'.*$prompt $" { pass "set variable char=1" }
|
|
-re "$prompt $" { fail "set variable char=1" }
|
|
timeout { fail "(timeout) set variable char=1" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable char=1" }
|
|
timeout { fail "(timeout) set variable char=1" }
|
|
}
|
|
|
|
|
|
send "set variable v_char=27\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 27 \'.e\'.*$prompt $" { pass "set variable char=27 (Esc)" }
|
|
-re "$prompt $" { fail "set variable char=27 (Esc)" }
|
|
timeout { fail "(timeout) set variable char=27 (Esc)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable char=27 (Esc)" }
|
|
timeout { fail "(timeout) set variable char=27 (Esc)" }
|
|
}
|
|
|
|
|
|
send "set variable v_char=32\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 32 \' \'.*$prompt $" { pass "set variable char=32 (SPC)" }
|
|
-re "$prompt $" { fail "set variable char=32 (SPC)" }
|
|
timeout { fail "(timeout) set variable char=32 (SPC)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable char=32 (SPC)" }
|
|
timeout { fail "(timeout) set variable char=32 (SPC)" }
|
|
}
|
|
|
|
|
|
send "set variable v_char=65\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 65 \'A\'.*$prompt $" { pass "set variable char=65 ('A')" }
|
|
-re "$prompt $" { fail "set variable char=65 ('A')" }
|
|
timeout { fail "(timeout) set variable char=65 ('A')" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable char=65 ('A')" }
|
|
timeout { fail "(timeout) set variable char=65 ('A')" }
|
|
}
|
|
|
|
|
|
send "set variable v_char=97\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 97 \'a\'.*$prompt $" { pass "set variable char=97 ('a')" }
|
|
-re "$prompt $" { fail "set variable char=97 ('a')" }
|
|
timeout { fail "(timeout) set variable char=97 ('a')" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable char=97 ('a')" }
|
|
timeout { fail "(timeout) set variable char=97 ('a')" }
|
|
}
|
|
|
|
|
|
send "set variable v_char=126\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 126 \'~\'.*$prompt $" { pass "set variable char=126 ('~')" }
|
|
-re "$prompt $" { fail "set variable char=126 ('~')" }
|
|
timeout { fail "(timeout) set variable char=126 ('~')" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable char=126 ('~')" }
|
|
timeout { fail "(timeout) set variable char=126 ('~')" }
|
|
}
|
|
|
|
|
|
send "set variable v_char=127\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 127 \'.177\'.*$prompt $" { pass "set variable char=127 (8-bit)" }
|
|
-re "$prompt $" { fail "set variable char=127 (8-bit)" }
|
|
timeout { fail "(timeout) set variable char=127 (8-bit)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable char=127 (8-bit)" }
|
|
timeout { fail "(timeout) set variable char=127 (8-bit)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "signed char"
|
|
#
|
|
send "set variable v_char=0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 0 \'.000\'.*$prompt $" { pass "set variable signed char=0" }
|
|
-re "$prompt $" { fail "set variable signed char=0" }
|
|
timeout { fail "(timeout) set variable signed char=0" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed char=0" }
|
|
timeout { fail "(timeout) set variable signed char=0" }
|
|
}
|
|
|
|
|
|
send "set variable v_signed_char=1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 1 \'.001\'.*$prompt $" { pass "set variable signed char=1" }
|
|
-re "$prompt $" { fail "set variable signed char=1" }
|
|
timeout { fail "(timeout) set variable signed char=1" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed char=1" }
|
|
timeout { fail "(timeout) set variable signed char=1" }
|
|
}
|
|
|
|
|
|
send "set variable v_signed_char=27\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 27 \'.e\'.*$prompt $" { pass "set variable signed char=27 (Esc)" }
|
|
-re "$prompt $" { fail "set variable signed char=27 (Esc)" }
|
|
timeout { fail "(timeout) set variable signed char=27 (Esc)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed char=27 (Esc)" }
|
|
timeout { fail "(timeout) set variable signed char=27 (Esc)" }
|
|
}
|
|
|
|
|
|
send "set variable v_signed_char=32\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 32 \' \'.*$prompt $" { pass "set variable signed char=32 (SPC)" }
|
|
-re "$prompt $" { fail "set variable signed char=32 (SPC)" }
|
|
timeout { fail "(timeout) set variable signed char=32 (SPC)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed char=32 (SPC)" }
|
|
timeout { fail "(timeout) set variable signed char=32 (SPC)" }
|
|
}
|
|
|
|
|
|
send "set variable v_signed_char=65\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 65 \'A\'.*$prompt $" { pass "set variable signed char=65 ('A')" }
|
|
-re "$prompt $" { fail "set variable signed char=65 ('A')" }
|
|
timeout { fail "(timeout) set variable signed char=65 ('A')" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed char=65 ('A')" }
|
|
timeout { fail "(timeout) set variable signed char=65 ('A')" }
|
|
}
|
|
|
|
|
|
send "set variable v_signed_char=97\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 97 \'a\'.*$prompt $" { pass "set variable signed char=97 ('a')" }
|
|
-re "$prompt $" { fail "set variable signed char=97 ('a')" }
|
|
timeout { fail "(timeout) set variable signed char=97 ('a')" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed char=97 ('a')" }
|
|
timeout { fail "(timeout) set variable signed char=97 ('a')" }
|
|
}
|
|
|
|
|
|
send "set variable v_signed_char=126\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 126 \'~\'.*$prompt $" { pass "set variable signed char=126 ('~')" }
|
|
-re "$prompt $" { fail "set variable signed char=126 ('~')" }
|
|
timeout { fail "(timeout) set variable signed char=126 ('~')" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed char=126 ('~')" }
|
|
timeout { fail "(timeout) set variable signed char=126 ('~')" }
|
|
}
|
|
|
|
|
|
send "set variable v_signed_char=127\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 127 \'.177\'.*$prompt $" { pass "set variable signed char=127 (8-bit)" }
|
|
-re "$prompt $" { fail "set variable signed char=127 (8-bit)" }
|
|
timeout { fail "(timeout) set variable signed char=127 (8-bit)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed char=127 (8-bit)" }
|
|
timeout { fail "(timeout) set variable signed char=127 (8-bit)" }
|
|
}
|
|
|
|
|
|
send "set variable v_signed_char=-1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = -1 \'.377\'.*$prompt $" { pass "set variable signed char=-1 (-1)" }
|
|
-re "$prompt $" { fail "set variable signed char=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable signed char=-1 (minus)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed char=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable signed char=-1 (minus)" }
|
|
}
|
|
|
|
|
|
send "set variable v_signed_char=0xFF\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = -1 \'.377\'.*$prompt $" { pass "set variable signed char=0xFF (0xFF)" }
|
|
-re "$prompt $" { fail "set variable signed char=0xFF (hex)" }
|
|
timeout { fail "(timeout) set variable signed char=0xFF (hex)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed char=0xFF (hex)" }
|
|
timeout { fail "(timeout) set variable signed char=0xFF (hex)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "unsigned char"
|
|
#
|
|
send "set variable v_unsigned_char=0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 0 \'.000\'.*$prompt $" { pass "set variable unsigned char=0" }
|
|
-re "$prompt $" { fail "set variable unsigned char=0" }
|
|
timeout { fail "(timeout) set variable unsigned char=0" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned char=0" }
|
|
timeout { fail "(timeout) set variable unsigned char=0" }
|
|
}
|
|
|
|
|
|
send "set variable v_unsigned_char=1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 1 \'.001\'.*$prompt $" { pass "set variable unsigned char=1" }
|
|
-re "$prompt $" { fail "set variable unsigned char=1" }
|
|
timeout { fail "(timeout) set variable unsigned char=1" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned char=1" }
|
|
timeout { fail "(timeout) set variable unsigned char=1" }
|
|
}
|
|
|
|
|
|
send "set variable v_unsigned_char=27\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 27 \'.e\'.*$prompt $" { pass "set variable unsigned char=27 (Esc)" }
|
|
-re "$prompt $" { fail "set variable unsigned char=27 (Esc)" }
|
|
timeout { fail "(timeout) set variable unsigned char=27 (Esc)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned char=27 (Esc)" }
|
|
timeout { fail "(timeout) set variable unsigned char=27 (Esc)" }
|
|
}
|
|
|
|
|
|
send "set variable v_unsigned_char=32\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 32 \' \'.*$prompt $" { pass "set variable unsigned char=32 (SPC)" }
|
|
-re "$prompt $" { fail "set variable unsigned char=32 (SPC)" }
|
|
timeout { fail "(timeout) set variable unsigned char=32 (SPC)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned char=32 (SPC)" }
|
|
timeout { fail "(timeout) set variable unsigned char=32 (SPC)" }
|
|
}
|
|
|
|
|
|
send "set variable v_unsigned_char=65\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 65 \'A\'.*$prompt $" { pass "set variable unsigned char=65 ('A')" }
|
|
-re "$prompt $" { fail "set variable unsigned char=65 ('A')" }
|
|
timeout { fail "(timeout) set variable unsigned char=65 ('A')" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned char=65 ('A')" }
|
|
timeout { fail "(timeout) set variable unsigned char=65 ('A')" }
|
|
}
|
|
|
|
|
|
send "set variable v_unsigned_char=97\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 97 \'a\'.*$prompt $" { pass "set variable unsigned char=97 ('a')" }
|
|
-re "$prompt $" { fail "set variable unsigned char=97 ('a')" }
|
|
timeout { fail "(timeout) set variable unsigned char=97 ('a')" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned char=97 ('a')" }
|
|
timeout { fail "(timeout) set variable unsigned char=97 ('a')" }
|
|
}
|
|
|
|
|
|
send "set variable v_unsigned_char=126\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 126 \'~\'.*$prompt $" { pass "set variable unsigned char=126 ('~')" }
|
|
-re "$prompt $" { fail "set variable unsigned char=126 ('~')" }
|
|
timeout { fail "(timeout) set variable unsigned char=126 ('~')" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned char=126 ('~')" }
|
|
timeout { fail "(timeout) set variable unsigned char=126 ('~')" }
|
|
}
|
|
|
|
|
|
send "set variable v_unsigned_char=~0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_char\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 255 \'.377\'.*$prompt $" { pass "set variable unsigned char=255 (8-bit)" }
|
|
-re "$prompt $" { fail "set variable unsigned char=255 (8-bit)" }
|
|
timeout { fail "(timeout) set variable unsigned char=255 (8-bit)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned char=255 (8-bit)" }
|
|
timeout { fail "(timeout) set variable unsigned char=255 (8-bit)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "short"
|
|
#
|
|
send "set variable v_short=0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_short\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 0.*$prompt $" { pass "set variable short=0" }
|
|
-re "$prompt $" { fail "set variable short=0" }
|
|
timeout { fail "(timeout) set variable short=0" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable short=0" }
|
|
timeout { fail "(timeout) set variable short=0" }
|
|
}
|
|
|
|
|
|
send "set variable v_short=1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_short\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 1.*$prompt $" { pass "set variable short=1" }
|
|
-re "$prompt $" { fail "set variable short=1" }
|
|
timeout { fail "(timeout) set variable short=1" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable short=1" }
|
|
timeout { fail "(timeout) set variable short=1" }
|
|
}
|
|
|
|
|
|
send "set variable v_short=-1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_short\n"
|
|
expect {
|
|
-re ".\[0-9\]* = -1.*$prompt $" { pass "set variable short=-1 (minus)" }
|
|
-re "$prompt $" { fail "set variable short=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable signed short=-1 (minus)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable short=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable short=-1 (minus)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "signed short"
|
|
#
|
|
send "set variable v_signed_short=0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_short\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 0.*$prompt $" { pass "set variable signed short=0" }
|
|
-re "$prompt $" { fail "set variable signed short=0" }
|
|
timeout { fail "(timeout) set variable signed short=0" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed short=0" }
|
|
timeout { fail "(timeout) set variable signed short=0" }
|
|
}
|
|
|
|
|
|
send "set variable v_signed_short=1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_short\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 1.*$prompt $" { pass "set variable signed short=1" }
|
|
-re "$prompt $" { fail "set variable signed short=1" }
|
|
timeout { fail "(timeout) set variable signed short=1" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed short=1" }
|
|
timeout { fail "(timeout) set variable signed short=1" }
|
|
}
|
|
|
|
|
|
send "set variable v_signed_short=-1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_short\n"
|
|
expect {
|
|
-re ".\[0-9\]* = -1.*$prompt $" { pass "set variable signed short=-1 (minus)" }
|
|
-re "$prompt $" { fail "set variable signed short=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable signed short=-1 (minus)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed short=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable signed short=-1 (minus)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "unsigned short"
|
|
#
|
|
send "set variable v_unsigned_short=0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_short\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 0.*$prompt $" { pass "set variable unsigned short=0" }
|
|
-re "$prompt $" { fail "set variable unsigned short=0" }
|
|
timeout { fail "(timeout) set variable unsigned short=0" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned short=0" }
|
|
timeout { fail "(timeout) set variable unsigned short=0" }
|
|
}
|
|
|
|
|
|
send "set variable v_unsigned_short=1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_short\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 1.*$prompt $" { pass "set variable unsigned short=1" }
|
|
-re "$prompt $" { fail "set variable unsigned short=1" }
|
|
timeout { fail "(timeout) set variable unsigned short=1" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned short=1" }
|
|
timeout { fail "(timeout) set variable unsigned short=1" }
|
|
}
|
|
|
|
|
|
send "set variable v_unsigned_short=~0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_short\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 65535.*$prompt $" { pass "set variable unsigned short=~0 (minus)" }
|
|
-re "$prompt $" { fail "set variable unsigned short=~0 (minus)" }
|
|
timeout { fail "(timeout) set variable unsigned short=~0 (minus)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned short=~0 (minus)" }
|
|
timeout { fail "(timeout) set variable unsigned short=~0 (minus)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "int"
|
|
#
|
|
send "set variable v_int=0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_int\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 0.*$prompt $" { pass "set variable int=0" }
|
|
-re "$prompt $" { fail "set variable int=0" }
|
|
timeout { fail "(timeout) set variable int=0" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable int=0" }
|
|
timeout { fail "(timeout) set variable int=0" }
|
|
}
|
|
|
|
|
|
send "set variable v_int=1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_int\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 1.*$prompt $" { pass "set variable int=1" }
|
|
-re "$prompt $" { fail "set variable int=1" }
|
|
timeout { fail "(timeout) set variable int=1" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable int=1" }
|
|
timeout { fail "(timeout) set variable int=1" }
|
|
}
|
|
|
|
|
|
send "set variable v_int=-1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_int\n"
|
|
expect {
|
|
-re ".\[0-9\]* = -1.*$prompt $" { pass "set variable int=-1 (minus)" }
|
|
-re "$prompt $" { fail "set variable int=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable signed int=-1 (minus)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable int=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable int=-1 (minus)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "signed int"
|
|
#
|
|
send "set variable v_signed_int=0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_int\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 0.*$prompt $" { pass "set variable signed int=0" }
|
|
-re "$prompt $" { fail "set variable signed int=0" }
|
|
timeout { fail "(timeout) set variable signed int=0" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed int=0" }
|
|
timeout { fail "(timeout) set variable signed int=0" }
|
|
}
|
|
|
|
|
|
send "set variable v_signed_int=1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_int\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 1.*$prompt $" { pass "set variable signed int=1" }
|
|
-re "$prompt $" { fail "set variable signed int=1" }
|
|
timeout { fail "(timeout) set variable signed int=1" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed int=1" }
|
|
timeout { fail "(timeout) set variable signed int=1" }
|
|
}
|
|
|
|
|
|
send "set variable v_signed_int=-1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_int\n"
|
|
expect {
|
|
-re ".\[0-9\]* = -1.*$prompt $" { pass "set variable signed int=-1 (minus)" }
|
|
-re "$prompt $" { fail "set variable signed int=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable signed int=-1 (minus)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed int=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable signed int=-1 (minus)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "unsigned int"
|
|
#
|
|
send "set variable v_unsigned_int=0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_int\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 0.*$prompt $" { pass "set variable unsigned int=0" }
|
|
-re "$prompt $" { fail "set variable unsigned int=0" }
|
|
timeout { fail "(timeout) set variable unsigned int=0" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned int=0" }
|
|
timeout { fail "(timeout) set variable unsigned int=0" }
|
|
}
|
|
|
|
|
|
send "set variable v_unsigned_int=1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_int\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 1.*$prompt $" { pass "set variable unsigned int=1" }
|
|
-re "$prompt $" { fail "set variable unsigned int=1" }
|
|
timeout { fail "(timeout) set variable unsigned int=1" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned int=1" }
|
|
timeout { fail "(timeout) set variable unsigned int=1" }
|
|
}
|
|
|
|
|
|
send "set variable v_unsigned_int=~0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_int\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 4294967295.*$prompt $" { pass "set variable unsigned int=~0 (minus)" }
|
|
-re "$prompt $" { fail "set variable unsigned int=~0 (minus)" }
|
|
timeout { fail "(timeout) set variable unsigned int=~0 (minus)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned int=~0 (minus)" }
|
|
timeout { fail "(timeout) set variable unsigned int=~0 (minus)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "long"
|
|
#
|
|
send "set variable v_long=0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_long\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 0.*$prompt $" { pass "set variable long=0" }
|
|
-re "$prompt $" { fail "set variable long=0" }
|
|
timeout { fail "(timeout) set variable long=0" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable long=0" }
|
|
timeout { fail "(timeout) set variable long=0" }
|
|
}
|
|
|
|
|
|
send "set variable v_long=1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_long\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 1.*$prompt $" { pass "set variable long=1" }
|
|
-re "$prompt $" { fail "set variable long=1" }
|
|
timeout { fail "(timeout) set variable long=1" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable long=1" }
|
|
timeout { fail "(timeout) set variable long=1" }
|
|
}
|
|
|
|
|
|
send "set variable v_long=-1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_long\n"
|
|
expect {
|
|
-re ".\[0-9\]* = -1.*$prompt $" { pass "set variable long=-1 (minus)" }
|
|
-re "$prompt $" { fail "set variable long=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable signed long=-1 (minus)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable long=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable long=-1 (minus)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "signed long"
|
|
#
|
|
send "set variable v_signed_long=0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_long\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 0.*$prompt $" { pass "set variable signed long=0" }
|
|
-re "$prompt $" { fail "set variable signed long=0" }
|
|
timeout { fail "(timeout) set variable signed long=0" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed long=0" }
|
|
timeout { fail "(timeout) set variable signed long=0" }
|
|
}
|
|
|
|
|
|
send "set variable v_signed_long=1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_long\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 1.*$prompt $" { pass "set variable signed long=1" }
|
|
-re "$prompt $" { fail "set variable signed long=1" }
|
|
timeout { fail "(timeout) set variable signed long=1" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed long=1" }
|
|
timeout { fail "(timeout) set variable signed long=1" }
|
|
}
|
|
|
|
|
|
send "set variable v_signed_long=-1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_signed_long\n"
|
|
expect {
|
|
-re ".\[0-9\]* = -1.*$prompt $" { pass "set variable signed long=-1 (minus)" }
|
|
-re "$prompt $" { fail "set variable signed long=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable signed long=-1 (minus)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed long=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable signed long=-1 (minus)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "unsigned long"
|
|
#
|
|
send "set variable v_unsigned_long=0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_long\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 0.*$prompt $" { pass "set variable unsigned long=0" }
|
|
-re "$prompt $" { fail "set variable unsigned long=0" }
|
|
timeout { fail "(timeout) set variable unsigned long=0" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned long=0" }
|
|
timeout { fail "(timeout) set variable unsigned long=0" }
|
|
}
|
|
|
|
|
|
send "set variable v_unsigned_long=1\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_long\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 1.*$prompt $" { pass "set variable unsigned long=1" }
|
|
-re "$prompt $" { fail "set variable unsigned long=1" }
|
|
timeout { fail "(timeout) set variable unsigned long=1" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned long=1" }
|
|
timeout { fail "(timeout) set variable unsigned long=1" }
|
|
}
|
|
|
|
|
|
send "set variable v_unsigned_long=~0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_long\n"
|
|
expect {
|
|
-re ".\[0-9\]* = $ulong_minus_1.*$prompt $" { pass "set variable unsigned long=~0 (minus)" }
|
|
-re "$prompt $" { fail "set variable unsigned long=~0 (minus)" }
|
|
timeout { fail "(timeout) set variable unsigned long=~0 (minus)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned long=~0 (minus)" }
|
|
timeout { fail "(timeout) set variable unsigned long=~0 (minus)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "float"
|
|
#
|
|
send "set variable v_float=0.0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_float\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 0.*$prompt $" { pass "set variable float=0" }
|
|
-re "$prompt $" { fail "set variable float=0" }
|
|
timeout { fail "(timeout) set variable float=0" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable float=0" }
|
|
timeout { fail "(timeout) set variable float=0" }
|
|
}
|
|
|
|
|
|
send "set variable v_float=1.0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_float\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 1.*$prompt $" { pass "set variable float=1" }
|
|
-re "$prompt $" { fail "set variable float=1" }
|
|
timeout { fail "(timeout) set variable float=1" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable float=1" }
|
|
timeout { fail "(timeout) set variable float=1" }
|
|
}
|
|
|
|
|
|
send "set variable v_float=-1.0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_float\n"
|
|
expect {
|
|
-re ".\[0-9\]* = -1.*$prompt $" { pass "set variable float=-1 (minus)" }
|
|
-re "$prompt $" { fail "set variable float=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable signed float=-1 (minus)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable float=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable float=-1 (minus)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "double"
|
|
#
|
|
send "set variable v_double=0.0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_double\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 0.*$prompt $" { pass "set variable double=0" }
|
|
-re "$prompt $" { fail "set variable double=0" }
|
|
timeout { fail "(timeout) set variable double=0" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable double=0" }
|
|
timeout { fail "(timeout) set variable double=0" }
|
|
}
|
|
|
|
|
|
send "set variable v_double=1.0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_double\n"
|
|
expect {
|
|
-re ".\[0-9\]* = 1.*$prompt $" { pass "set variable double=1" }
|
|
-re "$prompt $" { fail "set variable double=1" }
|
|
timeout { fail "(timeout) set variable double=1" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable double=1" }
|
|
timeout { fail "(timeout) set variable double=1" }
|
|
}
|
|
|
|
|
|
send "set variable v_double=-1.0\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_double\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = -1.*$prompt $" { pass "set variable double=-1 (minus)" }
|
|
-re "$prompt $" { fail "set variable double=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable double=-1 (minus)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable double=-1 (minus)" }
|
|
timeout { fail "(timeout) set variable double=-1 (minus)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for "char array[2]"
|
|
#
|
|
send "set variable v_char_array\[0\]='h'\n"
|
|
expect -re "$prompt $"
|
|
send "set variable v_char_array\[1\]='i'\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_char_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { pass "set variable char array=\"hi\" (string)" }
|
|
-re "$prompt $" { fail "set variable char array=\"hi\" (string)" }
|
|
timeout { fail "(timeout) set variable char array=\"hi\" (string)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable char array=\"hi\" (string)" }
|
|
timeout { fail "(timeout) set variable char array=\"hi\" (string)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for "signed char array[2]"
|
|
#
|
|
send "set variable v_signed_char_array\[0\]='h'\n"
|
|
expect -re "$prompt $"
|
|
send "set variable v_signed_char_array\[1\]='i'\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_signed_char_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { pass "set variable signed char array=\"hi\" (string)" }
|
|
-re "$prompt $" { fail "set variable signed char array=\"hi\" (string)" }
|
|
timeout { fail "(timeout) set variable signed char array=\"hi\" (string)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed char array=\"hi\" (string)" }
|
|
timeout { fail "(timeout) set variable signed char array=\"hi\" (string)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for "unsigned char array[2]"
|
|
#
|
|
send "set variable v_unsigned_char_array\[0\]='h'\n"
|
|
expect -re "$prompt $"
|
|
send "set variable v_unsigned_char_array\[1\]='i'\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_unsigned_char_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { pass "set variable unsigned char array=\"hi\" (string)" }
|
|
-re "$prompt $" { fail "set variable unsigned char array=\"hi\" (string)" }
|
|
timeout { fail "(timeout) set variable unsigned char array=\"hi\" (string)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned char array=\"hi\" (string)" }
|
|
timeout { fail "(timeout) set variable unsigned char array=\"hi\" (string)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for "short array[2]"
|
|
#
|
|
send "set variable v_short_array\[0\]=123\n"
|
|
expect -re "$prompt $"
|
|
send "set variable v_short_array\[1\]=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_short_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable short array" }
|
|
-re "$prompt $" { fail "set variable short array" }
|
|
timeout { fail "(timeout) set variable short array" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable short array" }
|
|
timeout { fail "(timeout) set variable short array" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for "signed short array[2]"
|
|
#
|
|
send "set variable v_signed_short_array\[0\]=123\n"
|
|
expect -re "$prompt $"
|
|
send "set variable v_signed_short_array\[1\]=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_signed_short_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable signed short array" }
|
|
-re "$prompt $" { fail "set variable signed short array" }
|
|
timeout { fail "(timeout) set variable signed short array" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed short array" }
|
|
timeout { fail "(timeout) set variable signed short array" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for "unsigned short array[2]"
|
|
#
|
|
send "set variable v_unsigned_short_array\[0\]=123\n"
|
|
expect -re "$prompt $"
|
|
send "set variable v_unsigned_short_array\[1\]=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_unsigned_short_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*65080\}.*$prompt $" { pass "set variable unsigned short array" }
|
|
-re "$prompt $" { fail "set variable unsigned short array" }
|
|
timeout { fail "(timeout) set variable unsigned short array" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned short array" }
|
|
timeout { fail "(timeout) set variable unsigned short array" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for "int array[2]"
|
|
#
|
|
send "set variable v_int_array\[0\]=123\n"
|
|
expect -re "$prompt $"
|
|
send "set variable v_int_array\[1\]=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_int_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable int array" }
|
|
-re "$prompt $" { fail "set variable int array" }
|
|
timeout { fail "(timeout) set variable int array" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable int array" }
|
|
timeout { fail "(timeout) set variable int array" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for "signed int array[2]"
|
|
#
|
|
send "set variable v_signed_int_array\[0\]=123\n"
|
|
expect -re "$prompt $"
|
|
send "set variable v_signed_int_array\[1\]=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_signed_int_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable signed int array" }
|
|
-re "$prompt $" { fail "set variable signed int array" }
|
|
timeout { fail "(timeout) set variable signed int array" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed int array" }
|
|
timeout { fail "(timeout) set variable signed int array" }
|
|
}
|
|
|
|
|
|
|
|
#
|
|
# test "set variable" for "unsigned int array[2]"
|
|
#
|
|
send "set variable v_unsigned_int_array\[0\]=123\n"
|
|
expect -re "$prompt $"
|
|
send "set variable v_unsigned_int_array\[1\]=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_unsigned_int_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*4294966840\}.*$prompt $" { pass "set variable unsigned int array" }
|
|
-re "$prompt $" { fail "set variable unsigned int array" }
|
|
timeout { fail "(timeout) set variable unsigned int array" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned int array" }
|
|
timeout { fail "(timeout) set variable unsigned int array" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for "long array[2]"
|
|
#
|
|
send "set variable v_long_array\[0\]=123\n"
|
|
expect -re "$prompt $"
|
|
send "set variable v_long_array\[1\]=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_long_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable long array" }
|
|
-re "$prompt $" { fail "set variable long array" }
|
|
timeout { fail "(timeout) set variable long array" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable long array" }
|
|
timeout { fail "(timeout) set variable long array" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for "signed long array[2]"
|
|
#
|
|
send "set variable v_signed_long_array\[0\]=123\n"
|
|
expect -re "$prompt $"
|
|
send "set variable v_signed_long_array\[1\]=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_signed_long_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable signed long array" }
|
|
-re "$prompt $" { fail "set variable signed long array" }
|
|
timeout { fail "(timeout) set variable signed long array" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed long array" }
|
|
timeout { fail "(timeout) set variable signed long array" }
|
|
}
|
|
|
|
|
|
|
|
#
|
|
# test "set variable" for "unsigned long array[2]"
|
|
#
|
|
send "set variable v_unsigned_long_array\[0\]=123\n"
|
|
expect -re "$prompt $"
|
|
send "set variable v_unsigned_long_array\[1\]=-456\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_unsigned_long_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*$ulong_minus_456\}.*$prompt $" { pass "set variable unsigned long array" }
|
|
-re "$prompt $" { fail "set variable unsigned long array" }
|
|
timeout { fail "(timeout) set variable unsigned long array" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned long array" }
|
|
timeout { fail "(timeout) set variable unsigned long array" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for "float array[2]"
|
|
#
|
|
send "set variable v_float_array\[0\]=123.0\n"
|
|
expect -re "$prompt $"
|
|
send "set variable v_float_array\[1\]=-456.0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_float_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable float array" }
|
|
-re "$prompt $" { fail "set variable float array" }
|
|
timeout { fail "(timeout) set variable float array" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable float array" }
|
|
timeout { fail "(timeout) set variable float array" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for "double array[2]"
|
|
#
|
|
send "set variable v_double_array\[0\]=123.0\n"
|
|
expect -re "$prompt $"
|
|
send "set variable v_double_array\[1\]=-456.0\n"
|
|
expect {
|
|
-re "$prompt $"\
|
|
{
|
|
send "print v_double_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable double array" }
|
|
-re "$prompt $" { fail "set variable double array" }
|
|
timeout { fail "(timeout) set variable double array" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable double array" }
|
|
timeout { fail "(timeout) set variable double array" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "char *"
|
|
#
|
|
send "set v_char_pointer=v_char_array\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_char_pointer)='h'\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_char_pointer+1)='i'\n"
|
|
expect {
|
|
-re "set.*$prompt $" {
|
|
send "print v_char_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" {
|
|
send "print *(v_char_pointer+1)\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $" { pass "set variable char pointer=\"hi\" (string)" }
|
|
-re "$prompt $" { fail "set variable char pointer=\"hi\" (string)" }
|
|
timeout { fail "(timeout) set variable char pointer=\"hi\" (string)" }
|
|
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable char pointer=\"hi\" (string)" }
|
|
timeout { fail "(timeout) set variable char pointer=\"hi\" (string)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable char pointer=\"hi\" (string)" }
|
|
timeout { fail "(timeout) set variable char pointer=\"hi\" (string)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "signed char *"
|
|
#
|
|
send "set v_signed_char_pointer=v_signed_char_array\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_signed_char_pointer)='h'\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_signed_char_pointer+1)='i'\n"
|
|
expect {
|
|
-re "set.*$prompt $" {
|
|
send "print v_signed_char_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" {
|
|
send "print *(v_signed_char_pointer+1)\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $" { pass "set variable signed char pointer=\"hi\" (string)" }
|
|
-re "$prompt $" { fail "set variable signed char pointer=\"hi\" (string)" }
|
|
timeout { fail "(timeout) set variable signed char pointer=\"hi\" (string)" }
|
|
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed char pointer=\"hi\" (string)" }
|
|
timeout { fail "(timeout) set variable signed char pointer=\"hi\" (string)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed char pointer=\"hi\" (string)" }
|
|
timeout { fail "(timeout) set variable signed char pointer=\"hi\" (string)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "unsigned char *"
|
|
#
|
|
send "set v_unsigned_char_pointer=v_unsigned_char_array\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_unsigned_char_pointer)='h'\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_unsigned_char_pointer+1)='i'\n"
|
|
expect {
|
|
-re "set.*$prompt $" {
|
|
send "print v_unsigned_char_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" {
|
|
send "print *(v_unsigned_char_pointer+1)\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $" { pass "set variable unsigned char pointer=\"hi\" (string)" }
|
|
-re "$prompt $" { fail "set variable unsigned char pointer=\"hi\" (string)" }
|
|
timeout { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" }
|
|
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned char pointer=\"hi\" (string)" }
|
|
timeout { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned char pointer=\"hi\" (string)" }
|
|
timeout { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "short *"
|
|
#
|
|
send "set v_short_pointer=v_short_array\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_short_pointer)=123\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_short_pointer+1)=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $" {
|
|
send "print v_short_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
|
|
send "print *(v_short_pointer+1)\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable short pointer" }
|
|
-re "$prompt $" { fail "set variable short pointer" }
|
|
timeout { fail "(timeout) set variable short pointer" }
|
|
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable short pointer" }
|
|
timeout { fail "(timeout) set variable short pointer" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable short pointer" }
|
|
timeout { fail "(timeout) set variable short pointer" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "signed short *"
|
|
#
|
|
send "set v_signed_short_pointer=v_signed_short_array\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_signed_short_pointer)=123\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_signed_short_pointer+1)=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $" {
|
|
send "print v_signed_short_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
|
|
send "print *(v_signed_short_pointer+1)\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]*.*=.*-456.*$prompt $" { pass "set variable signed short pointer" }
|
|
-re "$prompt $" { fail "set variable signed short pointer (FIXME)" }
|
|
timeout { fail "(timeout) set variable signed short pointer (FIXME)" }
|
|
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed short pointer (FIXME)" }
|
|
timeout { fail "(timeout) set variable signed short pointer (FIXME)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed short pointer (FIXME)" }
|
|
timeout { fail "(timeout) set variable signed short pointer (FIXME)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "unsigned short *"
|
|
#
|
|
send "set v_unsigned_short_pointer=v_unsigned_short_array\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_unsigned_short_pointer)=123\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_unsigned_short_pointer+1)=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $" {
|
|
send "print v_unsigned_short_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*65080\}.*$prompt $" {
|
|
send "print *(v_unsigned_short_pointer+1)\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = 65080.*$prompt $" { pass "set variable unsigned short pointer" }
|
|
-re "$prompt $" { fail "set variable unsigned short pointer (FIXME)" }
|
|
timeout { fail "(timeout) set variable unsigned short pointer (FIXME)" }
|
|
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned short pointer (FIXME)" }
|
|
timeout { fail "(timeout) set variable unsigned short pointer (FIXME)" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned short pointer (FIXME)" }
|
|
timeout { fail "(timeout) set variable unsigned short pointer (FIXME)" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "int *"
|
|
#
|
|
send "set v_int_pointer=v_int_array\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_int_pointer)=123\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_int_pointer+1)=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $" {
|
|
send "print v_int_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
|
|
send "print *(v_int_pointer+1)\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable int pointer" }
|
|
-re "$prompt $" { fail "set variable int pointer" }
|
|
timeout { fail "(timeout) set variable int pointer" }
|
|
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable int pointer" }
|
|
timeout { fail "(timeout) set variable int pointer" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable int pointer" }
|
|
timeout { fail "(timeout) set variable int pointer" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "signed int *"
|
|
#
|
|
send "set v_signed_int_pointer=v_signed_int_array\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_signed_int_pointer)=123\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_signed_int_pointer+1)=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $" {
|
|
send "print v_signed_int_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
|
|
send "print *(v_signed_int_pointer+1)\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable signed int pointer" }
|
|
-re "$prompt $" { fail "set variable signed int pointer" }
|
|
timeout { fail "(timeout) set variable signed int pointer" }
|
|
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed int pointer" }
|
|
timeout { fail "(timeout) set variable signed int pointer" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed int pointer" }
|
|
timeout { fail "(timeout) set variable signed int pointer" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "unsigned int *"
|
|
#
|
|
send "set v_unsigned_int_pointer=v_unsigned_int_array\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_unsigned_int_pointer)=123\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_unsigned_int_pointer+1)=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $" {
|
|
send "print v_unsigned_int_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*4294966840\}.*$prompt $" {
|
|
send "print *(v_unsigned_int_pointer+1)\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = 4294966840.*$prompt $" { pass "set variable unsigned int pointer" }
|
|
-re "$prompt $" { fail "set variable unsigned int pointer" }
|
|
timeout { fail "(timeout) set variable unsigned int pointer" }
|
|
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned int pointer" }
|
|
timeout { fail "(timeout) set variable unsigned int pointer" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned int pointer" }
|
|
timeout { fail "(timeout) set variable unsigned int pointer" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "long *"
|
|
#
|
|
send "set v_long_pointer=v_long_array\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_long_pointer)=123\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_long_pointer+1)=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $" {
|
|
send "print v_long_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
|
|
send "print *(v_long_pointer+1)\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable long pointer" }
|
|
-re "$prompt $" { fail "set variable long pointer" }
|
|
timeout { fail "(timeout) set variable long pointer" }
|
|
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable long pointer" }
|
|
timeout { fail "(timeout) set variable long pointer" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable long pointer" }
|
|
timeout { fail "(timeout) set variable long pointer" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "signed long *"
|
|
#
|
|
send "set v_signed_long_pointer=v_signed_long_array\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_signed_long_pointer)=123\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_signed_long_pointer+1)=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $" {
|
|
send "print v_signed_long_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
|
|
send "print *(v_signed_long_pointer+1)\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable signed long pointer" }
|
|
-re "$prompt $" { fail "set variable signed long pointer" }
|
|
timeout { fail "(timeout) set variable signed long pointer" }
|
|
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed long pointer" }
|
|
timeout { fail "(timeout) set variable signed long pointer" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable signed long pointer" }
|
|
timeout { fail "(timeout) set variable signed long pointer" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "unsigned long *"
|
|
#
|
|
send "set v_unsigned_long_pointer=v_unsigned_long_array\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_unsigned_long_pointer)=123\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_unsigned_long_pointer+1)=-456\n"
|
|
expect {
|
|
-re "set.*$prompt $" {
|
|
send "print v_unsigned_long_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*$ulong_minus_456\}.*$prompt $" {
|
|
send "print *(v_unsigned_long_pointer+1)\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = $ulong_minus_456.*$prompt $" { pass "set variable unsigned long pointer" }
|
|
-re "$prompt $" { fail "set variable unsigned long pointer" }
|
|
timeout { fail "(timeout) set variable unsigned long pointer" }
|
|
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned long pointer" }
|
|
timeout { fail "(timeout) set variable unsigned long pointer" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable unsigned long pointer" }
|
|
timeout { fail "(timeout) set variable unsigned long pointer" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "float *"
|
|
#
|
|
send "set v_float_pointer=v_float_array\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_float_pointer)=123.0\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_float_pointer+1)=-456.0\n"
|
|
expect {
|
|
-re "set.*$prompt $" {
|
|
send "print v_float_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
|
|
send "print *(v_float_pointer+1)\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable float pointer" }
|
|
-re "$prompt $" { fail "set variable float pointer" }
|
|
timeout { fail "(timeout) set variable float pointer" }
|
|
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable float pointer" }
|
|
timeout { fail "(timeout) set variable float pointer" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable float pointer" }
|
|
timeout { fail "(timeout) set variable float pointer" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for type "double *"
|
|
#
|
|
send "set v_double_pointer=v_double_array\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_double_pointer)=123.0\n"
|
|
expect -re "set.*$prompt $"
|
|
send "set variable *(v_double_pointer+1)=-456.0\n"
|
|
expect {
|
|
-re "set.*$prompt $" {
|
|
send "print v_double_array\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
|
|
send "print *(v_double_pointer+1)\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable double pointer" }
|
|
-re "$prompt $" { fail "set variable double pointer" }
|
|
timeout { fail "(timeout) set variable double pointer" }
|
|
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable double pointer" }
|
|
timeout { fail "(timeout) set variable double pointer" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable double pointer" }
|
|
timeout { fail "(timeout) set variable double pointer" }
|
|
}
|
|
|
|
|
|
#
|
|
# test "set variable" for struct members
|
|
#
|
|
send "set variable v_struct1.v_char_member='h'\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_struct1.v_char_member\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = 104 \'h\'.*$prompt $" { pass "set variable structure char member" }
|
|
-re "$prompt $" { fail "set variable structure char member" }
|
|
timeout { fail "(timeout) set variable structure char member" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable structure char member" }
|
|
timeout { fail "(timeout) set variable structure char member" }
|
|
}
|
|
|
|
|
|
send "set variable v_struct1.v_short_member=1\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_struct1.v_short_member\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = 1.*$prompt $" { pass "set variable structure short member" }
|
|
-re "$prompt $" { fail "set variable structure short member" }
|
|
timeout { fail "(timeout) set variable structure short member" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable structure short member" }
|
|
timeout { fail "(timeout) set variable structure short member" }
|
|
}
|
|
|
|
|
|
send "set variable v_struct1.v_int_member=2\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_struct1.v_int_member\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = 2.*$prompt $" { pass "set variable structure int member" }
|
|
-re "$prompt $" { fail "set variable structure int member" }
|
|
timeout { fail "(timeout) set variable structure int member" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable structure int member" }
|
|
timeout { fail "(timeout) set variable structure int member" }
|
|
}
|
|
|
|
|
|
send "set variable v_struct1.v_long_member=3\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_struct1.v_long_member\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = 3.*$prompt $" { pass "set variable structure long member" }
|
|
-re "$prompt $" { fail "set variable structure long member" }
|
|
timeout { fail "(timeout) set variable structure long member" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable structure long member" }
|
|
timeout { fail "(timeout) set variable structure long member" }
|
|
}
|
|
|
|
|
|
send "set variable v_struct1.v_float_member=4.0\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_struct1.v_float_member\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = 4.*$prompt $" { pass "set variable structure float member" }
|
|
-re "$prompt $" { fail "set variable structure float member" }
|
|
timeout { fail "(timeout) set variable structure float member" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable structure float member" }
|
|
timeout { fail "(timeout) set variable structure float member" }
|
|
}
|
|
|
|
|
|
send "set variable v_struct1.v_double_member=5.0\n"
|
|
expect {
|
|
-re "set.*$prompt $"\
|
|
{
|
|
send "print v_struct1.v_double_member\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = 5.*$prompt $" { pass "set variable structure double member" }
|
|
-re "$prompt $" { fail "set variable structure double member" }
|
|
timeout { fail "(timeout) set variable structure double member" }
|
|
}
|
|
}
|
|
-re "$prompt $" { fail "set variable structure double member" }
|
|
timeout { fail "(timeout) set variable structure double member" }
|
|
}
|
|
|
|
|
|
|
|
send "print v_struct1\n"
|
|
expect {
|
|
-re "print.*.\[0-9\]* = \{.*v_char_member = 104 \'h\',.*v_short_member = 1,.*v_int_member = 2,.*\
|
|
v_long_member = 3,.*v_float_member = 4,.*v_double_member = 5.*\}.*$prompt $"\
|
|
{ pass "set print structure" }
|
|
-re "$prompt $" { fail "set print structure" }
|
|
timeout { fail "(timeout) set print structure" }
|
|
}
|
|
|
|
if [istarget "a29k-*-udi"] then {
|
|
# FIXME: If PR 2415 is fixed, this is not needed.
|
|
gdb_target_udi
|
|
}
|