* [rfa/testsuite] more tests in gdb.c++/m-static
@ 2002-08-16 14:19 David Carlton
2002-08-16 14:30 ` Daniel Jacobowitz
2002-08-22 10:09 ` David Carlton
0 siblings, 2 replies; 5+ messages in thread
From: David Carlton @ 2002-08-16 14:19 UTC (permalink / raw)
To: gdb-patches; +Cc: carlton
[-- Attachment #1: Type: text/plain, Size: 1579 bytes --]
I've added some tests to gdb.c++/m-static that correspond to the patch
in <http://sources.redhat.com/ml/gdb-patches/2002-08/msg00385.html>;
patches below.
A few tangential questions:
* I hope I got the stuff in brackets in the subject correct; is rfa
"request for approval"?
* What's the convention for submitting new files (as opposed to
patches to existing files)? (I'd look through the mail archive for
examples, but I don't seem to be able to access it right now.) I'm
attaching them below as files and hoping that the mailer will make
it clear what they're named and so forth; please let me know if I
should do anything else.
* CONTRIBUTE suggests using "cvs diff -cp", but everybody submits
unidiff patches. Should I change it to say "cvs diff -up"?
* Does "make clean" actually clean up the testsuite directory
properly? Looking at the Makefile in gdb.c++, it seems like it
cleans up whatever's in the EXECUTABLES variable, which certainly
doesn't include all the executables in that directory. Is there
something else magic going on, or should I audit the Makefile.in's
in the various directories to see if they clean up everything?
(Yes, I know, I should really type "make clean" and see what it
does, but I don't feel like rebuilding gdb if somebody can answer
the question quickly.)
Thanks,
David Carlton
carlton@math.stanford.edu
2002-08-16 David Carlton <carlton@math.stanford.edu>
* gdb.c++/m-static.exp: Added test 4.
* gdb.c++/m-static.cc: Ditto.
* gdb.c++/m-static.h: New file.
* gdb.c++/m-static1.cc: New file.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch for m-static.exp --]
[-- Type: text/x-patch, Size: 3823 bytes --]
Index: m-static.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/m-static.exp,v
retrieving revision 1.1
diff -u -p -r1.1 m-static.exp
--- m-static.exp 30 May 2002 19:09:47 -0000 1.1
+++ m-static.exp 16 Aug 2002 20:59:29 -0000
@@ -16,6 +16,7 @@
# Tests for member static data
# 2002-05-13 Benjamin Kosnik <bkoz@redhat.com>
+# 2002-08-16 David Carlton <carlton@math.stanford.edu>
# This file is part of the gdb testsuite
@@ -33,9 +34,10 @@ set bug_id 0
set testfile "m-static"
set srcfile ${testfile}.cc
+set srcfile1 ${testfile}1.cc
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1}" "${binfile}" executable {debug c++}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
@@ -55,8 +57,8 @@ if ![runto_main] then {
}
# One.
-gdb_test "break 68" "Breakpoint \[0-9\]*.*line 68\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:68\r\n.*" "continue to 68"
+gdb_test "break 72" "Breakpoint \[0-9\]*.*line 72\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:72\r\n.*" "continue to 72"
# simple object, static const bool
gdb_test "print test1.test" "\\$\[0-9\]* = true" "simple object, static const bool"
@@ -71,8 +73,8 @@ gdb_test "print test1.key2" "\\$\[0-9\]*
gdb_test "print test1.value" "\\$\[0-9\]* = oriental" "simple object, static enum"
# Two.
-gdb_test "break 69" "Breakpoint \[0-9\]*.*line 69\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:69\r\n.*" "continue to 69"
+gdb_test "break 73" "Breakpoint \[0-9\]*.*line 73\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:73\r\n.*" "continue to 73"
# derived template object, base static const bool
gdb_test "print test2.test" "\\$\[0-9\]* = true" "derived template object, base static const bool"
@@ -90,8 +92,11 @@ gdb_test "print test2.value" "\\$\[0-9\]
gdb_test "print test2.value_derived" "\\$\[0-9\].* = etruscan" "derived template object, static enum"
# Three.
-gdb_test "break 71" "Breakpoint \[0-9\]*.*line 71\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:71\r\n.*" "continue to 71"
+
+# Setting a breakpoint at the test4 initializer doesn't work, since
+# execution won't stop there.
+gdb_test "break 76" "Breakpoint \[0-9\]*.*line 76\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:76\r\n.*" "continue to 76"
# template object, static derived template data member's base static const bool
gdb_test "print test3.data.test" "\\$\[0-9\].* = true" "template object, static const bool"
@@ -107,6 +112,22 @@ gdb_test "print test3.data.value" "\\$\[
# template object, static derived template data member's static enum
gdb_test "print test3.data.value_derived" "\\$\[0-9\].* = etruscan" "template object, static derived enum"
+
+# 2002-08-16
+# Four.
+
+# No breakpoint: see test3 comment.
+
+# static const int initialized in another file.
+gdb_test "print test4.elsewhere" "\\$\[0-9\].* = 221" "static const int initialized elsewhere"
+
+# static const int that nobody initializes. From PR gdb/635.
+gdb_test "print test4.nowhere" "field nowhere is nonexistent or has been optimised out" "static const int initialized nowhere"
+
+# Perhaps at some point test4 should also include a test for a static
+# const int that was initialized in the header file. But I'm not sure
+# that GDB's current behavior in such situations is either consistent
+# across platforms or optimal, so I'm not including one now.
gdb_exit
return 0
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: patch for m-static.cc --]
[-- Type: text/x-patch, Size: 713 bytes --]
Index: m-static.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/m-static.cc,v
retrieving revision 1.1
diff -u -p -r1.1 m-static.cc
--- m-static.cc 30 May 2002 19:09:47 -0000 1.1
+++ m-static.cc 16 Aug 2002 20:59:25 -0000
@@ -53,6 +53,10 @@ namespace __gnu_test
template<typename T>
gnu_obj_2<int> gnu_obj_3<T>::data(etruscan);
+
+ // 2002-08-16
+ // Test four.
+#include "m-static.h"
}
// instantiate templates explicitly so their static members will exist
@@ -67,6 +71,7 @@ int main()
gnu_obj_1 test1(egyptian, 4589);
gnu_obj_2<long> test2(roman);
gnu_obj_3<long> test3(greek);
+ gnu_obj_4 test4;
return 0;
}
[-- Attachment #4: m-static.h --]
[-- Type: text/plain, Size: 173 bytes --]
// 2002-08-16
class gnu_obj_4
{
public:
static const int elsewhere;
static const int nowhere;
// At some point, perhaps:
// static const int everywhere = 317;
};
[-- Attachment #5: m-static1.cc --]
[-- Type: text/plain, Size: 130 bytes --]
// 2002-08-16
namespace __gnu_test {
#include "m-static.h"
}
using namespace __gnu_test;
const int gnu_obj_4::elsewhere = 221;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfa/testsuite] more tests in gdb.c++/m-static
2002-08-16 14:19 [rfa/testsuite] more tests in gdb.c++/m-static David Carlton
@ 2002-08-16 14:30 ` Daniel Jacobowitz
2002-08-16 14:37 ` David Carlton
2002-08-22 10:09 ` David Carlton
1 sibling, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2002-08-16 14:30 UTC (permalink / raw)
To: David Carlton; +Cc: gdb-patches
On Fri, Aug 16, 2002 at 02:19:35PM -0700, David Carlton wrote:
> I've added some tests to gdb.c++/m-static that correspond to the patch
> in <http://sources.redhat.com/ml/gdb-patches/2002-08/msg00385.html>;
> patches below.
>
> A few tangential questions:
>
> * I hope I got the stuff in brackets in the subject correct; is rfa
> "request for approval"?
Yup. You might want to specify c++testsuite and/or CC the various
testsuite maintainers.
> * What's the convention for submitting new files (as opposed to
> patches to existing files)? (I'd look through the mail archive for
> examples, but I don't seem to be able to access it right now.) I'm
> attaching them below as files and hoping that the mailer will make
> it clear what they're named and so forth; please let me know if I
> should do anything else.
I usually use diff -N to do this.
> * CONTRIBUTE suggests using "cvs diff -cp", but everybody submits
> unidiff patches. Should I change it to say "cvs diff -up"?
Either works. I like unidiff, personally.
> * Does "make clean" actually clean up the testsuite directory
> properly? Looking at the Makefile in gdb.c++, it seems like it
> cleans up whatever's in the EXECUTABLES variable, which certainly
> doesn't include all the executables in that directory. Is there
> something else magic going on, or should I audit the Makefile.in's
> in the various directories to see if they clean up everything?
> (Yes, I know, I should really type "make clean" and see what it
> does, but I don't feel like rebuilding gdb if somebody can answer
> the question quickly.)
No, the testsuite directory doesn't get cleaned properly. I recommend
using a separate object directory anyway; it keeps things neater.
Oh, and you might want to use namespace names that aren't in the
implementation space (__gnu is in the implementation space, because it
starts with two underscores. _[A-Z] is also reserved.)
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfa/testsuite] more tests in gdb.c++/m-static
2002-08-16 14:30 ` Daniel Jacobowitz
@ 2002-08-16 14:37 ` David Carlton
0 siblings, 0 replies; 5+ messages in thread
From: David Carlton @ 2002-08-16 14:37 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches, carlton
In article <20020816213122.GA12044@nevyn.them.org>, Daniel Jacobowitz <drow@mvista.com> writes:
> On Fri, Aug 16, 2002 at 02:19:35PM -0700, David Carlton wrote:
>> * What's the convention for submitting new files (as opposed to
>> patches to existing files)? (I'd look through the mail archive for
>> examples, but I don't seem to be able to access it right now.) I'm
>> attaching them below as files and hoping that the mailer will make
>> it clear what they're named and so forth; please let me know if I
>> should do anything else.
> I usually use diff -N to do this.
Makes sense.
> Oh, and you might want to use namespace names that aren't in the
> implementation space (__gnu is in the implementation space, because
> it starts with two underscores. _[A-Z] is also reserved.)
Thanks for the tip. I inherited that from the pre-existing
m-static.cc file; to be honest, I have no idea why that file uses
namespaces at all, let alone namespaces beginning with two
underscores. But if I add more tests myself, I'll make sure to avoid
such underscores.
David Carlton
carlton@math.stanford.edu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfa/testsuite] more tests in gdb.c++/m-static
2002-08-16 14:19 [rfa/testsuite] more tests in gdb.c++/m-static David Carlton
2002-08-16 14:30 ` Daniel Jacobowitz
@ 2002-08-22 10:09 ` David Carlton
2002-08-22 10:23 ` David Carlton
1 sibling, 1 reply; 5+ messages in thread
From: David Carlton @ 2002-08-22 10:09 UTC (permalink / raw)
To: gdb-patches; +Cc: carlton, mec
[-- Attachment #1: Type: text/plain, Size: 913 bytes --]
In article <ro1fzxewlg8.fsf@jackfruit.Stanford.EDU>, David Carlton
<carlton@math.Stanford.EDU> writes:
> I've added some tests to gdb.c++/m-static that correspond to the
> patch in
> <http://sources.redhat.com/ml/gdb-patches/2002-08/msg00385.html>;
> patches below.
I've reworked these patches and the other two new testsuite files that
I posted to be a little better behaved: now the main() functions all
explicitly return 0, and they no longer set breakpoints based on line
numbers. Here are the revised patches for m-static; I'll send
revised patches for pr-574 and printmethod next.
David Carlton
carlton@math.stanford.edu
2002-08-20 David Carlton <carlton@math.stanford.edu>
* gdb.c++/m-static.exp: Remove breakpoints depending on line
numbers, and replace them by use of "next".
Add test 4.
* gdb.c++/m-static.cc: Add test 4.
* gdb.c++/m-static.h: New file.
* gdb.c++/m-static1.cc: New file.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch for m-static.exp --]
[-- Type: text/x-patch, Size: 713 bytes --]
Index: m-static.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/m-static.cc,v
retrieving revision 1.1
diff -u -p -r1.1 m-static.cc
--- m-static.cc 30 May 2002 19:09:47 -0000 1.1
+++ m-static.cc 22 Aug 2002 17:00:11 -0000
@@ -53,6 +53,10 @@ namespace __gnu_test
template<typename T>
gnu_obj_2<int> gnu_obj_3<T>::data(etruscan);
+
+ // 2002-08-16
+ // Test four.
+#include "m-static.h"
}
// instantiate templates explicitly so their static members will exist
@@ -67,6 +71,7 @@ int main()
gnu_obj_1 test1(egyptian, 4589);
gnu_obj_2<long> test2(roman);
gnu_obj_3<long> test3(greek);
+ gnu_obj_4 test4;
return 0;
}
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: patch for m-static.cc --]
[-- Type: text/x-patch, Size: 713 bytes --]
Index: m-static.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/m-static.cc,v
retrieving revision 1.1
diff -u -p -r1.1 m-static.cc
--- m-static.cc 30 May 2002 19:09:47 -0000 1.1
+++ m-static.cc 16 Aug 2002 20:59:25 -0000
@@ -53,6 +53,10 @@ namespace __gnu_test
template<typename T>
gnu_obj_2<int> gnu_obj_3<T>::data(etruscan);
+
+ // 2002-08-16
+ // Test four.
+#include "m-static.h"
}
// instantiate templates explicitly so their static members will exist
@@ -67,6 +71,7 @@ int main()
gnu_obj_1 test1(egyptian, 4589);
gnu_obj_2<long> test2(roman);
gnu_obj_3<long> test3(greek);
+ gnu_obj_4 test4;
return 0;
}
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: new file: m-static.h --]
[-- Type: text/x-patch, Size: 280 bytes --]
--- /dev/null Thu Apr 11 07:25:15 2002
+++ m-static.h Fri Aug 16 13:24:37 2002
@@ -0,0 +1,11 @@
+// 2002-08-16
+
+class gnu_obj_4
+{
+ public:
+ static const int elsewhere;
+ static const int nowhere;
+ // At some point, perhaps:
+ // static const int everywhere = 317;
+};
+
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: new file: m-static1.cc --]
[-- Type: text/x-patch, Size: 236 bytes --]
--- /dev/null Thu Apr 11 07:25:15 2002
+++ m-static1.cc Fri Aug 16 13:11:02 2002
@@ -0,0 +1,9 @@
+// 2002-08-16
+
+namespace __gnu_test {
+#include "m-static.h"
+}
+
+using namespace __gnu_test;
+
+const int gnu_obj_4::elsewhere = 221;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfa/testsuite] more tests in gdb.c++/m-static
2002-08-22 10:09 ` David Carlton
@ 2002-08-22 10:23 ` David Carlton
0 siblings, 0 replies; 5+ messages in thread
From: David Carlton @ 2002-08-22 10:23 UTC (permalink / raw)
To: gdb-patches; +Cc: mec, carlton
In article <ro1hehmrfd2.fsf@jackfruit.Stanford.EDU>, David Carlton <carlton@math.Stanford.EDU> writes:
> Here are the revised patches for m-static
Whoops: my patch that claims to be for m-static.exp is really a second
copy of the patch for m-static.cc. One more time, with feeling:
David Carlton
carlton@math.stanford.edu
2002-08-22 David Carlton <carlton@math.stanford.edu>
* gdb.c++/m-static.exp: Remove breakpoints depending on line
numbers, and replace them by use of "next" or relative
breakpoints.
Add test 4.
* gdb.c++/m-static.cc: Add test 4.
* gdb.c++/m-static.h: New file.
* gdb.c++/m-static1.cc: New file.
Index: m-static.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/m-static.exp,v
retrieving revision 1.1
diff -u -p -r1.1 m-static.exp
--- m-static.exp 30 May 2002 19:09:47 -0000 1.1
+++ m-static.exp 22 Aug 2002 17:15:03 -0000
@@ -16,6 +16,7 @@
# Tests for member static data
# 2002-05-13 Benjamin Kosnik <bkoz@redhat.com>
+# 2002-08-22 David Carlton <carlton@math.stanford.edu>
# This file is part of the gdb testsuite
@@ -33,9 +34,10 @@ set bug_id 0
set testfile "m-static"
set srcfile ${testfile}.cc
+set srcfile1 ${testfile}1.cc
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1}" "${binfile}" executable {debug c++}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
@@ -55,8 +57,7 @@ if ![runto_main] then {
}
# One.
-gdb_test "break 68" "Breakpoint \[0-9\]*.*line 68\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:68\r\n.*" "continue to 68"
+gdb_test "next" "" "next"
# simple object, static const bool
gdb_test "print test1.test" "\\$\[0-9\]* = true" "simple object, static const bool"
@@ -71,8 +72,7 @@ gdb_test "print test1.key2" "\\$\[0-9\]*
gdb_test "print test1.value" "\\$\[0-9\]* = oriental" "simple object, static enum"
# Two.
-gdb_test "break 69" "Breakpoint \[0-9\]*.*line 69\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:69\r\n.*" "continue to 69"
+gdb_test "next" "" "next"
# derived template object, base static const bool
gdb_test "print test2.test" "\\$\[0-9\]* = true" "derived template object, base static const bool"
@@ -90,8 +90,11 @@ gdb_test "print test2.value" "\\$\[0-9\]
gdb_test "print test2.value_derived" "\\$\[0-9\].* = etruscan" "derived template object, static enum"
# Three.
-gdb_test "break 71" "Breakpoint \[0-9\]*.*line 71\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:71\r\n.*" "continue to 71"
+
+# With the compiler that I'm using, execution won't stop at the test4
+# initializer. This seems the most robust way to handle that.
+gdb_breakpoint "+2"
+gdb_continue_to_breakpoint "end of initializers"
# template object, static derived template data member's base static const bool
gdb_test "print test3.data.test" "\\$\[0-9\].* = true" "template object, static const bool"
@@ -107,6 +110,22 @@ gdb_test "print test3.data.value" "\\$\[
# template object, static derived template data member's static enum
gdb_test "print test3.data.value_derived" "\\$\[0-9\].* = etruscan" "template object, static derived enum"
+
+# 2002-08-16
+# Four.
+
+# No next: see test3 comment.
+
+# static const int initialized in another file.
+gdb_test "print test4.elsewhere" "\\$\[0-9\].* = 221" "static const int initialized elsewhere"
+
+# static const int that nobody initializes. From PR gdb/635.
+gdb_test "print test4.nowhere" "field nowhere is nonexistent or has been optimised out" "static const int initialized nowhere"
+
+# Perhaps at some point test4 should also include a test for a static
+# const int that was initialized in the header file. But I'm not sure
+# that GDB's current behavior in such situations is either consistent
+# across platforms or optimal, so I'm not including one now.
gdb_exit
return 0
Index: m-static.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/m-static.cc,v
retrieving revision 1.1
diff -u -p -r1.1 m-static.cc
--- m-static.cc 30 May 2002 19:09:47 -0000 1.1
+++ m-static.cc 22 Aug 2002 17:12:20 -0000
@@ -53,6 +53,10 @@ namespace __gnu_test
template<typename T>
gnu_obj_2<int> gnu_obj_3<T>::data(etruscan);
+
+ // 2002-08-16
+ // Test four.
+#include "m-static.h"
}
// instantiate templates explicitly so their static members will exist
@@ -67,6 +71,7 @@ int main()
gnu_obj_1 test1(egyptian, 4589);
gnu_obj_2<long> test2(roman);
gnu_obj_3<long> test3(greek);
+ gnu_obj_4 test4;
return 0;
}
--- /dev/null Thu Apr 11 07:25:15 2002
+++ m-static.h Fri Aug 16 13:24:37 2002
@@ -0,0 +1,11 @@
+// 2002-08-16
+
+class gnu_obj_4
+{
+ public:
+ static const int elsewhere;
+ static const int nowhere;
+ // At some point, perhaps:
+ // static const int everywhere = 317;
+};
+
--- /dev/null Thu Apr 11 07:25:15 2002
+++ m-static1.cc Fri Aug 16 13:11:02 2002
@@ -0,0 +1,9 @@
+// 2002-08-16
+
+namespace __gnu_test {
+#include "m-static.h"
+}
+
+using namespace __gnu_test;
+
+const int gnu_obj_4::elsewhere = 221;
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-08-22 17:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-16 14:19 [rfa/testsuite] more tests in gdb.c++/m-static David Carlton
2002-08-16 14:30 ` Daniel Jacobowitz
2002-08-16 14:37 ` David Carlton
2002-08-22 10:09 ` David Carlton
2002-08-22 10:23 ` David Carlton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox