CPPUNIT аварийно завершает работу после выполнения моей программы при возврате из main на этапе очистки. dtor TestWrapping вызывает dtor TestSuite, который затем вызывает deleteContents, который запускает очистку тестовых случаев.
Что странно, так это то, что dtor TestSuite вызывается дважды? Это следует за успешным выполнением 6 тестовых случаев. Любая идея о том, как этого можно избежать?
Program terminated with signal 11, Segmentation fault.
#0 0x0000000000000045 in ?? ()
(gdb) bt
#0 0x0000000000000045 in ?? ()
#1 0x0000000000000001 in ?? ()
#2 0x0000000001004f2d in CppUnit::TestSuite::~TestSuite (this=0x7fe7bc005820, __in_chrg=<optimized out>) at TestSuite.cpp:18
#3 0x0000000001004ebd in CppUnit::TestSuite::deleteContents (this=0x7fe7bc001040) at TestSuite.cpp:28
#4 0x000000000100500d in CppUnit::TestSuite::~TestSuite (this=0x7fe7bc005820, __in_chrg=<optimized out>) at TestSuite.cpp:18
#5 0x0000000001004c50 in CppUnit::TestRunner::WrappingSuite::~WrappingSuite (this=0x7fe7bc005820, __in_chrg=<optimized out>) at ../../include/cppunit/TestRunner.h:101
#6 0x000000000040b72a in main (argc=0, argv=0x7fff8198bf08) at /project/EAB3_EMC/BRF/lmcgupe/brf/build/../software/brfc_test/BrfcTestMain.cc:447
Code exercising this:
(from main)
CppUnit::TextUi::TestRunner runner;
CPPUNIT_NS::TestResult controller;
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Show a message as each test starts
//
CppUnit::BriefTestProgressListener listener;
runner.eventManager().addListener(&listener);
controller.addListener( &listener );
// Specify XML output and inform the runner of this format
//
std::ofstream xmlout("test_result.xml");
CppUnit::XmlOutputter* outputter = new CppUnit::XmlOutputter(
&result, xmlout);
runner.setOutputter(outputter);
CppUnit::TextOutputter consoleOutputter(&result , std::cout);
runner.addTest(CreateAlarmBackupSuite::suite());
runner.run( controller );
from class CreateAlarmBackupSuite: public CppUnit::TestFixture
static CppUnit::Test *suite()
{
// Create the Test Suite
//
CppUnit::TestSuite *suite = new CppUnit::TestSuite("CreateAlarmBackupSuite");
// Add the test cases
//Crt_Syst_07
suite->addTest(new CppUnit::TestCaller<CreateAlarmBackupSuite>(
"07_Crt_ScheduledBackup_ScheduledSingleEvent_SystemDataBackup_Non_Successful_Create_Persistent_ManualDelNotClear",
&CreateAlarmBackupSuite::Crt_ScheduledBackup_ScheduledSingleEvent_SystemDataBackup_Non_Successful_Create_Persistent_ManualDelNotClear));
//Crt_Syst_09
suite->addTest(new CppUnit::TestCaller<CreateAlarmBackupSuite>(
"09_Crt_ScheduledBackup_ScheduledSingleEvent_SystemDataBackup_Non_Successful_Create_Transient_NoRetry",
&CreateAlarmBackupSuite::Crt_ScheduledBackup_ScheduledSingleEvent_SystemDataBackup_Non_Successful_Create_Transient_NoRetry));
return suite;
}