Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 49305 - cppunit segfaults or SIGABRTs on failed assertions
Summary: cppunit segfaults or SIGABRTs on failed assertions
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: George Shapovalov (RETIRED)
URL: http://c2.com/cgi/wiki?DirtSimpleCppU...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-28 11:21 UTC by yagu
Modified: 2005-07-15 17:33 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yagu 2004-04-28 11:21:25 UTC
CPPUnit tests consistently die on failed assertions, rather than dumping their usual useful information.

Originally, they would segfault upon reaching the failed assertion.  I tried remerging cppunit and now they're "Aborted" with a SIGABRT.

Reproducible: Always
Steps to Reproduce:
1.  Download the Dirt Simple CPPUnit example from their Wiki and copy it into a file (http://c2.com/cgi/wiki?DirtSimpleCppUnitExample)

2.  Add "#include <cassert>" or remove all references to assert().

3.  Change line #123 from "CPPUNIT_ASSERT (1 == 1);" to "CPPUNIT_ASSERT (2 == 1);"

4.  Compile and run: "g++ -g -o dirt dirt.cpp -lcppunit && ./dirt"

5.  Or run with gdb: "gdb ./dirt"

Actual Results:  
4:  ".Aborted"

5:
Starting program: ./dirt
.
Program received signal SIGABRT, Aborted.
0x4f71f731 in kill () from /lib/libc.so.6
(gdb) back
#0  0x4f71f731 in kill () from /lib/libc.so.6
#1  0x4f71f4d5 in raise () from /lib/libc.so.6
#2  0x4f720a7b in abort () from /lib/libc.so.6
#3  0x4fab88d7 in __cxa_call_unexpected ()
   from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libstdc++.so.5
#4  0x4fab8914 in std::terminate() ()
   from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libstdc++.so.5
#5  0x4fab8a86 in __cxa_throw ()
   from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libstdc++.so.5
#6  0x4002e30c in CppUnit::Asserter::fail(std::string, CppUnit::SourceLine)
    () from /usr/lib/libcppunit-1.8.so.0

Expected Results:  
Diagnostic output from CPPUnit describing the assertion that failed.

This happens on all tests I try to run, including old tests that used to work
fine for me and examples downloaded from cppunit.

Thanks.
Comment 1 yagu 2004-04-28 11:30:59 UTC
By the way, I'm using CPPUnit 1.8.0, GCC 3.3.2, Linux 2.6.5, and gdb 5.3.
Comment 2 Maurice van der Pot (RETIRED) gentoo-dev 2005-07-15 10:01:52 UTC
Yagu, is this problem still present in the latest version?
George, can you handle this one? It's been over a year.
Comment 3 yagu 2005-07-15 11:09:05 UTC
Hi; thanks for checking in.

I haven't used cppunit much in the past year but I went ahead and tried the same
test I initially described using cppunit 1.10.2 and it seems to be working now
-- no segfaults or aborts.

However, I had to explicitly link with the dl library when compiling in order to
 import dlclose, dlopen, and dlsym:

  $ g++ -g -o test test.cpp -lcppunit -ldl

Similar to Bug #49309
Comment 4 George Shapovalov (RETIRED) gentoo-dev 2005-07-15 16:39:42 UTC
Then I guess we should close this bug. I retested the package and it seems to   
build Ok, however I have no reasonable means to check the result, as I do not   
use it. But considering nobody else had this problem (at least as far as bug 
reports go :)) I think we can rely on yago's testing. 
  
As for:   
>However, I had to explicitly link with the dl library when compiling in order  
>to import dlclose, dlopen, and dlsym:  
isn't this how C/C++ build system is supposed to work?  
  
George  
Comment 5 yagu 2005-07-15 17:33:16 UTC
> >However, I had to explicitly link with the dl library when compiling in order  
> >to import dlclose, dlopen, and dlsym:  
> isn't this how C/C++ build system is supposed to work?  

I'm no expert on this but you may want to review the bug I referenced (Bug
#49309) since they don't seem to think so.  Also, at the time I posted this bug,
-ldl wasn't necessary.

Thanks, George.