diff options
author | Michael Chastain <mec@google.com> | 2004-01-08 02:13:57 +0000 |
---|---|---|
committer | Michael Chastain <mec@google.com> | 2004-01-08 02:13:57 +0000 |
commit | 96da2469a0aff15e2190387e1d6805980260dbe8 (patch) | |
tree | 790b51cd3d9a38e611273ab20e8fce9a69e00cad | |
parent | 16e109cad3ed540d6428b9b4ee661edb66e9ca76 (diff) | |
download | gdb-96da2469a0aff15e2190387e1d6805980260dbe8.zip gdb-96da2469a0aff15e2190387e1d6805980260dbe8.tar.gz gdb-96da2469a0aff15e2190387e1d6805980260dbe8.tar.bz2 |
2004-01-07 Michael Chastain <mec.gnu@mindspring.com>
* gdb.cp/ctti.exp: Partial rewrite. Call gdb_compile properly.
Use gdb_test, gdb_test_multiple. Use floating-point values that
have exact representations in IEEE-ish formats.
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/ctti.exp | 367 |
2 files changed, 162 insertions, 211 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 98dc283..2477087 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2004-01-07 Michael Chastain <mec.gnu@mindspring.com> + * gdb.cp/ctti.exp: Partial rewrite. Call gdb_compile properly. + Use gdb_test, gdb_test_multiple. Use floating-point values that + have exact representations in IEEE-ish formats. + +2004-01-07 Michael Chastain <mec.gnu@mindspring.com> + * gdb.base/constvars.exp: Do not force lang=c++ if using HP compilers. Delete duplicate call to get_compiler_info. (local_compiler_xfail_check): setup_xfail if $hp_cc_compiler. diff --git a/gdb/testsuite/gdb.cp/ctti.exp b/gdb/testsuite/gdb.cp/ctti.exp index 1bc005a..80edce1 100644 --- a/gdb/testsuite/gdb.cp/ctti.exp +++ b/gdb/testsuite/gdb.cp/ctti.exp @@ -1,4 +1,4 @@ -# Copyright 1998, 1999, 2001, 2003 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2001, 2003, 2004 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 @@ -17,253 +17,198 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-gdb@prep.ai.mit.edu - # This file is part of the gdb testsuite # file written by Elena Zannoni (ezannoni@cygnus.com) +# rewritten by Michael Chastain (mec.gnu@mindspring.com) # # source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.cc -# +# Call to template instantiations. if $tracelevel then { - strace $tracelevel + strace $tracelevel } if { [skip_cplus_tests] } { continue } -# Check to see if we have an executable to test. If not, then either we -# haven't tried to compile one, or the compilation failed for some reason. -# In either case, just notify the user and skip the tests in this file. - set testfile "cttiadd" -set srcfile ${testfile}.cc -set srcfile1 ${testfile}1.cc -set srcfile2 ${testfile}2.cc -set srcfile3 ${testfile}3.cc -set binfile ${objdir}/${subdir}/${testfile} +set srcfile "${srcdir}/${subdir}/${testfile}.cc" +set srcfile1 "${srcdir}/${subdir}/${testfile}1.cc" +set srcfile2 "${srcdir}/${subdir}/${testfile}2.cc" +set srcfile3 "${srcdir}/${subdir}/${testfile}3.cc" +set objfile "${objdir}/${subdir}/${testfile}.o" +set objfile1 "${objdir}/${subdir}/${testfile}1.o" +set objfile2 "${objdir}/${subdir}/${testfile}2.o" +set objfile3 "${objdir}/${subdir}/${testfile}3.o" +set binfile "${objdir}/${subdir}/${testfile}" + +if { [gdb_compile "${srcfile}" "${objfile}" object {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} -if [get_compiler_info ${binfile} "c++"] { - return -1; +if { [gdb_compile "${srcfile1}" "${objfile1}" object {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } -if { [test_compiler_info gcc-*] } then { continue } +if { [gdb_compile "${srcfile2}" "${objfile2}" object {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} -#if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3}" "${binfile}" executable {debug c++}] != "" } { -# gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -#} +if { [gdb_compile "${srcfile3}" "${objfile3}" object {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} -set cmdline "$CXX_FOR_TARGET ${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3} -g -o ${binfile}" +if { [gdb_compile "${objfile} ${objfile1} ${objfile2} ${objfile3}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} -remote_exec build $cmdline +if [get_compiler_info ${binfile} "c++"] { + return -1; +} gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} - - if ![runto_main] then { perror "couldn't run to breakpoint" continue } +# TODO: this needs more work before actually deploying it. +# So bail out here. + +if { [ test_compiler_info gcc-*] } then { continue } + +gdb_test "next" "$decimal.*i = 2;" "next 1" +gdb_test "next" "$decimal.*f = 4.5;" "next 2" +gdb_test "next" "$decimal.*c = add\\(c, c\\);" "next 3" +gdb_test "next" "$decimal.*i = add\\(i, i\\);" "next 4" +gdb_test "next" "$decimal.*f = add\\(f, f\\);" "next 5" +gdb_test "next" "$decimal.*add1\\(\\);" "next 6" + +gdb_test "print c" "\\$\[0-9\]+ = -62 .*" +gdb_test "print f" "\\$\[0-9\]+ = 9" +gdb_test "print i" "\\$\[0-9\]+ = 4" + +gdb_test_multiple "print add<int>(2,2)" "print add<int>(2,2)" { + -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" { + pass "print add<int>(2,2)" + } + -re "No symbol \"add<int>\" in current context.\r\n$gdb_prompt $" { + # TODO: kfail or xfail this + fail "print add<int>(2,2)" + } +} -send_gdb "n\n" -gdb_expect { - -re "$decimal.*i = 2;.*$gdb_prompt $" { - pass "next " - } - -re ".*$gdb_prompt $" { fail "next " } - timeout { fail "next " } - } - - -send_gdb "n\n" -gdb_expect { - -re "$decimal.*f = 4.5;.*$gdb_prompt $" { - pass "next " - } - -re ".*$gdb_prompt $" { fail "next " } - timeout { fail "next " } - } - -send_gdb "n\n" -gdb_expect { - -re "$decimal.*c = add\\(c, c\\);.*$gdb_prompt $" { - pass "next " - } - -re ".*$gdb_prompt $" { fail "next " } - timeout { fail "next " } - } - -send_gdb "n\n" -gdb_expect { - -re "$decimal.*i = add\\(i, i\\);.*$gdb_prompt $" { - pass "next " - } - -re ".*$gdb_prompt $" { fail "next " } - timeout { fail "next " } - } - -send_gdb "n\n" -gdb_expect { - -re "$decimal.*f = add\\(f, f\\);.*$gdb_prompt $" { - pass "next " - } - -re ".*$gdb_prompt $" { fail "next " } - timeout { fail "next " } - } - -send_gdb "n\n" -gdb_expect { - -re "$decimal.*add1\\(\\);.*$gdb_prompt $" { - pass "next " - } - -re ".*$gdb_prompt $" { fail "next " } - timeout { fail "next " } - } - -send_gdb "print c\n" -gdb_expect { - -re ".$decimal = -62.*\r\n$gdb_prompt $" { - pass "print value of c" - } - -re ".*$gdb_prompt $" { fail "print value of c" } - timeout { fail "(timeout) print value of c" } - } - - -send_gdb "print f\n" -gdb_expect { - -re ".$decimal = 9\r\n$gdb_prompt $" { - pass "print value of f" - } - -re ".*$gdb_prompt $" { fail "print value of f" } - timeout { fail "(timeout) print value of f" } - } - - -send_gdb "print i\n" -gdb_expect { - -re ".$decimal = 4\r\n$gdb_prompt $" { - pass "print value of i" - } - -re ".*$gdb_prompt $" { fail "print value of i" } - timeout { fail "(timeout) print value of i" } - } - - - -send_gdb "print add<int>(2,2)\n" -gdb_expect { - -re ".$decimal = 4\r\n$gdb_prompt $" { - pass "print value of add<int>(2,2)" - } - -re ".*$gdb_prompt $" { fail "print value of add<int>(2,2)" } - timeout { fail "(timeout) print value of add<int>(2,2)" } - } - -send_gdb "print add<float>(2.3,2.3)\n" -gdb_expect { - -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { - pass "print value of add<float>(2.3,2.3)" - } - -re ".*$gdb_prompt $" { fail "print value of add<float>(2.3,2.3)" } - timeout { fail "(timeout) print value of add<float>(2.3,2.3)" } - } - -send_gdb "print add<char>('A','A')\n" -gdb_expect { - -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { - pass "print value of add<char>('A','A')" - } - -re ".*$gdb_prompt $" { fail "print value of add<char>('A','A')" } - timeout { fail "(timeout) print value of add<char>('A','A')" } - } - - -send_gdb "print add2<int>(2,2)\n" -gdb_expect { - -re ".$decimal = 4\r\n$gdb_prompt $" { - pass "print value of add2<int>(2,2)" - } - -re ".*$gdb_prompt $" { fail "print value of add2<int>(2,2)" } - timeout { fail "(timeout) print value of add2<int>(2,2)" } - } +# Note: 2.25 and 4.5 are exactly representable in IEEE-ish formats +gdb_test_multiple "print add<float>(2.25,2.25)" "print add<float>(2.25,2.25)" { + -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" { + pass "print add<float>(2.25,2.25)" + } + -re "No symbol \"add<float>\" in current context.\r\n$gdb_prompt $" { + # TODO: kfail or xfail this + fail "print add<float>(2.25,2.25)" + } +} -send_gdb "print add2<float>(2.3,2.3)\n" -gdb_expect { - -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { - pass "print value of add2<float>(2.3,2.3)" - } - -re ".*$gdb_prompt $" { fail "print value of add2<float>(2.3,2.3)" } - timeout { fail "(timeout) print value of add2<float>(2.3,2.3)" } - } +gdb_test_multiple "print add<char>('A','A')" "print add<char>('A','A')" { + -re "\\$\[0-9\]+ = -126 .*\r\n$gdb_prompt $" { + pass "print add<char>('A','A')" + } + -re "No symbol \"add<char>\" in current context.\r\n$gdb_prompt $" { + # TODO: kfail or xfail this + fail "print add<char>('A','A')" + } +} -send_gdb "print add2<char>('A','A')\n" -gdb_expect { - -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { - pass "print value of add2<char>('A','A')" - } - -re ".*$gdb_prompt $" { fail "print value of add2<char>('A','A')" } - timeout { fail "(timeout) print value of add2<char>('A','A')" } - } +gdb_test_multiple "print add2<int>(2,2)" "print add2<int>(2,2)" { + -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" { + pass "print add2<int>(2,2)" + } + -re "No symbol \"add2<int>\" in current context.\r\n$gdb_prompt $" { + # TODO: kfail or xfail this + fail "print add2<int>(2,2)" + } +} -send_gdb "print add3<int>(2,2)\n" -gdb_expect { - -re ".$decimal = 4\r\n$gdb_prompt $" { - pass "print value of add3<int>(2,2)" - } - -re ".*$gdb_prompt $" { fail "print value of add3<int>(2,2)" } - timeout { fail "(timeout) print value of add3<int>(2,2)" } - } +gdb_test_multiple "print add2<float>(2.25,2.25)" "print add2<float>(2.25,2.25)" { + -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" { + pass "print add2<float>(2.25,2.25)" + } + -re "No symbol \"add2<float>\" in current context.\r\n$gdb_prompt $" { + # TODO: kfail or xfail this + fail "print add2<float>(2.25,2.25)" + } +} -send_gdb "print add3<float>(2.3,2.3)\n" -gdb_expect { - -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { - pass "print value of add3<float>(2.3,2.3)" - } - -re ".*$gdb_prompt $" { fail "print value of add3<float>(2.3,2.3)" } - timeout { fail "(timeout) print value of add3<float>(2.3,2.3)" } - } +gdb_test_multiple "print add2<char>('A','A')" "print add2<char>('A','A')" { + -re "\\$\[0-9]+ = -126 .*$gdb_prompt $" { + pass "print add2<char>('A','A')" + } + -re "No symbol \"add2<char>\" in current context.\r\n$gdb_prompt $" { + # TODO: kfail or xfail this + fail "print add2<char>('A','A')" + } +} -send_gdb "print add3<char>('A','A')\n" -gdb_expect { - -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { - pass "print value of add3<char>('A','A')" - } - -re ".*$gdb_prompt $" { fail "print value of add3<char>('A','A')" } - timeout { fail "(timeout) print value of add3<char>('A','A')" } - } +gdb_test_multiple "print add3<int>(2,2)" "print add3<int>(2,2)" { + -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" { + pass "print add3<int>(2,2)" + } + -re "No symbol \"add3<int>\" in current context.\r\n$gdb_prompt $" { + # TODO: kfail or xfail this + fail "print add3<int>(2,2)" + } +} -send_gdb "print add4<int>(2,2)\n" -gdb_expect { - -re ".$decimal = 4\r\n$gdb_prompt $" { - pass "print value of add4<int>(2,2)" - } - -re ".*$gdb_prompt $" { fail "print value of add4<int>(2,2)" } - timeout { fail "(timeout) print value of add4<int>(2,2)" } - } +gdb_test_multiple "print add3<float>(2.25,2.25)" "print add3<float>(2.25,2.25)" { + -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" { + pass "print add3<float>(2.25,2.25)" + } + -re "No symbol \"add3<float>\" in current context.\r\n$gdb_prompt $" { + # TODO: kfail or xfail this + fail "print add3<float>(2.25,2.25)" + } +} -send_gdb "print add4<float>(2.3,2.3)\n" -gdb_expect { - -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { - pass "print value of add4<float>(2.3,2.3)" - } - -re ".*$gdb_prompt $" { fail "print value of add4<float>(2.3,2.3)" } - timeout { fail "(timeout) print value of add4<float>(2.3,2.3)" } - } +gdb_test_multiple "print add3<char>('A','A')" "print add3<char>('A','A')" { + -re "\\$\[0-9]+ = -126 .*$gdb_prompt $" { + pass "print add3<char>('A','A')" + } + -re "No symbol \"add3<char>\" in current context.\r\n$gdb_prompt $" { + # TODO: kfail or xfail this + fail "print add3<char>('A','A')" + } +} -send_gdb "print add4<char>('A','A')\n" -gdb_expect { - -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { - pass "print value of add4<char>('A','A')" - } - -re ".*$gdb_prompt $" { fail "print value of add4<char>('A','A')" } - timeout { fail "(timeout) print value of add4<char>('A','A')" } - } +gdb_test_multiple "print add4<int>(2,2)" "print add4<int>(2,2)" { + -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" { + pass "print add4<int>(2,2)" + } + -re "No symbol \"add4<int>\" in current context.\r\n$gdb_prompt $" { + # TODO: kfail or xfail this + fail "print add4<int>(2,2)" + } +} +gdb_test_multiple "print add4<float>(2.25,2.25)" "print add4<float>(2.25,2.25)" { + -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" { + pass "print add4<float>(2.25,2.25)" + } + -re "No symbol \"add4<float>\" in current context.\r\n$gdb_prompt $" { + # TODO: kfail or xfail this + fail "print add4<float>(2.25,2.25)" + } +} -gdb_exit -return 0 +gdb_test_multiple "print add4<char>('A','A')" "print add4<char>('A','A')" { + -re "\\$\[0-9]+ = -126 .*$gdb_prompt $" { + pass "print add4<char>('A','A')" + } + -re "No symbol \"add4<char>\" in current context.\r\n$gdb_prompt $" { + # TODO: kfail or xfail this + fail "print add4<char>('A','A')" + } +} |