コード例 #1
0
TInt CTestLibcwchar::wcwidth2L(  )
    {
       
	wchar_t wc = L'\0';
	int retval;

	retval = wcwidth(wc);

	INFO_PRINTF2(_L("wcwidth2 result is %d"),retval);
	
	if(retval != 0)
		{
		return KErrGeneral;
		}
	else
		{
		return KErrNone;
		}
    
    }
コード例 #2
0
void CX3pChannel::ConnectClientL(TUint aRequestId)
	{
	INFO_PRINTF1(_L("<<<< X3P Client: Connect to client :"));
	INFO_PRINTF2(_L("-> Client Id : %d"), aRequestId);
	
	TInt index = iRequestBuffer.Find(aRequestId, IsClientIdEqual);
	if (index != KErrNotFound)
		{
		User::Leave(KErrInUse);
		}
	
	if (!iConnected)
		{
		User::LeaveIfError(iTransmitPositionServer.Connect());
		iConnected = ETrue;	
		}
	
	CX3pRequest* request = CX3pRequest::NewL(*this, iTransmitPositionServer, aRequestId);
	iRequestBuffer.AppendL(request);
	}
コード例 #3
0
void CT_DataSdpAttrValue::DoCmdInt(const TDesC& aSection)
	{
	TInt	actual = GetSdpAttrValue()->Int();
	INFO_PRINTF2(_L("CSdpAttrValue::Int = %d"), actual);

	TInt	expected;
	if ( GetIntFromConfig(aSection, KExpected(), expected) )
		{
		if ( actual!=expected )
			{
			ERR_PRINTF1(_L("Int is not as expected!"));
			SetBlockResult(EFail);
			}
		}
	else
		{
  		ERR_PRINTF2(_L("Missing expected value %S"), &KExpected());
  		SetBlockResult(EFail);		
		}
	}
コード例 #4
0
void CX3pChannel::DisconnectClient(TUint aRequestId)
	{
	INFO_PRINTF1(_L("<<<< X3P Client: Disconnect from server :"));
	INFO_PRINTF2(_L("-> Client Id : %d"), aRequestId);	

	TInt index = iRequestBuffer.Find(aRequestId, IsClientIdEqual);
	if (index != KErrNotFound)
		{
		CX3pRequest* request = iRequestBuffer[index];
		iRequestBuffer.Remove(index);
		delete request;
		
		// If there are no active subsessions, disconnect from the server
		if (iRequestBuffer.Count() == 0)
			{
			iTransmitPositionServer.Close();
			iConnected = EFalse;
			}
		}
	}
コード例 #5
0
void CT_DataSdpAttrValue::DoCmdBool(const TDesC& aSection)
	{
	TBool	actual = GetSdpAttrValue()->Bool();
	INFO_PRINTF2(_L("CSdpAttrValue::Bool = %d"), actual);

	TBool	expected;
	if ( GetBoolFromConfig(aSection, KExpected(), expected) )
		{
		if ( actual!=expected )
			{
			ERR_PRINTF1(_L("Bool is not as expected!"));
			SetBlockResult(EFail);
			}
		}
	else
		{
  		ERR_PRINTF2(_L("Missing expected value %S"), &KExpected());
  		SetBlockResult(EFail);		
		}
	}
コード例 #6
0
// ---------------------------
// RTestStepMmfCtlfrmAudioNoSource
// same as RTestStepMmfCtlfrmAudio, but has no source or sink loaded yet
TVerdict RTestStepMmfCtlfrmAudioNoSource::OpenL()
{
    // preamble - load a controller but give it no data source
    TInt error = KErrNone;

    iSettings.iPriority = ETSIMmfPriorityHigh;
    iSettings.iPref = EMdaPriorityPreferenceQuality;
    iSettings.iState = EMMFStateIdle;

    // Open a controller
    error = iController.Open(KUidCustomTestAudioPlugin, iSettings);
    if (error)
    {
        ERR_PRINTF2(_L("controller failed to open, error %d"), error);
        return iTestStepResult = EInconclusive;
    }

    INFO_PRINTF2(_L("Opened Custom Audio Controller, UID 0x%8x"), KUidCustomTestAudioPlugin);
    return iTestStepResult = EPass;
}
コード例 #7
0
TInt CTestLibcwchar::wcswidth3L(  )
	{	
       
	wchar_t *ws = L"test case";
	int retval;
	
	retval = wcswidth(ws,5);

	INFO_PRINTF2(_L("wcswidth3 result is %d"),retval);

	if(retval != 5)
		{
		return KErrGeneral;
		}
	else
		{
		return KErrNone;
		}
    
    }
