/**
 Compare input and output
*/ 
void CCmdTestLoadSup::CompareInputAndOutputL(TCmdErrorSeverity aSeverity, TSsmExecutionBehaviour aExecutionBehaviour, TInt16 aRetries, const TSsmSupInfo& aInfo, CBufFlat* aWriteBuf, const TUint16 aPriority)
	{
	RDesReadStream aReadStream(aWriteBuf->Ptr(0));
	CleanupClosePushL(aReadStream);

	TCmdErrorSeverity severity = static_cast<TCmdErrorSeverity>(aReadStream.ReadUint16L());
	TSsmExecutionBehaviour executionBehaviour = static_cast<TSsmExecutionBehaviour>(aReadStream.ReadUint8L());
	TSsmSupInfo info;
	info.InternalizeL(aReadStream);
	TInt16 retries = aReadStream.ReadInt16L();
#ifdef SYMBIAN_SSM_FLEXIBLE_MERGE
	TUint16 priority = aReadStream.ReadUint16L();
#endif
	
	INFO_PRINTF4(_L("Original: Severity %d Start Method %d Retries %d"), aSeverity, aExecutionBehaviour, aRetries);
	INFO_PRINTF4(_L("Original: FileName %S NewLOrdinal %d Identity %d"), &aInfo.FileName(), aInfo.NewLOrdinal(), aInfo.Identity().iUid);
	INFO_PRINTF4(_L("Write:    Severity %d Start Method %d Retries %d"), severity, executionBehaviour, retries);
	INFO_PRINTF4(_L("Write:    FileName %S NewLOrdinal %d Identity %d"), &info.FileName(), info.NewLOrdinal(), info.Identity().iUid);
	
	TEST(aSeverity == severity);
	TEST(aExecutionBehaviour == executionBehaviour);
	TEST(aRetries == retries);
	TEST(aInfo.FileName() == info.FileName());
	TEST(aInfo.NewLOrdinal() == info.NewLOrdinal());
	TEST(aInfo.Identity().iUid == info.Identity().iUid);
#ifdef SYMBIAN_SSM_FLEXIBLE_MERGE
	INFO_PRINTF2(_L("Original: Priority %d "), aPriority);
	INFO_PRINTF2(_L("Write   : Priority %d "), priority);
	TEST(aPriority == priority);
#else
	TEST(aPriority == KDefaultPriority);
#endif

	CleanupStack::PopAndDestroy(&aReadStream);
	}
/**
This function is used to write to the log file
@param  aNonPreMulDestPixColor non pre multiplied destination pixel colour
@param  aPreMulSrcPixelColor pre multiplied source pixel colour
@param  aNonPreMulSrcPixelColor	non pre multiplied source pixel colour
@param  aVal1 it contains the value of the first variable of the message to be displayed
@param  aVal2 it contains the value of the second variable of the message to be displayed
@param  aVal3 it contains the value of the third variable of the message to be displayed
@param  aMsg it contains the message to be printed to the log file
@param  aErr if true then the test case fails, if false test passes. log is printed in both the case. TEST does not abort, just reports test case failure
*/
void CTDirectScreenBitmap::LogColourEvent(TInt aPreMulDestPixColor,TInt aNonPreMulDestPixColor,TInt aPreMulSrcPixelColor,TInt aNonPreMulSrcPixelColor,TReal aVal1,TReal aVal2,TReal aVal3,TRefByValue<const TDesC> aMsg,TBool aErr)
	{
	TEST(aErr==EFalse); // if aErr=True, then the previous test step failed.
	INFO_PRINTF4(aMsg,aVal1,aVal2,aVal3);
	if (aNonPreMulSrcPixelColor<0)
		{
		INFO_PRINTF4(_L("Processing source colours for MDest=%i, CDest=%i, MSrc=%i"),aPreMulDestPixColor,aNonPreMulDestPixColor,aPreMulSrcPixelColor);
		}
	else
		{
		INFO_PRINTF5(_L("Processing colour set MDest=%i, CDest=%i, MSrc=%i, CSrc=%i"),aPreMulDestPixColor,aNonPreMulDestPixColor,aPreMulSrcPixelColor,aNonPreMulSrcPixelColor);
		}
	}
/** 
Read the FSInfo sector at the FSI_Free_Count field. 
Following this check that the last known cluster count is less than 
the actual cluster count of the volume. 

Note: This function should be called after files have been written 
to the disk to ensure that clusters have been occupied

@param aPos The position at which to start reading from the raw disk

@return KErrNone if successful
*/	
TInt CBaseTestFat32Calculate::CheckFSInfo(TInt aPos)
	{
	TUint32 fsInfo;

	TUint32 data;
	TPtr8 buffer((TUint8*)&data,4);
	
	TInt r = TheDisk.Open(iTheFs, CurrentDrive());
	r = TheDisk.Read(aPos,buffer);
	
	fsInfo = data; 
	
	TheDisk.Close();
	
	if (fsInfo < iClusterCount)
		{
		_LIT(KFSInfoPass, "FSInfo Correct, iClusterCount = %08x fsInfo = %08x fsInfo = %08x");
		INFO_PRINTF4(KFSInfoPass, iClusterCount, data, fsInfo);
		return KErrNone;
		}
	else
		{
		_LIT(KFSInfoFail, "FSInfo incorrect, iClusterCount = %08x fsInfo = %08x");
		INFO_PRINTF3(KFSInfoFail, iClusterCount, fsInfo);
		return -1;
		}
	}
/**
See BT_ROMCONFIG_RCOMMSERV_001.script
*/
TVerdict CTestStepBtRomConfigRCommServ001::doTestStepL()
	{
	INFO_PRINTF1(\
		_L("&gt;&gt;CTestStepBtRomConfigRCommServ001::doTestStepL()"));
	const TInt expectedError = ( iBtExcluded ? KErrNotFound : KErrNone );
	// this is only used for logging readability purposes
	const TDesC* expectedErrorDesPtr = ( iBtExcluded ? &KErrNotFoundLit : &KErrNoneLit ); 
	
	RCommServ commServ;
	commServ.Connect();
	
	TInt err = commServ.LoadCommModule( KBtComm );
	if ( err!=expectedError )
		{
		INFO_PRINTF4(\
			_L("Failed: Expected %S(%d) and got %d when calling LoadCommModule(\"BTCOMM\")"),\
			expectedErrorDesPtr, expectedError, err);
		SetTestStepResult(EFail);
		}
	
	commServ.Close();

	INFO_PRINTF1(\
		_L("&lt;&lt;CTestStepBtRomConfigRCommServ001::doTestStepL()"));
	CheckAndSetTestResult();
	return TestStepResult(); 
	}
TVerdict CCTestLtsySmsControlReceiveSmsCase1Step::doTestStepL()
/**
 * @return - TVerdict code
 * Override of base class pure virtual
 * Our implementation only gets called if the base class doTestStepPreambleL() did
 * not leave. That being the case, the current test result value will be EPass.
 */
	{
	  if (TestStepResult()==EPass)
		{

		//  ************** Delete the Block, the block start ****************
		INFO_PRINTF1(_L("Please modify me. I am in CCTestLtsySmsControlReceiveSmsCase1Step::doTestStepL() in the file CTestLtsySmsControlReceiveSmsCase1Step.cpp"));  //Block start
		TPtrC TheString;
		TBool TheBool;
		TInt TheInt;
		if(!GetStringFromConfig(ConfigSection(),KTe_integration_stltsySuiteString, TheString) ||
			!GetBoolFromConfig(ConfigSection(),KTe_integration_stltsySuiteBool,TheBool) ||
			!GetIntFromConfig(ConfigSection(),KTe_integration_stltsySuiteInt,TheInt)
			)
			{
			// Leave if there's any error.
			User::Leave(KErrNotFound);
			}
		else
			{
			INFO_PRINTF4(_L("The test step is %S, The Bool is %d, The int-value is %d"), &TheString, TheBool,TheInt); // Block end
			}

		//  **************   Block end ****************

		SetTestStepResult(EPass);
		}
	  return TestStepResult();
	}
