* gdb.c++/classes.exp, gdb.c++/cplusfuncs.exp,

gdb.c++/inherit.exp, gdb.c++/templates.exp, gdb.c++/virtfunc.exp,
	gdb.fortran/exprs.exp, gdb.fortran/types.exp, gdb.chill/chexp.exp,
	gdb.base/printcmds.exp: Remove passcount, failcount, etc., stuff;
	it makes the tests harder to understand and confuses test-o-matic.
	The preferred style is that each test provides a PASS or a FAIL,
	and has a unique message (e.g. "continue #54" not just "continue")
	which is the same for the pass and the fail.
	* gdb.fortran/exprs.exp, gdb.fortran/types.exp,
	gdb.chill/chexp.exp: Move test_print_accept and test_print_reject
	to lib/gdb.exp.
	* gdb.base/printcmds.exp: Use test_print_accept.  Remove
	prt_accept which was basically the same thing.  Likewise for
	test_print_reject and prt_reject.
	* lib/gdb.exp (test_print_reject): Add some more error message
	patterns to match from the former printcmds.exp (prt_reject).
	* gdb.c++/classes.exp, gdb.base/scope.exp: Remove spurious xfails.
	One defect of the passcount stuff is that some of it failed to
	report XPASS where appropriate.
	* gdb.c++/cplusfuncs.exp (print_addr_of): No longer accept extra
	stuff before and after arg in expected pattern.
	(test_paddr_operator_functions): Re-do test without print_addr_of;
	this is the only test which seems to want extra stuff there.
This commit is contained in:
Jim Kingdon 1995-01-20 22:26:33 +00:00
parent b2683e0914
commit f34c87666e
5 changed files with 774 additions and 1398 deletions

View File

@ -1,5 +1,34 @@
Fri Jan 20 12:14:23 1995 Jim Kingdon (kingdon@lioth.cygnus.com)
* gdb.c++/classes.exp, gdb.c++/cplusfuncs.exp,
gdb.c++/inherit.exp, gdb.c++/templates.exp, gdb.c++/virtfunc.exp,
gdb.fortran/exprs.exp, gdb.fortran/types.exp, gdb.chill/chexp.exp,
gdb.base/printcmds.exp: Remove passcount, failcount, etc., stuff;
it makes the tests harder to understand and confuses test-o-matic.
The preferred style is that each test provides a PASS or a FAIL,
and has a unique message (e.g. "continue #54" not just "continue")
which is the same for the pass and the fail.
* gdb.fortran/exprs.exp, gdb.fortran/types.exp,
gdb.chill/chexp.exp: Move test_print_accept and test_print_reject
to lib/gdb.exp.
* gdb.base/printcmds.exp: Use test_print_accept. Remove
prt_accept which was basically the same thing. Likewise for
test_print_reject and prt_reject.
* lib/gdb.exp (test_print_reject): Add some more error message
patterns to match from the former printcmds.exp (prt_reject).
* gdb.c++/classes.exp, gdb.base/scope.exp: Remove spurious xfails.
One defect of the passcount stuff is that some of it failed to
report XPASS where appropriate.
* gdb.c++/cplusfuncs.exp (print_addr_of): No longer accept extra
stuff before and after arg in expected pattern.
(test_paddr_operator_functions): Re-do test without print_addr_of;
this is the only test which seems to want extra stuff there.
Tue Jan 17 10:47:53 1995 Jim Kingdon <kingdon@lioth.cygnus.com>
* gdb.base/nodebug.exp: Update new tests to reflect improved
wording of gdb output.
* gdb.base/nodebug.exp: Add tests to check that "print", "whatis"
and "ptype" work on variables in files compiled without -g.
Replaces commented out "maint print msymbol" tests.

File diff suppressed because it is too large Load Diff

View File