コード例 #8
0
void CT_DataSdpAttrValue::DoCmdType(const TDesC& aSection)
	{
	TSdpElementType	actual=GetSdpAttrValue()->Type();
	INFO_PRINTF2(_L("CSdpAttrValue::Type = %d"), actual);

	TSdpElementType	expected;
	if ( CT_BTUtil::ReadSdpElementType(*this, expected, aSection, KExpected()) )
		{
		if ( actual!=expected )
			{
			ERR_PRINTF1(_L("Type is not as expected!"));
			SetBlockResult(EFail);
			}
		}
	else
		{
  		ERR_PRINTF1(_L("Missing expected value Type"));
  		SetBlockResult(EFail);		
		}
	}
コード例 #9
0
TInt CCTSYIntegrationTestSuiteStepBase::DoPauseL(const TDesC& aText, TTimeDuration aTimeout /* = ETimeMedium */)
/**
 Performs a pause, usually to allow user to intervene in Manual tests
 
 @param		aText - text for prompt
 @param		aTimeout - 
 @return	KErrNone if user pressed a key
 */
	{
	TInt ret = KErrNone;
		
	CConsoleBase* con = NULL;
	TRAPD(err, con = Console::NewL(_L("Interactive Test"), TSize(KConsFullScreen, KConsFullScreen)));

	INFO_PRINTF2(_L("Console status = %d"), err);
	TEST(err == KErrNone);
	CleanupStack::PushL(con);
	
	TConsoleReadRequestStatus readRequest(*con);
	//add to cleanup stack
	CleanupStack::PushL(readRequest);
	con->Printf(_L("%S (timeout %d secs) ..."), &aText, aTimeout / KOneSecond);
	con->Read(readRequest);
	
	ret = WaitForRequestWithTimeOut(readRequest, aTimeout);	
		
	if (ret == KErrTimedOut)
		{
		WARN_PRINTF1(_L("[doPause] No keypress detected, timeout! Manual action may not have occurred."));
		}

	if (readRequest.Int() == KRequestPending)	
		{
		readRequest.Cancel();
		}
	
	CleanupStack::PopAndDestroy(); // readRequest
	CleanupStack::PopAndDestroy(); // con
	
	return ret;
	}
コード例 #10
0
TVerdict CGpsAlmanacSatInfoNodeStep::doTestStepPreambleL()
/**
 * @return - TVerdict code
 * Override of base class virtual
 */
	{

	// A previous step may have built the NavModelSatInfoArrayBuilder. If that is not the case,
	// then build it.
	//
	SetTestStepResult(EPass);
   	iGpsAlmanacReader.DataBuffer() = iGpsAlmanacBuilder.DataBuffer();
   	TBool exists = iGpsAlmanacReader.FieldExists(TUEPositioningGpsAlmanac::EAlmanacInfoSatArray);
   	if (!exists)
		{
		iGpsAlmanacBuilder.GetArrayBuilder(TUEPositioningGpsAlmanac::EAlmanacInfoSatArray, iAlmanacSatInfoArrayBuilder);
   		}

    // Modify index to grab next node. Test only nodes 0, 15 and 31.
    // (initial value is -1 so first used index will be zero)
    if (iArrayIndex == -1)
    	{
    	iArrayIndex = 0;
    	}
    else if (iArrayIndex == 0)
    	{
    	iArrayIndex = 15;
    	}
    else if (iArrayIndex == 15)
    	{
    	iArrayIndex = 31;	
    	}
    else
    	{
    	SetTestStepResult(EFail);	
    	}
    
   	INFO_PRINTF2(_L("Node being proccesed at index %D"),iArrayIndex);

	return TestStepResult();
	}