TInt CTestLibcwchar::Wcstol9L(  )
	{	 
    INFO_PRINTF1(_L("started Wcstol  8")); //was _L8
	wchar_t wcs1[41] = L"045aGHJK";
	wchar_t wcs2[41] = L"aGHJK";
	wchar_t *eptr;
	long l;


    l = wcstol(wcs1, &eptr, 0);

     
    if((l==37L)&&!wcscmp(eptr, wcs2) )
		{
     	INFO_PRINTF4(_L("Input Wchar string: %ls is converted to a long integer: %d and end pointer is set to the Wchar string: %ls"),wcs1,l, eptr);
     	 
     	return KErrNone;
		}
   	    
     else 
		{ 
     	return KErrGeneral;   
  		}
              
	}
示例#7
0
void CT_MsgServer::HandleEventL(RProperty& /*aProperty*/, TUint /*aKey*/)
#endif //__MOBILITY_TEST_FRAMEWORK
	{
#ifdef __MOBILITY_TEST_FRAMEWORK

	TInt propertyVal = 0;
	User::LeaveIfError(aProperty.Get(propertyVal));

	const TDesC& name = Name(); //Server name.


	const TMsgTestPropertyMapEntry* propertyMap = TMobilityTestPropertyMapAccess::Get(propertyVal);
	if(propertyMap == NULL)
		{
		ERR_PRINTF1(_L("CT_MsgServer::HandleEventL() - Event not found"));
		}
	else
		{
		TBufC8<80> buf8((const unsigned char*)(propertyMap->name));
		TBuf<80> buf;
		buf.Copy(buf8);
		INFO_PRINTF4(_L("%S EVENT [%d %S]"), &name, propertyVal, &buf);
		}
#endif //__MOBILITY_TEST_FRAMEWORK
	}
/**
 Function : DisplayMsgEntryList
 Description : Prints message entry details into the log file
 @param aMessageEntries Array to hold index entries corresponding to the Search/Sort result.
 @return : TVerdict - Test step result
 */
void CT_MsgVerifySortResult::DisplayMsgEntryList(const RArray<TMsvEntry>& aMessageEntries)
	{
	for(TInt j = 0; j < aMessageEntries.Count(); ++j)
		{
		INFO_PRINTF4(_L("Messagge Entry ID = %d , ServiceID = %d, Size = %d"), aMessageEntries[j].Id(), aMessageEntries[j].iServiceId, aMessageEntries[j].iSize);
		}
	}
/**
See BT_ROMCONFIG_RBTPHYLNKADAPT_001.script
*/
TVerdict CTestStepBtRomConfigRBtPhyLnkAdapt001::doTestStepL()
	{
	INFO_PRINTF1(_L("&gt;&gt;CTestStepBtRomConfigRBtPhyLnkAdapt001::doTestStepL()"));
	
	CActiveScheduler* sched(new (ELeave)CActiveScheduler);
	CActiveScheduler::Install(sched);
	CleanupStack::PushL(sched);

	User::LeaveIfError(iSocketServ.Connect());

	// if BT is included, we will be 'disconnected' as we will specify
	// an invalid BT address
	const TInt expectedError(iBtExcluded ? KErrBadName : KErrDisconnected);

	// this is only used for logging readability purposes
	const TDesC* expectedErrorDesPtr(iBtExcluded ? 
									 &KErrBadNameLit : &KErrDisconnectedLit);

	const TInt err(TestPhyLnkAdapt(1));

	if (expectedError != err)
		{
		INFO_PRINTF4(\
			_L("Failed: Expected %S(%d) and got %d calling RBTPhysicalLinkAdapter::Open"), 
			expectedErrorDesPtr, expectedError, err);
		SetTestStepResult(EFail);
		}
	
	CleanupStack::PopAndDestroy(sched);
	
	INFO_PRINTF1(_L("&lt;&lt;CTestStepBtRomConfigRBtPhyLnkAdapt001::doTestStepL()"));
	CheckAndSetTestResult();
	return TestStepResult();
	}
示例#10
0
/**
Draws a stretched bitmap with or without a mask.

@param aUseMask set to ETrue to use a alpha mask. Normally used for 16MU display modes that do not store the alpha.
@param aSrcMode is the source display mode
@param aDstMode is the destination display mode
@param aSession is the windows server session
@param aWindow is a reference to the window
@param aGc is the graphics context of the window
@param aNumIterations is the number of iterations to run the test
*/
void CAlphaBlendTest::DoDrawBitmapL(TBool aUseMask, TDisplayMode aSrcMode, TDisplayMode aDstMode, RWsSession& aSession, RWindow& aWindow, CWindowGc* aGc, TInt aNumIterations)
	{		
	const TSize bitmapSize = aWindow.Size();
	
	// Construct target bitmap.
	CFbsBitmap* bitmapTarget = CreateSoftwareBitmapLC(bitmapSize, aDstMode);
	CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmapTarget);
	CleanupStack::PushL(bitmapDevice);
	
	// Construct GC.
	CFbsBitGc* bitmapGc = NULL;
	User::LeaveIfError(bitmapDevice->CreateContext(bitmapGc));
	CleanupStack::PushL(bitmapGc);
	
	// Construct source bitmap.	
	TSize smallerSize(bitmapSize.iWidth/2,  bitmapSize.iHeight/2);
	CFbsBitmap* source = CreateSoftwareBitmapLC(smallerSize, aSrcMode);
	VerticalGradientAlphaL(source, TRgb(0x00000000), TRgb(0xffffffff));	
	CFbsBitmap* sourceAlpha = CreateSoftwareBitmapLC(smallerSize, EGray256);	// match size to src
	VerticalGradientAlphaL(sourceAlpha, TRgb(0x01010101), TRgb(0xfefefefe));
		
	bitmapGc->SetBrushStyle(CGraphicsContext::ENullBrush);
	bitmapGc->SetBrushColor(TRANSPARENT_BLACK);
	bitmapGc->Clear();
	bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
	aGc->Activate(aWindow);
	TPoint point(0,0);
	bitmapGc->BitBlt(point, bitmapTarget);
	aGc->Deactivate();
	aSession.Flush();

	TBuf <20> testName;
	if (!aUseMask)
		{
		testName=_L("DrawBitmap");
		iProfiler->InitResults();
		for(int i=0; i<aNumIterations; i++)
			{
			bitmapGc->DrawBitmap(TRect(point, bitmapSize), source);
			iProfiler->MarkResultSetL();
			}
		}
	else
		{
		testName=_L("DrawBitmapMasked");
		iProfiler->InitResults();
		for(int i=0; i<aNumIterations; i++)
			{
			bitmapGc->DrawBitmapMasked(TRect(point, bitmapSize), source,TRect(point, smallerSize), sourceAlpha, EFalse);
			iProfiler->MarkResultSetL();
			}
		}
	INFO_PRINTF4(_L("%S(Stretched) with src = %S, dst = %S"), &testName, &ColorModeName(aSrcMode), &ColorModeName(aDstMode));
	iProfiler->ResultsAnalysis(testName, 0, aSrcMode, aDstMode, aNumIterations);
	// copy up to screen for sanity check
	BitBlt(aSession, aWindow, aGc, *bitmapTarget);
	CleanupStack::PopAndDestroy(5, bitmapTarget);
	}
TVerdict CTimeZoneOffsetCheck::doTestStepL()
	{
	SetTestStepResult(EFail);
	// connect to the time zone server
	User::LeaveIfError(iTimeZoneServer.Connect());
	TInt err(KErrNone);
	// first we set the time zone where we want to test
	err = CDstIntUtils::SetHomeTimeZoneL(iLocation, iTimeZoneServer);
	if(err)
		{
		ERR_PRINTF2(_L("Setting time zone failed: error = %d"),err);
		return TestStepResult();
		}		
	
	TTzTimeReference timeRef = ETzUtcTimeReference;
	TTime minTime = TCalTime::MinTime();
	TTime maxTime = TCalTime::MaxTime();
	
	CTzId* zoneId =  CTzId::NewL(iLocation);
	CleanupStack::PushL(zoneId);
	CTzRules* tzRules = iTimeZoneServer.GetTimeZoneRulesL(*zoneId, minTime, maxTime, timeRef);
	CleanupStack::PopAndDestroy(zoneId);
	CleanupStack::PushL(tzRules);
	TInt count = tzRules->Count();
	SetTestStepResult(EPass);
	for(TInt i = 0;i<count;++i)
		{
		TTzRule& rule = (*tzRules)[i];
		if(rule.iOldLocalTimeOffset != iNewOffset && rule.iOldLocalTimeOffset != iOldOffset)
			{
			SetTestStepResult(EFail);
			INFO_PRINTF4(_L("Test Failed! Offset should have been %d or %d, found %d"),iNewOffset, iOldOffset, rule.iOldLocalTimeOffset);
			break;
			}
		if(rule.iNewLocalTimeOffset != iNewOffset && rule.iNewLocalTimeOffset != iOldOffset)
			{	
			SetTestStepResult(EFail);
			INFO_PRINTF4(_L("Test Failed! Offset should have been %d or %d, found %d"),iNewOffset, iOldOffset, rule.iNewLocalTimeOffset);
			break;
			}
		}
	CleanupStack::PopAndDestroy(tzRules);	
	return TestStepResult();
	}
