I am currently working on a cross-platform project, using GCC 3.0 on both a Linux (RedHat and Mandrake) and Solaris 8 base. We have used cppunit on bith platforms and had no problems until we went to cppunit 1.5.5. and gcc 3.0. Since then, none of our tests seem to work anymore on Solaris, and we're having the devil's time figuring out why.
I've done a side-by-side debugger run of the first test harness and noticed the following:
Under linux, TestSuite* is returned as a struct TestSuite* . Under Solaris, it appears to be a class.
When we make the call to run(&results), linux pretty much goes to the test code we have defined. Solaris does some STL iterator stuff.
TestSuite.cpp:19 for (std::vector<Test *>::iterator it = m_tests.begin ();
TestSuite.cpp:22 if (result->shouldStop ())
TestSuite.cpp:25 Test *test = *it;
TestSuite.cpp:26 test->run (result);
result->startTest (this);
TestCase.cpp:
16 /// Run the test and catch any exceptions that are triggered by it
17 void
18 TestCase::run (TestResult *result)
19 {
20 result->startTest (this);
21
22 setUp ();
23
24 try {
(gdb) l
25
26 runTest ();
27
28 }
At runTest, we go to TestCaller.h
103 void runTest ()
104 {
105 (m_fixture->*m_test)();
106 }
Followed by me flailing around to figure out values...
(gdb) p this
$23 = (TestCaller<HelpersTest> *) 0x2cea8
(gdb) p *this
$24 = {<TestCase> = {<Test> = {_vptr. = 0x2b2e0}, <TestAssert> = {
_vptr. = 0x2b310}, m_name = {static npos = 4294967295,
_M_dataplus = {<allocator<char>> = {<No data fields>},
_M_p = 0x319dc "Helpers entity encoding"},
static _S_empty_rep_storage = {0, 0, 11, 0}}}, m_ownFixture = true,
m_fixture = 0x2c458, m_test = {__pfn = Internal: Cannot demangle mangled name `__base_dtor__11HelpersTest_ZN11HelpersTestD2Ev'.
(gdb) l *m_test
Value can't be converted to integer.
(gdb) l m_test
Function "m_test" not defined.
(gdb) l *m_test()
Couldn't find method TestCaller<HelpersTest>::m_test
Notice the mangling which seems to have happened throughout cppunit.
If and when I go into the function so defined at line 105, I appear to end up in a method where the "this" argument is 0x0. Ultimately, I hit a SEGV which is external sign of the problem that has frustrated us. This does not happen in Linux, and it didn't happen before the update.
Any clues? Anything else I can provide as info?
-Keith-
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2001-07-09
OK, I've had a chance to play with this over the weekend, and today, I seem to have hit precisely where we've been getting the error.
By rights, as I understand cppunit, the following should have some default behaviour:
Our tests use the former, shorter syntax. It appears that this does NOT work under the combination of Solaris 8, GCC 3.0, and cppunit 1.5.5 . What appears to happen is that the program execution goes into some basic_string STL stuff, eventually segfaulting:
Program received signal SIGSEGV, Segmentation fault.
_ZNKSs4_Rep12_M_is_leakedEv (this=0xfffffff4)
at /usr/local/xmlg/include/g++-v3/bits/basic_string.h:145
this = (_Rep *) 0xfffffff4
*this --> Cannot access memory at address 0xfffffff4
When I put in the __LINE__ and __FILE__ entries, the tests pass.
I'll be rooting around cppunit's source code, trying to rig it to work properly; however, if this is something you've encountered and fixed, please enlighten me as to the proper course of action.
Much appreciated,
-Keith-
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am currently working on a cross-platform project, using GCC 3.0 on both a Linux (RedHat and Mandrake) and Solaris 8 base. We have used cppunit on bith platforms and had no problems until we went to cppunit 1.5.5. and gcc 3.0. Since then, none of our tests seem to work anymore on Solaris, and we're having the devil's time figuring out why.
I've done a side-by-side debugger run of the first test harness and noticed the following:
Under linux, TestSuite* is returned as a struct TestSuite* . Under Solaris, it appears to be a class.
When we make the call to run(&results), linux pretty much goes to the test code we have defined. Solaris does some STL iterator stuff.
TestSuite.cpp:19 for (std::vector<Test *>::iterator it = m_tests.begin ();
TestSuite.cpp:22 if (result->shouldStop ())
TestSuite.cpp:25 Test *test = *it;
TestSuite.cpp:26 test->run (result);
result->startTest (this);
TestCase.cpp:
16 /// Run the test and catch any exceptions that are triggered by it
17 void
18 TestCase::run (TestResult *result)
19 {
20 result->startTest (this);
21
22 setUp ();
23
24 try {
(gdb) l
25
26 runTest ();
27
28 }
At runTest, we go to TestCaller.h
103 void runTest ()
104 {
105 (m_fixture->*m_test)();
106 }
Followed by me flailing around to figure out values...
(gdb) p this
$23 = (TestCaller<HelpersTest> *) 0x2cea8
(gdb) p *this
$24 = {<TestCase> = {<Test> = {_vptr. = 0x2b2e0}, <TestAssert> = {
_vptr. = 0x2b310}, m_name = {static npos = 4294967295,
_M_dataplus = {<allocator<char>> = {<No data fields>},
_M_p = 0x319dc "Helpers entity encoding"},
static _S_empty_rep_storage = {0, 0, 11, 0}}}, m_ownFixture = true,
m_fixture = 0x2c458, m_test = {__pfn = Internal: Cannot demangle mangled name `__base_dtor__11HelpersTest_ZN11HelpersTestD2Ev'.
(gdb) l *m_test
Value can't be converted to integer.
(gdb) l m_test
Function "m_test" not defined.
(gdb) l *m_test()
Couldn't find method TestCaller<HelpersTest>::m_test
Notice the mangling which seems to have happened throughout cppunit.
If and when I go into the function so defined at line 105, I appear to end up in a method where the "this" argument is 0x0. Ultimately, I hit a SEGV which is external sign of the problem that has frustrated us. This does not happen in Linux, and it didn't happen before the update.
Any clues? Anything else I can provide as info?
-Keith-
OK, I've had a chance to play with this over the weekend, and today, I seem to have hit precisely where we've been getting the error.
By rights, as I understand cppunit, the following should have some default behaviour:
assertEquals( 1, <some_condition> )
as opposed to the more fully qualified
assertEquals( 1, <some_condition>, __LINE__, __FILE__ )
Our tests use the former, shorter syntax. It appears that this does NOT work under the combination of Solaris 8, GCC 3.0, and cppunit 1.5.5 . What appears to happen is that the program execution goes into some basic_string STL stuff, eventually segfaulting:
186 __str.get_allocator())
--> /usr/local/xmlg/include/g++-v3/bits/basic_string.h:246
246 { return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); }
--> /usr/local/xmlg/include/g++-v3/bits/basic_string.h:238
238 { return _M_dataplus._M_p; }
<-- /usr/local/xmlg/include/g++-v3/bits/basic_string.h:246
-- /usr/local/xmlg/include/g++-v3/bits/stl_alloc.h:542
246 { return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); }
--> /usr/local/xmlg/include/g++-v3/bits/basic_string.h:238
238 { return _M_dataplus._M_p; }
<-- /usr/local/xmlg/include/g++-v3/bits/basic_string.h:246
-- /usr/local/xmlg/include/g++-v3/bits/stl_alloc.h:542
542 allocator() __STL_NOTHROW {}
--> /usr/local/xmlg/include/g++-v3/bits/basic_string.h:725
725 get_allocator() const { return _M_dataplus; }
--> /usr/local/xmlg/include/g++-v3/bits/stl_alloc.h:543
543 allocator(const allocator&) __STL_NOTHROW {}
<-- /usr/local/xmlg/include/g++-v3/bits/basic_string.h:725
--> /usr/local/xmlg/include/g++-v3/bits/basic_string.h:169
169 { return (!_M_is_leaked() && __alloc1 == __alloc2) ?
170 _M_refcopy() : _M_clone(__alloc1); }
--> /usr/local/xmlg/include/g++-v3/bits/basic_string.h:145
145 { return _M_references < 0; }
Program received signal SIGSEGV, Segmentation fault.
_ZNKSs4_Rep12_M_is_leakedEv (this=0xfffffff4)
at /usr/local/xmlg/include/g++-v3/bits/basic_string.h:145
this = (_Rep *) 0xfffffff4
*this --> Cannot access memory at address 0xfffffff4
When I put in the __LINE__ and __FILE__ entries, the tests pass.
I'll be rooting around cppunit's source code, trying to rig it to work properly; however, if this is something you've encountered and fixed, please enlighten me as to the proper course of action.
Much appreciated,
-Keith-