コード例 #11
0
TInt CTestSendsignal::TestNegativeKill2 (  )
	{  
	int ret1 = KErrGeneral, pid, pid1, Signum, ret, status;
	char **argv=(char**)malloc(3*sizeof(char*));
	ret = GetIntFromConfig(ConfigSection(), _L("Signum"), Signum);
	if(ret == 0)
		{
		ERR_PRINTF1(_L("Failed to read the signal number")) ;
		goto close; 
		}
	argv[0]=(char*)malloc(34*sizeof(char));
	argv[1]= 0;
	strcpy(argv[0], "z:\\sys\\bin\\receivesignal.exe");
	ret = posix_spawn(&pid, "z:\\sys\\bin\\receivesignal.exe", NULL, NULL, argv, (char**)NULL);
	if(ret != 0)
		{
		ERR_PRINTF2(_L("Error in posix spawn and errno is set to %d"),errno);
		goto close;
		}
	INFO_PRINTF2( _L("the value of pid returned by posix_spawn is %d"),  pid);
	ret = kill(pid,Signum);
	INFO_PRINTF1(_L("Negative test on Kill()"));
	if((ret != -1) || (errno != EINVAL))
		{
		ERR_PRINTF1(_L("Failed to set the return value"));	
		goto close;
		}
	pid1 = waitpid(pid, &status, WUNTRACED);
	if (pid1 != pid)
		{
		ERR_PRINTF1(_L("waitpid failed..."));	
		goto close;
		}	
	INFO_PRINTF1(_L("Both the return and expected value of kill() are same"));
	ret1 = KErrNone;
	
	close:
	free((void*)argv[0]);
	free((void*)argv);
	return ret1;
	}
コード例 #12
0
/**
Test operator!=()
*/
void CT_SEIDData::DoCmdNegativeCompareL(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("TSEID != Call."));
	TSEID*	seid=NULL;
	TPtrC	seidName;
	if ( !GetStringFromConfig(aSection, KFldSeid, seidName) )
		{
		ERR_PRINTF2(KLogMissingParameter, &KFldSeid);
		SetBlockResult(EFail);
		}
	else
		{
		seid = static_cast<TSEID*>(GetDataObjectL(seidName));
		}	
	
	if(seid)
		{
		TBool actual = iData->operator !=(*seid);
		INFO_PRINTF2(_L("execuete operator !=(TSEID) = %d"), actual);
		
		TBool expected=EFalse;
		if( !GetBoolFromConfig(aSection, KFldExpected(), expected) )
			{
			ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
			SetBlockResult(EFail);
			}
		else
			{
			if ( actual!=expected )
				{
				ERR_PRINTF1(KLogNotExpectedValue);
				SetBlockResult(EFail);
				}
			}
		}
	else
		{
		ERR_PRINTF1(_L("seid is NULL"));
		SetBlockResult(EFail);
		}
	}
コード例 #13
0
// signal complete
void RTestStepConvertAudio::ConvertComplete(TInt aError)
	{
	if (aError != KErrNone)
		{
		StopTest(aError);		
		}
	else
		{
		TBool result = EFalse;
		TRAPD(err, result = CheckConversionL());
		if (err != KErrNone)
			{
			INFO_PRINTF2(_L("Could not check the converted file, err = %d"), err);
			StopTest(err, EFail);				
			}
		else  
			{
			StopTest(aError, (result ? EPass : EFail));			
			}
		}
	}
コード例 #14
0
/**
Test Value()
*/
void CT_SEIDData::DoCmdValue(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("TSEID Value() Call."));
	TInt actual = iData->Value();
	INFO_PRINTF2(_L("Value()=%d"), actual);
	
	TInt expected=0;
	if( !GetIntFromConfig(aSection, KFldExpected(), expected) )
		{
		ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
		SetBlockResult(EFail);
		}
	else
		{
		if ( actual!=expected )
			{
			ERR_PRINTF1(KLogNotExpectedValue);
			SetBlockResult(EFail);
			}
		}
	}
コード例 #15
0
void CT_TCommConfigV02Data::DoCmdiTxShutdownTimeout(const TDesC& aSection)
	{
	TInt	actual=GetCommConfigV02().iTxShutdownTimeout;
	INFO_PRINTF2(_L("iTxShutdownTimeout : %d"), actual);

	TInt	expected;
	if( GetIntFromConfig(aSection, KFldExpected(), expected) )
		{
		if ( expected!=actual )
			{
			ERR_PRINTF1(_L("Expected Value does not match actual"));
			SetBlockResult(EFail);
			}
		}

	TInt	value;
	if( GetIntFromConfig(aSection, KFldValue(), value) )
		{
		GetCommConfigV02().iTxShutdownTimeout=value;
		}
	}
