Hi Steve, Thanks hugely for looking into this.
On Sun, Feb 25, 2007 at 10:36:21AM -0800, Steve Langasek wrote: > On Sun, Feb 25, 2007 at 01:14:44AM -0800, Steve Langasek wrote: > > Looking at the code, I gather that it's expected for this test to throw an > > assertion, and the problem is that it blows up on the other end. Other > > tests that use CPPUNIT_ASSERT_ASSERTION_FAIL() seem to work ok, though, so > > it doesn't seem to be a general problem with exception handling on alpha. Have you actually seen a test using CPPUNIT_ASSERT_ASSERTION_FAIL() work ok? In the buildd logs, the only tests that successfully complete (src/cppunit/t_link, src/DllPlugInTester/DllPlugInTesterTest, and examples/hierarchy) do *not* use CPPUNIT_ASSERT_ASSERTION_FAIL. And the next test, examples/cppunittest/cppunittestmain, blows up at the first usage of CPPUNIT_ASSERT_ASSERTION_FAIL. Just in case you were mistaken about seeing CPPUNIT_ASSERT_ASSERTION_FAIL work correctly, I'm attaching a small test case to exercise it. If it fails to work with -O2, but does work with -O0, perhaps the assembly might clue us in on what is being optimized away. > > I'll dig a bit further and see what I can see. > > Well, debugging this is pretty non-trivial. I've figured out that > parse_lsda_header() is used for "language-specific data" in the objects that > the exception is being generated for, but half of the activity for this > happens within libgcc, for which no debugging version is available. > > I've tried rebuilding cppunit itself with different -g options (-gstabs, or > without -g at all) to see if that would have any effect; it didn't. Still > bombs out at the same place. > > Ah, but building with -O0 does the trick -- so there's a workaround for you > if you'd care to go with that. Thanks! I'll take that if no better solution can be found. -Steve
#include <cppunit/extensions/HelperMacros.h> #include <cppunit/CompilerOutputter.h> #include <cppunit/TestResult.h> #include <cppunit/TestResultCollector.h> #include <cppunit/TestRunner.h> #include <cppunit/TextTestProgressListener.h> #include <cppunit/BriefTestProgressListener.h> #include <cppunit/XmlOutputter.h> #include <cppunit/extensions/TestFactoryRegistry.h> #include <stdexcept> #include <fstream> class MyTester : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( MyTester ); CPPUNIT_TEST( myTest ); CPPUNIT_TEST_SUITE_END(); public: void myTest() { CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_EQUAL( 0, 1 ) ); } }; int main( int argc, char* argv[] ) { CPPUNIT_NS::TestResultCollector result; CPPUNIT_NS::BriefTestProgressListener progress; CPPUNIT_NS::TestResult controller; controller.addListener( &result ); controller.addListener( &progress ); CPPUNIT_NS::TestRunner runner; runner.addTest( MyTester::suite() ); try { runner.run( controller ); // Print test in a compiler compatible format. CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() ); outputter.write(); } catch ( std::invalid_argument &e ) // Test path not resolved { CPPUNIT_NS::stdCOut() << "\n" << "ERROR: " << e.what() << "\n"; return 0; } return result.wasSuccessful() ? 0 : 1; }