diff options
author | Bob Manson <manson@cygnus> | 1997-01-29 09:40:31 +0000 |
---|---|---|
committer | Bob Manson <manson@cygnus> | 1997-01-29 09:40:31 +0000 |
commit | 787f6220773d9174a9675dedd3bbfc8f070511a6 (patch) | |
tree | 64911c10d46bc93973cc825a730b4173b3367a49 /gdb/testsuite/gdb.fortran | |
parent | 1a2faf1f1e335ff32c1d8c5c7675cd7ce9055e33 (diff) | |
download | gdb-787f6220773d9174a9675dedd3bbfc8f070511a6.zip gdb-787f6220773d9174a9675dedd3bbfc8f070511a6.tar.gz gdb-787f6220773d9174a9675dedd3bbfc8f070511a6.tar.bz2 |
Major revision to testsuites for cross-testing and DOS testing support.
Diffstat (limited to 'gdb/testsuite/gdb.fortran')
-rw-r--r-- | gdb/testsuite/gdb.fortran/exprs.exp | 134 | ||||
-rw-r--r-- | gdb/testsuite/gdb.fortran/types.exp | 195 |
2 files changed, 84 insertions, 245 deletions
diff --git a/gdb/testsuite/gdb.fortran/exprs.exp b/gdb/testsuite/gdb.fortran/exprs.exp index 28c86fe..0392843 100644 --- a/gdb/testsuite/gdb.fortran/exprs.exp +++ b/gdb/testsuite/gdb.fortran/exprs.exp @@ -12,7 +12,7 @@ # # 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. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # Please email any bugs, comments, and/or additions to this file to: # bug-gdb@prep.ai.mit.edu @@ -31,27 +31,15 @@ set bug_id 0 proc set_lang_fortran {} { global prompt - - send "set language fortran\n" - expect { - -re ".*$prompt $" {} - timeout { fail "set language fortran (timeout)" ; return 0 } + + if [gdb_test "set language fortran" ""] { + return 0; } - send "show language\n" - expect { - -re ".* source language is \"fortran\".*$prompt $" { - pass "set language to \"fortran\"" - return 1 - } - -re ".*$prompt $" { - fail "setting language to \"fortran\"" - return 0 - } - timeout { - fail "can't show language (timeout)" - return 0 - } + if ![gdb_test "show language" ".* source language is \"fortran\".*"] { + return 1; + } else { + return 0; } } @@ -92,72 +80,72 @@ proc test_float_literals_accepted {} { # Test various floating point formats - gdb_test "p .44 .LT. .45" " = 1" - gdb_test "p .44 .GT. .45" " = 0" - gdb_test "p 0.44 .LT. 0.45" " = 1" - gdb_test "p 0.44 .GT. 0.45" " = 0" - gdb_test "p 44. .LT. 45." " = 1" - gdb_test "p 44. .GT. 45." " = 0" - gdb_test "p 44.0 .LT. 45.0" " = 1" - gdb_test "p 44.0 .GT. 45.0" " = 0" - gdb_test "p 10D20 .LT. 10D21" " = 1" - gdb_test "p 10D20 .GT. 10D21" " = 0" - gdb_test "p 10d20 .LT. 10d21" " = 1" - gdb_test "p 10d20 .GT. 10d21" " = 0" - gdb_test "p 10E20 .LT. 10E21" " = 1" - gdb_test "p 10E20 .GT. 10E21" " = 0" - gdb_test "p 10e20 .LT. 10e21" " = 1" - gdb_test "p 10e20 .GT. 10e21" " = 0" - gdb_test "p 10.D20 .LT. 10.D21" " = 1" - gdb_test "p 10.D20 .GT. 10.D21" " = 0" - gdb_test "p 10.d20 .LT. 10.d21" " = 1" - gdb_test "p 10.d20 .GT. 10.d21" " = 0" - gdb_test "p 10.E20 .LT. 10.E21" " = 1" - gdb_test "p 10.E20 .GT. 10.E21" " = 0" - gdb_test "p 10.e20 .LT. 10.e21" " = 1" - gdb_test "p 10.e20 .GT. 10.e21" " = 0" - gdb_test "p 10.0D20 .LT. 10.0D21" " = 1" - gdb_test "p 10.0D20 .GT. 10.0D21" " = 0" - gdb_test "p 10.0d20 .LT. 10.0d21" " = 1" - gdb_test "p 10.0d20 .GT. 10.0d21" " = 0" - gdb_test "p 10.0E20 .LT. 10.0E21" " = 1" - gdb_test "p 10.0E20 .GT. 10.0E21" " = 0" - gdb_test "p 10.0e20 .LT. 10.0e21" " = 1" - gdb_test "p 10.0e20 .GT. 10.0e21" " = 0" - gdb_test "p 10.0D+20 .LT. 10.0D+21" " = 1" - gdb_test "p 10.0D+20 .GT. 10.0D+21" " = 0" - gdb_test "p 10.0d+20 .LT. 10.0d+21" " = 1" - gdb_test "p 10.0d+20 .GT. 10.0d+21" " = 0" - gdb_test "p 10.0E+20 .LT. 10.0E+21" " = 1" - gdb_test "p 10.0E+20 .GT. 10.0E+21" " = 0" - gdb_test "p 10.0e+20 .LT. 10.0e+21" " = 1" - gdb_test "p 10.0e+20 .GT. 10.0e+21" " = 0" - gdb_test "p 10.0D-11 .LT. 10.0D-10" " = 1" - gdb_test "p 10.0D-11 .GT. 10.0D-10" " = 0" - gdb_test "p 10.0d-11 .LT. 10.0d-10" " = 1" - gdb_test "p 10.0d-11 .GT. 10.0d-10" " = 0" - gdb_test "p 10.0E-11 .LT. 10.0E-10" " = 1" - gdb_test "p 10.0E-11 .GT. 10.0E-10" " = 0" - gdb_test "p 10.0e-11 .LT. 10.0e-10" " = 1" - gdb_test "p 10.0e-11 .GT. 10.0e-10" " = 0" + gdb_test "p .44 .LT. .45" " = .TRUE." + gdb_test "p .44 .GT. .45" " = .FALSE." + gdb_test "p 0.44 .LT. 0.45" " = .TRUE." + gdb_test "p 0.44 .GT. 0.45" " = .FALSE." + gdb_test "p 44. .LT. 45." " = .TRUE." + gdb_test "p 44. .GT. 45." " = .FALSE." + gdb_test "p 44.0 .LT. 45.0" " = .TRUE." + gdb_test "p 44.0 .GT. 45.0" " = .FALSE." + gdb_test "p 10D20 .LT. 10D21" " = .TRUE." + gdb_test "p 10D20 .GT. 10D21" " = .FALSE." + gdb_test "p 10d20 .LT. 10d21" " = .TRUE." + gdb_test "p 10d20 .GT. 10d21" " = .FALSE." + gdb_test "p 10E20 .LT. 10E21" " = .TRUE." + gdb_test "p 10E20 .GT. 10E21" " = .FALSE." + gdb_test "p 10e20 .LT. 10e21" " = .TRUE." + gdb_test "p 10e20 .GT. 10e21" " = .FALSE." + gdb_test "p 10.D20 .LT. 10.D21" " = .TRUE." + gdb_test "p 10.D20 .GT. 10.D21" " = .FALSE." + gdb_test "p 10.d20 .LT. 10.d21" " = .TRUE." + gdb_test "p 10.d20 .GT. 10.d21" " = .FALSE." + gdb_test "p 10.E20 .LT. 10.E21" " = .TRUE." + gdb_test "p 10.E20 .GT. 10.E21" " = .FALSE." + gdb_test "p 10.e20 .LT. 10.e21" " = .TRUE." + gdb_test "p 10.e20 .GT. 10.e21" " = .FALSE." + gdb_test "p 10.0D20 .LT. 10.0D21" " = .TRUE." + gdb_test "p 10.0D20 .GT. 10.0D21" " = .FALSE." + gdb_test "p 10.0d20 .LT. 10.0d21" " = .TRUE." + gdb_test "p 10.0d20 .GT. 10.0d21" " = .FALSE." + gdb_test "p 10.0E20 .LT. 10.0E21" " = .TRUE." + gdb_test "p 10.0E20 .GT. 10.0E21" " = .FALSE." + gdb_test "p 10.0e20 .LT. 10.0e21" " = .TRUE." + gdb_test "p 10.0e20 .GT. 10.0e21" " = .FALSE." + gdb_test "p 10.0D+20 .LT. 10.0D+21" " = .TRUE." + gdb_test "p 10.0D+20 .GT. 10.0D+21" " = .FALSE." + gdb_test "p 10.0d+20 .LT. 10.0d+21" " = .TRUE." + gdb_test "p 10.0d+20 .GT. 10.0d+21" " = .FALSE." + gdb_test "p 10.0E+20 .LT. 10.0E+21" " = .TRUE." + gdb_test "p 10.0E+20 .GT. 10.0E+21" " = .FALSE." + gdb_test "p 10.0e+20 .LT. 10.0e+21" " = .TRUE." + gdb_test "p 10.0e+20 .GT. 10.0e+21" " = .FALSE." + gdb_test "p 10.0D-11 .LT. 10.0D-10" " = .TRUE." + gdb_test "p 10.0D-11 .GT. 10.0D-10" " = .FALSE." + gdb_test "p 10.0d-11 .LT. 10.0d-10" " = .TRUE." + gdb_test "p 10.0d-11 .GT. 10.0d-10" " = .FALSE." + gdb_test "p 10.0E-11 .LT. 10.0E-10" " = .TRUE." + gdb_test "p 10.0E-11 .GT. 10.0E-10" " = .FALSE." + gdb_test "p 10.0e-11 .LT. 10.0e-10" " = .TRUE." + gdb_test "p 10.0e-11 .GT. 10.0e-10" " = .FALSE." } proc test_convenience_variables {} { global prompt - gdb_test "set \$foo = 101" " = 101\[\r\n\]+" \ + gdb_test "set \$foo = 101" " = 101\[\r\n\]*" \ "Set a new convenience variable" gdb_test "print \$foo" " = 101" \ "Print contents of new convenience variable" - gdb_test "set \$foo = 301" " = 301\[\r\n\]+" \ + gdb_test "set \$foo = 301" " = 301\[\r\n\]*" \ "Set convenience variable to a new value" gdb_test "print \$foo" " = 301" \ "Print new contents of convenience variable" - gdb_test "set \$_ = 11" " = 11\[\r\n\]+" \ + gdb_test "set \$_ = 11" " = 11\[\r\n\]*" \ "Set convenience variable \$_" gdb_test "print \$_" " = 11" \ @@ -269,7 +257,7 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir -send "set print sevenbit-strings\n" ; expect -re ".*$prompt $" +gdb_test "set print sevenbit-strings" "" if [set_lang_fortran] then { test_value_history @@ -281,5 +269,5 @@ if [set_lang_fortran] then { test_float_literals_accepted test_arithmetic_expressions } else { - warning "$test_name tests suppressed." + warning "$test_name tests suppressed." 0 } diff --git a/gdb/testsuite/gdb.fortran/types.exp b/gdb/testsuite/gdb.fortran/types.exp index ecba256..0c47511 100644 --- a/gdb/testsuite/gdb.fortran/types.exp +++ b/gdb/testsuite/gdb.fortran/types.exp @@ -12,7 +12,7 @@ # # 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. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # Please email any bugs, comments, and/or additions to this file to: # bug-gdb@prep.ai.mit.edu @@ -31,213 +31,64 @@ set bug_id 0 proc set_lang_fortran {} { global prompt - - send "set language fortran\n" - expect { - -re ".*$prompt $" {} - timeout { fail "set language fortran (timeout)" ; return 0 } - } - - send "show language\n" - expect { - -re ".* source language is \"fortran\".*$prompt $" { - pass "set language to \"fortran\"" - return 1 - } - -re ".*$prompt $" { - fail "setting language to \"fortran\"" - return 0 - } - timeout { - fail "can't show language (timeout)" - return 0 - } + + if [gdb_test "set language fortran" ""] { + return 0; } -} - -# 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] + if ![gdb_test "show language" ".* source language is \"fortran\".*"] { + return 1; } 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 - } - } -} - -# 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 - } + return 0; } } proc test_integer_literal_types_accepted {} { global prompt - global passcount - - set passcount 0 # Test various decimal values. - test_print_accept "pt 123" "integer" - - if $passcount then { - pass "$passcount correct integer literal types printed" - } + gdb_test "pt 123" "type = int" # Should be integer*4 probably } proc test_character_literal_types_accepted {} { global prompt - global passcount - - set passcount 0 # Test various character values. - test_print_accept "pt 'a'" "character*1" - - if $passcount then { - pass "$passcount correct character literal types printed" - } + gdb_test "pt 'a'" "type = character\\*1" } proc test_integer_literal_types_rejected {} { global prompt - global passcount - - set passcount 0 test_print_reject "pt _" - - if $passcount then { - pass "$passcount incorrect integer literal types rejected" - } } proc test_logical_literal_types_accepted {} { global prompt - global passcount - - set passcount 0 # Test the only possible values for a logical, TRUE and FALSE. - test_print_accept "pt .TRUE." "logical*2" - test_print_accept "pt .FALSE." "logical*2" - - if $passcount then { - pass "$passcount correct logical literal types printed" - } + gdb_test "pt .TRUE." "type = logical\\*2" + gdb_test "pt .FALSE." "type = logical\\*2" } proc test_float_literal_types_accepted {} { global prompt - global passcount - - set passcount 0 # Test various floating point formats - test_print_accept "pt .44" "real*8" - test_print_accept "pt 44.0" "real*8" - test_print_accept "pt 10D20" "1" - test_print_accept "pt 10D20" "0" - test_print_accept "pt 10d20" "1" - test_print_accept "pt 10d20" "0" - test_print_accept "pt 10E20" "real*8" - test_print_accept "pt 10E20" "real*8" - test_print_accept "pt 10e20" "real*8" - test_print_accept "pt 10e20" "real*8" - - if $passcount then { - pass "$passcount correct float literal comparisons" - } + gdb_test "pt .44" "type = real\\*8" + gdb_test "pt 44.0" "type = real\\*8" + gdb_test "pt 10D20" "type = real\\*8" + gdb_test "pt 10D20" "type = real\\*8" + gdb_test "pt 10d20" "type = real\\*8" + gdb_test "pt 10d20" "type = real\\*8" + gdb_test "pt 10E20" "type = real\\*8" + gdb_test "pt 10E20" "type = real\\*8" + gdb_test "pt 10e20" "type = real\\*8" + gdb_test "pt 10e20" "type = real\\*8" } # Start with a fresh gdb. @@ -246,7 +97,7 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir -send "set print sevenbit-strings\n" ; expect -re ".*$prompt $" +gdb_test "set print sevenbit-strings" "" if [set_lang_fortran] then { test_integer_literal_types_accepted @@ -255,5 +106,5 @@ if [set_lang_fortran] then { test_character_literal_types_accepted test_float_literal_types_accepted } else { - warning "$test_name tests suppressed." + warning "$test_name tests suppressed." 0 } |