コード例 #16
0
TVerdict CTRuleBasedLaunchingStep::doTestStepL()
	{
	INFO_PRINTF1(_L("TRuleBasedLaunchingStep test started...."));
	
	User::LeaveIfError(FbsStartup());
	TInt ret=RFbsSession::Connect();

	User::LeaveIfError(iFs.Connect());
	User::LeaveIfError(iWs.Connect());
	
	TEST(ret==KErrNone);
	__UHEAP_MARK;			
	TRAPD(err, ExecuteL()); 	
	TEST(err == KErrNone);
	INFO_PRINTF2(_L("execute tests ended with return value '%d'"), err);
	__UHEAP_MARKEND; 			
	
	RFbsSession::Disconnect();
	INFO_PRINTF1(_L(".... TRuleBasedLaunchingStep test finished!!"));
	return TestStepResult();
	}
コード例 #17
0
void CTestCalInterimApiIterator::doAllocTestL()
	{
	INFO_PRINTF1(_L("Alloc test"));
	TInt failCount = 1;
	for( ;; )
		{
		__UHEAP_SETFAIL(RHeap::EFailNext, failCount);
		TRAPD( err, IterateEntriesL());
		if ( err==KErrNone ) 
			{
			INFO_PRINTF1(_L("Memory allocation testing for iterators is done"));
			__UHEAP_RESET;
			break;
			}		
		if ( err != KErrNoMemory )
			SetTestStepResult(EFail);
		__UHEAP_SETFAIL(RHeap::ENone, 0);		
		failCount++;
		}
		INFO_PRINTF2(_L("FAILCOUNT %d"), failCount);
	}
コード例 #18
0
/**
 * This is from MMMFControllerEventMonitorObserver. CMMFControllerEventMonitor
 * calls the method whenever it receives an event from OggRecordController. Basically
 * checks for the Playcompletion event and passes the error back to the test step.
 */
void RTestStepOggCtrlRecordBase::HandleEvent(const TMMFEvent& aEvent)
	{
	if (aEvent.iEventType==KMMFEventCategoryPlaybackComplete)
		{
		if((aEvent.iErrorCode == KErrNone) || (aEvent.iErrorCode == KErrEof))
			{
			iTestStepResult = EPass;
			}
		else
			{
			iTestStepResult = EFail;
			INFO_PRINTF2(_L("RecordCompletion is failed with  %d "), aEvent.iErrorCode);
			}
		}
	else
		{
		INFO_PRINTF1(_L("Failed to receive RecordCompletion Event "));
		iTestStepResult = EFail;
		}
	CActiveScheduler::Stop();
	}
コード例 #19
0
TInt CTestFloat_blr::sinh_test()
	{	
	char chParam[MAX_SIZE];
  	FLOAT input;
  	FLOAT expected;
  	FLOAT max_ulp;
  	FLOAT gen_ulp;
  	
  	
  	// Read parameters
  	
  	ReadStringParam (chParam);
    ReadFloatParam (input);
    ReadFloatParam (expected);
    ReadFloatParam (max_ulp);
    //
    TBuf<MAX_SIZE> buf;
    TInt len = strlen(chParam);
    
    for (TInt j =0; j<len;j++)
    	{
    	buf.Append(chParam[j]);
		}
    
    // Do some testing
    FLOAT res = FUNC(sinh) (input);
        
    if(check_longlong(res, expected, max_ulp, gen_ulp))
    	{
    	INFO_PRINTF1(_L("Test passed."));
    	}
    else    
    	{
    	ERR_PRINTF1(_L("Test Failed."));
   		return KErrGeneral;
    	}
    
    INFO_PRINTF1(_L("_________________________________________\n"));
    INFO_PRINTF2(_L("TestCase		  : %S\n"), &buf );
    INFO_PRINTF2(_L("Input Value    : %f\n"), input );
    INFO_PRINTF2(_L("Expected Value : %f\n"), expected );
	INFO_PRINTF2(_L("Max ULP value  : %f\n"), max_ulp );
	INFO_PRINTF2(_L("Result  		  : %f\n"), res );
	INFO_PRINTF2(_L("Generated Ulp  : %f\n"), gen_ulp );
	INFO_PRINTF1(_L("_________________________________________\n"));
    return KErrNone;

	}
コード例 #20
0
/**
RHostResolver::SetHostName()
*/
void CT_InquirySockAddrData::DoCmdSetHostName(const TDesC& aSection)
	{
	TPtrC deviceName;
	if(GetStringFromConfig(aSection, KDeviceName(), deviceName) )
		{
		INFO_PRINTF1(_L("Call RHostResolver::SetHostName()"));
		TInt err=iHostResolver.SetHostName(deviceName);
		INFO_PRINTF2(_L("iHostResolver.SetHostName(%S)"), &deviceName);

		if( err!=KErrNone )
			{
			ERR_PRINTF2(_L("iHostResolver.SetHostName() = %d"), err);
			SetError(err);
			}
		}
	else
		{
		ERR_PRINTF1(_L("No HostName given"));
		SetBlockResult(EFail);
		}
	}
