void CTe_LbsSimulationPSYSuiteStepBase::HeapTestL(const TInt aIndex) { #ifdef __DEBUG__ TInt err = KErrNone; TBool warn = EFalse; const TInt KHeapFailureMaxLoop = KMaxTInt32 - 1; for (TInt i = 1; i < KHeapFailureMaxLoop; i++) { __UHEAP_FAILNEXT(i); __UHEAP_MARK; TRAP(err, DoTestL(aIndex)); __UHEAP_MARKEND; // If no error occurred, fake a memory error to // make sure that this is the last test. If this // last allocation goes wrong, it proves that the // FAILNEXT() macro has reached its limit in this // test. if (err != KErrNoMemory) { TInt* dummy = new TInt; warn = (dummy != NULL); delete dummy; } __UHEAP_RESET; if ((err != KErrNoMemory) && !warn) { break; } if (warn) { // Commenting this out means we do not catch non leaving allocs // unfortunately testing for these generates too many false positives // as every use of INFO_PRINT triggers it. //LogTrap(aIndex); } } if (err != KErrNone) { User::Leave(err); } #else DoTestL(aIndex); #endif }
GLDEF_C TInt E32Main() { __UHEAP_MARK; CActiveScheduler* scheduler=new CActiveScheduler; if (scheduler) { CActiveScheduler::Install(scheduler); CTrapCleanup* cleanup=CTrapCleanup::New(); if (cleanup) { test.Title(); test.Start(_L("T_HintExtension")); TRAPD(err, DoTestL()); test(err == KErrNone); test.End(); //test.Printf(_L("Exiting in one second...\n")); User::After(1000000); test.Close(); delete cleanup; } delete scheduler; } __UHEAP_MARKEND; return KErrNone; }
TInt E32Main() { __UHEAP_MARK; CTrapCleanup* tc = CTrapCleanup::New(); TEST(tc != NULL); TInt err = TheDbs.Connect(); TEST2(err, KErrNone); TBuf<32> format; TheTest.Printf(_L("Open database\n")); format.Copy(KSecure); format.Append(KSecureDbUid.Name()); err = TheDb.Open(TheDbs, KDbName, format); TEST2(err, KErrNone); TRAP(err, DoTestL()); TEST2(err, KErrNone); TheView.Close(); TheTbl.Close(); TheDb.Close(); TheDbs.Close(); TheTest.End(); TheTest.Close(); delete tc; __UHEAP_MARKEND; User::Heap().Check(); return KErrNone; }
TInt E32Main() { __UHEAP_MARK; test.Start(_L("@SYMTESTCaseID:PIM-TCAL-GSENTRY-0001 Calendar Interim API Group Scheduling test suite")); test.Title(); CTrapCleanup* trapCleanup = CTrapCleanup::New(); if (!trapCleanup) { return KErrNoMemory; } CActiveScheduler* scheduler = new CActiveScheduler(); if (!scheduler) { delete trapCleanup; return KErrNoMemory; } CActiveScheduler::Install(scheduler); TRAPD(ret, DoTestL()); test(ret == KErrNone); delete scheduler; delete trapCleanup; test.End(); test.Close(); __UHEAP_MARKEND; return (KErrNone); }
GLDEF_C TInt E32Main() { __UHEAP_MARK; CActiveScheduler* scheduler=new CActiveScheduler; if (scheduler) { CActiveScheduler::Install(scheduler); CTrapCleanup* cleanup=CTrapCleanup::New(); if (cleanup) { test.Title(); test.Start(_L("@SYMTESTCaseID:PIM-T-DATACOMPATIBILITY-0001 T_DataCompatibility")); TRAPD(err, DoTestL()); // delete database files if they are not cleaned up elsewhere TRAP_IGNORE(CleanupFilesL() ); test(err == KErrNone); test.End(); User::After(1000000); // wait 1 second and exit test.Close(); delete cleanup; } delete scheduler; } __UHEAP_MARKEND; return KErrNone; }
/** * * Do the test step. * Each test step must supply an implementation for DoTestStepL. * * @return "TVerdict" * The result of the test step * */ TVerdict CTestStepDevVideoPlayAllocFail::DoTestStepL() { TVerdict ret = EFail; // do we want to do anything else in the base class? // call alloc test step ret = DoTestL(); return ret; }
TInt TestMainL() { // Create and install the active scheduler CActiveScheduler* exampleScheduler=new (ELeave) CActiveScheduler; CleanupStack::PushL(exampleScheduler); CActiveScheduler::Install(exampleScheduler); // Call function TInt result = DoTestL(); CleanupStack::PopAndDestroy(exampleScheduler); return result; }
/** * Load and initialise an audio file. */ TVerdict CTestVclntVideoFile::DoTestStepL() { TVerdict ret = EFail; iError = KErrTimedOut; INFO_PRINTF1(_L("Test : Video Player - File")); TPtrC filename; if(!GetStringFromConfig(iSectName,iKeyName,filename)) return EInconclusive; InitWservL(); TRect rect, clipRect; CVideoPlayerUtility* player = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality, iWs, *iScreen, *iWindow, rect, clipRect); CleanupStack::PushL(player); TRAP(iError,player->OpenFileL(filename)); if(iError == KErrNone) { // Wait for initialisation callback INFO_PRINTF1(_L("CVideoPlayerUtility: Opening file")); CActiveScheduler::Start(); } // Until JetStream #ifndef JETSTREAM_TESTS if(iError == KErrNotSupported) ret = EPass; #endif // Check for errors. if (iError == KErrNone && player != NULL) { player->Prepare(); CActiveScheduler::Start(); } // Check for errors. if (iError == KErrNone && player != NULL) ret = DoTestL(player); INFO_PRINTF1(_L("CVideoPlayerUtility: Destroying")); CleanupStack::PopAndDestroy(player); if(iError != KErrNone) ERR_PRINTF2( _L("CVideoPlayerUtility failed with error %d"),iError ); return ret; }
/** * Load and initialise an audio descriptor. */ TVerdict CTestVclntVideoDes::DoTestStepL() { TVerdict ret = EFail; INFO_PRINTF1(_L("Test : Video Player - Descriptor")); iError = KErrTimedOut; InitWservL(); TRect rect, clipRect; CVideoPlayerUtility* player = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality, iWs, *iScreen, *iWindow, rect, clipRect); CleanupStack::PushL(player); TRAP(iError, player->OpenDesL(iVideo->Des())); if(iError == KErrNone) { INFO_PRINTF1(_L("CVideoPlayerUtility: Opening descriptor")); // Wait for init callback CActiveScheduler::Start(); } // Until JetStream #ifndef JETSTREAM_TESTS if(iError == KErrNotSupported) ret = EPass; #endif if (iError == KErrNone && player != NULL) { player->Prepare(); CActiveScheduler::Start(); } if ((iError == KErrNone) && (player != NULL)) ret = DoTestL(player); INFO_PRINTF1(_L("CVideoPlayerUtility: Destroying")); CleanupStack::PopAndDestroy(player); if(iError != KErrNone) ERR_PRINTF2( _L("CVideoPlayerUtility failed with error %d"),iError ); return ret; }
void CBenchMarker::RunL() { iTest.Printf(_L("Starting CntModel benchmarks...\n")); // This forces the console to get loaded under WINS - would otherwise scew profiles. for (TInt i=0;i<ENumTests;++i) { StartProfile(); TInt timeMinorNumber=0; TRAPD(err,timeMinorNumber=DoTestL(TTest(i))); if (err) { iLog->LogLine(_L("Test %d left with %d"),i,err); break; } LogResult(i,timeMinorNumber,KTimeProfileFormat,EndProfile()); User::CompressAllHeaps(); TMemoryInfoV1Buf memoryBuf; UserHal::MemoryInfo(memoryBuf); TMemoryInfoV1 memory(memoryBuf()); const TInt totalK=memory.iTotalRamInBytes>>10; const TInt freeK=memory.iFreeRamInBytes>>10; const TInt usedK=totalK-freeK; LogResult(i,timeMinorNumber+1,KSystemMemoryFormat,usedK); TInt allocSize; User::Heap().AllocSize(allocSize);; allocSize>>=10; LogResult(i,timeMinorNumber+2,KThreadMemoryFormat,allocSize); } iTest.Printf(_L("Dump log to comm port? (y/n) ")); TKeyCode key=iTest.Getch(); if (key=='y' || key=='Y') { writelog: iLog->WriteLogToCommPortL(); } iTest.Printf(_L("\nAgain? (y/n)")); key=iTest.Getch(); if (key=='y' || key=='Y') { goto writelog; } }
/** * Open audio from a URL and play. */ TVerdict CTestVclntVideoUrl::DoTestStepL() { TVerdict ret = EFail; INFO_PRINTF1(_L("Test : Video Player - URL")); iError = KErrTimedOut; TPtrC urlname; if(!GetStringFromConfig(iSectName,iKeyName,urlname)) return EInconclusive; InitWservL(); TRect rect, clipRect; CVideoPlayerUtility* player = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality, iWs, *iScreen, *iWindow, rect, clipRect); // wait for init to complete CleanupStack::PushL(player); player->OpenUrlL(urlname); INFO_PRINTF1(_L("CVideoPlayerUtility: Opening URL")); CActiveScheduler::Start(); // Until JetStream #ifndef JETSTREAM_TESTS if(iError == KErrNotSupported) ret = EPass; #endif if (iError == KErrNone) { player->Prepare(); CActiveScheduler::Start(); } if (iError == KErrNone) ret = DoTestL(player); INFO_PRINTF1(_L("CVideoPlayerUtility: Destroying")); CleanupStack::PopAndDestroy(player); if(iError != KErrNone) ERR_PRINTF2( _L("CVideoPlayerUtility failed with error %d"),iError ); return ret; }
void CTestBase::RunL() { if(!iTestFinished) { if(!iWaiting) { DoTestL(); CActiveScheduler::Stop(); } else { //if test hasnt finished and is waiting for notification then it must have //failed as timer on waiting for notification has expired. iTest->Printf(_L("ERROR:No notification received")); (*iTest)(EFalse); } } }
GLDEF_C TInt E32Main() { __UHEAP_MARK; CActiveScheduler* scheduler=new CActiveScheduler; if (scheduler) { CActiveScheduler::Install(scheduler); CTrapCleanup* cleanup=CTrapCleanup::New(); test.Start(_L("@SYMTESTCaseID:PIM-T-LOWDISKSPACE-0001 T_LOWDISKSPACE")); TRAPD(r, DoTestL()); test(r == KErrNone); test.End(); test.Close(); delete scheduler; delete cleanup; } __UHEAP_MARKEND; return KErrNone; }
//Usage: "t_dbperf3 [<drive letter>:]" TInt E32Main() { TheTest.Title(); TheTrapCleanup = CTrapCleanup::New(); TEST(TheTrapCleanup != NULL); //Construct test database file name _LIT(KTestDatabase, "c:\\dbms-tst\\t_dbperf3.db"); TFileName fname; User::CommandLine(fname); TParse parse; parse.Set(fname, &KTestDatabase, 0); const TDesC& dbFilePath = parse.FullName(); TheDatabaseFileName.Copy(dbFilePath); TheTest.Printf(_L("Test database: %S\r\n"), &TheDatabaseFileName); __UHEAP_MARK; TInt err = TheFs.Connect(); TEST2(err, KErrNone); err = TheFs.MkDir(TheDatabaseFileName); TheTest.Printf(_L("MkDir(): err=%d\r\n"), err); TEST(err == KErrNone || err == KErrAlreadyExists); DeleteFile(TheDatabaseFileName); TRAP(err, DoTestL()); TEST2(err, KErrNone); CloseAll(); DeleteFile(TheDatabaseFileName); __UHEAP_MARKEND; TheTest.End(); TheTest.Close(); delete TheTrapCleanup; return KErrNone; }
// --------------------------------------------------------- // LOCAL_C TInt MyThreadFunctionL(TAny* aData) // Runs the DoTestL in a TRAP nest // Panics this thread if any errors occurred // --------------------------------------------------------- // LOCAL_C TInt MyThreadFunctionL(TAny* aData) { __UHEAP_MARK; CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack // Read parameters from TAny* MyAnyData* info = (MyAnyData*) aData; TInt result = KErrNone; TInt err = KErrNone; // Why must this function be TRAPPED? TRAP(err, DoTestL(info->iFullTest, info->iNrOfRuns, &result)); _LIT(KErrorConnect, "Error when connecting to RPositionServer"); __ASSERT_ALWAYS(!err, User::Panic(KErrorConnect, err)); __ASSERT_ALWAYS(result == KErrNone, User::Panic(KErrorConnect, result)); delete cleanup; // destroy clean-up stack __UHEAP_MARKEND; return 0; }
GLDEF_C TInt E32Main() { __UHEAP_MARK; g_test.Start(_L("Speed dial test")); CActiveScheduler* scheduler=new CActiveScheduler; if (scheduler) { CActiveScheduler::Install(scheduler); CTrapCleanup* cleanup=CTrapCleanup::New(); if (cleanup) { TRAPD(err,DoTestL() ); g_test(err == KErrNone); delete cleanup; } delete scheduler; } g_test.Close(); __UHEAP_MARKEND; return KErrNone; }
TInt CTestDriveOOMVoiceCall::DriveETelApiL() // // This function contains the real meat of the Client-side test code // { CloseDown(); User::After(KETelServerShutdownGuardPeriod); TInt n=1; for(;;n++) { INFO_PRINTF2(_L("Fail After %d allocs... "),n); TInt res=DoTestL(n); INFO_PRINTF2(_L("Result=%d"),res); if(res==KErrNone) break; RestartScript(); User::After(KETelServerShutdownGuardPeriod); } OpenUpL(); TerminateScript(); return KErrNone; }
// --------------------------------------------------------- // CPosTp52::StartL // // (other items were commented in a header). // --------------------------------------------------------- // void CPosTp52::StartL() { iLog->Log(_L("1)) *********************")); DoTestL(KErronousXMLFile, KLmxMimeType, KErrPosLmUnknownFormat); DoTestL(KErronousXMLFile, KGpxMimeType, KErrPosLmUnknownFormat); iLog->Log(_L("2)) *********************")); DoTestL(KUnknownTags, KLmxMimeType, KErrNone, 1); DoTestL(KUnknownTags, KGpxMimeType, KErrNone, 1); DoTestL(KUnknownTrees, KLmxMimeType, KErrNone, 1); DoTestL(KUnknownTrees, KGpxMimeType, KErrNone, 1); iLog->Log(_L("3)) *********************")); DoTestL(KNoEndTag1, KLmxMimeType, EXmlTagMismatch, 0); DoTestL(KNoEndTag1, KGpxMimeType, EXmlTagMismatch, 0); iLog->Log(_L("4)) *********************")); DoTestL(KNoEndTag2, KLmxMimeType, KErrPosLmUnknownFormat, 0); DoTestL(KNoEndTag2, KGpxMimeType, KErrPosLmUnknownFormat, 0); // Containing XML tags as data field iLog->Log(_L("5)) *********************")); DoTestL(KXMLFileWithXMLTagAsDataField1, KLmxMimeType, EXmlTagMismatch, 0); DoTestL(KXMLFileWithXMLTagAsDataField1, KGpxMimeType, EXmlTagMismatch, 0); // Containing XML tags as data field iLog->Log(_L("6)) *********************")); DoTestL(KXMLFileWithXMLTagAsDataField2, KLmxMimeType, EXmlTagMismatch, 0); DoTestL(KXMLFileWithXMLTagAsDataField2, KGpxMimeType, EXmlTagMismatch, 0); // Containing XML tags as data field iLog->Log(_L("7)) *********************")); DoTestL(KXMLFileWithXMLTagAsDataField3, KLmxMimeType, EXmlTagMismatch, 0); DoTestL(KXMLFileWithXMLTagAsDataField3, KGpxMimeType, EXmlTagMismatch, 0); iLog->Log(_L("8)) *********************")); DoTestL(KXMLFileWithEmptyCollection, KLmxMimeType, KErrPosLmUnknownFormat, 0); // N/A for GPX iLog->Log(_L("9)) *********************")); DoTestL(KXMLFileWithLongCategoryName, KLmxMimeType, KErrNone, 1); CheckLongCategoryNameL(4); DoTestL(KXMLFileWithLongCategoryName, KGpxMimeType, KErrNone, 1); CheckLongCategoryNameL(1); iLog->Log(_L("10)) *********************")); DoTestL(KXMLFileWithLongLandmarkName, KLmxMimeType, KErrNone, 1); CheckLongLandmarkNameL(); DoTestL(KXMLFileWithLongLandmarkName, KGpxMimeType, KErrNone, 1); CheckLongLandmarkNameL(); iLog->Log(_L("11)) *********************")); DoTestL(KXMLFileWithLongLatitudeField, KLmxMimeType, KErrNone, 1); DoTestL(KXMLFileWithLongLatitudeField, KGpxMimeType, KErrNone, 1); iLog->Log(_L("12)) *********************")); DoTestL(KErronousXMLFileDataMissing1, KLmxMimeType, KErrPosLmUnknownFormat, 0); DoTestL(KErronousXMLFileDataMissing1, KGpxMimeType, KErrPosLmUnknownFormat, 0); iLog->Log(_L("13)) *********************")); DoTestL(KErronousXMLFileDataMissing2, KLmxMimeType, KErrNone, 1); DoTestL(KErronousXMLFileDataMissing2, KGpxMimeType, KErrNone, 1); iLog->Log(_L("14)) *********************")); DoTestL(KErronousXMLFileDataMissing3, KLmxMimeType, KErrNone, 1); DoTestL(KErronousXMLFileDataMissing3, KGpxMimeType, KErrNone, 1); iLog->Log(_L("15)) *********************")); DoTestL(KXMLFileWithQuotedXMLTagAsDataField1, KLmxMimeType, KErrNone, 2); DoTestL(KXMLFileWithQuotedXMLTagAsDataField1, KGpxMimeType, KErrNone, 2); if (iErrorsFound != KErrNone) { iLog->Log(_L("Errors were found in Tp52")); User::Leave(-1); } }
/** * * Do the test step. * Each test step must supply an implementation for DoTestStepL. * * @return "TVerdict" * The result of the test step * * @xxxx * */ TVerdict CTestStepConverterSharedHeapMultiFile::DoTestStepL() { INFO_PRINTF1(_L("This is a test that several converter utilities using a shared heap can be created.")); return DoTestL( EConvert ); }
/** * * Do the test step. * Each test step must supply an implementation for DoTestStepL. * * @return "TVerdict" * The result of the test step * * @xxxx * */ TVerdict CTestStepRecorderSharedHeapMultiFilePlayer::DoTestStepL() { INFO_PRINTF1(_L("This is a test that several recorder utilities using a shared heap can be created.")); return DoTestL( ERecord ); }
void CTParam::RunTestCaseL(TInt aCurTestCase) { ((CTParamStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); switch(aCurTestCase) { case 1: { ((CTParamStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0084")); INFO_PRINTF1(_L("Test display mode EGray256")); DoTestL(EGray256); break; } case 2: { ((CTParamStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0084")); INFO_PRINTF1(_L("Test display mode EColor256")); DoTestL(EColor256); break; } case 3: { ((CTParamStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0084")); INFO_PRINTF1(_L("Test display mode EColor4K")); DoTestL(EColor4K); break; } case 4: { ((CTParamStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0084")); INFO_PRINTF1(_L("Test display mode EColor64K")); DoTestL(EColor64K); break; } case 5: { ((CTParamStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0084")); INFO_PRINTF1(_L("Test display mode EColor16M")); DoTestL(EColor16M); break; } case 6: { ((CTParamStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0084")); INFO_PRINTF1(_L("Test display mode EColor16MU")); DoTestL(EColor16MU); break; } case 7: { ((CTParamStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0084")); INFO_PRINTF1(_L("Test display mode EColor16MA")); DoTestL(EColor16MA); break; } case 8: { ((CTParamStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0084")); INFO_PRINTF1(_L("Test display mode EColor16MAP")); DoTestL(EColor16MAP); break; } case 9: { ((CTParamStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); ((CTParamStep*)iStep)->CloseTMSGraphicsStep(); TestComplete(); break; } } ((CTParamStep*)iStep)->RecordTestResultL(); }