void CTestLtsySmsStoreGetInfo::GetSmsStoreInfoL()
	{
	TRequestStatus status;
	TPckg<RMobilePhoneBookStore::TMobilePhoneBookInfoV1> smsInfoPckg(iInfo);
	SmsStore().GetInfo(status,smsInfoPckg);
	User::WaitForRequest(status);
	TInt r = status.Int();
	INFO_PRINTF2(_L("GetInfo() request status = %d"),r);
	CheckSmsStoreInfoL();
	INFO_PRINTF4(_L("GetInfo() MobileTypeName = %S, TotalEntries=%d,UsedEntries=%d\n"),&iInfo.iName,iInfo.iTotalEntries,iInfo.iUsedEntries );
	}
void CPerformanceFunctionalityBase::PrintNotifications(	const TDesC &aType, const RArray<TInt> &aEvents,
														const RArray<TInt> &aContacts)
	{
	_LIT(KEvent, "%S %d event(s)");
	const TInt count = ( aEvents.Count() < aContacts.Count() ) ? aEvents.Count() : aContacts.Count();
	INFO_PRINTF3(KEvent , &aType, count );
	for(TInt i = 0; i < count ; ++i)
		{
		_LIT(KEventAndContact,"%S event %s for contact %d");
		INFO_PRINTF4(KEventAndContact , &aType, PrintNotification(aEvents[i]), aContacts[i] );
		}
	}
/**
See BT_ROMCONFIG_SDPAGENT_001.script
*/
TVerdict CTestStepBtRomConfigSdpAgent001::doTestStepL()
	{
	INFO_PRINTF1(_L("&gt;&gt;CTestStepBtRomConfigSdpAgent001::doTestStepL()"));
	
	CActiveScheduler* sched(new (ELeave)CActiveScheduler);
	CActiveScheduler::Install(sched);
	CleanupStack::PushL(sched);

	const TInt expectedError(iBtExcluded ? KErrBadName : KErrNone);
	// this is only used for logging readability purposes
	const TDesC* expectedErrorDesPtr(iBtExcluded ? 
									  &KErrBadNameLit : &KErrNoneLit);	
	TRAPD(err1, TestSdpAgentL(1));

	if (expectedError != err1)
		{
		INFO_PRINTF4(\
			_L("Failed: Expected %S(%d) and got %d calling CSdpAgent::NextRecordRequestL"), 
			expectedErrorDesPtr, expectedError, err1);
		SetTestStepResult(EFail);
		}
	
	TRAPD(err2, TestSdpAgentL(2));
	if (expectedError != err2)
		{
		INFO_PRINTF4(\
			_L("Failed: Expected %S(%d) and got %d calling CSdpAgent::NextRecordRequestL"), 
			expectedErrorDesPtr, expectedError, err2);
		SetTestStepResult(EFail);
		}
	
	CleanupStack::PopAndDestroy(sched);
	
	INFO_PRINTF1(_L("&lt;&lt;CTestStepBtRomConfigSdpAgent001::doTestStepL()"));

	CheckAndSetTestResult();
	return TestStepResult(); 
	}