コード例 #21
0
/**
* Function Name		: TestFtw3
* Description		: Tests the behaviour of ftw 
*/
TInt CTestftw::TestFtw3()
	{
	int ret=KErrNone;
	
	if(CreateDirs() == -1)
		{	
		INFO_PRINTF1(_L("Failed to create directory tree"));
		return KErrGeneral;
		}
	
	if(ftw("c:\\ftwtest", &action, 3) != 0)
		{
		INFO_PRINTF2(_L("FTW failed with errno %d"), errno);
		ret = KErrGeneral;	
		}
		
	rmdir("c:\\ftwtest\\test");
	rmdir("c:\\ftwtest");
	return ret;
			
	}
コード例 #22
0
/**
Test InUse()
*/
void CT_AvdtpSEPInfoData::DoCmdInUse(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("TAvdtpSEPInfo InUse() Call."));
	TBool actual = iData->InUse();
	INFO_PRINTF2(_L("Execute InUse()=%d"), actual);
	
	TBool expected = EFalse;
	if( !GetBoolFromConfig(aSection, KFldExpected(), expected) )
		{
		ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
		SetBlockResult(EFail);
		}
	else
		{
		if ( actual!=expected )
			{
			ERR_PRINTF1(KLogNotExpectedValue);
			SetBlockResult(EFail);
			}
		}
	}
コード例 #23
0
/**
Test IsLocal()
*/
void CT_SEIDData::DoCmdIsLocal(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("TSEID IsLocal() Call."));
	TBool actual = iData->IsLocal();
	INFO_PRINTF2(_L("IsLocal()=%d"), actual);
	
	TBool expected = EFalse;
	if( !GetBoolFromConfig(aSection, KFldExpected(), expected) )
		{
		ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
		SetBlockResult(EFail);
		}
	else
		{
		if ( actual!=expected )
			{
			ERR_PRINTF1(KLogNotExpectedValue);
			SetBlockResult(EFail);
			}
		}
	}
コード例 #24
0
/**
Test MediaType()
*/
void CT_AvdtpSEPInfoData::DoCmdMediaType(const TDesC& aSection) 
	{	
	INFO_PRINTF1(_L("TAvdtpSEPInfo MediaType() Call."));
	SymbianBluetoothAV::TBluetoothMediaType actual = iData->MediaType();
	INFO_PRINTF2(_L("Execute MediaType()=%d"), actual);
	
	SymbianBluetoothAV::TBluetoothMediaType expected;
	if( CT_BTUtil::ReadBluetoothMediaType(*this, aSection, KFldExpected(), expected) )
		{
		if ( actual!=expected )
			{
			ERR_PRINTF1(KLogNotExpectedValue);
			SetBlockResult(EFail);
			}
		}
	else
		{
		ERR_PRINTF2(KLogMissingParameter, KFldExpected);
		SetBlockResult(EFail);		
		}
	}
コード例 #25
0
void CT_EntryData::DoCmdIsUidPresent( const TDesC& aSection )
/** Checks if TEntry has a valid UID using IsTypeValid() function */
	{
	TInt theIntUid;
	TBool expected;
	if( GET_MANDATORY_BOOL_PARAMETER( KExpected, aSection, expected ) &&
		GET_MANDATORY_INT_PARAMETER( KValue, aSection, theIntUid ) )
		{
		INFO_PRINTF2( _L( "IsUidPresent( Uid(%d) )" ), theIntUid );
		TUid theUid;
		theUid.iUid = theIntUid;
		
		TBool result = iEntry->IsUidPresent( theUid );
		
		if ( !( CompareBool(result, expected) ) )
			{
			ERR_PRINTF1( _L( "Error compare function result and expected value" ));
			SetBlockResult(EFail);
			}
		}
	}
コード例 #26
0
/**
 * Selects the network phone that is currently used.
 * @param aNetworkMode is the new network mode.
 * @return Request status.
 */
