os/kernelhwsrv/kerneltest/f32test/bench/t_fat_perf.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // File Name:		f32test/bench/t_fat_perf.cpp
    15 // This file contains implementation for the functions called 
    16 // by test cases from the command line to test FAT Performance on
    17 // large number of files (PREQ 1885).
    18 // 
    19 //
    20 
    21 //Include files
    22 #include <e32test.h>
    23 #include <f32file.h>
    24 #include <f32dbg.h>
    25 #include "t_server.h"
    26 #include "t_fat_perf.h"
    27 
    28 
    29 
    30 LOCAL_C void ClearCache(TInt); 
    31 
    32 RTest test(_L("T_FAT_PERF"));
    33 
    34 TFileName 	gPath;
    35 TFileName 	gFileNameBase;
    36 TInt 		gFileNo = 0;
    37 TInt		gTestCase = -1;
    38 TInt		gCacheClear = 0;
    39 TInt        gZeroPadFileNumberForFixedLengthFileNames = 0;
    40 
    41 
    42 //-----------------------------------------------------------------------------
    43 
    44 TNamingSchemeParam::TNamingSchemeParam() 
    45     : iConOrRan(EConsecutive), iUniOrAsc(EAscii), iZeroPadFileNumber(EFalse), iMaxFileNameLength(0), iMinStringLength(0)
    46     {
    47     iFileNameBase = _L("");
    48     }
    49 
    50 //-----------------------------------------------------------------------------
    51 /**
    52   	This function creates the files in the following directories
    53   	INITIAL CONDITION: FILL FOLLOWING SUB-DIRS WITH 1600 FILES
    54 	"\\DIR1\\"...2000 files ("ABCD1ABCD2ABCD3ABCD4ABCD5ABCD_1 ~ 2000.TXT")
    55 	"\\DIR1\\DIR11\\"...1600 files ("ABCD1ABCD2ABCD3ABCD4ABCD5ABCD_1 ~ 1600.TXT")
    56 	"\\DIR1\\DIR11\\DIR111\\"...1610 files ("ABCD1ABCD2ABCD3ABCD4ABCD5ABCD_1 ~ 1600.TXT") + "ANOTHERLONGFILENAME_1~10.TXT"
    57 	"\\DIR1\\DIR12RAN\\"...1600 files ("...random string (31~34)....TXT")
    58 	"\\DIR2\\"...1600 files ("ABCD1ABCD2ABCD3ABCD4ABCD5ABCD_1 ~ 1600.TXT")
    59  */
    60 //-----------------------------------------------------------------------------
    61 
    62 LOCAL_C void DoTestCaseSetup()
    63 	{
    64 	test.Next(_L(" 'Test Setup' - 00"));
    65 
    66 	TMLUnitParam mlParam = 
    67 		{
    68 		12345	// iID
    69 		};
    70 	CMeasureAndLogUnit* measureAndLogUnit = CMeasureAndLogUnit::NewLC(mlParam);
    71 	CExecutionUnit* execUnit = CExecutionUnit::NewLC(measureAndLogUnit, gDriveToTest);
    72 
    73 	TInt curDriveNum;
    74 	TInt err = TheFs.CharToDrive(gDriveToTest, curDriveNum);
    75 	test(KErrNone == err);
    76 	FormatFatDrive(TheFs,curDriveNum, EQuickFormat, NULL, EFalse);
    77 
    78 /*-----------------------------------------------------------------------------
    79  * Setup for "\\DIR1\\"
    80  *-----------------------------------------------------------------------------*/
    81 
    82    	TNamingSchemeParam namingScheme;
    83 	namingScheme.iConOrRan 			       = EConsecutive;
    84 	namingScheme.iUniOrAsc 			       = EAscii;
    85 	namingScheme.iZeroPadFileNumber   = EFalse;
    86 	namingScheme.iFileNameBase 		       = _L("ABCD1ABCD2ABCD3ABCD4ABCD5ABCD_");
    87 	namingScheme.iMaxFileNameLength        = 0;
    88 	namingScheme.iMinStringLength 	       = 0;
    89 	
    90 	TDirUnitParam dirParam1;
    91 	dirParam1.iPriority 			= 1;
    92 	dirParam1.iDirName 				= _L("?:\\DIR1\\");
    93 	dirParam1.iRuns 				= 1;
    94 	dirParam1.iFilesPerRun 			= 2000;
    95 	dirParam1.iSampleInterval 		= 0;
    96 	dirParam1.iNamingScheme 		= namingScheme;
    97 	dirParam1.iFileOpMode 			= EFATPerfFileCreate;
    98 	
    99 	execUnit->AddDirUnitL(dirParam1);
   100 	
   101 /*-----------------------------------------------------------------------------
   102  * Setup for "\\DIR1\\DIR11\\"
   103  *-----------------------------------------------------------------------------*/
   104 
   105 	TDirUnitParam dirParam11		= dirParam1;
   106 	dirParam11.iDirName 			= _L("?:\\DIR1\\DIR11\\");
   107 	dirParam11.iFilesPerRun			= 1600;
   108 	dirParam11.iSampleInterval		= 0;
   109 
   110 	execUnit->AddDirUnitL(dirParam11);
   111 	
   112 /*-----------------------------------------------------------------------------
   113  * Setup for "\\DIR1\\DIR11\\DIR111\\"
   114  *-----------------------------------------------------------------------------*/
   115 
   116 	TDirUnitParam dirParam111		= dirParam1;
   117 	dirParam111.iDirName 			= 	_L("?:\\DIR1\\DIR11\\DIR111\\");
   118 	dirParam111.iFilesPerRun		= 1600;
   119 	dirParam111.iSampleInterval		= 0;
   120 
   121 	execUnit->AddDirUnitL(dirParam111);
   122 
   123 /*-----------------------------------------------------------------------------
   124  * Test setup for "\\DIR1\\DIR11\\DIR111\\" with "ANOTHERLONGFILENAME_" file
   125  *-----------------------------------------------------------------------------*/
   126 
   127 	TNamingSchemeParam namingScheme111A = namingScheme;
   128 	namingScheme111A.iFileNameBase 		= _L("ANOTHERLONGFILENAME_");
   129 
   130 	TDirUnitParam dirParam111A		= dirParam1;
   131 	dirParam111A.iDirName 			= 	_L("?:\\DIR1\\DIR11\\DIR111\\");
   132 	dirParam111A.iFilesPerRun		= 10;
   133 	dirParam111A.iSampleInterval	= 0;
   134 	dirParam111A.iNamingScheme 		= namingScheme111A;
   135 	
   136 	execUnit->AddDirUnitL(dirParam111A);
   137 
   138 /*-----------------------------------------------------------------------------
   139  * Setup for "\\DIR1\\DIR12RAN\\"
   140  *-----------------------------------------------------------------------------*/
   141 
   142 	TNamingSchemeParam namingScheme12 = namingScheme;
   143 	namingScheme12.iConOrRan 			   = ERandom;
   144 	namingScheme12.iZeroPadFileNumber = EFalse;
   145 	namingScheme12.iFileNameBase 		   = _L("");
   146 	namingScheme12.iMaxFileNameLength 	   = 34;
   147 	namingScheme12.iMinStringLength 	   = 31;
   148 
   149 	TDirUnitParam dirParam12		= dirParam1;
   150 	dirParam12.iDirName 			= _L("?:\\DIR1\\DIR12RAN\\");
   151 	dirParam12.iFilesPerRun			= 1600;
   152 	dirParam12.iSampleInterval		= 0;
   153 	dirParam12.iNamingScheme 		= namingScheme12;
   154 	
   155 	execUnit->AddDirUnitL(dirParam12);
   156 
   157 /*-----------------------------------------------------------------------------
   158  * Setup for "\\DIR2\\"
   159  *-----------------------------------------------------------------------------*/
   160 
   161 	TDirUnitParam dirParam2		= dirParam1;
   162 	dirParam2.iDirName 			= _L("?:\\DIR2\\");
   163 	dirParam2.iFilesPerRun		= 1600;
   164 	dirParam2.iSampleInterval	= 0;
   165 	dirParam2.iNamingScheme 	= namingScheme;
   166 	
   167 	execUnit->AddDirUnitL(dirParam2);
   168 
   169 	execUnit->Run();
   170 	CleanupStack::PopAndDestroy(2);
   171 	}
   172 
   173 //-----------------------------------------------------------------------------
   174 /**
   175 This function creates a files in the valid directory path
   176 */
   177 //-----------------------------------------------------------------------------
   178 LOCAL_C void DoTestCaseCreateFile()
   179 	{
   180 	test.Next(_L(" 'Create File' - 01"));
   181 
   182 	TMLUnitParam mlParam = 
   183 		{
   184 		12345	// iID
   185 		};
   186 	CMeasureAndLogUnit* measureAndLogUnit = CMeasureAndLogUnit::NewLC(mlParam);
   187 	CExecutionUnit* execUnit = CExecutionUnit::NewLC(measureAndLogUnit, gDriveToTest);
   188 
   189 	ClearCache(gCacheClear);
   190 	
   191 	TNamingSchemeParam namingScheme;
   192 	namingScheme.iZeroPadFileNumber = 	gZeroPadFileNumberForFixedLengthFileNames;
   193 	
   194 	TDirUnitParam dirParam1;
   195 	dirParam1.iPriority 			= 1;
   196 	dirParam1.iDirName 				= _L("");
   197 	dirParam1.iRuns 				= 1;
   198 	dirParam1.iFilesPerRun 			= 0;
   199 	dirParam1.iSampleInterval 		= 1;
   200 	dirParam1.iNamingScheme 		= namingScheme;
   201 	dirParam1.iFileOpMode 			= EFATPerfFileCreate;
   202 	
   203 		
   204 	TFileName path = _L("?:\\");
   205 	path.Append(gPath);
   206 	if (path[path.Length() - 1] != '\\')
   207 		{
   208 		path.Append('\\');
   209 		}
   210 	
   211 	dirParam1.iDirName = path;
   212 	dirParam1.iFilesPerRun = gFileNo;
   213 	dirParam1.iNamingScheme.iFileNameBase = gFileNameBase;
   214 
   215 	execUnit->AddDirUnitL(dirParam1);
   216 	execUnit->Run();
   217 
   218 	CleanupStack::PopAndDestroy(2);
   219 	
   220 	}
   221 
   222 //-----------------------------------------------------------------------------
   223 /**
   224 This function opens file in the valid directoy path
   225 */
   226 //-----------------------------------------------------------------------------
   227 
   228 LOCAL_C void DoTestCaseOpenFile()
   229 	{
   230 	test.Next(_L(" 'Open File' - 02"));
   231 
   232 	TMLUnitParam mlParam = 
   233 		{
   234 		12345	// iID
   235 		};
   236 	CMeasureAndLogUnit* measureAndLogUnit = CMeasureAndLogUnit::NewLC(mlParam);
   237 	CExecutionUnit* execUnit = CExecutionUnit::NewLC(measureAndLogUnit, gDriveToTest);
   238 
   239 	ClearCache(gCacheClear);
   240 	
   241 	TNamingSchemeParam namingScheme;
   242 	namingScheme.iZeroPadFileNumber = gZeroPadFileNumberForFixedLengthFileNames;
   243 	
   244 	TDirUnitParam dirParam1;
   245 	dirParam1.iPriority 			= 1;
   246 	dirParam1.iDirName 				= _L("");
   247 	dirParam1.iRuns 				= 1;
   248 	dirParam1.iFilesPerRun 			= 0;
   249 	dirParam1.iSampleInterval 		= 1;
   250 	dirParam1.iNamingScheme 		= namingScheme;
   251 	dirParam1.iFileOpMode 			= EFATPerfFileOpen;
   252 	
   253 	
   254 	TFileName path = _L("?:\\");
   255 	path.Append(gPath);
   256 	if (path[path.Length() - 1] != '\\')
   257 		{
   258 		path.Append('\\');
   259 		}
   260 	
   261 	dirParam1.iDirName = path;
   262 	dirParam1.iFilesPerRun = gFileNo;
   263 	dirParam1.iNamingScheme.iFileNameBase = gFileNameBase;
   264 
   265 	execUnit->AddDirUnitL(dirParam1);
   266 	execUnit->Run();
   267 
   268 	CleanupStack::PopAndDestroy(2);
   269 	
   270 	}
   271 
   272 //-----------------------------------------------------------------------------
   273 /**
   274 This function deletes the files in the valid directory path
   275 */
   276 //-----------------------------------------------------------------------------
   277 
   278 LOCAL_C void DoTestCaseDeleteFile()
   279 	{
   280 	test.Next(_L(" 'Delete File' - 03"));
   281 
   282 	TMLUnitParam mlParam = 
   283 		{
   284 		12345	// iID
   285 		};
   286 	CMeasureAndLogUnit* measureAndLogUnit = CMeasureAndLogUnit::NewLC(mlParam);
   287 	CExecutionUnit* execUnit = CExecutionUnit::NewLC(measureAndLogUnit, gDriveToTest);
   288 
   289 	ClearCache(gCacheClear);
   290 	
   291 	TNamingSchemeParam namingScheme;
   292 	namingScheme.iZeroPadFileNumber = gZeroPadFileNumberForFixedLengthFileNames;
   293 	
   294 	TDirUnitParam dirParam1;
   295 	dirParam1.iPriority 			= 1;
   296 	dirParam1.iDirName 				= _L("");
   297 	dirParam1.iRuns 				= 1;
   298 	dirParam1.iFilesPerRun 			= 0;
   299 	dirParam1.iSampleInterval 		= 1;
   300 	dirParam1.iNamingScheme 		= namingScheme;
   301 	dirParam1.iFileOpMode 			= EFATPerfFileDelete;
   302 	
   303 	TFileName path = _L("?:\\");
   304 	path.Append(gPath);
   305 	if (path[path.Length() - 1] != '\\')
   306 		{
   307 		path.Append('\\');
   308 		}
   309 	
   310 	dirParam1.iDirName = path;
   311 	dirParam1.iFilesPerRun = gFileNo;
   312 	dirParam1.iNamingScheme.iFileNameBase = gFileNameBase;
   313 
   314 	execUnit->AddDirUnitL(dirParam1);
   315 	execUnit->Run();
   316 
   317 	CleanupStack::PopAndDestroy(2);
   318 	
   319 	}
   320 
   321 //-----------------------------------------------------------------------------
   322 /**
   323 PREQ1885  - optional test case 
   324 This function writes data into the files in the valid directory path
   325 */
   326 //-----------------------------------------------------------------------------
   327 
   328 LOCAL_C void DoTestCaseWriteFile()
   329 	{
   330 	test.Next(_L(" 'Write File'  - 04 - Write 4KB of Data"));
   331 
   332 	TMLUnitParam mlParam = 
   333 		{
   334 		12345	// iID
   335 		};
   336 	CMeasureAndLogUnit* measureAndLogUnit = CMeasureAndLogUnit::NewLC(mlParam);
   337 	CExecutionUnit* execUnit = CExecutionUnit::NewLC(measureAndLogUnit, gDriveToTest);
   338 
   339 	ClearCache(gCacheClear);
   340 	
   341 	TNamingSchemeParam namingScheme;
   342 	namingScheme.iZeroPadFileNumber = gZeroPadFileNumberForFixedLengthFileNames;
   343 
   344 	TDirUnitParam dirParam1;
   345 	dirParam1.iPriority 			= 1;
   346 	dirParam1.iDirName 				= _L("");
   347 	dirParam1.iRuns 				= 1;
   348 	dirParam1.iFilesPerRun 			= 0;
   349 	dirParam1.iSampleInterval 		= 1;
   350 	dirParam1.iNamingScheme 		= namingScheme;
   351 	dirParam1.iFileOpMode 			= EFATPerfFileWrite;
   352 	
   353 	TFileName path = _L("?:\\");
   354 	path.Append(gPath);
   355 	if (path[path.Length() - 1] != '\\')
   356 		{
   357 		path.Append('\\');
   358 		}
   359 	
   360 	dirParam1.iDirName = path;
   361 	dirParam1.iFilesPerRun = gFileNo;
   362 	dirParam1.iNamingScheme.iFileNameBase = gFileNameBase;
   363 
   364 	execUnit->AddDirUnitL(dirParam1);
   365 	execUnit->Run();
   366 
   367 	CleanupStack::PopAndDestroy(2);
   368 	
   369 	}
   370 
   371 //-----------------------------------------------------------------------------
   372 /**
   373 PREQ1885  - optional test case  
   374 This function Reads data from the files in the valid directory path
   375 */
   376 //-----------------------------------------------------------------------------
   377 
   378 LOCAL_C void DoTestCaseReadFile()
   379 	{
   380 	test.Next(_L(" 'Read File' - 05 Read 4KB of data"));
   381 
   382 	TMLUnitParam mlParam = 
   383 		{
   384 		12345	// iID
   385 		};
   386 	CMeasureAndLogUnit* measureAndLogUnit = CMeasureAndLogUnit::NewLC(mlParam);
   387 	CExecutionUnit* execUnit = CExecutionUnit::NewLC(measureAndLogUnit, gDriveToTest);
   388 
   389 	ClearCache(gCacheClear);
   390 		
   391 	TNamingSchemeParam namingScheme;
   392     namingScheme.iZeroPadFileNumber = gZeroPadFileNumberForFixedLengthFileNames;
   393     
   394 	TDirUnitParam dirParam1;
   395 	dirParam1.iPriority 			= 1;
   396 	dirParam1.iDirName 				= _L("");
   397 	dirParam1.iRuns 				= 1;
   398 	dirParam1.iFilesPerRun 			= 0;
   399 	dirParam1.iSampleInterval 		= 1;
   400 	dirParam1.iNamingScheme 		= namingScheme;
   401 	dirParam1.iFileOpMode 			= EFATPerfFileRead;
   402 	
   403 
   404 	TFileName path = _L("?:\\");
   405 	path.Append(gPath);
   406 	if (path[path.Length() - 1] != '\\')
   407 		{
   408 		path.Append('\\');
   409 		}
   410 	
   411 	dirParam1.iDirName = path;
   412 	dirParam1.iFilesPerRun = gFileNo;
   413 	dirParam1.iNamingScheme.iFileNameBase = gFileNameBase;
   414 
   415 	execUnit->AddDirUnitL(dirParam1);
   416 	execUnit->Run();
   417 
   418 	CleanupStack::PopAndDestroy(2);
   419 	
   420 	}
   421 
   422 //-----------------------------------------------------------------------------
   423 /**
   424 This function Dumps the information about Directory Cache
   425 */
   426 //
   427 LOCAL_C void DoTestCaseDirCacheInfo()
   428 	{
   429 	ClearCache(gCacheClear);
   430 	RDebug::Print(_L("Dumping DirCache Info - Only for DEBUG Mode \n"));
   431 	#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
   432         TInt ret = TheFs.ControlIo(CurrentDrive(), ETestFATDirCacheInfo);    // For DirCache info
   433         if (ret != KErrNone)
   434             {
   435             RDebug::Print(_L("RFs::ControlIo() returned %d when attempting to dump cache info"), ret);
   436             }
   437         ret = TheFs.ControlIo(CurrentDrive(), ETestDumpFATDirCache);  // For Dumping DirCache contents
   438         if (ret != KErrNone)
   439             {
   440             RDebug::Print(_L("RFs::ControlIo() returned %d when attempting to dump cache contents"), ret);
   441             }
   442 	#endif
   443 	}
   444 
   445 /* To clear the cache - remount drive */
   446 
   447 LOCAL_C void ClearCache(TInt gCacheClear)
   448     {
   449     TInt rel = KErrNone;
   450     if (gCacheClear == 1)
   451         {
   452         // Remount the drive to clear the cache 
   453         rel = RemountFS (TheFs, CurrentDrive(), NULL);
   454         if (rel != KErrNone)
   455             {
   456             RDebug::Print(_L("<<Error>>: Remounting: %d\n"), rel);
   457             User::Leave(rel);
   458             }	
   459         }
   460 
   461     }
   462 
   463 
   464 /* Function for command line arguments for the tests */
   465 LOCAL_C void ParseMyCommandArguments()
   466 	{
   467 	TBuf<0x100> cmd;
   468 	User::CommandLine(cmd);
   469 	TLex lex(cmd);
   470 	TPtrC token=lex.NextToken();
   471 	TFileName thisfile=RProcess().FileName();
   472 	if (token.MatchF(thisfile)==0)
   473 		{
   474 		token.Set(lex.NextToken());
   475 		}
   476 	test.Printf(_L("CLP=%S"),&token);
   477 
   478 	if(token.Length()!=0)		
   479 		{
   480 		gDriveToTest=token[0];
   481 		gDriveToTest.UpperCase();
   482 		}
   483 	else
   484 		{
   485 		gDriveToTest='C';
   486 		return;
   487 		}
   488 
   489 	while (!lex.Eos())
   490 		{
   491 		token.Set(lex.NextToken());
   492 		if (token.Compare(_L("-c")) == 0 || token.Compare(_L("-C")) == 0)
   493 			{
   494 			token.Set(lex.NextToken());
   495 			if (token.MatchF(_L("Setup"))==0)
   496 				{
   497 				
   498 				gTestCase = EFATPerfSetup;
   499 				
   500 				}
   501 			else if (token.MatchF(_L("Create"))==0)
   502 				{
   503 				
   504 				gTestCase = EFATPerfCreate; 
   505 				
   506 				}
   507 			
   508 			else if (token.MatchF(_L("Open"))==0)
   509 				{
   510 				
   511 				gTestCase = EFATPerfOpen;
   512 				
   513 				}
   514 			
   515 			else if (token.MatchF(_L("Delete"))==0)
   516 			
   517 				{
   518 				
   519 				gTestCase = EFATPerfDelete;
   520 				
   521 				}
   522 			
   523 			else if (token.MatchF(_L("Write"))==0)
   524 				{
   525 
   526 				gTestCase = EFATPerfWrite;
   527 	
   528 				}
   529 			
   530 			else if (token.MatchF(_L("Read"))==0)
   531 		
   532 				{
   533 				
   534 				gTestCase = EFATPerfRead;
   535 		
   536 				}	
   537 			else if (token.MatchF(_L("Dumpinfo"))==0)
   538 				{
   539 				gTestCase = EFATPerfDirCacheInfo;
   540 				}
   541 			else
   542 				{
   543 				test.Printf(_L("Bad command syntax"));
   544 				test(EFalse);
   545 				}
   546 			}
   547 		
   548 		if (token.Compare(_L("-p")) == 0 || token.Compare(_L("-P")) == 0)
   549 			{
   550 			token.Set(lex.NextToken());
   551 			if (token.Length() != 0)
   552 				{
   553 				gPath = token;
   554 				}
   555 			else
   556 				{
   557 				test.Printf(_L("Bad command syntax"));
   558 				test(EFalse);
   559 				}
   560 			}
   561 		
   562 		if (token.Compare(_L("-b")) == 0 || token.Compare(_L("-B")) == 0)
   563 			{
   564 			token.Set(lex.NextToken());
   565 			if (token.Length() != 0)
   566 				{
   567 				gFileNameBase = token;
   568 				}
   569 			else
   570 				{
   571 				test.Printf(_L("Bad command syntax"));
   572 				test(EFalse);
   573 				}
   574 			}
   575 		
   576 		if (token.Compare(_L("-n")) == 0 || token.Compare(_L("-N")) == 0)
   577 			{
   578 			token.Set(lex.NextToken());
   579 			if (token.Length() != 0)
   580 				{
   581 				TLex tokenLex;
   582 				tokenLex.Assign(token);
   583 				TInt value;
   584 				tokenLex.Val(value);
   585 				gFileNo = value;
   586 				}
   587 			else
   588 				{
   589 				test.Printf(_L("Bad command syntax"));
   590 				test(EFalse);
   591 				}
   592 			}
   593 			
   594 		if (token.Compare(_L("-m")) == 0 || token.Compare(_L("-M")) == 0)
   595 			{
   596 			token.Set(lex.NextToken());
   597 			if (token.Length() != 0)
   598 				{
   599 				TLex tokenLex;
   600 				tokenLex.Assign(token);
   601 				TInt value;
   602 				tokenLex.Val(value);
   603 				gCacheClear = value;
   604 				}
   605 			else
   606 				{
   607 				test.Printf(_L("Bad command syntax"));
   608 				test(EFalse);
   609 				}
   610 			}
   611 		
   612         if (token.Compare(_L("-f")) == 0 || token.Compare(_L("-F")) == 0)
   613             {
   614             token.Set(lex.NextToken());
   615             if (token.Length() != 0)
   616                 {
   617                 TLex tokenLex;
   618                 tokenLex.Assign(token);
   619                 TInt value;
   620                 tokenLex.Val(value);
   621                 gZeroPadFileNumberForFixedLengthFileNames = value;
   622                 }
   623             else
   624                 {
   625                 test.Printf(_L("Bad command syntax"));
   626                 test(EFalse);
   627                 }
   628             }
   629 		}
   630 	}
   631 
   632 
   633 /* System Info */
   634 LOCAL_C void GetSystemInfo()
   635 	{
   636 	test.Next(_L("Get System Info"));
   637 	TFSName fsName;
   638 	TInt drvNo = -1; 
   639 	TInt err = TheFs.CharToDrive(gDriveToTest, drvNo);
   640 	test(err == KErrNone);
   641 	err = TheFs.FileSystemSubType(drvNo, fsName);
   642 	test(err == KErrNone);
   643 	test.Printf(_L("File System: [%S]\n"), &fsName);
   644 	TVolumeIOParamInfo ioParam;
   645 	err = TheFs.VolumeIOParam(drvNo, ioParam);
   646 	test(err == KErrNone);
   647 	test.Printf(_L("Sector Size: [%d Bytes]\n"), ioParam.iBlockSize);
   648 	test.Printf(_L("Cluster Size: [%d Bytes]\n"), ioParam.iClusterSize);
   649 	}
   650 
   651 //-----------------------------------------------------------------------------
   652 /**
   653 Main Function to call specific test features
   654 */
   655 //-----------------------------------------------------------------------------
   656 void CallTestsL()
   657 	{
   658 	
   659 	//Interpreting Command Line Arguments
   660 	ParseMyCommandArguments(); 
   661 	
   662 
   663 	// Get Drive Information
   664 	GetSystemInfo(); 
   665  	
   666  	
   667  	// Switch Case for Test Functions
   668  	switch(gTestCase)
   669 		{
   670 	
   671 	    //Test Setup
   672 		case EFATPerfSetup:    
   673 			{
   674 			DoTestCaseSetup();
   675 			break;
   676 			}
   677 		
   678 		//File Create
   679 		case EFATPerfCreate:
   680 			{
   681 			DoTestCaseCreateFile();
   682 			break;
   683 			}
   684 	  	
   685 	  	// File Open 
   686 		case EFATPerfOpen:
   687 			{
   688 			DoTestCaseOpenFile();
   689 			break;
   690 			}
   691 		
   692 		// File Delete
   693 		case EFATPerfDelete:
   694 			{
   695 			DoTestCaseDeleteFile();
   696 			break;
   697 			}
   698 		// File Write
   699 		case EFATPerfWrite:
   700 			{
   701 			DoTestCaseWriteFile();
   702 			break;
   703 			}
   704 		
   705 		// File Read
   706 		case EFATPerfRead:
   707 			{
   708 			DoTestCaseReadFile();
   709 			break;
   710 			}
   711 		// Print / Dump DirCache Info
   712 		case EFATPerfDirCacheInfo:
   713 			{
   714 			DoTestCaseDirCacheInfo();
   715 			break;
   716 			}
   717 		
   718 		default:
   719 			break;
   720 		}
   721 
   722 	}
   723 
   724 /*-- EOF--*/