void CCompare::ConstructL(const TTestActionSpec& aTestActionSpec) { CKeyStoreTestAction::ConstructL(aTestActionSpec); TInt err = KErrNone; TInt pos = 0; TDriveUnit sysDrive (RFs::GetSystemDrive()); TBuf<128> ramDrive (sysDrive.Name()); ramDrive.Append(_L("\\tkeystore\\data\\")); iOriginalFile = ramDrive; iNewFile = ramDrive; TFileName buf; buf.FillZ(); buf.Copy(Input::ParseElement(aTestActionSpec.iActionBody, KOriginalFile, KOriginalFileEnd, pos, err)); // Now the filename itself iOriginalFile.Append(buf); buf.Copy(Input::ParseElement(aTestActionSpec.iActionBody, KNewFile, KNewFileEnd, pos, err)); // Now the filename itself iNewFile.Append(buf); // iExpectedResult = SetExpectedResultL(Input::ParseElement(aTestActionSpec.iActionResult, // KReturnStart, // KReturnEnd, pos, err)); }
// start run a test case void CTestExecutor::RunTestCaseL() { RSemaphore smphF; smphF.CreateLocal(0); RSemaphore smphN; smphN.CreateLocal(0); RArray<RThread> notiThreads; // list of handles of notification threads RPointerArray<CTimerLogger> loggerList; TUint16 count = 0; TUint16 option = iTestSetting.iOption; while (count < iTestSetting.iNumCli) { test(count < 16); iTestSetting.iOption = (TUint16)(option + count); // Put Thread ID in option TThreadParam param; param.iSetting = iTestSetting; param.iSmphFT = &smphF; param.iSmphNT = &smphN; TFileName logName; logName.FillZ(); if (gPerfMeasure) { logName.Append(gLogFilePath); if (iTestSetting.iNumCli == 1) logName.Append(_L("SingleClient")); else logName.AppendFormat(_L("MultiClient%02d"), count); logName.Append(gLogPostFix); } CTimerLogger* logger = CTimerLogger::NewL(logName); CleanupStack::PushL(logger); param.iLogger = logger; param.iLoggerArray = NULL; TUint operation = *iTestSetting.iOperationList; TBool numFilesVaries = EFalse; if (operation == EOpManyFiles || operation == EOpManyChanges || operation == EOpMixed) { numFilesVaries = ETrue; } logger->LogSettingDescription(iTestSetting.iNumFiles, iTestSetting.iNumCli, iTestSetting.iOption, numFilesVaries); loggerList.AppendL(logger); TBuf<20> threadName; threadName.AppendFormat(_L("NotificationThread%02d"), count); RThread notifyOp; notifyOp.Create(threadName, NotificationOperationThread, KDefaultStackSize, KMinHeapSize, KMaxHeapSize, ¶m); notiThreads.AppendL(notifyOp); notifyOp.Resume(); smphF.Wait(); // Wait for the parameters being properly passed CleanupStack::Pop(logger); count++; } gNotiThreads = notiThreads; if (iTestSetting.iNumCli == 0) // no notification { TFileName logName; logName.Append(gLogFilePath); logName.Append(_L("SingleClient")); logName.Append(gLogPostFix); CTimerLogger* logger = CTimerLogger::NewL(logName); CleanupStack::PushL(logger); logger->LogSettingDescription(iTestSetting.iNumFiles, iTestSetting.iNumCli, iTestSetting.iOption); loggerList.AppendL(logger); CleanupStack::Pop(logger); } TThreadParam paramFileOp; paramFileOp.iSetting = iTestSetting; paramFileOp.iSmphFT = &smphF; paramFileOp.iSmphNT = &smphN; paramFileOp.iLogger = NULL; paramFileOp.iLoggerArray = &loggerList; RThread fileOp; fileOp.Create(_L("FileOperationThread"), FileOperationThread, KDefaultStackSize, KMinHeapSize, KMaxHeapSize, ¶mFileOp); gFileThread = fileOp; fileOp.Resume(); TInt err; TRequestStatus status; fileOp.Logon(status); User::WaitForRequest(status); err = fileOp.ExitReason(); test(err == KErrNone); count = 0; while(count < notiThreads.Count()) { notiThreads[count].Logon(status); User::WaitForRequest(status); err = notiThreads[count].ExitReason(); test(err == KErrNone); count++; } CLOSE_AND_WAIT(fileOp); count = 0; while(count < notiThreads.Count()) { RThread thread = notiThreads[count]; CLOSE_AND_WAIT(thread); count++; } for (TInt i = 0; i < loggerList.Count(); i++) { loggerList[i]->LogAndPrint(_L("====================================================")); } smphN.Close(); smphF.Close(); loggerList.ResetAndDestroy(); loggerList.Close(); notiThreads.Reset(); notiThreads.Close(); }