sl@0: // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // File Name: f32test/bench/t_fat_perf.cpp sl@0: // This file contains implementation for the functions called sl@0: // by test cases from the command line to test FAT Performance on sl@0: // large number of files (PREQ 1885). sl@0: // sl@0: // sl@0: sl@0: //Include files sl@0: #include sl@0: #include sl@0: #include sl@0: #include "t_server.h" sl@0: #include "t_fat_perf.h" sl@0: sl@0: sl@0: sl@0: LOCAL_C void ClearCache(TInt); sl@0: sl@0: RTest test(_L("T_FAT_PERF")); sl@0: sl@0: TFileName gPath; sl@0: TFileName gFileNameBase; sl@0: TInt gFileNo = 0; sl@0: TInt gTestCase = -1; sl@0: TInt gCacheClear = 0; sl@0: TInt gZeroPadFileNumberForFixedLengthFileNames = 0; sl@0: sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: sl@0: TNamingSchemeParam::TNamingSchemeParam() sl@0: : iConOrRan(EConsecutive), iUniOrAsc(EAscii), iZeroPadFileNumber(EFalse), iMaxFileNameLength(0), iMinStringLength(0) sl@0: { sl@0: iFileNameBase = _L(""); sl@0: } sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: /** sl@0: This function creates the files in the following directories sl@0: INITIAL CONDITION: FILL FOLLOWING SUB-DIRS WITH 1600 FILES sl@0: "\\DIR1\\"...2000 files ("ABCD1ABCD2ABCD3ABCD4ABCD5ABCD_1 ~ 2000.TXT") sl@0: "\\DIR1\\DIR11\\"...1600 files ("ABCD1ABCD2ABCD3ABCD4ABCD5ABCD_1 ~ 1600.TXT") sl@0: "\\DIR1\\DIR11\\DIR111\\"...1610 files ("ABCD1ABCD2ABCD3ABCD4ABCD5ABCD_1 ~ 1600.TXT") + "ANOTHERLONGFILENAME_1~10.TXT" sl@0: "\\DIR1\\DIR12RAN\\"...1600 files ("...random string (31~34)....TXT") sl@0: "\\DIR2\\"...1600 files ("ABCD1ABCD2ABCD3ABCD4ABCD5ABCD_1 ~ 1600.TXT") sl@0: */ sl@0: //----------------------------------------------------------------------------- sl@0: sl@0: LOCAL_C void DoTestCaseSetup() sl@0: { sl@0: test.Next(_L(" 'Test Setup' - 00")); sl@0: sl@0: TMLUnitParam mlParam = sl@0: { sl@0: 12345 // iID sl@0: }; sl@0: CMeasureAndLogUnit* measureAndLogUnit = CMeasureAndLogUnit::NewLC(mlParam); sl@0: CExecutionUnit* execUnit = CExecutionUnit::NewLC(measureAndLogUnit, gDriveToTest); sl@0: sl@0: TInt curDriveNum; sl@0: TInt err = TheFs.CharToDrive(gDriveToTest, curDriveNum); sl@0: test(KErrNone == err); sl@0: FormatFatDrive(TheFs,curDriveNum, EQuickFormat, NULL, EFalse); sl@0: sl@0: /*----------------------------------------------------------------------------- sl@0: * Setup for "\\DIR1\\" sl@0: *-----------------------------------------------------------------------------*/ sl@0: sl@0: TNamingSchemeParam namingScheme; sl@0: namingScheme.iConOrRan = EConsecutive; sl@0: namingScheme.iUniOrAsc = EAscii; sl@0: namingScheme.iZeroPadFileNumber = EFalse; sl@0: namingScheme.iFileNameBase = _L("ABCD1ABCD2ABCD3ABCD4ABCD5ABCD_"); sl@0: namingScheme.iMaxFileNameLength = 0; sl@0: namingScheme.iMinStringLength = 0; sl@0: sl@0: TDirUnitParam dirParam1; sl@0: dirParam1.iPriority = 1; sl@0: dirParam1.iDirName = _L("?:\\DIR1\\"); sl@0: dirParam1.iRuns = 1; sl@0: dirParam1.iFilesPerRun = 2000; sl@0: dirParam1.iSampleInterval = 0; sl@0: dirParam1.iNamingScheme = namingScheme; sl@0: dirParam1.iFileOpMode = EFATPerfFileCreate; sl@0: sl@0: execUnit->AddDirUnitL(dirParam1); sl@0: sl@0: /*----------------------------------------------------------------------------- sl@0: * Setup for "\\DIR1\\DIR11\\" sl@0: *-----------------------------------------------------------------------------*/ sl@0: sl@0: TDirUnitParam dirParam11 = dirParam1; sl@0: dirParam11.iDirName = _L("?:\\DIR1\\DIR11\\"); sl@0: dirParam11.iFilesPerRun = 1600; sl@0: dirParam11.iSampleInterval = 0; sl@0: sl@0: execUnit->AddDirUnitL(dirParam11); sl@0: sl@0: /*----------------------------------------------------------------------------- sl@0: * Setup for "\\DIR1\\DIR11\\DIR111\\" sl@0: *-----------------------------------------------------------------------------*/ sl@0: sl@0: TDirUnitParam dirParam111 = dirParam1; sl@0: dirParam111.iDirName = _L("?:\\DIR1\\DIR11\\DIR111\\"); sl@0: dirParam111.iFilesPerRun = 1600; sl@0: dirParam111.iSampleInterval = 0; sl@0: sl@0: execUnit->AddDirUnitL(dirParam111); sl@0: sl@0: /*----------------------------------------------------------------------------- sl@0: * Test setup for "\\DIR1\\DIR11\\DIR111\\" with "ANOTHERLONGFILENAME_" file sl@0: *-----------------------------------------------------------------------------*/ sl@0: sl@0: TNamingSchemeParam namingScheme111A = namingScheme; sl@0: namingScheme111A.iFileNameBase = _L("ANOTHERLONGFILENAME_"); sl@0: sl@0: TDirUnitParam dirParam111A = dirParam1; sl@0: dirParam111A.iDirName = _L("?:\\DIR1\\DIR11\\DIR111\\"); sl@0: dirParam111A.iFilesPerRun = 10; sl@0: dirParam111A.iSampleInterval = 0; sl@0: dirParam111A.iNamingScheme = namingScheme111A; sl@0: sl@0: execUnit->AddDirUnitL(dirParam111A); sl@0: sl@0: /*----------------------------------------------------------------------------- sl@0: * Setup for "\\DIR1\\DIR12RAN\\" sl@0: *-----------------------------------------------------------------------------*/ sl@0: sl@0: TNamingSchemeParam namingScheme12 = namingScheme; sl@0: namingScheme12.iConOrRan = ERandom; sl@0: namingScheme12.iZeroPadFileNumber = EFalse; sl@0: namingScheme12.iFileNameBase = _L(""); sl@0: namingScheme12.iMaxFileNameLength = 34; sl@0: namingScheme12.iMinStringLength = 31; sl@0: sl@0: TDirUnitParam dirParam12 = dirParam1; sl@0: dirParam12.iDirName = _L("?:\\DIR1\\DIR12RAN\\"); sl@0: dirParam12.iFilesPerRun = 1600; sl@0: dirParam12.iSampleInterval = 0; sl@0: dirParam12.iNamingScheme = namingScheme12; sl@0: sl@0: execUnit->AddDirUnitL(dirParam12); sl@0: sl@0: /*----------------------------------------------------------------------------- sl@0: * Setup for "\\DIR2\\" sl@0: *-----------------------------------------------------------------------------*/ sl@0: sl@0: TDirUnitParam dirParam2 = dirParam1; sl@0: dirParam2.iDirName = _L("?:\\DIR2\\"); sl@0: dirParam2.iFilesPerRun = 1600; sl@0: dirParam2.iSampleInterval = 0; sl@0: dirParam2.iNamingScheme = namingScheme; sl@0: sl@0: execUnit->AddDirUnitL(dirParam2); sl@0: sl@0: execUnit->Run(); sl@0: CleanupStack::PopAndDestroy(2); sl@0: } sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: /** sl@0: This function creates a files in the valid directory path sl@0: */ sl@0: //----------------------------------------------------------------------------- sl@0: LOCAL_C void DoTestCaseCreateFile() sl@0: { sl@0: test.Next(_L(" 'Create File' - 01")); sl@0: sl@0: TMLUnitParam mlParam = sl@0: { sl@0: 12345 // iID sl@0: }; sl@0: CMeasureAndLogUnit* measureAndLogUnit = CMeasureAndLogUnit::NewLC(mlParam); sl@0: CExecutionUnit* execUnit = CExecutionUnit::NewLC(measureAndLogUnit, gDriveToTest); sl@0: sl@0: ClearCache(gCacheClear); sl@0: sl@0: TNamingSchemeParam namingScheme; sl@0: namingScheme.iZeroPadFileNumber = gZeroPadFileNumberForFixedLengthFileNames; sl@0: sl@0: TDirUnitParam dirParam1; sl@0: dirParam1.iPriority = 1; sl@0: dirParam1.iDirName = _L(""); sl@0: dirParam1.iRuns = 1; sl@0: dirParam1.iFilesPerRun = 0; sl@0: dirParam1.iSampleInterval = 1; sl@0: dirParam1.iNamingScheme = namingScheme; sl@0: dirParam1.iFileOpMode = EFATPerfFileCreate; sl@0: sl@0: sl@0: TFileName path = _L("?:\\"); sl@0: path.Append(gPath); sl@0: if (path[path.Length() - 1] != '\\') sl@0: { sl@0: path.Append('\\'); sl@0: } sl@0: sl@0: dirParam1.iDirName = path; sl@0: dirParam1.iFilesPerRun = gFileNo; sl@0: dirParam1.iNamingScheme.iFileNameBase = gFileNameBase; sl@0: sl@0: execUnit->AddDirUnitL(dirParam1); sl@0: execUnit->Run(); sl@0: sl@0: CleanupStack::PopAndDestroy(2); sl@0: sl@0: } sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: /** sl@0: This function opens file in the valid directoy path sl@0: */ sl@0: //----------------------------------------------------------------------------- sl@0: sl@0: LOCAL_C void DoTestCaseOpenFile() sl@0: { sl@0: test.Next(_L(" 'Open File' - 02")); sl@0: sl@0: TMLUnitParam mlParam = sl@0: { sl@0: 12345 // iID sl@0: }; sl@0: CMeasureAndLogUnit* measureAndLogUnit = CMeasureAndLogUnit::NewLC(mlParam); sl@0: CExecutionUnit* execUnit = CExecutionUnit::NewLC(measureAndLogUnit, gDriveToTest); sl@0: sl@0: ClearCache(gCacheClear); sl@0: sl@0: TNamingSchemeParam namingScheme; sl@0: namingScheme.iZeroPadFileNumber = gZeroPadFileNumberForFixedLengthFileNames; sl@0: sl@0: TDirUnitParam dirParam1; sl@0: dirParam1.iPriority = 1; sl@0: dirParam1.iDirName = _L(""); sl@0: dirParam1.iRuns = 1; sl@0: dirParam1.iFilesPerRun = 0; sl@0: dirParam1.iSampleInterval = 1; sl@0: dirParam1.iNamingScheme = namingScheme; sl@0: dirParam1.iFileOpMode = EFATPerfFileOpen; sl@0: sl@0: sl@0: TFileName path = _L("?:\\"); sl@0: path.Append(gPath); sl@0: if (path[path.Length() - 1] != '\\') sl@0: { sl@0: path.Append('\\'); sl@0: } sl@0: sl@0: dirParam1.iDirName = path; sl@0: dirParam1.iFilesPerRun = gFileNo; sl@0: dirParam1.iNamingScheme.iFileNameBase = gFileNameBase; sl@0: sl@0: execUnit->AddDirUnitL(dirParam1); sl@0: execUnit->Run(); sl@0: sl@0: CleanupStack::PopAndDestroy(2); sl@0: sl@0: } sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: /** sl@0: This function deletes the files in the valid directory path sl@0: */ sl@0: //----------------------------------------------------------------------------- sl@0: sl@0: LOCAL_C void DoTestCaseDeleteFile() sl@0: { sl@0: test.Next(_L(" 'Delete File' - 03")); sl@0: sl@0: TMLUnitParam mlParam = sl@0: { sl@0: 12345 // iID sl@0: }; sl@0: CMeasureAndLogUnit* measureAndLogUnit = CMeasureAndLogUnit::NewLC(mlParam); sl@0: CExecutionUnit* execUnit = CExecutionUnit::NewLC(measureAndLogUnit, gDriveToTest); sl@0: sl@0: ClearCache(gCacheClear); sl@0: sl@0: TNamingSchemeParam namingScheme; sl@0: namingScheme.iZeroPadFileNumber = gZeroPadFileNumberForFixedLengthFileNames; sl@0: sl@0: TDirUnitParam dirParam1; sl@0: dirParam1.iPriority = 1; sl@0: dirParam1.iDirName = _L(""); sl@0: dirParam1.iRuns = 1; sl@0: dirParam1.iFilesPerRun = 0; sl@0: dirParam1.iSampleInterval = 1; sl@0: dirParam1.iNamingScheme = namingScheme; sl@0: dirParam1.iFileOpMode = EFATPerfFileDelete; sl@0: sl@0: TFileName path = _L("?:\\"); sl@0: path.Append(gPath); sl@0: if (path[path.Length() - 1] != '\\') sl@0: { sl@0: path.Append('\\'); sl@0: } sl@0: sl@0: dirParam1.iDirName = path; sl@0: dirParam1.iFilesPerRun = gFileNo; sl@0: dirParam1.iNamingScheme.iFileNameBase = gFileNameBase; sl@0: sl@0: execUnit->AddDirUnitL(dirParam1); sl@0: execUnit->Run(); sl@0: sl@0: CleanupStack::PopAndDestroy(2); sl@0: sl@0: } sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: /** sl@0: PREQ1885 - optional test case sl@0: This function writes data into the files in the valid directory path sl@0: */ sl@0: //----------------------------------------------------------------------------- sl@0: sl@0: LOCAL_C void DoTestCaseWriteFile() sl@0: { sl@0: test.Next(_L(" 'Write File' - 04 - Write 4KB of Data")); sl@0: sl@0: TMLUnitParam mlParam = sl@0: { sl@0: 12345 // iID sl@0: }; sl@0: CMeasureAndLogUnit* measureAndLogUnit = CMeasureAndLogUnit::NewLC(mlParam); sl@0: CExecutionUnit* execUnit = CExecutionUnit::NewLC(measureAndLogUnit, gDriveToTest); sl@0: sl@0: ClearCache(gCacheClear); sl@0: sl@0: TNamingSchemeParam namingScheme; sl@0: namingScheme.iZeroPadFileNumber = gZeroPadFileNumberForFixedLengthFileNames; sl@0: sl@0: TDirUnitParam dirParam1; sl@0: dirParam1.iPriority = 1; sl@0: dirParam1.iDirName = _L(""); sl@0: dirParam1.iRuns = 1; sl@0: dirParam1.iFilesPerRun = 0; sl@0: dirParam1.iSampleInterval = 1; sl@0: dirParam1.iNamingScheme = namingScheme; sl@0: dirParam1.iFileOpMode = EFATPerfFileWrite; sl@0: sl@0: TFileName path = _L("?:\\"); sl@0: path.Append(gPath); sl@0: if (path[path.Length() - 1] != '\\') sl@0: { sl@0: path.Append('\\'); sl@0: } sl@0: sl@0: dirParam1.iDirName = path; sl@0: dirParam1.iFilesPerRun = gFileNo; sl@0: dirParam1.iNamingScheme.iFileNameBase = gFileNameBase; sl@0: sl@0: execUnit->AddDirUnitL(dirParam1); sl@0: execUnit->Run(); sl@0: sl@0: CleanupStack::PopAndDestroy(2); sl@0: sl@0: } sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: /** sl@0: PREQ1885 - optional test case sl@0: This function Reads data from the files in the valid directory path sl@0: */ sl@0: //----------------------------------------------------------------------------- sl@0: sl@0: LOCAL_C void DoTestCaseReadFile() sl@0: { sl@0: test.Next(_L(" 'Read File' - 05 Read 4KB of data")); sl@0: sl@0: TMLUnitParam mlParam = sl@0: { sl@0: 12345 // iID sl@0: }; sl@0: CMeasureAndLogUnit* measureAndLogUnit = CMeasureAndLogUnit::NewLC(mlParam); sl@0: CExecutionUnit* execUnit = CExecutionUnit::NewLC(measureAndLogUnit, gDriveToTest); sl@0: sl@0: ClearCache(gCacheClear); sl@0: sl@0: TNamingSchemeParam namingScheme; sl@0: namingScheme.iZeroPadFileNumber = gZeroPadFileNumberForFixedLengthFileNames; sl@0: sl@0: TDirUnitParam dirParam1; sl@0: dirParam1.iPriority = 1; sl@0: dirParam1.iDirName = _L(""); sl@0: dirParam1.iRuns = 1; sl@0: dirParam1.iFilesPerRun = 0; sl@0: dirParam1.iSampleInterval = 1; sl@0: dirParam1.iNamingScheme = namingScheme; sl@0: dirParam1.iFileOpMode = EFATPerfFileRead; sl@0: sl@0: sl@0: TFileName path = _L("?:\\"); sl@0: path.Append(gPath); sl@0: if (path[path.Length() - 1] != '\\') sl@0: { sl@0: path.Append('\\'); sl@0: } sl@0: sl@0: dirParam1.iDirName = path; sl@0: dirParam1.iFilesPerRun = gFileNo; sl@0: dirParam1.iNamingScheme.iFileNameBase = gFileNameBase; sl@0: sl@0: execUnit->AddDirUnitL(dirParam1); sl@0: execUnit->Run(); sl@0: sl@0: CleanupStack::PopAndDestroy(2); sl@0: sl@0: } sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: /** sl@0: This function Dumps the information about Directory Cache sl@0: */ sl@0: // sl@0: LOCAL_C void DoTestCaseDirCacheInfo() sl@0: { sl@0: ClearCache(gCacheClear); sl@0: RDebug::Print(_L("Dumping DirCache Info - Only for DEBUG Mode \n")); sl@0: #if defined(_DEBUG) || defined(_DEBUG_RELEASE) sl@0: TInt ret = TheFs.ControlIo(CurrentDrive(), ETestFATDirCacheInfo); // For DirCache info sl@0: if (ret != KErrNone) sl@0: { sl@0: RDebug::Print(_L("RFs::ControlIo() returned %d when attempting to dump cache info"), ret); sl@0: } sl@0: ret = TheFs.ControlIo(CurrentDrive(), ETestDumpFATDirCache); // For Dumping DirCache contents sl@0: if (ret != KErrNone) sl@0: { sl@0: RDebug::Print(_L("RFs::ControlIo() returned %d when attempting to dump cache contents"), ret); sl@0: } sl@0: #endif sl@0: } sl@0: sl@0: /* To clear the cache - remount drive */ sl@0: sl@0: LOCAL_C void ClearCache(TInt gCacheClear) sl@0: { sl@0: TInt rel = KErrNone; sl@0: if (gCacheClear == 1) sl@0: { sl@0: // Remount the drive to clear the cache sl@0: rel = RemountFS (TheFs, CurrentDrive(), NULL); sl@0: if (rel != KErrNone) sl@0: { sl@0: RDebug::Print(_L("<>: Remounting: %d\n"), rel); sl@0: User::Leave(rel); sl@0: } sl@0: } sl@0: sl@0: } sl@0: sl@0: sl@0: /* Function for command line arguments for the tests */ sl@0: LOCAL_C void ParseMyCommandArguments() sl@0: { sl@0: TBuf<0x100> cmd; sl@0: User::CommandLine(cmd); sl@0: TLex lex(cmd); sl@0: TPtrC token=lex.NextToken(); sl@0: TFileName thisfile=RProcess().FileName(); sl@0: if (token.MatchF(thisfile)==0) sl@0: { sl@0: token.Set(lex.NextToken()); sl@0: } sl@0: test.Printf(_L("CLP=%S"),&token); sl@0: sl@0: if(token.Length()!=0) sl@0: { sl@0: gDriveToTest=token[0]; sl@0: gDriveToTest.UpperCase(); sl@0: } sl@0: else sl@0: { sl@0: gDriveToTest='C'; sl@0: return; sl@0: } sl@0: sl@0: while (!lex.Eos()) sl@0: { sl@0: token.Set(lex.NextToken()); sl@0: if (token.Compare(_L("-c")) == 0 || token.Compare(_L("-C")) == 0) sl@0: { sl@0: token.Set(lex.NextToken()); sl@0: if (token.MatchF(_L("Setup"))==0) sl@0: { sl@0: sl@0: gTestCase = EFATPerfSetup; sl@0: sl@0: } sl@0: else if (token.MatchF(_L("Create"))==0) sl@0: { sl@0: sl@0: gTestCase = EFATPerfCreate; sl@0: sl@0: } sl@0: sl@0: else if (token.MatchF(_L("Open"))==0) sl@0: { sl@0: sl@0: gTestCase = EFATPerfOpen; sl@0: sl@0: } sl@0: sl@0: else if (token.MatchF(_L("Delete"))==0) sl@0: sl@0: { sl@0: sl@0: gTestCase = EFATPerfDelete; sl@0: sl@0: } sl@0: sl@0: else if (token.MatchF(_L("Write"))==0) sl@0: { sl@0: sl@0: gTestCase = EFATPerfWrite; sl@0: sl@0: } sl@0: sl@0: else if (token.MatchF(_L("Read"))==0) sl@0: sl@0: { sl@0: sl@0: gTestCase = EFATPerfRead; sl@0: sl@0: } sl@0: else if (token.MatchF(_L("Dumpinfo"))==0) sl@0: { sl@0: gTestCase = EFATPerfDirCacheInfo; sl@0: } sl@0: else sl@0: { sl@0: test.Printf(_L("Bad command syntax")); sl@0: test(EFalse); sl@0: } sl@0: } sl@0: sl@0: if (token.Compare(_L("-p")) == 0 || token.Compare(_L("-P")) == 0) sl@0: { sl@0: token.Set(lex.NextToken()); sl@0: if (token.Length() != 0) sl@0: { sl@0: gPath = token; sl@0: } sl@0: else sl@0: { sl@0: test.Printf(_L("Bad command syntax")); sl@0: test(EFalse); sl@0: } sl@0: } sl@0: sl@0: if (token.Compare(_L("-b")) == 0 || token.Compare(_L("-B")) == 0) sl@0: { sl@0: token.Set(lex.NextToken()); sl@0: if (token.Length() != 0) sl@0: { sl@0: gFileNameBase = token; sl@0: } sl@0: else sl@0: { sl@0: test.Printf(_L("Bad command syntax")); sl@0: test(EFalse); sl@0: } sl@0: } sl@0: sl@0: if (token.Compare(_L("-n")) == 0 || token.Compare(_L("-N")) == 0) sl@0: { sl@0: token.Set(lex.NextToken()); sl@0: if (token.Length() != 0) sl@0: { sl@0: TLex tokenLex; sl@0: tokenLex.Assign(token); sl@0: TInt value; sl@0: tokenLex.Val(value); sl@0: gFileNo = value; sl@0: } sl@0: else sl@0: { sl@0: test.Printf(_L("Bad command syntax")); sl@0: test(EFalse); sl@0: } sl@0: } sl@0: sl@0: if (token.Compare(_L("-m")) == 0 || token.Compare(_L("-M")) == 0) sl@0: { sl@0: token.Set(lex.NextToken()); sl@0: if (token.Length() != 0) sl@0: { sl@0: TLex tokenLex; sl@0: tokenLex.Assign(token); sl@0: TInt value; sl@0: tokenLex.Val(value); sl@0: gCacheClear = value; sl@0: } sl@0: else sl@0: { sl@0: test.Printf(_L("Bad command syntax")); sl@0: test(EFalse); sl@0: } sl@0: } sl@0: sl@0: if (token.Compare(_L("-f")) == 0 || token.Compare(_L("-F")) == 0) sl@0: { sl@0: token.Set(lex.NextToken()); sl@0: if (token.Length() != 0) sl@0: { sl@0: TLex tokenLex; sl@0: tokenLex.Assign(token); sl@0: TInt value; sl@0: tokenLex.Val(value); sl@0: gZeroPadFileNumberForFixedLengthFileNames = value; sl@0: } sl@0: else sl@0: { sl@0: test.Printf(_L("Bad command syntax")); sl@0: test(EFalse); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* System Info */ sl@0: LOCAL_C void GetSystemInfo() sl@0: { sl@0: test.Next(_L("Get System Info")); sl@0: TFSName fsName; sl@0: TInt drvNo = -1; sl@0: TInt err = TheFs.CharToDrive(gDriveToTest, drvNo); sl@0: test(err == KErrNone); sl@0: err = TheFs.FileSystemSubType(drvNo, fsName); sl@0: test(err == KErrNone); sl@0: test.Printf(_L("File System: [%S]\n"), &fsName); sl@0: TVolumeIOParamInfo ioParam; sl@0: err = TheFs.VolumeIOParam(drvNo, ioParam); sl@0: test(err == KErrNone); sl@0: test.Printf(_L("Sector Size: [%d Bytes]\n"), ioParam.iBlockSize); sl@0: test.Printf(_L("Cluster Size: [%d Bytes]\n"), ioParam.iClusterSize); sl@0: } sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: /** sl@0: Main Function to call specific test features sl@0: */ sl@0: //----------------------------------------------------------------------------- sl@0: void CallTestsL() sl@0: { sl@0: sl@0: //Interpreting Command Line Arguments sl@0: ParseMyCommandArguments(); sl@0: sl@0: sl@0: // Get Drive Information sl@0: GetSystemInfo(); sl@0: sl@0: sl@0: // Switch Case for Test Functions sl@0: switch(gTestCase) sl@0: { sl@0: sl@0: //Test Setup sl@0: case EFATPerfSetup: sl@0: { sl@0: DoTestCaseSetup(); sl@0: break; sl@0: } sl@0: sl@0: //File Create sl@0: case EFATPerfCreate: sl@0: { sl@0: DoTestCaseCreateFile(); sl@0: break; sl@0: } sl@0: sl@0: // File Open sl@0: case EFATPerfOpen: sl@0: { sl@0: DoTestCaseOpenFile(); sl@0: break; sl@0: } sl@0: sl@0: // File Delete sl@0: case EFATPerfDelete: sl@0: { sl@0: DoTestCaseDeleteFile(); sl@0: break; sl@0: } sl@0: // File Write sl@0: case EFATPerfWrite: sl@0: { sl@0: DoTestCaseWriteFile(); sl@0: break; sl@0: } sl@0: sl@0: // File Read sl@0: case EFATPerfRead: sl@0: { sl@0: DoTestCaseReadFile(); sl@0: break; sl@0: } sl@0: // Print / Dump DirCache Info sl@0: case EFATPerfDirCacheInfo: sl@0: { sl@0: DoTestCaseDirCacheInfo(); sl@0: break; sl@0: } sl@0: sl@0: default: sl@0: break; sl@0: } sl@0: sl@0: } sl@0: sl@0: /*-- EOF--*/