void CEComPerfTestBase::CheckPerformance(TReal aActualTime, TReal aMaxTime, TPtrC aTimingMessage)
	{
	THardwareConfiguration hardware_configuration = EComTestUtils::GetHardwareConfiguration();
    if ( hardware_configuration != EPlatformH4NANDDP )
		{	
		if (aActualTime < aMaxTime)
			{
			INFO_PRINTF4(_L("Performance test for [%S] passed (Measured time [%f] mSecs, Time limit [%f] mSecs\n"), &aTimingMessage, aActualTime, aMaxTime);
			}
		else
			{
			INFO_PRINTF4(_L("Performance test for [%S] FAILED (Measured time [%f] mSecs, Time limit [%f] mSecs\n"), &aTimingMessage, aActualTime, aMaxTime);
			}
		TEST(aActualTime < aMaxTime);		
		}
	else
#else
void CEComPerfTestBase::CheckPerformance(TReal aActualTime, TReal /*aMaxTime*/, TPtrC aTimingMessage)
	{
#endif
		/*Stub implementation used when performance testing is disabled
		Performance testing is not enabled on debug, emulator and DP builds*/
		INFO_PRINTF3(_L("Performance check disabled. Measured time for [%S] is [%f] mSecs\n"), &aTimingMessage, aActualTime);
	}
示例#16
0
TVerdict CTestVclntFrameSize::DoTestL(CVideoPlayerUtility* aPlayer)
	{
	TVerdict ret = EFail;

	INFO_PRINTF1(_L("Test : Video Player - Frame Size"));

	TSize	frameSize;
	TRAPD(err, aPlayer->VideoFrameSizeL(frameSize) );

	INFO_PRINTF4(_L("Error : %d, Frame size : (%d, %d)"), err, frameSize.iWidth, frameSize.iHeight);
	if (err == KErrNone &&
		frameSize.iWidth >= 0 && frameSize.iHeight >= 0 )  
		return EPass;

	return ret;
	}
void CLoopbackTestStepBase::TestErrorCodeAndDescriptorL(TInt aErrCode, TInt aExpectedErrCode, const TDesC8& aDesC, const TDesC8& aExpectedDesC, const TDesC& aMessage)
	{
	if ( (aExpectedErrCode == aErrCode) && (aDesC.Compare(aExpectedDesC) == 0) )
		{
		INFO_PRINTF4(_L("[%S]. err[%d], and string [%S] as expected. OK."), &aMessage, aErrCode, &aExpectedDesC);
		}
	else if (aExpectedErrCode == aErrCode)
		{
		ERR_PRINTF5(_L("Failed: [%S]. err[%d], expected [%d]. Leaving with [%d])."), &aMessage, aErrCode, aExpectedErrCode, aErrCode);
		User::Leave(aErrCode);
		}
	else
		{
		ERR_PRINTF4(_L("Failed: [%S]. String [%S] received, expected [%S]. Leaving with KErrGeneral."), &aMessage, &aDesC, &aExpectedDesC);
		User::Leave(KErrGeneral);
		}
	}
void CCmnStateTest::StartThread(TInt aOption)
	{
	RThread thread;
	TRequestStatus stat;
	TBuf<32> threadNameBuf;
	// Give each thread a unique name to avoid KErrAlreadyExists error on thread creation
	_LIT(KThreadNameFormat, "CCmnStateTest%d");
	threadNameBuf.Format(KThreadNameFormat, aOption);
	TInt threadCreationVal = thread.Create(threadNameBuf,PanicTestThread,KDefaultStackSize,0x2000,0x20000,(TAny*)aOption);
	TEST(threadCreationVal==KErrNone);	

	TRequestStatus status;
	thread.Logon(status);
	TBool jit =	User::JustInTime();
	User::SetJustInTime(EFalse);
	thread.Resume();
	User::WaitForRequest(status);

	// we are always expecting the same panic category KPanicSsmCmn only in debug (doesn't panic in release -> hw testing)
	TExitCategoryName category = thread.ExitCategory();
#ifdef __WINS__
	TEST(category.Compare(KPanicSsmCmn) == 0);
	INFO_PRINTF4(_L("  *** Case %d: Panic ExitCategory is %S (expected was %S)"), aOption, &category, &KPanicSsmCmn);
#else
	TEST(category.Compare(_L("Kill")) == 0);
	INFO_PRINTF2(_L("  *** category = %S ***"),&category);
#endif	
	
	// we are always expecting the same panic reason in the format ECmnStateMaxValueX (doesn't panic in release -> hw testing)
	const TInt exitReason = thread.ExitReason();
#ifdef __WINS__
	TEST(exitReason >= ECmnStateMaxValue1);
	TEST(exitReason <= ECmnStateMaxValue4);
	INFO_PRINTF5(_L("  *** Case %d: Panic reason is %d (expected was in range [%d, %d]"), aOption, exitReason, ECmnStateMaxValue1, ECmnStateMaxValue4);
#else
	TEST(exitReason == KErrNone);
#endif	
	thread.Close();
	User::SetJustInTime(jit);
	}
示例#19
0
TInt CTestLibcwchar::Wcstol2L(  )
	{	 
    INFO_PRINTF1(_L("started Wcstol  2")); //was _L8
	wchar_t wcs1[41] = L"2147483649abcd";
	wchar_t *eptr;
	long l , long_max = 2147483647;

    errno = 0;
    l = wcstol(wcs1, &eptr, 0);

    INFO_PRINTF4(_L("Input Wchar string: %ls is converted to a long integer: %d and end pointer is set to the Wchar string: %ls"),wcs1,l, eptr);
         
    if((l==long_max)&&(errno==ERANGE))
   		{
		return KErrNone;
		}
    else
		{
		return KErrGeneral;
		}
    
	}
示例#20
0
/* --------------------------------------------------------------------------------------------
	Function Name			:	Wcstol1L
	API Tested				:	Wcstol()
	TestCase Description	:	Test where input wide code character cannot be completely converted to long.
  --------------------------------------------------------------------------------------------- */
TInt CTestLibcwchar::Wcstol1L(  )
	{	 

    INFO_PRINTF1(_L("started Wcstol  1")); //was _L8
	wchar_t wcs1[41] = L"123.45abcd";
	wchar_t wcs2[8]=L".45abcd";
	wchar_t *eptr;
	long l;

    errno = 0;
    l = wcstol(wcs1, &eptr, 0);

    INFO_PRINTF4(_L("Input Wchar string: %ls is converted to a long integer: %d and end pointer is set to the Wchar string: %ls"),wcs1,l, eptr);
          
    if((l== 123L) && !(wcscmp (eptr, wcs2)) && (errno==0))
		{
   		return KErrNone;
		}
    else
		{
     	return KErrGeneral;
		}
  
	}
/**
*
* Implementation of the MoscoStateChangeEvent interface function.
*
* @param CBase* aObject
* @param TInt aPreviousState
* @param TInt aCurrentState
* @param TInt aErrorCode
*
*/
void CTestMmfOggAudioRecorderBase::MoscoStateChangeEvent(CBase* aObject, 
    TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
    {
    iObject = aObject;
    iPreviousState = aPreviousState;
    iCurrentState = aCurrentState;
    iError = aErrorCode;
	if ((iError != KErrEof) && (iError != KErrNone))
    	{
    	ERR_PRINTF2(_L("AudioRecPlay failed, unexpected error %d."), aErrorCode);
    	iAudioRecorder->Close();
    	CActiveScheduler::Stop();
    	}
    else
		{
		INFO_PRINTF1(_L("MoscoStateChangeEvent."));
		INFO_PRINTF4(_L("Error: %d, PreviousState: %d, CurrentState: %d"), iError, iPreviousState, iCurrentState);
		TRAP(iError, FsmL(EOggMoscoStateChange, iAudioRecorder->State(), aErrorCode));
		if (iError != KErrNone)
		    {
		    ERR_PRINTF2(_L("Problem in state change, unexpected error %d."), iError);
		    }
		}
	}
TBool CDataWrapperBase::GetCommandStringParameterL(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult)
	{
	TBool	ret=EFalse;

	if ( aSectName.Length()!=0 )
		{
		ret=CDataWrapper::GetStringFromConfig(aSectName, aKeyName, aResult);

		for ( TInt index=iInclude.Count(); (index>0) && (!ret); )
			{
			ret=iInclude[--index]->FindVar(aSectName, aKeyName, aResult);
			}
		}

	if ( ret )
		{
		if ( aResult.Match(KMatch)!=KErrNotFound )
			{
			//	We have an entry of the format
			//	entry =*{section,entry}*
			//	where * is one or more characters
			//	We need to construct this from other data in the ini file replacing {*,*}
			//	with the data from
			//	[section]
			//	entry =some_value
			HBufC*	buffer=HBufC::NewLC(aResult.Length());
			buffer->Des().Copy(aResult);

			TInt	startLength=KStart().Length();
			TInt	sparatorLength=KSeparator().Length();
			TInt	endLength=KEnd().Length();
			TInt	bufferLength;
			TInt	start;
			TInt	sparator;
			TInt	end;
			TPtrC	remaining;
			TLex	lex;
			do
				{
				bufferLength=buffer->Length();
				start=buffer->Find(KStart);

				remaining.Set(buffer->Des().Right(bufferLength-start-startLength));
				sparator=remaining.Find(KSeparator);
				remaining.Set(remaining.Right(remaining.Length()-sparator-sparatorLength));
				sparator += (start + startLength);

				end=remaining.Find(KEnd) + sparator + sparatorLength;

				TPtrC	sectionName(buffer->Ptr()+start+startLength, sparator-start-startLength);
				TPtrC	keyName(buffer->Ptr()+sparator+sparatorLength, end-sparator-sparatorLength);
				sectionName.Set(TLex(sectionName).NextToken());
				keyName.Set(TLex(keyName).NextToken());

				TInt	entrySize=0;
				TPtrC	entryData;
				TBool	found=CDataWrapper::GetStringFromConfig(sectionName, keyName, entryData);
				for ( TInt index=iInclude.Count(); (index>0) && (!found);  )
					{
					found=iInclude[--index]->FindVar(sectionName, keyName, entryData);
					}
				if ( found )
					{
					entrySize=entryData.Length();
					}

				TInt	newLength=start + bufferLength - end - endLength + entrySize;
				HBufC*	bufferNew=HBufC::NewLC(newLength);
				bufferNew->Des().Copy(buffer->Ptr(), start);
				if ( entrySize>0 )
					{
					bufferNew->Des().Append(entryData);
					}
				bufferNew->Des().Append(buffer->Ptr() + end + endLength, bufferLength - end - endLength);
				CleanupStack::Pop(bufferNew);
				CleanupStack::PopAndDestroy(buffer);
				buffer=bufferNew;
				CleanupStack::PushL(buffer);
				}
			while ( buffer->Match(KMatch)!=KErrNotFound );
			iBuffer.Append(buffer);
			CleanupStack::Pop(buffer);
			aResult.Set(*buffer);
			INFO_PRINTF4(KDataRead, &aSectName, &aKeyName , &aResult);
			}
		}

	return ret;
	}
/**
@SYMTestCaseID SYSLIB-BAFL-CT-0071
@SYMTestCaseDesc Tests the overload of LangUtil::NearestLanguageFile.
@SYMTestPriority High
@SYMTestActions  Calls the overload of LangUtil::NearestLanguageFile and checks the returned language.
@SYMTestExpectedResults The test must not fail.
@SYMREQ 3785: Overload of LangUtil::NearestLanguageFile.
*/
void CT_LANGUTILSLANG::TestNearestLang()
    {
    INFO_PRINTF1 (_L (" @SYMTestCaseID SYSLIB-BAFL-CT-0071 TestNearestLang "));

    __UHEAP_MARK;

    User::LeaveIfError (TheFs.Connect ());
    ::CleanupClosePushL (TheFs);

    TBuf <256> filename;
    TLanguage language;

    // Ensure that ideal language is default
    LangUtil::SetIdealLanguage( ELangNone);
    language=LangUtil::IdealLanguage();
    test(language == ELangNone);

    // Test NearestLanguageFile overload with language returned
    language=ELangAmerican;
    filename.Copy (KRscFilename);
    LangUtil::NearestLanguageFile (TheFs, filename, language);
    INFO_PRINTF4(_L ("The NearestLanguageFile for %S is %S, language = %d\n"), &KRscFilename, &filename, language);
    test(language == ELangNone);
    test(filename == KRscFilename);

    // Set ideal language to American

    LangUtil::SetIdealLanguage( ELangAmerican);
    language=LangUtil::IdealLanguage();
    test(language == ELangAmerican);

    // Test NearestLanguageFile overload with language returned
    language=ELangNone;
    filename.Copy (KRscFilename);
    LangUtil::NearestLanguageFile (TheFs, filename, language);
    INFO_PRINTF4 (_L ("The NearestLanguageFile for %S is %S, language = %d\n"), &KRscFilename, &filename, language);
    test(language == ELangAmerican);
    test(filename == KAmericanLang);

    // Set ideal language to French

    LangUtil::SetIdealLanguage( ELangFrench);
    language=LangUtil::IdealLanguage();
    test(language == ELangFrench);

    // Test NearestLanguageFile overload with language returned
    language=ELangNone;
    filename.Copy (KRscFilename);
    LangUtil::NearestLanguageFile (TheFs, filename, language);
    INFO_PRINTF4 (_L ("The NearestLanguageFile for %S is %S, language = %d\n"), &KRscFilename, &filename, language);
    test(language == ELangFrench);
    test(filename == KFrenchLang);

    // Set ideal language to one we don't have
    LangUtil::SetIdealLanguage( ELangGerman);
    language=LangUtil::IdealLanguage();
    test(language == ELangGerman);

    // Test NearestLanguageFile overload with language returned
    language=ELangAmerican;
    filename.Copy (KRscFilename);
    LangUtil::NearestLanguageFile (TheFs, filename, language);
    INFO_PRINTF4 (_L ("The NearestLanguageFile for %S is %S, language = %d\n"), &KRscFilename, &filename, language);
    test(language == ELangNone);
    test(filename == KRscFilename);

    // Restore ideal language to default
    LangUtil::SetIdealLanguage( ELangNone);
    language=LangUtil::IdealLanguage();
    test(language == ELangNone);

    // Release ideal language - free's TLS

    LangUtil::ReleaseIdealLanguage();

    CleanupStack::PopAndDestroy (&::TheFs);

    __UHEAP_MARKEND;
    }
示例#24
0
/*
TVerdict MainThread()

Called by: "doTestStepL"

Purpose:	Creates the child thread(which calls the respective function with regard
			to the server and also implements the Message Call). Then this fn.waits for the
			completion of the childthread( doesnt matter how the thread did die!)

Return Value(Verdict of the TestStep):

			A.Reporting PASS/FAIL
				Direct Test:
						When a message call gets thru. Please note that in such cases
						actually the implementation of the message has started. As we
						are passing "0" Parameters, server may panic, though our botheration
						stops once the call gets thru.
						NOTE:	The style is the same when CONNECTION capabilities
								are tested, the only diff is you dont have to expect a
								panic from server
				Inverse Test:
						The call should be either failed or panicked with
						"KErrPermissionDenied" flag.

				General Case:
						If a thread creation failed or if the server couldnt be connected
						apart from the above two cases, then a FAIL is reported

			B.Reporting INCONCLUSIVE
						Any panic say from unexpected source (eg:KERN-EXEC) will be
						reported INCONCLUSIVE
*/
TVerdict CCapabilityTestStep::MainThread()
	{

	TBuf<100>	tExitCategory;
	TInt		tExitReason = 0;
	TBuf<100>	TestStyle;

	iExpect_Rejection?TestStyle = _L("Inverse"):TestStyle = _L("Direct");
	TCapabilitySet theCaps =  TSecurityInfo(RProcess()).iCaps ;
	const TInt KMaxTestThreadHeapSize = 0x10000;

	//Initialize return values
	iResult_SR = iResult_Server = KErrNone;


	// Create a child thread, with a new heap
	TInt nRes_Thread =	tChildThread.Create(
						ChildThread_SR,
						ThreadStartFn,
						KDefaultStackSize,
						KMinHeapSize,
						KMaxTestThreadHeapSize,
						this,
						EOwnerProcess);


	if(nRes_Thread == KErrNone)//Thread Created
		{

		//Let me know when the thread is dead
		TRequestStatus ThreadStatus;
		tChildThread.Logon(ThreadStatus);
		tChildThread.Resume();
		//Is the thread dead?
		User::WaitForRequest( ThreadStatus );

		//yes, he is dead. RIP!  Now the Killer's profile
		tExitCategory	=	tChildThread.ExitCategory();
		tExitReason		=	tChildThread.ExitReason();


		//Somebody Please say what are we testing!!
		if(iSessionCreated && (SR_MESSAGE_ID >=0))//Flag set by Child thread when connected to Server
		{
			//DEF INFO_PRINTF5(_L("Connected to Server(%S) for %S Test [MessageID: %d,Req.Cap: 0x%x,Present.Cap: 0x%x]"),&SR_ServerName,&TestStyle,SR_MESSAGE_ID,iStepCap,TSecurityInfo(RProcess()));
		}
		else if(SR_MESSAGE_ID < 0)
		{
			//DEF INFO_PRINTF5(_L("Testing Connection capabilities[%S Test] for Server(%S)  [Req.Cap: 0x%x,Present.Cap: 0x%x]"),&TestStyle,
			//&SR_ServerName,TSecurityInfo(RProcess()));
		}
		else if(!iSessionCreated)// NO Connection
			{
			INFO_PRINTF4(_L("Couldnt connect to the Server(%S) ErrorCode - ServerRet: %d C32ret: %d"),&SR_ServerName,iResult_Server,iResult_C32);
			//INFO_PRINTF3(_L("Child Thread: ExitCategory : %S ExitReason : %d"),&tExitCategory,tExitReason);
  			return EFail;
 			}



		switch(tChildThread.ExitType())
			{
			case EExitPanic:
				//1.A Panic from the connected Server
				//2.A CServer Panic normally for capability rejection
				//3.A kernel Panic (consider yourself doomed!)
				if((tExitReason == KErrPermissionDenied) ||
					//DEF ? 	it's old version (tExitReason == CServer::EClientDoesntHaveRequiredCaps))//Rejected for Insufficient Cap.
					// is it correct ?
					(tExitReason == CServer2::EClientDoesntHaveRequiredCaps))//Rejected for Insufficient Cap.
					{
					INFO_PRINTF2(_L("Rejected for insufficient capabilities [Return Value : %d] "),tExitReason);
					return(GetVerdict(API_RetValue_PermissionDenied));
					}
				else if(tExitCategory == iServer_Panic) //Panic from Server
					{
					INFO_PRINTF2(_L("Server(%S) Panic to child thread"),&tExitCategory);
					INFO_PRINTF3(_L("Child Thread: ExitCategory : %S ExitReason : %d"),&tExitCategory,tExitReason);
					return(GetVerdict(API_RetValue_ServerPanic));
					}
				else//A kernel Panic possibly
					{
					INFO_PRINTF3(_L("Child Thread: Panic from unexpected source (ExitCategory: %S ExitReason : %d)!"),&tExitCategory,tExitReason);
					return EInconclusive;
					}

					break;
			case EExitKill:
				if(iResult_SR != KErrPermissionDenied)
					{
					INFO_PRINTF2(_L("A Successfull call (Return Value : %d)"),((SR_MESSAGE_ID >=0)?iResult_SR:iResult_Server));
					return(GetVerdict(API_RetValue_NoCapError));
					}
				else
					{
					INFO_PRINTF2(_L("Rejected for insufficient capabilities [Return Value : %d] "),((SR_MESSAGE_ID >=0)?iResult_SR:iResult_Server));
					return(GetVerdict(API_RetValue_PermissionDenied));
					}

					break;
			default:
					break;
			}
		}
	else //Our thread couldnt start	:o(
		{
		INFO_PRINTF2(_L("ERROR: Failed to create Child thread,  ErrorCode:(%d)"),nRes_Thread);
		return EFail;
		}

	return EInconclusive;
	}
EXPORT_C void CTe_LbsNotifyPositionUpdateErrStep::ReallyDoTestStepImpL()
	{
	//SIMPLE POSITION UPDATE ERROR (Scenario 3.0)
	INFO_PRINTF1(_L("SIMPLE POSITION UPDATE ERROR (Scenario 3.0) START"));
	INFO_PRINTF1(_L("Create positioner and the position update object"));
		
	CTe_PsyPositioner* positioner = MakePositionerLC(); 
	CTe_PsyRequest* updateRequest = CTe_PsyRequest::NewLC(*this);
		
	INFO_PRINTF1(_L("Call NotifyPositionUpdate() PSY->ALM"));
	updateRequest->NotifyPsyRequest();
	positioner->NotifyPositionUpdate();
	StartSchedulerWaitL(KUsualTimeout, 1);
		
	updateRequest->ExpectDefaultUpdateRequest();
	updateRequest->UpdateRequest().NewClient() = ETrue;
	updateRequest->CheckPosUpdateOrReqReceivedL();
	
	INFO_PRINTF1(_L("Set a position update on the bus ALM->PSY"));
	CTe_PsyResponse* errUpdate = CTe_PsyResponse::IssueErrPosUpdateLC(KErrNoMemory,
			TPositionModuleInfo::ETechnologyTerminal);

	INFO_PRINTF2(_L("Start the active scheduler for %d microsec"), KUsualTimeout);
	StartSchedulerWaitL(KUsualTimeout, 1);
	INFO_PRINTF1(_L("The active scheduler stopped"));
	
	positioner->CheckPosUpdateFailedL(KErrNoMemory);
	CleanupStack::PopAndDestroy(errUpdate);
	
	INFO_PRINTF1(_L("SIMPLE POSITION UPDATE ERROR (Scenario 3.0) END"));
	
	__UHEAP_FAILNEXT(0);	
	TInt* marker = new TInt(0);
	delete marker;
		
	if(marker) //it is the urel OS version - skipping the memory leak tests
		{
		CleanupStack::PopAndDestroy(updateRequest);
		CleanupStack::PopAndDestroy(positioner);
		return;
		}
	
	//CPOSITIONER CREATION/DESTRUCTION WITH MEMORY LEAKS (Scenario 3.2)
	INFO_PRINTF1(_L("CPOSITIONER CREATION/DESTRUCTION WITH MEMORY LEAKS (Scenario 3.2) START"));	
	for(TInt i=1; marker; i++)
		{			
		INFO_PRINTF1(_L("Calling the MakePositionerLC"));
		__UHEAP_FAILNEXT(i);
		CTe_PsyPositioner* positioner = NULL;
		TRAPD(err, positioner = MakePositionerLC(); CleanupStack::PopAndDestroy(positioner));
		marker = new TInt(0);
		delete marker;
			
		if(marker) //Leave has happened inside the MakePositionerLC
			{
			INFO_PRINTF4(_L("Leave has happened inside the MakePositionerLC, i=%d err=%d positioner=0x%x"),
					i, err, positioner);
			if(err==KErrNone && !positioner)
				{
				User::Leave(EFail);
				}
			}
		else//Leave hasn't happened inside the MakePositionerLC - not interested
			{
			INFO_PRINTF2(_L("No leave has happened inside the MakePositionerLC - stop the test, i=%d"), i);
			break;
			}
		}
	INFO_PRINTF1(_L("CPOSITIONER CREATION/DESTRUCTION WITH MEMORY LEAKS (Scenario 3.2) END"));
	
	
	//SIMPLE POSITION UPDATE WITH OOM WHILE CALLING NotifyPositionUpdate (Scenario 3.3)
	INFO_PRINTF1(_L("SIMPLE POSITION UPDATE WITH OOM WHILE CALLING NotifyPositionUpdate (Scenario 3.3) START"));
	INFO_PRINTF1(_L("Create positioner and the position update object"));
	
	marker = new TInt(0);
	delete marker;
	for(TInt i=1; marker; i++)
		{
		INFO_PRINTF1(_L("Call NotifyPositionUpdate() PSY->ALM"));
		updateRequest->NotifyPsyRequest();
	
		__UHEAP_FAILNEXT(i);
		positioner->NotifyPositionUpdate();
		
		marker = new TInt(0);
		delete marker;
		
		StartSchedulerWaitL(KUsualTimeout, 1);
		
		if(!marker) //The leave has occured after the  NotifyPositionUpdate - not interested
			{
			break;
			}
		
		updateRequest->ExpectDefaultUpdateRequest();
		TRAPD(err, updateRequest->CheckPosUpdateOrReqReceivedL());
		if(err==KErrNone)
			{
			INFO_PRINTF1(_L("Set a position update on the bus ALM->PSY"));
			CTe_PsyResponse* simplePosUpdate = CTe_PsyResponse::IssueSimplePosUpdateLC(
					TPositionModuleInfo::ETechnologyTerminal);

			INFO_PRINTF2(_L("Start the active scheduler for %d microsec"), KUsualTimeout);
			StartSchedulerWaitL(KUsualTimeout, 1);
			INFO_PRINTF1(_L("The active scheduler stopped"));
			positioner->CheckPosUpdateReceivedL(*simplePosUpdate);
			CleanupStack::PopAndDestroy(simplePosUpdate);
			}
		else if(err==KErrNotFound)
			{
			INFO_PRINTF2(_L("Start the active scheduler for %d microsec"), KUsualTimeout);
			StartSchedulerWaitL(KLongTimeoutInterval, 1);
			INFO_PRINTF1(_L("The active scheduler stopped"));
			positioner->CheckPosUpdateFailedL(KErrTimedOut);			
			}
		else //the request is received in the wrong format or some unexpected leave
			{
			User::Leave(err);
			}
		}
	
	
	INFO_PRINTF1(_L("SIMPLE POSITION UPDATE WITH OOM WHILE CALLING NotifyPositionUpdate (Scenario 3.3) END"));
		

	CleanupStack::PopAndDestroy(updateRequest);
	CleanupStack::PopAndDestroy(positioner);		
	
	}
/**
 *
 * Creates KMaxConverters players, performs the desired test on one of them
 * and then closes them all and cleans up.
 * If problems are encountered the returned result will reflect this.
 *
 * @return	"TVerdict"
 *			The result of the tests
 *
 * @xxxx
 * 
 */
TVerdict CTestStepConverterSharedHeapMultiFile::DoTestL( TTestType aTestType )
	{
	iTestStepResult = EPass;
    TInt err = KErrNone;
	
	__MM_HEAP_MARK;
	
	TInt i=0;
	for( ; i < KMaxConverters; ++i )	
		{
		iError = KErrNone;
		
		CMdaAudioConvertUtility* converter = NULL;
		
		TRAPD(err, converter = CreateAndOpenConverterL(i) );
		
		if (err == KErrNone && iError == KErrNone)
			{
			// see if valid result and break if wrong - might be premature result
			TInt err2 = KErrNone;
			TMMFMessageDestination* srcHandle = NULL;
			err2 = GetAudConverterSourceHandle(converter, srcHandle);
			
			if ( err2 != KErrNone ||
				 &srcHandle == NULL ||
				 converter->State() != CMdaAudioConvertUtility::EOpen ||
				 converter->Duration() == TTimeIntervalMicroSeconds(0) || // we know the duration of the file is more than 0
				 iError != KErrNone)
				{
				// dodgy converter
				
				INFO_PRINTF2(_L("	Dodgy converter on iteration %2d"), i);
				iTestStepResult = EFail;
				
				delete converter;
				converter = NULL;
				break;
				}
			else
				{
				// no errors				
				// append converter to array
				if( (err = iConverters.Append( converter )) != KErrNone )
					{
					INFO_PRINTF2(_L("Fail to append converter on iteration %2d"), i);
					// this doesn't indicate a failure in what we're testing here
					iTestStepResult = EInconclusive;
				
					delete converter;
					converter = NULL;
					break;
					}
				}
			}
		else
			{
			INFO_PRINTF4(_L("Fail to open converter on iteration %2d - %d %d"), i, err, iError);
			break;
			}	
		}

	// check outcome of making converters
	if ( err || iError )
		{
		if ((err && err != KErrNoMemory) || (err == KErrNone && iError != KErrNoMemory))
			{
			// a genuine error
			
			if( err )
				{
				INFO_PRINTF3(_L("Error %d occured while trying to create converter #%d"), err, i );
				}
			else
				{
				INFO_PRINTF3(_L("Error %d occured while opening converter #%d"), iError, i );
				}
			
			iTestStepResult = EFail;
			}
		else
			{
			// we ran out of memory
			INFO_PRINTF2(_L("Teststep ran out of memory while creating converter #%d"), i );
			iTestStepResult = EFail;
			}
		}
	// else no errors


	// perform test on 1st converter(unless there were errors above)
	if( (iTestStepResult == EPass) && (iConverters.Count() > 0 ) )
		{
		switch( aTestType )
			{
			case EConvert:
				{		
				(iConverters[0])->ConvertL();
				CActiveScheduler::Start();
				
				if( iError )
					{
					// playback died
					INFO_PRINTF2(_L("Error %d occured while converting"), iError );
					iTestStepResult = EFail;
					}
					
				break;
				}
		
				
			case EPanic:
				{
				// panic player
				
				// load a custom controller (using the share heap)
				// that can be panicked and see if we recover OK
				TMMFPrioritySettings settings;
				TInt error = KErrNone;
				RMMFController controller;

				settings.iPriority = 1;
				settings.iPref = EMdaPriorityPreferenceTime;
				settings.iState = EMMFStateIdle;

				error = controller.Open(KTstControllerUid, settings, ETrue); // use shared heap
				INFO_PRINTF2(_L("Custom controller Open: %d"), error);

				if( ! error )
					{
					// panic the controller
					// this command will complete immediately and
					// then panic
					TUid uid;
					uid = TUid::Uid(0x101f72B4);
					TMMFMessageDestinationPckg destPckg(uid);
					//TRequestStatus status = KRequestPending;
					controller.CustomCommandSync(destPckg,
												EMMFTestCustomCommandPanic,
												KNullDesC8,
												KNullDesC8);
					
					// need to allow some time to make
					// sure the thread has actually been panicked when we close it
					User::After( TTimeIntervalMicroSeconds32(5000000) ); // 5 seconds
					}
					
				// controller should have panicked by now
				controller.Close();
				
				break;
				}


			// default: // do nothing
			}
		}
		
	// cleanup
	for( i = 0; i < iConverters.Count(); ++i )
		{
		delete iConverters[i];
		
		iConverters[i] = NULL;
		}
	iConverters.Reset();

	__MM_HEAP_MARKEND;

	// test steps return a result
	return iTestStepResult;
	}
void CT_DataRSocketServ::DoCmdStopProtocolL(const TDesC& aSection, const TInt aAsyncErrorIndex)
	{
				
	TUint	addrFamily = iProtocolDesc.iAddrFamily;
	TPtrC	addrFamilyStr;
	if( GetStringFromConfig(aSection, KAddrFamily(), addrFamilyStr) )
		{
		if( GetAddrFamily( addrFamilyStr, addrFamily ) )
			{
			INFO_PRINTF3(_L("RSocketServ::StopProtocol() - Using addrFamily %S (%d)"), &addrFamilyStr, addrFamily);
			}
		else
			{
			TInt	addrFamilyInt;
			if( GetIntFromConfig(aSection, KAddrFamily(), addrFamilyInt) )
				{
				addrFamily = addrFamilyInt;
				INFO_PRINTF2(_L("RSocketServ::StopProtocol() - Using addrFamily %d"), addrFamily);
				}
			else
				{
				ERR_PRINTF2(_L("RSocketServ::StopProtocol() - Given addrFamily (%S) is invalid"), &addrFamilyStr);
				SetBlockResult(EFail);
				}
			}
		}

	TUint	sockType = iProtocolDesc.iSockType;
	TPtrC	sockTypeStr;
	if( GetStringFromConfig(aSection, KSockType(), sockTypeStr) )
		{
		if( GetSockType( sockTypeStr, sockType ) )
			{
			INFO_PRINTF3(_L("RSocketServ::StopProtocol() - Using sockType %S (%d)"), &sockTypeStr, sockType);
			}
		else
			{
			TInt	sockTypeInt;
			if( GetIntFromConfig(aSection, KSockType(), sockTypeInt) )
				{
				sockType = sockTypeInt;
				INFO_PRINTF2(_L("RSocketServ::StopProtocol() - Using sockType %d"), sockType);
				}
			else
				{
				ERR_PRINTF2(_L("RSocketServ::StopProtocol() - Given sockType (%S) is invalid"), &sockTypeStr);
				SetBlockResult(EFail);
				}
			}
		}

	TUint	protocol = iProtocolDesc.iProtocol;
	TPtrC	protocolStr;
	if( GetStringFromConfig(aSection, KProtocol(), protocolStr) )
		{
		if( GetProtocol( protocolStr, protocol ) )
			{
			INFO_PRINTF3(_L("RSocketServ::StopProtocol() - Using protocol %S (%d)"), &protocolStr, protocol);
			}
		else
			{
			TInt	protocolInt;
			if( GetIntFromConfig(aSection, KProtocol(), protocolInt) )
				{
				protocol = protocolInt;
				INFO_PRINTF2(_L("RSocketServ::StopProtocol() - Using protocol %d"), protocol);
				}
			else
				{
				ERR_PRINTF2(_L("RSocketServ::StopProtocol() - Given protocol (%S) is invalid"), &protocolStr);
				SetBlockResult(EFail);
				}
			}
		}

	INFO_PRINTF4(_L("Calling RSocketServ::StopProtocol(%d, %d, %d)"), addrFamily, sockType, protocol);
	iSocketServ->StopProtocol(addrFamily, sockType, protocol, iActiveStopProtocol->iStatus);
	iActiveStopProtocol->Activate(aAsyncErrorIndex);
	IncOutstanding();
	}
void CT_DataRSocketServ::DoCmdConnect(const TDesC& aSection)
	{	
	TInt messageSlots=KESockDefaultMessageSlots;
	GetIntFromConfig(aSection, KMessageSlots(), messageSlots);

	TUint	protocol = 0;
	TPtrC	protocolStr;
	TBool	hasProtocol = GetStringFromConfig(aSection, KProtocol(), protocolStr);
	if( hasProtocol )
		{
		if( GetProtocol( protocolStr, protocol ) )
			{
			INFO_PRINTF3(_L("RSocketServ::Connect() - Using protocol %S (%d)"), &protocolStr, protocol);
			}
		else
			{
			TInt	protocolInt;
			if( GetIntFromConfig(aSection, KProtocol(), protocolInt) )
				{
				protocol = protocolInt;
				INFO_PRINTF2(_L("RSocketServ::Connect() - Using protocol %d"), protocol);
				}
			else
				{
				ERR_PRINTF2(_L("RSocketServ::Connect() - Given protocol (%S) is invalid"), &protocolStr);
				SetBlockResult(EFail);
				}
			}
		}
					
	TUint	addrFamily = 0;
	TPtrC	addrFamilyStr;
	TBool	hasAddrFamily = GetStringFromConfig(aSection, KAddrFamily(), addrFamilyStr);	
	if( hasAddrFamily )
		{
		if( GetAddrFamily( addrFamilyStr, addrFamily ) )
			{
			INFO_PRINTF3(_L("RSocketServ::Connect() - Using addrFamily %S (%d)"), &addrFamilyStr, addrFamily);
			}
		else
			{
			TInt	addrFamilyInt;
			if( GetIntFromConfig(aSection, KAddrFamily(), addrFamilyInt) )
				{
				addrFamily = addrFamilyInt;
				INFO_PRINTF2(_L("RSocketServ::Connect() - Using addrFamily %d"), addrFamily);
				}
			else
				{
				ERR_PRINTF2(_L("RSocketServ::Connect() - Given addrFamily (%S) is invalid"), &addrFamilyStr);
				SetBlockResult(EFail);
				}
			}
		}

	TInt err;

	if( hasProtocol || hasAddrFamily )
		{
		TSessionPref preference;
		preference.iProtocol = protocol;
		preference.iAddrFamily = addrFamily;
		INFO_PRINTF4(_L("Calling RSocketServ::Connect({%d, %d}, %d)"), preference.iProtocol, preference.iAddrFamily, messageSlots);			
		err = iSocketServ->Connect(preference, messageSlots);		
		}
	else
		{
		INFO_PRINTF2(_L("Calling RSocketServ::Connect(%d)"), messageSlots);			
		err = iSocketServ->Connect(messageSlots);			
		}

	if( err!=KErrNone )
		{
		ERR_PRINTF2(_L("RSocketServ::Connect() failed with error %d"), err);
		SetError(err);	
		}
	}
TVerdict CSyncTestStep::doTestStepPreambleL()
	{
	__UHEAP_MARK;

	iScheduler = new(ELeave) CActiveScheduler;
	CActiveScheduler::Install(iScheduler);
	
	iSecureBackupEngine = CSBEClient::NewL();

	//
	// Connect to PhBkSync...
	//
	TInt  ret = iSession.Connect();
	TESTCHECKL(ret, KErrNone);

	//
	// Perform a sync to start the tests in a clean state. We also wait for the
	// slower TSYs to get ready!
	//
	RPhoneBookSession::TSyncState  syncState(RPhoneBookSession::EUnsynchronised);
	
	ret = iSession.GetPhoneBookCacheState(syncState);

	if (ret != KErrNone  ||  syncState != RPhoneBookSession::ECacheValid)
		{
		TRequestStatus  status(KErrUnknown);

		while (status.Int() != KErrNone)
			{
			iSession.DoSynchronisation(status);
			User::WaitForRequest(status);

			if (status.Int() == KErrServerTerminated)
				{
				INFO_PRINTF1(_L("PhBkSync has terminated, restarting..."));

				iSession.Close();
				ret = iSession.Connect();
				TESTCHECKL(ret, KErrNone);

				User::After(5*1000000);
				}
			else if (status.Int() != KErrNone)
				{
				INFO_PRINTF2(_L("Preamble sync result was %d so retrying..."), status.Int());
				User::After(5*1000000);
				}
			}
		TESTCHECKL(status.Int(), KErrNone);
	
		//
		// For MMTSY testing to pass, ensure that the equivilant entries
		// from SIMTSY are on the SIM (slots 1 to 20 excluding 18 and 19)...
		//
		RArray<TInt>  freeSlotArray;
		CleanupClosePushL(freeSlotArray);
		
		iSession.GetFreeSlotsL(freeSlotArray);

		for (TInt count = 1;  count <= 20;  count++)
			{
			if (freeSlotArray.Find(count) != KErrNotFound  &&
			    count != 18  &&  count != 19)
				{
				TBuf<20>  telName;
				TBuf<20>  telNumber;

				telName.AppendFormat(_L("Friend %d"), count);
				telNumber.AppendFormat(_L("12345000%03d"), count);

				INFO_PRINTF4(_L("Preamble filling contact {\"%S\", \"%S\"} to slot %d..."),
				             &telName, &telNumber, count);
				
				TContactICCEntry  iccEntry;
				TRequestStatus  status;

				iccEntry.iName.Copy(telName);
				iccEntry.iNumber.Copy(telNumber);
				iccEntry.iSlotNum    = count;
				iccEntry.iContactUID = KNullContactId;
				iccEntry.iTON        = RMobilePhone::EUnknownNumber;

				WriteContactToICCL(iccEntry, status);
				TESTCHECKL(status.Int(), KErrNone);
				TESTCHECKCONDITION(iccEntry.iSlotNum != KSyncIndexNotSupplied);
				}
			}

		CleanupStack::PopAndDestroy(&freeSlotArray);
		}

	return TestStepResult();
	} // CSyncTestStep::doTestStepPreambleL
/**
Old Test CaseID 		APPFWK-SSM-0012
New Test CaseID 		DEVSRVS-SSMA-SSM-0012
 */
TVerdict CSsmValidSwpListTest::doTestStepL()
	{
	INFO_PRINTF1(_L("CSsmValidSwpListTest started...."));

	__UHEAP_MARK;

	TInt err = RProperty::Define(RProcess().SecureId(), key, RProperty::EInt);
	TEST(err == KErrNone || err == KErrAlreadyExists);
	INFO_PRINTF1(_L("Checking cmd list without a Publish System Swp command"));
	TInt exitReason(0);
	SetFunction(ESwpCmdWithoutPublishSwp);
	TRAP(err, exitReason = StartSwpInvalidListInThreadL(this));
	TEST(err == KErrNone);
	INFO_PRINTF2(_L("    -- StartSwpInvalidListInThreadL method completed with '%d'."), err);
	TEST(exitReason == ESwpTransitionEngineError16);
	INFO_PRINTF3(_L("    -- received panic '%d', expected was '%d'."), exitReason, ESwpTransitionEngineError16);

	INFO_PRINTF1(_L("Checking cmd list with more than one Publish System Swp command"));
	exitReason=0;
	SetFunction(ESwpCmdTwoPublishSwp);
	TRAP(err, exitReason = StartSwpInvalidListInThreadL(this));
	TEST(err == KErrNone);
	INFO_PRINTF2(_L("    -- StartSwpInvalidListInThreadL method completed with '%d'."), err);
	TEST(exitReason == ESwpTransitionEngineError16);
	INFO_PRINTF3(_L("    -- received panic '%d', expected was '%d'."), exitReason, ESwpTransitionEngineError16);

	INFO_PRINTF1(_L("Checking cmd list with a Publish System State"));
	exitReason=0;
	SetFunction(ESwpCmdPublishState);
	TRAP(err, exitReason = StartSwpInvalidListInThreadL(this));
	TEST(err == KErrNone);
	INFO_PRINTF2(_L("    -- StartSwpInvalidListInThreadL method completed with '%d'."), err);
	TEST(exitReason == ESwpTransitionEngineError16);
	INFO_PRINTF3(_L("    -- received panic '%d', expected was '%d'."), exitReason, ESwpTransitionEngineError16);

	INFO_PRINTF1(_L("Checking cmd list with no Multiple Wait command and more than one deferred commands"));
	exitReason=0;
	SetFunction(ESwpCmdNoMultipleWait);
	TRAP(err, exitReason = StartSwpInvalidListInThreadL(this));
	TEST(err == KErrNone);
	INFO_PRINTF2(_L("    -- StartSwpInvalidListInThreadL method completed with '%d'."), err);
	TEST(exitReason == ESwpTransitionEngineError16);
	INFO_PRINTF3(_L("    -- received panic '%d', expected was '%d'."), exitReason, ESwpTransitionEngineError16);

	INFO_PRINTF1(_L("Checking cmd list with too many Multiple Wait command and and no deferred commands - Validation should be OK - Panic comes from HandleCleReturnValue"));
	exitReason=0;
	SetFunction(ESwpCmdTooManyMultipleWaitErr1);
	TRAP(err, exitReason = StartSwpInvalidListInThreadL(this));
	TEST(err == KErrNone);
	INFO_PRINTF2(_L("    -- StartSwpInvalidListInThreadL method completed with '%d'."), err);
	const TInt threadExitReason = iThread.ExitReason();
	TBuf<16> threadExitCategory = iThread.ExitCategory();
	// This is the exit reason for the ssmswppolicyserver
	TEST(threadExitReason == KSsmTestAppRvError);
	// this is the exit reason for the engine.
	TEST(exitReason == ESwpTransitionEngineError20);
	iThread.Close();
	INFO_PRINTF4(_L("    -- received panic '%d', category '%S', expected was '%d'."), threadExitReason, &threadExitCategory, KSsmTestAppRvError);

	INFO_PRINTF1(_L("Checking cmd list with too many Multiple Wait command and and no deferred commands - Validation should be OK - Panic originates in HandleCleReturnValue returning an error"));
	exitReason=0;
	SetFunction(ESwpCmdTooManyMultipleWaitErr2);
	TRAP(err, exitReason = StartSwpInvalidListInThreadL(this));
	TEST(err == KErrNone);
	INFO_PRINTF2(_L("    -- StartSwpInvalidListInThreadL method completed with '%d'."), err);
	TEST(exitReason == ESwpTransitionEngineError20);
	INFO_PRINTF3(_L("    -- received panic '%d', expected was '%d'."), exitReason, ESwpTransitionEngineError20);

	INFO_PRINTF1(_L("Checking cmd list which leaves with an error when it is being prepared"));
	exitReason=0;
	SetFunction(ESwpCmdPrepareCmdListFailed);
	TRAP(err, exitReason = StartSwpInvalidListInThreadL(this));
	TEST(err == KErrNone);
	INFO_PRINTF2(_L("    -- StartSwpInvalidListInThreadL method completed with '%d'."), err);
	TEST(exitReason == ESwpTransitionEngineError20);
	INFO_PRINTF3(_L("    -- received panic '%d', expected was '%d'."), exitReason, ESwpTransitionEngineError20);
	
	err = RProperty::Delete(RProcess().SecureId(), key);
	TEST(err == KErrNone);
	__UHEAP_MARKEND;

	// this test raises panics due to negative testing - close them to clear the screen.
	CloseAllPanicWindowsL();

	INFO_PRINTF1(_L("....CSsmValidSwpListTest completed!!"));
	return TestStepResult();
	}