traceservices/tracefw/integ_test/ost/TEF/te_ostv2integsuite_performance/src/te_perfoutputsanity.cpp
branchRCL_3
changeset 24 cc28652e0254
parent 23 26645d81f48d
equal deleted inserted replaced
23:26645d81f48d 24:cc28652e0254
    69 					const TInt /*aAsyncErrorIndex*/)
    69 					const TInt /*aAsyncErrorIndex*/)
    70 	{
    70 	{
    71 	
    71 	
    72 	if(BlockResult()==EPass)
    72 	if(BlockResult()==EPass)
    73 		{
    73 		{
    74 		SetBlockResult(TestBaselineCsvL());
    74 		SetBlockResult(TestBaselineCsv());
    75 		}
    75 		}
    76 	
    76 	
    77 	return ETrue;
    77 	return ETrue;
    78 	}
    78 	}
    79 
    79 
    80 
    80 
    81 
    81 
    82 TVerdict COutputCSVSanityWrapper::TestBaselineCsvL()
    82 TVerdict COutputCSVSanityWrapper::TestBaselineCsv()
    83 	{
    83 	{
    84 
    84 
    85 	//read a sanity test file
    85 	//read a sanity test file
    86 	//read generated file
    86 	//read generated file
    87 	//compare...
    87 	//compare...
    89 	//Create csvReference
    89 	//Create csvReference
    90 	CCsvReader csvReference;
    90 	CCsvReader csvReference;
    91 	TInt size = 0;
    91 	TInt size = 0;
    92 	//get the size of the reference file
    92 	//get the size of the reference file
    93 #ifdef __WINSCW__
    93 #ifdef __WINSCW__
    94 	TInt error = CsvFileSizeL(KReferenceWinscwCsvFile, size);
    94 	TInt error = CsvFileSize(KReferenceWinscwCsvFile, size);
    95 #else
    95 #else
    96 	TInt error = CsvFileSizeL(KReferenceCsvFile, size);
    96 	TInt error = CsvFileSize(KReferenceCsvFile, size);
    97 #endif
    97 #endif
    98 	if(error)
    98 	if(error)
    99 		{
    99 		{
   100 		SetBlockResult(EFail);
   100 		SetBlockResult(EFail);
   101 		INFO_PRINTF2(_L("TestBaselineCsvL, KReferenceCsvFile, test failed on with error code %d"), error);
   101 		INFO_PRINTF2(_L("TestBaselineCsv, KReferenceCsvFile, test failed on with error code %d"), error);
   102 		}
   102 		}
   103 	//Set the size of the RBuf
   103 	//Set the size of the RBuf
   104 	csvReference.Create(size);
   104 	csvReference.Create(size);
   105 	
   105 	
   106 	//Create csvGenerated
   106 	//Create csvGenerated
   107 	CCsvReader csvGenerated;
   107 	CCsvReader csvGenerated;
   108 	//get the size of the generated file
   108 	//get the size of the generated file
   109 	error = CsvFileSizeL(KApiCSVFile, size);
   109 	error = CsvFileSize(KApiCSVFile, size);
   110 	if(error)
   110 	if(error)
   111 		{
   111 		{
   112 		SetBlockResult(EFail);
   112 		SetBlockResult(EFail);
   113 		INFO_PRINTF2(_L("TestBaselineCsvL, KApiCSVFile, test failed on with error code %d"), error);
   113 		INFO_PRINTF2(_L("TestBaselineCsv, KApiCSVFile, test failed on with error code %d"), error);
   114 		}
   114 		}
   115 	//create the RBuf
   115 	//create the RBuf
   116 	csvGenerated.Create(size);
   116 	csvGenerated.Create(size);
   117 	
   117 	
   118 	//Read the reference file into the RBuf
   118 	//Read the reference file into the RBuf
   119 #ifdef __WINSCW__
   119 #ifdef __WINSCW__
   120 	error = ReadCsvFileL(KReferenceWinscwCsvFile, csvReference.Buffer());
   120 	error = ReadCsvFile(KReferenceWinscwCsvFile, csvReference.Buffer());
   121 #else
   121 #else
   122 	error = ReadCsvFileL(KReferenceCsvFile, csvReference.Buffer());
   122 	error = ReadCsvFile(KReferenceCsvFile, csvReference.Buffer());
   123 #endif
   123 #endif
   124 	if(error)
   124 	if(error)
   125 		{
   125 		{
   126 		SetBlockResult(EFail);
   126 		SetBlockResult(EFail);
   127 		INFO_PRINTF2(_L("TestBaselineCsvL, ReadCsvFileL(KReferenceCsvFile) failed on with error code %d"), error);		
   127 		INFO_PRINTF2(_L("TestBaselineCsv, ReadCsvFile(KReferenceCsvFile) failed on with error code %d"), error);		
   128 		}
   128 		}
   129 	//Read the generated file into the RBuf
   129 	//Read the generated file into the RBuf
   130 	error = ReadCsvFileL(KApiCSVFile, csvGenerated.Buffer());
   130 	error = ReadCsvFile(KApiCSVFile, csvGenerated.Buffer());
   131 	if(error)
   131 	if(error)
   132 		{
   132 		{
   133 		SetBlockResult(EFail);
   133 		SetBlockResult(EFail);
   134 		INFO_PRINTF2(_L("TestBaselineCsvL, ReadCsvFileL(KApiCSVFile) failed on with error code %d"), error);		
   134 		INFO_PRINTF2(_L("TestBaselineCsv, ReadCsvFile(KApiCSVFile) failed on with error code %d"), error);		
   135 		}
   135 		}
   136 
   136 
   137 	//compare the two files
   137 	//compare the two files
   138 	if(!error)
   138 	if(!error)
   139 		{
   139 		{
   162 		}
   162 		}
   163 	return BlockResult();
   163 	return BlockResult();
   164 	}
   164 	}
   165 
   165 
   166 
   166 
   167 TInt COutputCSVSanityWrapper::CsvFileSizeL(const TDesC& aFilename, TInt& aSize)
   167 TInt COutputCSVSanityWrapper::CsvFileSize(const TDesC& aFilename, TInt& aSize)
   168 	{
   168 	{
   169 	RFs fsSession;
   169 	RFs fsSession;
   170 	CleanupClosePushL(fsSession);
   170 	CleanupClosePushL(fsSession);
   171 	User::LeaveIfError(fsSession.Connect()); 
   171 	User::LeaveIfError(fsSession.Connect()); 
   172 	
   172 	
   187 /*
   187 /*
   188  * Read a file and stick the data in a buffer and return that.
   188  * Read a file and stick the data in a buffer and return that.
   189  * The caller of the method owns the buffer 
   189  * The caller of the method owns the buffer 
   190  * Ie. this method allocates the buffer but the caller is responsible for destroying it.
   190  * Ie. this method allocates the buffer but the caller is responsible for destroying it.
   191  */
   191  */
   192 TInt COutputCSVSanityWrapper::ReadCsvFileL(const TDesC& aFilename, RBuf8& aBuffer)
   192 TInt COutputCSVSanityWrapper::ReadCsvFile(const TDesC& aFilename, RBuf8& aBuffer)
   193 	{
   193 	{
   194 	RFs fsSession;
   194 	RFs fsSession;
   195 	CleanupClosePushL(fsSession);
   195 	CleanupClosePushL(fsSession);
   196 	User::LeaveIfError(fsSession.Connect()); 
   196 	User::LeaveIfError(fsSession.Connect()); 
   197 	
   197