featuremgmt/featuremgr/test/tef/tef_efm_configured/src/characterisation_steps.cpp
branchRCL_3
changeset 24 cc28652e0254
parent 23 26645d81f48d
equal deleted inserted replaced
23:26645d81f48d 24:cc28652e0254
    25 #include <featmgr/featurecontrol.h>
    25 #include <featmgr/featurecontrol.h>
    26 #include <hal.h>
    26 #include <hal.h>
    27 #include "characterisation_steps.h"
    27 #include "characterisation_steps.h"
    28 #include "efm_teststepbase.h"
    28 #include "efm_teststepbase.h"
    29 
    29 
    30 
       
    31 TBool SkipPerformanceTest = EFalse;
       
    32 const TInt KPlatSimUid = 0x20029a73; //0x20029a73 will be changed soon once PlatSim get its own uid.
       
    33 
       
    34 // This is the base class for some of our characterisation tests.
    30 // This is the base class for some of our characterisation tests.
    35 // Creates an RFeatureControl object, finds out what the fast counter
    31 // Creates an RFeatureControl object, finds out what the fast counter
    36 // frequency is and gets the timeout for this test.
    32 // frequency is and gets the timeout for this test.
    37 TVerdict CCharacteriseBaseStep :: doTestStepPreambleL()
    33 TVerdict CCharacteriseBaseStep :: doTestStepPreambleL()
    38 	{
    34 	{
    39 
    35 	// First find out the granularity of the system clock..
       
    36 	HAL::Get(HALData::EFastCounterFrequency, icountfreq);
       
    37 	INFO_PRINTF2(_L("Counts per sec=%d"), icountfreq);
       
    38 	icountperusec = icountfreq/1000000.0;
       
    39 	INFO_PRINTF2(_L("Counts per usec=%f"), icountperusec);
       
    40 
       
    41 	TInt err = icontrol.Open();
       
    42 	TESTDIAGNOSTICERROR(err==KErrNone,
       
    43 		_L("RFeatureControl::Open failed: error = %d"), err);
       
    44 	if(err) { return TestStepResult(); }
       
    45 	CleanupClosePushL(icontrol);
    40 
    46 
    41 	// Get the timeout from the .ini file. The name of the timeout entry
    47 	// Get the timeout from the .ini file. The name of the timeout entry
    42 	// varies depending on what type of build we have.
    48 	// varies depending on what type of build we have.
    43 	TBuf<20> timeoutini(_L("Timeout"));
    49 	TBuf<20> timeoutini(_L("Timeout"));
    44 #ifdef __WINSCW__
    50 #ifdef __WINSCW__
    60 	   		timeoutini.Append(_L("_H6"));
    66 	   		timeoutini.Append(_L("_H6"));
    61 	   		break;
    67 	   		break;
    62 	   case HAL::EMachineUid_NE1_TB:
    68 	   case HAL::EMachineUid_NE1_TB:
    63 	   		timeoutini.Append(_L("_NE1"));
    69 	   		timeoutini.Append(_L("_NE1"));
    64 	   		break;
    70 	   		break;
    65 	   case KPlatSimUid:
       
    66             ERR_PRINTF1(_L("Not running performance test in PlatSim"));
       
    67             SkipPerformanceTest = ETrue; //Skip performance test on PlatSim
       
    68             break;
       
    69 	   //add any new hardware IDs here		
    71 	   //add any new hardware IDs here		
    70 	   default:
    72 	   default:
    71 	   		break;
    73 	   		break;
    72 	   	}
    74 	   	}
    73 #endif
    75 #endif
    74 #ifdef _DEBUG
    76 #ifdef _DEBUG
    75 	timeoutini.Append(_L("_UDEB"));
    77 	timeoutini.Append(_L("_UDEB"));
    76 #else
    78 #else
    77 	timeoutini.Append(_L("_UREL"));
    79 	timeoutini.Append(_L("_UREL"));
    78 #endif
    80 #endif
    79     if (!SkipPerformanceTest)
    81 
    80         {
    82 	// Get the timeout, which is measured in microseconds.
    81         // First find out the granularity of the system clock..
    83 	if( !GetIntFromConfig(ConfigSection(), timeoutini, itimeout ) )
    82         HAL::Get(HALData::EFastCounterFrequency, icountfreq);
    84 		{
    83         INFO_PRINTF2(_L("Counts per sec=%d"), icountfreq);
    85 		ERR_PRINTF2(_L("Can't find '%S' in .ini file"),
    84         icountperusec = icountfreq/1000000.0;
    86 						&timeoutini );
    85         INFO_PRINTF2(_L("Counts per usec=%f"), icountperusec);
    87 		CleanupStack::PopAndDestroy(&icontrol);
    86         TInt err = icontrol.Open();
    88 		SetTestStepResult(EFail);
    87         TESTDIAGNOSTICERROR(err==KErrNone,
    89 		return TestStepResult();
    88             _L("RFeatureControl::Open failed: error = %d"), err);
    90 		}
    89         if(err) { return TestStepResult(); }
       
    90         CleanupClosePushL(icontrol);
       
    91         // Get the timeout, which is measured in microseconds.
       
    92         if( !GetIntFromConfig(ConfigSection(), timeoutini, itimeout ) )
       
    93             {
       
    94             ERR_PRINTF2(_L("Can't find '%S' in .ini file"),
       
    95                             &timeoutini );
       
    96             CleanupStack::PopAndDestroy(&icontrol);
       
    97             SetTestStepResult(EFail);
       
    98             return TestStepResult();
       
    99             }
       
   100         }
       
   101 	return TestStepResult();
    91 	return TestStepResult();
   102 	}
    92 	}
   103 
    93 
   104 TVerdict CCharacteriseBaseStep :: doTestStepPostambleL()
    94 TVerdict CCharacteriseBaseStep :: doTestStepPostambleL()
   105 	{
    95 	{
   106     if (SkipPerformanceTest)
       
   107 		{
       
   108         return TestStepResult();
       
   109 		}
       
   110 	CleanupStack::PopAndDestroy(&icontrol);
    96 	CleanupStack::PopAndDestroy(&icontrol);
   111 	return TestStepResult();
    97 	return TestStepResult();
   112 	}
    98 	}
   113 
    99 
   114 CCharacteriseSupportedStep :: CCharacteriseSupportedStep()
   100 CCharacteriseSupportedStep :: CCharacteriseSupportedStep()
   116 	SetTestStepName(KCharacteriseSupported);
   102 	SetTestStepName(KCharacteriseSupported);
   117 	}
   103 	}
   118 
   104 
   119 TVerdict CCharacteriseSupportedStep::doTestStepL()
   105 TVerdict CCharacteriseSupportedStep::doTestStepL()
   120 	{
   106 	{
   121     if (SkipPerformanceTest)
       
   122 		{
       
   123 		return TestStepResult();
       
   124 		}
       
   125 	// The base class 'CCharacteriseBaseStep' has already opened the
   107 	// The base class 'CCharacteriseBaseStep' has already opened the
   126 	// RFeatureControl object and read in the timeout number.
   108 	// RFeatureControl object and read in the timeout number.
   127 
   109 
   128 	// Find out how many features we're going to attempt to read, the
   110 	// Find out how many features we're going to attempt to read, the
   129 	// minimum uid (that we start on) and the number of supported UIDs
   111 	// minimum uid (that we start on) and the number of supported UIDs
   187 	SetTestStepName(KCharacteriseSupportedArray);
   169 	SetTestStepName(KCharacteriseSupportedArray);
   188 	}
   170 	}
   189 
   171 
   190 TVerdict CCharacteriseSupportedArrayStep::doTestStepL()
   172 TVerdict CCharacteriseSupportedArrayStep::doTestStepL()
   191 	{
   173 	{
   192     if (SkipPerformanceTest)
       
   193 		{
       
   194 		return TestStepResult();
       
   195 		}
       
   196 	// Find out how many features we're going to attempt to read..
   174 	// Find out how many features we're going to attempt to read..
   197 	TInt nfeats, minuid, expsup;
   175 	TInt nfeats, minuid, expsup;
   198 	if(!GetIntFromConfig(ConfigSection(), _L("NumFeaturesToRead"), nfeats) ||
   176 	if(!GetIntFromConfig(ConfigSection(), _L("NumFeaturesToRead"), nfeats) ||
   199 	   !GetIntFromConfig(ConfigSection(), _L("MinFeatureUID"), minuid) ||
   177 	   !GetIntFromConfig(ConfigSection(), _L("MinFeatureUID"), minuid) ||
   200 	   !GetIntFromConfig(ConfigSection(), _L("NumSupported"), expsup))
   178 	   !GetIntFromConfig(ConfigSection(), _L("NumSupported"), expsup))