@ -55,62 +55,8 @@ proc set_lang_chill {} {
}
}
# Testing printing of a specific value. Increment passcount for
# success or issue fail message for failure. In both cases, return
# a 1 to indicate that more tests can proceed. However a timeout
# is a serious error, generates a special fail message, and causes
# a 0 to be returned to indicate that more tests are likely to fail
# as well.
#
# Args are:
#
# First one is string to send to gdb
# Second one is string to match gdb result to
# Third one is an optional message to be printed
proc test_print_accept { args } {
global prompt
global passcount
global verbose
if [llength $args]==3 then {
set message [lindex $args 2]
} else {
set message [lindex $args 0]
}
set sendthis [lindex $args 0]
set expectthis [lindex $args 1]
if $verbose>2 then {
send_user "Sending \"$sendthis\" to gdb\n"
send_user "Looking to match \"$expectthis\"\n"
send_user "Message is \"$message\"\n"
}
send "$sendthis\n"
expect {
-re ".* = $expectthis\r\n$prompt $" {
incr passcount
return 1
}
-re ".*$prompt $" {
if ![string match "" $message] then {
fail "$sendthis ($message)"
} else {
fail "$sendthis"
}
return 1
}
timeout {
fail "$sendthis (timeout)"
return 0
}
}
}
proc test_integer_literals_accepted {} {
global prompt
global passcount
set passcount 0
# Test various decimal values.
@ -166,17 +112,10 @@ proc test_integer_literals_accepted {} {
test_print_accept "p H'AbCdEf" "11259375"
test_print_accept "p H'_A_b_C_d_E_f_" "11259375"
test_print_accept "p/x H'123" "H'123"
if $passcount then {
pass "$passcount correct integer literals printed"
}
}
proc test_character_literals_accepted {} {
global prompt
global passcount
set passcount 0
# Test various decimal values.
@ -190,68 +129,10 @@ proc test_character_literals_accepted {} {
test_print_accept "p/x C'FF'" "H'ff"
# test_print_accept "p/x '^(H'FF)'" "H'ff" (not in GNU Chill)
# test_print_accept "p/x '^(D'255)'" "H'ff" (not in GNU Chill)
if $passcount then {
pass "$passcount correct character literals printed"
}
}
# Testing printing of a specific value. Increment passcount for
# success or issue fail message for failure. In both cases, return
# a 1 to indicate that more tests can proceed. However a timeout
# is a serious error, generates a special fail message, and causes
# a 0 to be returned to indicate that more tests are likely to fail
# as well.
proc test_print_reject { args } {
global prompt
global passcount
global verbose
if [llength $args]==2 then {
set expectthis [lindex $args 1]
} else {
set expectthis "should never match this bogus string"
}
set sendthis [lindex $args 0]
if $verbose>2 then {
send_user "Sending \"$sendthis\" to gdb\n"
send_user "Looking to match \"$expectthis\"\n"
}
send "$sendthis\n"
expect {
-re ".*A .* in expression.*\\.*$prompt $" {
incr passcount
return 1
}
-re ".*Junk after end of expression.*$prompt $" {
incr passcount
return 1
}
-re ".*No symbol table is loaded.*$prompt $" {
incr passcount
return 1
}
-re ".*$expectthis.*$prompt $" {
incr passcount
return 1
}
-re ".*$prompt $" {
fail "$sendthis not properly rejected"
return 1
}
timeout {
fail "$sendthis (timeout)"
return 0
}
}
}
proc test_integer_literals_rejected {} {
global prompt
global passcount
set passcount 0
# These are valid integer literals in Z.200, but not GNU-Chill.
@ -293,33 +174,19 @@ proc test_integer_literals_rejected {} {
test_print_reject "p H'G"
test_print_reject "p H'AG"
if $passcount then {
pass "$passcount incorrect integer literals rejected"
}
}
proc test_boolean_literals_accepted {} {
global prompt
global passcount
set passcount 0
# Test the only possible values for a boolean, TRUE and FALSE.
test_print_accept "p TRUE" "TRUE"
test_print_accept "p FALSE" "FALSE"
if $passcount then {
pass "$passcount correct boolean literals printed"
}
}
proc test_float_literals_accepted {} {
global prompt
global passcount
set passcount 0
# Test various floating point formats
@ -376,10 +243,6 @@ proc test_float_literals_accepted {} {
test_print_accept "p _.1e+10 > _.1e+11" "0"
test_print_accept "p __.1e-12 < __.1e-11" "1"
test_print_accept "p __.1e-12 > __.1e-11" "0"
if $passcount then {
pass "$passcount correct float literal comparisons"
}
}
proc test_convenience_variables {} {
@ -463,9 +326,6 @@ proc test_value_history {} {
proc test_arithmetic_expressions {} {
global prompt
global passcount
set passcount 0
# Test unary minus with various operands
@ -564,10 +424,6 @@ proc test_arithmetic_expressions {} {
"Integer-only operation on floating point number.*"
test_print_reject "p 6.0 REM 3.0" \
"Integer-only operation on floating point number.*"
if $passcount then {
pass "$passcount correct arithmetic expressions"
}
}
# Start with a fresh gdb.

View File

@ -55,173 +55,40 @@ proc set_lang_fortran {} {
}
}
# Testing printing of a specific value. Increment passcount for
# success or issue fail message for failure. In both cases, return
# a 1 to indicate that more tests can proceed. However a timeout
# is a serious error, generates a special fail message, and causes
# a 0 to be returned to indicate that more tests are likely to fail
# as well.
#
# Args are:
#
# First one is string to send to gdb
# Second one is string to match gdb result to
# Third one is an optional message to be printed
proc test_print_accept { args } {
global prompt
global passcount
global verbose
if [llength $args]==3 then {
set message [lindex $args 2]
} else {
set message [lindex $args 0]
}
set sendthis [lindex $args 0]
set expectthis [lindex $args 1]
if $verbose>2 then {
send_user "Sending \"$sendthis\" to gdb\n"
send_user "Looking to match \"$expectthis\"\n"
send_user "Message is \"$message\"\n"
}
send "$sendthis\n"
expect {
-re ".* = $expectthis\r\n$prompt $" {
incr passcount
return 1
}
-re ".*$prompt $" {
if ![string match "" $message] then {
fail "$sendthis ($message)"
} else {
fail "$sendthis"
}
return 1
}
timeout {
fail "$sendthis (timeout)"
return 0
}
}
}
proc test_integer_literals_accepted {} {
global prompt
global passcount
set passcount 0
# Test various decimal values.
test_print_accept "p 123" "123"
test_print_accept "p -123" "-123"
if $passcount then {
pass "$passcount correct integer literals printed"
}
}
proc test_character_literals_accepted {} {
global prompt
global passcount
set passcount 0
# Test various character values.
test_print_accept "p 'a'" "'a'"
if $passcount then {
pass "$passcount correct character literals printed"
}
}
# Testing printing of a specific value. Increment passcount for
# success or issue fail message for failure. In both cases, return
# a 1 to indicate that more tests can proceed. However a timeout
# is a serious error, generates a special fail message, and causes
# a 0 to be returned to indicate that more tests are likely to fail
# as well.
proc test_print_reject { args } {
global prompt
global passcount
global verbose
if [llength $args]==2 then {
set expectthis [lindex $args 1]
} else {
set expectthis "should never match this bogus string"
}
set sendthis [lindex $args 0]
if $verbose>2 then {
send_user "Sending \"$sendthis\" to gdb\n"
send_user "Looking to match \"$expectthis\"\n"
}
send "$sendthis\n"
expect {
-re ".*A .* in expression.*\\.*$prompt $" {
incr passcount
return 1
}
-re ".*Junk after end of expression.*$prompt $" {
incr passcount
return 1
}
-re ".*No symbol table is loaded.*$prompt $" {
incr passcount
return 1
}
-re ".*$expectthis.*$prompt $" {
incr passcount
return 1
}
-re ".*$prompt $" {
fail "$sendthis not properly rejected"
return 1
}
timeout {
fail "$sendthis (timeout)"
return 0
}
}
}
proc test_integer_literals_rejected {} {
global prompt
global passcount
set passcount 0
test_print_reject "p _"
if $passcount then {
pass "$passcount incorrect integer literals rejected"
}
}
proc test_logical_literals_accepted {} {
global prompt
global passcount
set passcount 0
# Test the only possible values for a logical, TRUE and FALSE.
test_print_accept "p .TRUE." ".TRUE."
test_print_accept "p .FALSE." ".FALSE."
if $passcount then {
pass "$passcount correct logical literals printed"
}
}
proc test_float_literals_accepted {} {
global prompt
global passcount
set passcount 0
# Test various floating point formats
@ -273,10 +140,6 @@ proc test_float_literals_accepted {} {
test_print_accept "p 10.0E-11 .GT. 10.0E-10" "0"
test_print_accept "p 10.0e-11 .LT. 10.0e-10" "1"
test_print_accept "p 10.0e-11 .GT. 10.0e-10" "0"
if $passcount then {
pass "$passcount correct float literal comparisons"
}
}
proc test_convenience_variables {} {
@ -306,7 +169,7 @@ proc test_convenience_variables {} {
gdb_test "print (\\\$foo = 32) + 4" " = 36" \
"Use convenience variable assignment in arithmetic expression"
gdb_test "print \\\$bar" " = void" \
gdb_test "print \\\$bar" " = VOID" \
"Print contents of uninitialized convenience variable"
}
@ -360,9 +223,6 @@ proc test_value_history {} {
proc test_arithmetic_expressions {} {
global prompt
global passcount
set passcount 0
# Test unary minus with various operands
@ -401,9 +261,6 @@ proc test_arithmetic_expressions {} {
# Test modulo with various operands
if $passcount then {
pass "$passcount correct arithmetic expressions"
}
}
# Start with a fresh gdb.

View File

@ -1,4 +1,4 @@
# Copyright (C) 1992, 1994 Free Software Foundation, Inc.
# Copyright (C) 1992, 1994, 1995 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
@ -40,15 +40,15 @@ if ![info exists prompt] then {
}
#
# gdb_version -- extract and print the version number of gcc
# gdb_version -- extract and print the version number of GDB
#
proc default_gdb_version {} {
global GDB
global GDBFLAGS
if {[which $GDB] != 0} then {
set tmp [exec echo "q" | $GDB]
set tmp [exec echo "q" | $GDB -nw]
regexp " \[0-9\.\]+" $tmp version
clone_output "[which $GDB] version$version $GDBFLAGS\n"
clone_output "[which $GDB] version$version -nw $GDBFLAGS \n"
} else {
warning "$GDB does not exist"
}
@ -157,9 +157,9 @@ proc runto { function } {
send "break $function\n"
# The first two regexps are what we get with -g, the third is without -g.
expect {
-re "Breakpoint \[0-9\]* at 0x\[0-9a-f\]*: file .*, line $decimal.\r\n$prompt $" {}
-re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$prompt $" {}
-re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$prompt $" {}
-re "Breakpoint \[0-9\]* at 0x\[0-9a-f\]*.*$prompt $" {}
-re "Breakpoint \[0-9\]* at .*$prompt $" {}
-re "$prompt $" { fail "setting breakpoint at $function" ; return 0 }
timeout { fail "setting breakpoint at $function (timeout)" ; return 0 }
}
@ -285,7 +285,131 @@ proc gdb_test { args } {
}
return $result
}
# Testing printing of a specific value. For passes and fails, return
# a 1 to indicate that more tests can proceed. However a timeout
# is a serious error, generates a special fail message, and causes
# a 0 to be returned to indicate that more tests are likely to fail
# as well.
#
# Args are:
#
# First one is string to send to gdb
# Second one is string to match gdb result to
# Third one is an optional message to be printed
#
# This differs from gdb_test in a few ways: (1) no catch on the send (there is
# no reason for this to be different from gdb_test but I think the lack of
# catch is correct), (2) it tests for the " =" (that could easily be moved
# to the callers, (3) the pattern must be followed by \r\n and the prompt,
# not other garbage as in gdb_test (this feature seems kind of worthwhile).
proc test_print_accept { args } {
global prompt
global verbose
if [llength $args]==3 then {
set message [lindex $args 2]
} else {
set message [lindex $args 0]
}
set sendthis [lindex $args 0]
set expectthis [lindex $args 1]
if $verbose>2 then {
send_user "Sending \"$sendthis\" to gdb\n"
send_user "Looking to match \"$expectthis\"\n"
send_user "Message is \"$message\"\n"
}
send "$sendthis\n"
expect {
-re ".* = $expectthis\r\n$prompt $" {
if ![string match "" $message] then {
pass "$sendthis ($message)"
} else {
pass "$sendthis"
}
return 1
}
-re ".*$prompt $" {
if ![string match "" $message] then {
fail "$sendthis ($message)"
} else {
fail "$sendthis"
}
return 1
}
timeout {
fail "$sendthis (timeout)"
return 0
}
}
}
# Testing printing of a specific value. For pass or fail, return
# a 1 to indicate that more tests can proceed. However a timeout
# is a serious error, generates a special fail message, and causes
# a 0 to be returned to indicate that more tests are likely to fail
# as well.
proc test_print_reject { args } {
global prompt
global verbose
if [llength $args]==2 then {
set expectthis [lindex $args 1]
} else {
set expectthis "should never match this bogus string"
}
set sendthis [lindex $args 0]
if $verbose>2 then {
send_user "Sending \"$sendthis\" to gdb\n"
send_user "Looking to match \"$expectthis\"\n"
}
send "$sendthis\n"
expect {
-re ".*A .* in expression.*\\.*$prompt $" {
pass "reject $sendthis"
return 1
}
-re ".*Invalid syntax in expression.*$prompt $" {
pass "reject $sendthis"
return 1
}
-re ".*Junk after end of expression.*$prompt $" {
pass "reject $sendthis"
return 1
}
-re ".*Invalid number.*$prompt $" {
pass "reject $sendthis"
return 1
}
-re ".*Invalid character constant.*$prompt $" {
pass "reject $sendthis"
return 1
}
-re ".*No symbol table is loaded.*$prompt $" {
pass "reject $sendthis"
return 1
}
-re ".*No symbol .* in current context.*$prompt $" {
pass "reject $sendthis"
return 1
}
-re ".*$expectthis.*$prompt $" {
pass "reject $sendthis"
return 1
}
-re ".*$prompt $" {
fail "reject $sendthis"
return 1
}
default {
fail "reject $sendthis (eof or timeout)"
return 0
}
}
}
# Given an input string, adds backslashes as needed to create a
# regexp that will match the string.
@ -308,7 +432,7 @@ proc gdb_test_exact { args } {
}
return [gdb_test $command $pattern $message]
}
proc gdb_reinitialize_dir { subdir } {
global prompt
@ -434,7 +558,7 @@ proc default_gdb_start { } {
global prompt
global spawn_id
global timeout
verbose "Spawning $GDB $GDBFLAGS"
verbose "Spawning $GDB -nw $GDBFLAGS"
if { [which $GDB] == 0 } then {
perror "$GDB does not exist."
@ -443,11 +567,7 @@ proc default_gdb_start { } {
set oldtimeout $timeout
set timeout [expr "$timeout + 60"]
if [ llength $GDBFLAGS ] then {
spawn $GDB $GDBFLAGS
} else {
spawn $GDB
}
eval "spawn $GDB -nw $GDBFLAGS"
expect {
-re ".*\r\n$prompt $" {
verbose "GDB initialized."