void CT_RMmCustomApiData::DoCmdSetSystemNetworkMode(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
{
    INFO_PRINTF1(_L("*START*CT_RMmCustomApiData::ModeChange"));

    TInt mode = 0;
    if (!GetEnumFromConfig(aSection, KChangeMode, iEnumTestCaseMode, mode))
    {
        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KChangeMode);
        SetBlockResult(EFail);
    }
    else
    {
        INFO_PRINTF2(_L("Change network mode to: %d"), mode);
        // Setting the network mode, with aNetworkMode
        INFO_PRINTF1(_L("Use RMmCustomAPI to set the phone mode."));
        iCustomPhone->SetSystemNetworkMode(iActiveCallback->iStatus, static_cast<RMmCustomAPI::TNetworkModeCaps>(mode));
        iActiveCallback->Activate(aAsyncErrorIndex);
        IncOutstanding();
    }
    INFO_PRINTF1(_L("*END*CT_RMmCustomApiData::ModeChange"));
}
コード例 #27
0
enum TVerdict CTestMMSetEmgClientLcsReqAndSetPrClient::doTestStepL()
//
// To test a combination of SetPriorityClient API and SetEmergencyClient(LCSRequest) API.
//
	{
	INFO_PRINTF1(_L("To test a combination of SetPriorityClient API and SetEmergencyClient(LCSRequest) API."));
	// OOM testing only works with debug builds
#ifdef _DEBUG
	TInt setemergency;
	setemergency=iPhone.SetEmergencyClient(RPhone::EEmergencyLCSRequest);
    TEST(setemergency==KErrNone);
    INFO_PRINTF2(_L("Test %d - iPhone.SetEmergencyClient(RPhone::EEmergencyLCSRequest); "), setemergency);
  	TInt ret=iTelServer.SetPriorityClient();
	TEST(ret==KErrAlreadyExists);
 	INFO_PRINTF1(_L("Test 	iTelServer.SetPriorityClient "));
 	OOMTest_LBS();
#else
	INFO_PRINTF1(_L("Test disabled on release builds."));	
#endif // _DEBUG	
    return TestStepResult();
	}
コード例 #28
0
/**
Test IsValid()
*/
void CT_RfcommRemotePortParamsData::DoCmdIsValid(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("TRfcommRemotePortParams IsValid Call"));
	TUint8 result = iData->IsValid();
	INFO_PRINTF2(_L("IsValid result (%d)"), result);
	
	TInt expected = 0;
	if(GetIntFromConfig(aSection, KExpected(), expected) )
		{
		if ( result != expected )
			{
			ERR_PRINTF3(_L("Return value (%d) is not as expected (%d)"), result, expected);
			SetBlockResult(EFail);
			}	
		}
	else
		{
		ERR_PRINTF2(KLogMissingParameter, &KExpected());
		SetBlockResult(EFail);
		}
	}
コード例 #29
0
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);
	}
コード例 #30
0
TBool RTestStepConvertAudio::CheckConversionL()
	{
	RFile outputFile; //output file
	RFile refFile; //reference file
	
	//open the files
	User::LeaveIfError(outputFile.Open(iFs, iToFileName, EFileRead|EFileShareAny));
	CleanupClosePushL(outputFile);
	User::LeaveIfError(refFile.Open(iFs, iToFileName, EFileRead|EFileShareAny));  // this is changed because of fix for DEF145347 (TSW id : ESLM-844Q3G). As file size is changing everytime, we should compare with output file always
	CleanupClosePushL(refFile);	

	TInt err = KErrNone;
	//read contents of output file using file stream
	RFileReadStream outputFileStream(outputFile, 0);
	CleanupClosePushL(outputFileStream);
	HBufC8* outputFileBuf = HBufC8::NewLC(KNumBytesToCompare);
	TPtr8 outputData = outputFileBuf->Des();
	TRAP(err, outputFileStream.ReadL(outputData));
	if ((err != KErrNone) && (err != KErrEof)) 
		{
		User::Leave(err);	
		}

	//read contents of reference file using file stream
	RFileReadStream refFileStream(refFile, 0);
	CleanupClosePushL(refFileStream);
	HBufC8* refFileBuf = HBufC8::NewLC(KNumBytesToCompare);
	TPtr8 refData = refFileBuf->Des();
	TRAP(err, refFileStream.ReadL(refData))
	if ((err != KErrNone) && (err != KErrEof)) 
		{
		User::Leave(err);	
		}		
			
	TInt result = refFileBuf->Compare(*outputFileBuf);
	INFO_PRINTF2(_L("Result = %d"), result);	

	CleanupStack::PopAndDestroy(6, &outputFile);
	return (result == 0);
	}