#197 TestSuite w. PlugInManager Error on Visual 2005

open
5
2009-03-19
2009-03-19
skalimer0
No

Hello,

I use wxTestRunner application to load (with PlugInManager a test dll.

in my code i have :

CppUnit::PlugInManager _plugInManager;
CppUnit::TestSuite *_suite;

i make :

_plugInManager.load(dll_name);
_suite->addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());

After that i create a tree (on wxWidget window) who represente the TestSuite, it will be by this function :

void wxTestRunnerTree::AddTestItems(wxTreeItemId &parentId, CppUnit::Test *suite)
{
int nbelts = suite->getChildTestCount();
int childIndex = 0;
wxString str;
for ( ; childIndex < nbelts; ++childIndex ) {
CppUnit::Test *test = suite->getChildTestAt( childIndex );
str = test->getName();
int image, imageSel;
if (test->getChildTestCount() == 0)
image = TreeCtrlIcon_File;
else
image = TreeCtrlIcon_Folder;
imageSel = image + 1;
wxTreeItemId id = AppendItem(parentId, str, image, imageSel,
new MyTreeItemData(str, test));

// and now we also set the expanded one (only for the folders)
if ( test->getChildTestCount() ) {
SetItemImage(id, TreeCtrlIcon_FolderOpened, wxTreeItemIcon_Expanded);
AddTestItems(id, test);
}
}
}

I don't have problem with Borland 5.0 and the tree is build.
But in Visual Studio 2005, i have an execution error on test->getName(). It return the good value (apparently the TestSuite is build correctly) but crash on a std::string destructor just after that.

Thanks for any fast return.

Discussion

  • skalimer0

    skalimer0 - 2009-03-19

    I just use wxWidget 2.8.9 and cppUnit 1.12.1 on Visual Studio 2005

     
  • skalimer0

    skalimer0 - 2009-03-19

    I think i have the response....

    Apparently.. if i change :
    CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite( "Communication Test" );
    suiteOfTests->addTest( new CppUnit::TestCaller<IntMessComm>("Communication Test 1", &IntMessS2000PM2::tu_startcomOK));

    by :
    CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite( "Comm Test" );
    suiteOfTests->addTest( new CppUnit::TestCaller<IntMessComm>("Comm Test 1", &IntMessS2000PM2::tu_startcomOK));

    it's work !!!

    all names mustn't exceed 15 caracters !!!

    It's quick test... i try with pluginmanger now....

     
  • skalimer0

    skalimer0 - 2009-03-19

    It's also OK with plugInManager...but the unload method (of plugInManager) crash.

     
  • Baptiste Lepilleur

    Are you sure that you use the same run-time across all your libraries? The bug you describe sound a like lot incompatible heap:
    - memory allocated in the plug-in is freed with another incompatible allocator outside the plug-in leading to a crash.
    => the 15 characters limit is due to an std::string optimization that avoid allocating memory if the string is small enough....

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks