|
-
April 25th, 2011, 08:49 AM
#1
Cpp unit testing of classes
I am an intern in Hp Global software pvt ltd.My job out here is to test native cpp modules.I have encountered a serious problem.my code doesnt have any error but when i debug it,it breaks with a message
[Windows has triggered a breakpoint in STAR_RemoteDeployer.exe.
This may be due to a corruption of the heap, which indicates a bug in STAR_RemoteDeployer.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while STAR_RemoteDeployer.exe has focus.
The output window may have more diagnostic information.]
And i am directed to free.c page and the error shown is-
retval = HeapFree(_crtheap, 0, pBlock);
(error over here)-> if (retval == 0)
{
errno = _get_errno_from_oserr(GetLastError());
}
this is my main program
int main (int argc, char* argv[])
{
// informs test-listener about testresults
CPPUNIT_NS :: TestResult testresult;
// register listener for collecting the test-results
CPPUNIT_NS :: TestResultCollector collectedresults;
testresult.addListener (&collectedresults);
// register listener for per-test progress output
CPPUNIT_NS :: BriefTestProgressListener progress;
testresult.addListener (&progress);
// insert test-suite at test-runner by registry
CPPUNIT_NS :: TestRunner testrunner;
testrunner.addTest (CPPUNIT_NS :: TestFactoryRegistry::getRegistry().makeTest ());
testrunner.run (testresult);(this is the place where it is getting stuck everytime)
// output results in compiler-format
CPPUNIT_NS :: CompilerOutputter compileroutputter (&collectedresults, std::cerr);
compileroutputter.write ();
// return 0 if tests were successful
return collectedresults.wasSuccessful () ? 0 : 1;
}
please help.i have to give a presentation soon in my office.
-
April 25th, 2011, 10:56 AM
#2
Re: Cpp unit testing of classes
Well I'm sorry to tell you that your code or the code you're testing have bugs. Most likely you have either a buffer overrun bug or a double delete bug.
Run it in the debugger and when it breaks check the callstack and variables for clues.
-
April 26th, 2011, 04:25 AM
#3
Re: Cpp unit testing of classes
the main program worked fine when i used in a project of my own.when i decided to add the test cases in the same project that i was supposed to test,the problem arised(thats what i was asked to do by my team mentor).
The parent project is working fine individually and the cppunit testing is working fine when used individually,but when they are merged problem arises.
It worked on the same station,OS and there had been no updates,rollbacks or system restores.
the o/p to "errno" is not helping too
-
April 26th, 2011, 10:58 AM
#4
Re: Cpp unit testing of classes
There's a hidden bug in the code somewhere. Adding the testcases changed how the code is laid out in memory, revealing the bug. Did you run it in a debugger?
Viggy
-
April 27th, 2011, 03:43 AM
#5
Re: Cpp unit testing of classes
I have run in a debugger.i will again go thru it.which code are u talking abt the parent code or the main function of the test casses
-
April 27th, 2011, 03:15 PM
#6
Re: Cpp unit testing of classes
Could be either one...
Viggy
-
April 28th, 2011, 04:45 AM
#7
Re: Cpp unit testing of classes
while running in the debugging executable its running fine but while debugging in the debugging executable its breaking.
Any help?
-
April 28th, 2011, 05:18 AM
#8
Re: Cpp unit testing of classes
When "its breaking" have a look at the Call stack and find the last line of your own code executed before (or while) breaking.
Victor Nijegorodov
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|