* [patch/testsuite/cp] ctti.exp: partial overhaul
@ 2004-01-08 2:12 Michael Elizabeth Chastain
2004-01-08 3:56 ` Daniel Jacobowitz
0 siblings, 1 reply; 3+ messages in thread
From: Michael Elizabeth Chastain @ 2004-01-08 2:12 UTC (permalink / raw)
To: carlton, gdb-patches
This patch partially overhauls gdb.cp/ctti.exp, a sweet little test
script for "call to template instantiation". It calls instantiations of
template functions like "print add<int>(2,2)".
This script used to skip all the tests if the compiler is gcc.
It still does that.
The script was using the wrong commands to compile and link several
sources. The right commands are: gdb_compile on each source file
separately, and then gdb_compile the object files into an executable.
This part was hosing me on hp-ux with ERROR's.
All the send_gdb/gdb_expect part become gdb_test and gdb_test_multiple.
Some of the tests use floating-point values. I changed the values
to values such as 2.25 and 4.5, which have exact representations in
IEEE 754 and similar formats. (Anything which can be written
as a fraction over an exact power of 2 is exactly representable,
like 9/4 or 9/2).
But alas, there is more work to do. There are a lot of FAILs with
both gcc and hp ac++. Like this:
# gcc 3.3.2 -gdwarf-2
print add<int>(2,2)
No symbol "add<int>" in current context.
(gdb) FAIL: gdb.cp/ctti.exp: print add<int>(2,2)
# hp ac++ 3.45.00
print add<float>(2.25,2.25)
warning: Unable to restore previously selected frame.
$5 = 9
(gdb) FAIL: gdb.cp/ctti.exp: print add<float>(2.25,2.25)
I am not going to get into the bugs with gcc right now. So I exited the
test script early, right after "break main". At least it builds the
executable now.
So the old situation was:
gcc-*-* leave at the beginning
hpacc-* ERROR during compile
New situation:
gcc-*-* leave after compiling
hpacc-*-* lotsa FAILs
The new situation is an improvement on the old situation.
Tested on:
native i686-pc-linux-gnu, gcc 2.95.3 3.3.2 HEAD, dwarf-2 stabs+
native hppa2.0w-hp-hpux11.11, hp acc 3.45.00
I am committing this now.
Michael C
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.
Index: ctti.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/ctti.exp,v
retrieving revision 1.2
diff -c -3 -p -r1.2 ctti.exp
*** ctti.exp 23 Nov 2003 18:24:46 -0000 1.2
--- ctti.exp 8 Jan 2004 01:49:27 -0000
***************
*** 1,4 ****
! # Copyright 1998, 1999, 2001, 2003 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
--- 1,4 ----
! # 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,269 ****
# 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)
#
# source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.cc
- #
if $tracelevel then {
! 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}
! if [get_compiler_info ${binfile} "c++"] {
! return -1;
}
! if { [test_compiler_info gcc-*] } then { continue }
! #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."
! #}
! set cmdline "$CXX_FOR_TARGET ${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3} -g -o ${binfile}"
! remote_exec build $cmdline
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
-
-
if ![runto_main] then {
perror "couldn't run to breakpoint"
continue
}
! 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)" }
! }
!
! 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)" }
! }
!
! 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')" }
! }
!
! 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)" }
! }
!
! 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)" }
! }
!
! 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')" }
! }
!
! 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)" }
! }
!
! 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)" }
! }
!
! 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_exit
! return 0
--- 17,214 ----
# 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
}
if { [skip_cplus_tests] } { continue }
set testfile "cttiadd"
! 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 { [gdb_compile "${srcfile1}" "${objfile1}" object {debug c++}] != "" } {
! gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
! }
! 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 "${srcfile3}" "${objfile3}" object {debug c++}] != "" } {
! gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
! }
! 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."
! }
!
! 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)"
+ }
+ }
! # 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)"
! }
! }
!
! 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')"
! }
! }
!
! 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)"
! }
! }
!
! 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)"
! }
! }
!
! 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')"
! }
! }
!
! 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)"
! }
! }
!
! 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)"
! }
! }
!
! 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')"
! }
! }
!
! 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_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')"
! }
! }
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [patch/testsuite/cp] ctti.exp: partial overhaul
2004-01-08 2:12 [patch/testsuite/cp] ctti.exp: partial overhaul Michael Elizabeth Chastain
@ 2004-01-08 3:56 ` Daniel Jacobowitz
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2004-01-08 3:56 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: carlton, gdb-patches
On Wed, Jan 07, 2004 at 09:12:30PM -0500, Michael Chastain wrote:
> But alas, there is more work to do. There are a lot of FAILs with
> both gcc and hp ac++. Like this:
>
> # gcc 3.3.2 -gdwarf-2
> print add<int>(2,2)
> No symbol "add<int>" in current context.
> (gdb) FAIL: gdb.cp/ctti.exp: print add<int>(2,2)
Yes, I'm aware of (and recently described) the issue. It doesn't work
because the function has its return type in its mangled name, which
boggles GDB's symbol table. I'll fix this on drow-cplus-branch - but
probably not until at least February.
> I am not going to get into the bugs with gcc right now. So I exited the
> test script early, right after "break main". At least it builds the
> executable now.
How about some KFAILs for GCC so I can see what I'm doing? :)
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch/testsuite/cp] ctti.exp: partial overhaul
@ 2004-01-08 4:23 Michael Elizabeth Chastain
0 siblings, 0 replies; 3+ messages in thread
From: Michael Elizabeth Chastain @ 2004-01-08 4:23 UTC (permalink / raw)
To: drow; +Cc: carlton, gdb-patches
> How about some KFAILs for GCC so I can see what I'm doing? :)
That would be good; the only problem is actually doing the work.
If I feed you a set of gdb.log files, can you file the necessary PR's
(if they aren't already filed) and feed me PR numbers? Or if you can't
do that, can you feed me URL's?
For your own purposes, you can grab the test and rip out one "continue"
in the middle. When all the results are PASS or KFAIL on all
configurations then I can rip out the "continue" for everybody.
The test script also does this to get to a defined place:
break main
run
next
next
next
next
next
next
Which is not really cool what with the freedom that compilers have to
choose line numbers. That's something else I have to fix up.
Michael C
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-01-08 4:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-08 2:12 [patch/testsuite/cp] ctti.exp: partial overhaul Michael Elizabeth Chastain
2004-01-08 3:56 ` Daniel Jacobowitz
2004-01-08 4:23 Michael Elizabeth Chastain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox