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: // f32test\server\t_mount.cpp sl@0: // Testing FAT cache performance sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: */ sl@0: sl@0: #define __E32TEST_EXTENSION__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #include "t_server.h" sl@0: //#include "t_std.h" sl@0: sl@0: #include "fat_utils.h" sl@0: sl@0: using namespace Fat_Test_Utils; sl@0: sl@0: #ifdef __VC32__ sl@0: // Solve compilation problem caused by non-English locale sl@0: #pragma setlocale("english") sl@0: #endif sl@0: sl@0: RTest test(_L("T_FAT_Cache_BM")); sl@0: sl@0: //-- note that this test disables all FAT mount enhancements, like asynchronous mounting and using FSInfo sector. sl@0: sl@0: static void WaitForFatBkGndActivityEnd(); sl@0: sl@0: //------------------------------------------------------------------- sl@0: //-- debug bit flags that may be set in the property which controls FAT volume mounting sl@0: sl@0: const TUid KThisTestSID={0x10210EB3}; ///< this EXE SID sl@0: sl@0: //const TUint32 KMntProp_EnableALL = 0x00000000; //-- enable all operations sl@0: const TUint32 KMntProp_DisableALL = 0xFFFFFFFF; //-- disable all operations sl@0: sl@0: //const TUint32 KMntProp_Disable_FsInfo = 0x00000001; //-- mask for disabling/enabling FSInfo information sl@0: //const TUint32 KMntProp_Disable_FatBkGndScan = 0x00000002; //-- mask for disabling/enabling FAT background scanner sl@0: sl@0: //------------------------------------------------------------------- sl@0: sl@0: static TInt gDriveNum=-1; ///< drive number we are dealing with sl@0: static TInt64 gRndSeed; sl@0: static TFatBootSector gBootSector; sl@0: sl@0: static void DoRemountFS(TInt aDrive); sl@0: sl@0: //-- Array of integer file tars. Tags are used to identify files (the file name is generated by KFnTemplate template) sl@0: typedef CArrayFixFlat CFileTagsArray; sl@0: static CFileTagsArray *pFTagArray = NULL; sl@0: sl@0: sl@0: //------------------------------------------------------------------- sl@0: const TInt KMaxFiles = 1000; //-- maximal number of files to create sl@0: sl@0: //-- number of unfragmented files that will be left, other files will be merged to bigger ones. sl@0: const TInt KUnfragmentedFilesLeave = KMaxFiles/10; sl@0: sl@0: _LIT(KDirName, "\\DIR1\\"); //-- directory name we a working with (FAT12/16 won't allow KMaxFiles in the root dir.) sl@0: _LIT(KFirstFileName, "\\First_file_1.nul"); //-- the name of the first file on the volume sl@0: sl@0: //------------------------------------------------------------------- sl@0: sl@0: /** sl@0: Make a file name by its numeric tag sl@0: @param aDes here will be a file name sl@0: @param aFileNameTag numeric tag for the file name generation sl@0: sl@0: */ sl@0: void MakeFileName(TDes& aDes, TInt aFileNameTag) sl@0: { sl@0: _LIT(KFnTemplate, "F%d.NUL");//-- file name template, use 8.3 names here in order not to stress dir. cache much. sl@0: aDes.Copy(KDirName); sl@0: aDes.AppendFormat(KFnTemplate, aFileNameTag); sl@0: } sl@0: sl@0: //------------------------------------------------------------------- sl@0: /** sl@0: format the volume and read the boot sector sl@0: */ sl@0: static void FormatVolume(TBool aQuickFormat) sl@0: { sl@0: (void)aQuickFormat; sl@0: sl@0: #ifndef __EPOC32__ sl@0: test.Printf(_L("This is emulator configuration!!!!\n")); sl@0: sl@0: //-- FAT32 SPC:1; for the FAT32 testing on the emulator sl@0: //TFatFormatParam fp; sl@0: //fp.iFatType = EFat32; sl@0: //fp.iSecPerCluster = 1; sl@0: //FormatFatDrive(TheFs, CurrentDrive(), ETrue, &fp); //-- always quick; doesn't matter for the emulator sl@0: sl@0: aQuickFormat = ETrue; sl@0: #endif sl@0: sl@0: sl@0: FormatFatDrive(TheFs, CurrentDrive(), aQuickFormat); sl@0: sl@0: sl@0: TInt nRes = ReadBootSector(TheFs, gDriveNum, 0x00, gBootSector); sl@0: test_KErrNone(nRes); sl@0: } sl@0: sl@0: sl@0: //------------------------------------------------------------------- sl@0: sl@0: /** sl@0: Helper method. Does one iteration of merging test files into one fragmented one. sl@0: See DoMergeFiles() sl@0: sl@0: @param aFTagArray reference to the file tags array sl@0: @param aBigFileNo a sequential number of the result file to be merged from random number of smaller ones (names are taken from the tag array) sl@0: @param aTimeTaken_us on return will contain time taken to this operation, in microseconds sl@0: sl@0: @return number of files merged into one. sl@0: */ sl@0: TInt DoMergeTestFiles(CFileTagsArray& aFTagArray, TInt aBigFileNo, TInt64& aTimeTaken_us) sl@0: { sl@0: sl@0: aTimeTaken_us = 0; sl@0: TTime timeStart; sl@0: TTime timeEnd; sl@0: sl@0: sl@0: //-- merged files' names start with this number sl@0: const TInt KMergedFileFnThreshold = 20000; sl@0: sl@0: const TInt KMaxMergedFiles = 20; sl@0: const TInt nFilesToMerge = Max((Math::Rand(gRndSeed) % KMaxMergedFiles), 2); //-- how many files to merge into one sl@0: sl@0: test(aFTagArray.Count() > KMaxMergedFiles); sl@0: sl@0: TInt selectedFTags[KMaxMergedFiles]; //-- here we will store file tags to be merged to one large fragmented file sl@0: TInt i; sl@0: TInt nRes; sl@0: sl@0: i=0; sl@0: do sl@0: { sl@0: //-- randomly select a file tag from the global array sl@0: const TInt index = (TUint)Math::Rand(gRndSeed) % aFTagArray.Count(); sl@0: const TInt fnTag = aFTagArray[index]; sl@0: sl@0: if(fnTag < 0 || //-- no such file, already deleted sl@0: fnTag >= KMergedFileFnThreshold) //-- this is a big, already merged file sl@0: continue; sl@0: sl@0: sl@0: selectedFTags[i] = fnTag; sl@0: aFTagArray.Delete(index); sl@0: sl@0: ++i; sl@0: }while(i buf; sl@0: RFile file; sl@0: sl@0: timeStart.UniversalTime(); //-- take start time sl@0: sl@0: for(i=0; i KUnfragmentedFilesLeave; ++i) sl@0: { sl@0: nUnfragmentedLeft -= DoMergeTestFiles(aFTagArray, i, usCurrTime); sl@0: usTotalTime += usCurrTime; sl@0: } sl@0: sl@0: test.Printf(_L("#--> Merging files :%d ms\n"), (TUint32)usTotalTime/K1mSec); sl@0: } sl@0: sl@0: //------------------------------------------------------------------- sl@0: /** sl@0: Randomly shuffles entries in file name tags array. sl@0: */ sl@0: void ShuffleArray(CFileTagsArray& aFTagArray) sl@0: { sl@0: const TInt KSwapIterations = 500; sl@0: const TInt arrSize = aFTagArray.Count(); sl@0: sl@0: sl@0: for(TInt i = 0; i buf; sl@0: sl@0: TTime timeStart; sl@0: TTime timeEnd; sl@0: TInt64 usTotalTimeSeek=0; sl@0: TInt64 usTotalTimeOpen=0; sl@0: sl@0: const TInt KNumRepetitions = 10; sl@0: sl@0: for(TInt repCnt=0; repCnt Total open time for %d files is %d ms\n"), aFTagArray.Count(), (TUint32)usTotalTimeOpen/(K1mSec*KNumRepetitions)); sl@0: test.Printf(_L("#--> Total seek time for %d files is %d ms\n"), aFTagArray.Count(), (TUint32)usTotalTimeSeek/(K1mSec*KNumRepetitions)); sl@0: } sl@0: sl@0: sl@0: //---------------------------------------------------------------------------------------------- sl@0: //! @SYMTestCaseID PBASE-T_FATCACHE_BM-0692 sl@0: //! @SYMTestType PT sl@0: //! @SYMPREQ PREQ1721 sl@0: //! @SYMTestCaseDesc Detetes all files that have name tags in name tags array and measures time taken. sl@0: //! sl@0: //! @SYMTestActions sl@0: //! 0 remount the FS sl@0: //! 1 delete files and measure time taken. sl@0: //! sl@0: //! @SYMTestExpectedResults successful creating files sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //---------------------------------------------------------------------------------------------- sl@0: void DeleteAllFiles(CFileTagsArray& aFTagArray) sl@0: { sl@0: TInt nRes; sl@0: TBuf<128> buf; sl@0: sl@0: TTime timeStart; sl@0: TTime timeEnd; sl@0: TInt64 usTotalTime=0; sl@0: sl@0: test.Next(_L("Deleting all files...\n")); sl@0: sl@0: //-- remount file system, reset caches sl@0: DoRemountFS(gDriveNum); sl@0: sl@0: for(TInt i = 0; i Deleted %d files in %d ms\n"), aFTagArray.Count(), (TUint32)usTotalTime/K1mSec); sl@0: } sl@0: sl@0: //---------------------------------------------------------------------------------------------- sl@0: //! @SYMTestCaseID PBASE-T_FATCACHE_BM-0687 sl@0: //! @SYMTestType PT sl@0: //! @SYMPREQ PREQ1721 sl@0: //! @SYMTestCaseDesc Create KMaxFiles files to fill in space in FAT table and measure time taken. sl@0: //! sl@0: //! @SYMTestActions sl@0: //! 0 Create KMaxFiles files and measure time taken. sl@0: //! sl@0: //! @SYMTestExpectedResults successful creating files sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //---------------------------------------------------------------------------------------------- sl@0: /** sl@0: Create KMaxFiles files to fill in space in FAT table and measure time taken. sl@0: @return EFalse if it is impossible to create test files sl@0: */ sl@0: TBool DoCreateFiles(CFileTagsArray& aFTagArray) sl@0: { sl@0: TInt nRes; sl@0: TBuf<128> buf; sl@0: sl@0: TTime timeStart; sl@0: TTime timeEnd; sl@0: TInt64 usTotalTime=0; sl@0: sl@0: test.Next(_L("Creating many files\n")); sl@0: test.Printf(_L("Number of files:%d\n"), KMaxFiles); sl@0: sl@0: aFTagArray.Reset(); sl@0: sl@0: TVolumeInfo volInfo; sl@0: nRes = TheFs.Volume(volInfo, gDriveNum); sl@0: test_KErrNone(nRes); sl@0: sl@0: sl@0: test(gBootSector.IsValid()); sl@0: sl@0: const TUint32 clustSz = gBootSector.SectorsPerCluster() * gBootSector.BytesPerSector(); sl@0: const TUint32 maxClusters = (TUint32)(volInfo.iFree / clustSz); sl@0: sl@0: if(KMaxFiles > 0.8 * maxClusters) sl@0: { sl@0: test.Printf(_L("Can't create %d files; skipping the test!\n"), KMaxFiles); sl@0: return EFalse; sl@0: } sl@0: sl@0: //-- adjust file size for very small volumes sl@0: TUint32 fillFileSz = (maxClusters/KMaxFiles)*clustSz; sl@0: if(fillFileSz*KMaxFiles >= 0.8*volInfo.iFree) //-- take into account the size of the directory with 1000 files. sl@0: { sl@0: if(fillFileSz <= clustSz) sl@0: { sl@0: test.Printf(_L("Can't create %d files; skipping the test!\n"), KMaxFiles); sl@0: return EFalse; sl@0: } sl@0: sl@0: fillFileSz -= clustSz; sl@0: } sl@0: sl@0: //-- create the first file on the volume. It will be deleted then in order to create 1 free FAT entry sl@0: //-- in the very beginnng of the FAT. So, the size of this file shan't be more that 1 sector/cluster. sl@0: nRes = CreateEmptyFile(TheFs, KFirstFileName, 100); sl@0: test_KErrNone(nRes); sl@0: sl@0: sl@0: //-- to avoid affected timings in UREL mode. sl@0: WaitForFatBkGndActivityEnd(); sl@0: sl@0: //-- disable FAT test utils print out, it affects measured time when we create empty files sl@0: EnablePrintOutput(EFalse); sl@0: sl@0: //-- create KMaxFiles files on the volume sl@0: for(TInt i=0; i Created %d files in %d ms\n"), KMaxFiles, (TUint32)usTotalTime/K1mSec); sl@0: sl@0: return ETrue; sl@0: } sl@0: sl@0: //---------------------------------------------------------------------------------------------- sl@0: //! @SYMTestCaseID PBASE-T_FATCACHE_BM-0691 sl@0: //! @SYMTestType PT sl@0: //! @SYMPREQ PREQ1721 sl@0: //! @SYMTestCaseDesc Check that all FAT copies are the same. sl@0: //! sl@0: //! @SYMTestActions sl@0: //! 0 read all available FAT copies and compare them sl@0: //! sl@0: //! @SYMTestExpectedResults all FAT copies on the vollume must be the same. sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //---------------------------------------------------------------------------------------------- sl@0: void CheckFatCopies() sl@0: { sl@0: test.Next(_L("Comparing FATs...\n")); sl@0: sl@0: TFatBootSector bootSec; sl@0: sl@0: TInt nRes = ReadBootSector(TheFs, gDriveNum, 0x00, bootSec); sl@0: test_KErrNone(nRes); sl@0: sl@0: const TInt numFATs = bootSec.NumberOfFats(); sl@0: if(numFATs < 2) sl@0: {//-- only one FAT, nothing to compare with. sl@0: test.Printf(_L("The volume has only 1 FAT. Nothing to do.\n")); sl@0: return; sl@0: } sl@0: sl@0: const TUint32 bytesPerSec = bootSec.BytesPerSector(); sl@0: const TUint32 posFat1Start = bootSec.FirstFatSector() * bytesPerSec; sl@0: const TUint32 fatSize = bootSec.TotalFatSectors() * bytesPerSec; sl@0: sl@0: RBuf8 fatBuf1; sl@0: RBuf8 fatBuf2; sl@0: sl@0: nRes = fatBuf1.CreateMax(bytesPerSec); sl@0: test_KErrNone(nRes); sl@0: sl@0: nRes = fatBuf2.CreateMax(bytesPerSec); sl@0: test_KErrNone(nRes); sl@0: sl@0: //-- read FAT sector by sector comparing all copies sl@0: TUint32 currPos = posFat1Start; sl@0: for(TUint cntSectors=0; cntSectors file at the end of FAT created in %d ms\n"), (TUint32)usTotalTime/K1mSec); sl@0: sl@0: //-- delete the file sl@0: nRes = TheFs.Delete(KLastFn); sl@0: test_KErrNone(nRes); sl@0: sl@0: EnablePrintOutput(ETrue); //-- Enable FAT test utils print out sl@0: } sl@0: sl@0: //------------------------------------------------------------------- sl@0: /** sl@0: Create 100 directories in the root and measure time sl@0: */ sl@0: void DoCreateDirsInRoot() sl@0: { sl@0: test.Next(_L("Measure time to create many directories in the Root.\n")); sl@0: sl@0: if(!Is_Fat32(TheFs, gDriveNum)) sl@0: { sl@0: test.Printf(_L("This test requires FAT32, skipping\n")); sl@0: return; sl@0: } sl@0: sl@0: TTime timeStart; sl@0: TTime timeEnd; sl@0: TInt64 usTotalTime=0; sl@0: TFileName dirName; sl@0: sl@0: //-- remount file system, reset caches etc. The first known free cluster will be number 2 or 3 sl@0: DoRemountFS(gDriveNum); sl@0: sl@0: //-- disable FAT test utils print out, it affects measured time sl@0: EnablePrintOutput(EFalse); sl@0: sl@0: timeStart.UniversalTime(); //-- take start time sl@0: sl@0: //-- create some subdirectories in the root dir and measure time sl@0: const TInt KMaxDirs = 100; sl@0: for(TInt i=0; i %d Dirs. created in %d ms\n"), KMaxDirs, (TUint32)usTotalTime/K1mSec); sl@0: sl@0: EnablePrintOutput(ETrue); //-- Enable FAT test utils print out sl@0: } sl@0: sl@0: //---------------------------------------------------------------------------------------------- sl@0: //! @SYMTestCaseID PBASE-T_FATCACHE_BM-0693 sl@0: //! @SYMTestType PT sl@0: //! @SYMPREQ PREQ1721 sl@0: //! @SYMTestCaseDesc Create a large file (2G max) and measure the time. Then delete this file and measure time taken sl@0: //! sl@0: //! @SYMTestActions sl@0: //! 0 quick format the volume sl@0: //! 1 create emply file that takes either 80% of the volume of 2G max, masure time taken sl@0: //! 2 remount FS sl@0: //! 3 delete this file and measure time taken sl@0: //! sl@0: //! @SYMTestExpectedResults successful files creation/deletion sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //---------------------------------------------------------------------------------------------- sl@0: static void CreateLargeFile() sl@0: { sl@0: test.Next(_L("Create a large file and measure time\n")); sl@0: sl@0: FormatVolume(ETrue); //-- quick format the volume. sl@0: sl@0: _LIT(KBigFileName, "\\BigFile.big"); sl@0: sl@0: test(gBootSector.IsValid()); sl@0: sl@0: //-- calculate the size of the file, it shall be max 2G or take almost all volume sl@0: TVolumeInfo volInfo; sl@0: TInt nRes; sl@0: sl@0: nRes = TheFs.Volume(volInfo, gDriveNum); sl@0: test_KErrNone(nRes); sl@0: sl@0: const TUint32 clustSz = gBootSector.SectorsPerCluster() * gBootSector.BytesPerSector(); sl@0: const TUint32 maxClusters = (TUint32)(volInfo.iFree / clustSz); sl@0: sl@0: const TUint32 clustersPer1G = K1GigaByte / clustSz; sl@0: const TUint32 clustersPer2G = 2*clustersPer1G; sl@0: sl@0: TUint32 fileClusters=0; sl@0: if(maxClusters*0.8 < clustersPer2G) sl@0: fileClusters = (TUint32)(maxClusters*0.8); sl@0: else sl@0: fileClusters = (TUint32)(clustersPer2G*0.8); sl@0: sl@0: const TUint32 fileSize = fileClusters*clustSz; sl@0: sl@0: //-- create empty file and measure time sl@0: TTime timeStart; sl@0: TTime timeEnd; sl@0: TInt64 usTimeCreate=0; sl@0: TInt64 usTimeDelete=0; sl@0: sl@0: timeStart.UniversalTime(); //-- take start time sl@0: nRes = CreateEmptyFile(TheFs, KBigFileName, fileSize); sl@0: timeEnd.UniversalTime(); //-- take end time sl@0: test_KErrNone(nRes); sl@0: sl@0: usTimeCreate = (timeEnd.MicroSecondsFrom(timeStart)).Int64(); sl@0: sl@0: //-- remount file system, reset caches etc. sl@0: DoRemountFS(gDriveNum); sl@0: sl@0: //-- delete the file sl@0: timeStart.UniversalTime(); //-- take start time sl@0: nRes = TheFs.Delete(KBigFileName); sl@0: timeEnd.UniversalTime(); //-- take end time sl@0: sl@0: test_KErrNone(nRes); sl@0: usTimeDelete = (timeEnd.MicroSecondsFrom(timeStart)).Int64(); sl@0: sl@0: test.Printf(_L("#--> Big file sz:%u created:%d ms, deleted:%d ms\n"), fileSize, (TUint32)(usTimeCreate/K1mSec) , (TUint32)(usTimeDelete/K1mSec)); sl@0: sl@0: } sl@0: sl@0: sl@0: //------------------------------------------------------------------- sl@0: /** sl@0: Start tests. sl@0: */ sl@0: void RunTest() sl@0: { sl@0: test.Printf(_L("Prepare the volume for BM testing...\n")); sl@0: sl@0: test(pFTagArray != NULL); sl@0: CFileTagsArray &fTagArray = *pFTagArray; sl@0: fTagArray.Reset(); sl@0: sl@0: //-- full format the drive sl@0: FormatVolume(EFalse); sl@0: sl@0: test.Printf(_L("\n#--> t_fatcache_bm\n")); sl@0: sl@0: //-- create test directory. sl@0: MakeDir(KDirName); sl@0: sl@0: //-- 1. create KMaxFiles files to fill in space in FAT table. sl@0: if(!DoCreateFiles(fTagArray)) sl@0: return; //-- test is inconsistent sl@0: sl@0: sl@0: //-- 1.1 create a file in the very end of the full volume (FAT table is almost full). Measure time taken sl@0: CreateLastFile(); sl@0: sl@0: //-- 1.2 create multiple directories in the root and measure time sl@0: // DoCreateDirsInRoot(); sl@0: sl@0: //-- 2. randomly merge some small files to bigger ones that will be fragmented sl@0: DoMergeFiles(fTagArray); sl@0: sl@0: //-- 3. randomly shuffle file tags in the array sl@0: ShuffleArray(fTagArray); sl@0: sl@0: //-- 4. measure file open and seek time sl@0: MeasureSeekTime(fTagArray); sl@0: sl@0: //-- 4.5 Check that all copies of FAT are the same. sl@0: CheckFatCopies(); sl@0: sl@0: //-- 5. delete all files and print out time taken sl@0: DeleteAllFiles(fTagArray); sl@0: sl@0: //-- 6. Create a large file (2G max) and measure the time sl@0: //!!!! sl@0: CreateLargeFile(); sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: //------------------------------------------------------------------- sl@0: static void WaitForFatBkGndActivityEnd() sl@0: { sl@0: //-- if we work in release mode, we need to use a hardcore solution to wait until possible FAT background activity finishes sl@0: //-- because transient FAT threads can affect timings (e.g. creating a file may need waiting to FAT background thread to sl@0: //-- parse some portion of FAT) etc. sl@0: //-- for debug mode background FAT activity is disabled in InitGlobals() and timings are not precise anyway sl@0: //-- for release mode we just need to wait some time sl@0: #ifndef _DEBUG sl@0: const TInt KWaitTimeSec = 10; sl@0: test.Printf(_L("waiting %d sec...\n"), KWaitTimeSec); sl@0: User::After(KWaitTimeSec*K1Sec); sl@0: #endif sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: //------------------------------------------------------------------- sl@0: sl@0: /** sl@0: Dismounts and mounts the FS on a drive aDrive sl@0: This will cause resetting "last known free cluster number" value in the FAT table implementation in FSY. sl@0: (Mounting enhancements are disabled.) Empty the caches etc. sl@0: */ sl@0: static void DoRemountFS(TInt aDrive) sl@0: { sl@0: TInt nRes = RemountFS(TheFs, aDrive); sl@0: test_KErrNone(nRes); sl@0: sl@0: //-- get volume info, this is a trick that can help avoiding asynchronous FAT mount in UREL mode sl@0: //TVolumeInfo v; sl@0: //nRes = TheFs.Volume(v); sl@0: sl@0: //-- to avoid affected timings in UREL mode. sl@0: WaitForFatBkGndActivityEnd(); sl@0: } sl@0: sl@0: sl@0: //------------------------------------------------------------------- sl@0: sl@0: /** initialise test global objects */ sl@0: static void InitGlobals() sl@0: { sl@0: //-- initialise random generator sl@0: gRndSeed = 0x67fc1a9; sl@0: sl@0: //-- construct file numbers array sl@0: pFTagArray = new CFileTagsArray(KMaxFiles); sl@0: test(pFTagArray != NULL); sl@0: pFTagArray->SetReserveL(KMaxFiles); sl@0: sl@0: //-- define a propery which will control mount process in the fsy. sl@0: //-- The property key is a drive number being tested sl@0: _LIT_SECURITY_POLICY_PASS(KTestPropPolicy); sl@0: TInt nRes = RProperty::Define(KThisTestSID, gDriveNum, RProperty::EInt, KTestPropPolicy, KTestPropPolicy); sl@0: test(nRes == KErrNone || nRes == KErrAlreadyExists); sl@0: sl@0: //-- disable all volume mount enhancements, like asynch mount and FSInfo. sl@0: //-- this works only in debug mode. sl@0: nRes = RProperty::Set(KThisTestSID, gDriveNum, (TInt)KMntProp_DisableALL); sl@0: test_KErrNone(nRes); sl@0: sl@0: } sl@0: sl@0: /** destroy test global objects */ sl@0: static void DestroyGlobals() sl@0: { sl@0: delete pFTagArray; sl@0: sl@0: //-- delete test property sl@0: RProperty::Delete(KThisTestSID, gDriveNum); sl@0: sl@0: } sl@0: sl@0: sl@0: //------------------------------------------------------------------- sl@0: void CallTestsL() sl@0: { sl@0: sl@0: //-- set up console output sl@0: Fat_Test_Utils::SetConsole(test.Console()); sl@0: sl@0: TInt nRes=TheFs.CharToDrive(gDriveToTest, gDriveNum); sl@0: test(nRes==KErrNone); sl@0: sl@0: //-- check if this is FAT sl@0: if(!Is_Fat(TheFs, gDriveNum)) sl@0: { sl@0: test.Printf(_L("Skipping. This test requires FAT drive.\n")); sl@0: return; sl@0: } sl@0: sl@0: //-- check this is not the internal ram drive sl@0: TVolumeInfo v; sl@0: nRes = TheFs.Volume(v); sl@0: test(nRes==KErrNone); sl@0: if(v.iDrive.iMediaAtt & KMediaAttVariableSize) sl@0: { sl@0: test.Printf(_L("Skipping. Internal ram drive not tested.\n")); sl@0: return; sl@0: } sl@0: sl@0: sl@0: //------------------------------------- sl@0: PrintDrvInfo(TheFs, gDriveNum); sl@0: sl@0: InitGlobals(); sl@0: sl@0: RunTest(); sl@0: sl@0: //------------------------------------- sl@0: DestroyGlobals(); sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: