/** @SYMTestCaseID SYSLIB-XML-CT-3744 @SYMTestCaseDesc Function to convert a test into an OOM test. @SYMTestPriority Medium @SYMTestActions Creates a low memory situation and runs the set of tests to make sure the component(s) works in such conditions. @SYMTestExpectedResults Tests continue to pass, even in low memory conditions. @SYMPREQ PREQ230 */ LOCAL_C void OomTest(void (*testFuncL)()) { TInt error; TInt count = 0; do { User::__DbgSetAllocFail(RHeap::EUser, RHeap::EFailNext, ++count); User::__DbgMarkStart(RHeap::EUser); TRAP(error, (testFuncL)()); User::__DbgMarkEnd(RHeap::EUser, 0); } while(error == KErrNoMemory); _LIT(KTestFailed, "Out of memory test failure on iteration %d\n"); __ASSERT_ALWAYS(error==KErrNone, test.Panic(error, KTestFailed, count)); User::__DbgSetAllocFail(RHeap::EUser, RHeap::ENone, 1); }