sl@0: // Copyright (c) 2006-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\bench\t_fsrdirload.cpp sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include "t_select.h" sl@0: #include "..\server\t_server.h" sl@0: #include "t_benchmain.h" sl@0: sl@0: sl@0: GLDEF_D RTest test(_L("File Server Benchmarks, Dir Load")); sl@0: sl@0: //---------------------------------------------------------------------------------------------- sl@0: //! @SYMTestCaseID PBASE-T_FSRDIRLOAD-0273 sl@0: //! @SYMTestType CIT sl@0: //! @SYMPREQ PREQ000 sl@0: //! @SYMTestCaseDesc This test case is measuring performance of the FAT implementation. sl@0: //! @SYMTestActions 0. Expects the files to exist in order to successful execution sl@0: //! 1. Time the listing of each directory sorted by name sl@0: //! 2. Time the listing of each directory sorted by extension sl@0: //! 3. Time the listing of each directory sorted by size sl@0: //! 4. Time the listing of each directory sorted by date sl@0: //! 5. Time the search of each file in a directory sorted by name sl@0: //! 6. Time the search of each file in a directory sorted by extension sl@0: //! 7. Time the search of each file in a directory sorted by size sl@0: //! 8. Time the search of each file in a directory sorted by date sl@0: //! sl@0: //! @SYMTestExpectedResults Finishes if the system behaves as expected, panics otherwise sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //---------------------------------------------------------------------------------------------- sl@0: sl@0: sl@0: LOCAL_D RSemaphore client; sl@0: LOCAL_D TRequestStatus stat; sl@0: LOCAL_D TBuf8<4096> buf; sl@0: sl@0: LOCAL_D TDriveList gDriveList; sl@0: sl@0: sl@0: _LIT(KDirMultipleName2, "dir%d_%d\\"); sl@0: sl@0: /** Sort a directory with different criterias sl@0: sl@0: @param aN Number of files in the directory sl@0: @param aKey Type of sorting to use sl@0: @param aStep Test step sl@0: */ sl@0: LOCAL_C TInt SortFile(TInt aN, TEntryKey aKey, TInt aStep) sl@0: { sl@0: TBuf16<100> dir1; sl@0: TBuf16<100> dir2; sl@0: TBuf16<100> dir3; sl@0: TBuf16<100> temp; sl@0: sl@0: TInt r = 0; sl@0: TTime startTime; sl@0: TTime endTime; sl@0: TTimeIntervalMicroSeconds timeTaken(0); sl@0: TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1; sl@0: sl@0: if(aN <= gFilesLimit) sl@0: { sl@0: CDir* dirPtr; sl@0: sl@0: dir1 = gSessionPath; sl@0: dir2 = gSessionPath; sl@0: dir3 = gSessionPath; sl@0: sl@0: temp.Format(KDirMultipleName2, 1, aN); sl@0: dir1.Append(temp); sl@0: sl@0: temp.Format(KDirMultipleName2, 2, aN); sl@0: dir2.Append(temp); sl@0: sl@0: temp.Format(KDirMultipleName2, 3, aN); sl@0: dir3.Append(temp); sl@0: sl@0: dir1.Append(_L("*.*")); sl@0: dir2.Append(_L("*.*")); sl@0: dir3.Append(_L("*.*")); sl@0: sl@0: if(gTypes >= 1) sl@0: { sl@0: startTime.HomeTime(); sl@0: r = TheFs.GetDir(dir1,KEntryAttMaskSupported,ESortNone,dirPtr); sl@0: FailIfError(r); sl@0: sl@0: r = dirPtr->Sort(aKey); sl@0: FailIfError(r); sl@0: sl@0: endTime.HomeTime(); sl@0: delete dirPtr; sl@0: sl@0: timeTaken = endTime.MicroSecondsFrom(startTime); sl@0: timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit); sl@0: } sl@0: sl@0: if(gTypes >= 2) sl@0: { sl@0: startTime.HomeTime(); sl@0: r = TheFs.GetDir(dir2,KEntryAttMaskSupported,ESortNone,dirPtr); sl@0: FailIfError(r); sl@0: sl@0: r = dirPtr->Sort(aKey); sl@0: FailIfError(r); sl@0: endTime.HomeTime(); sl@0: sl@0: timeTaken = endTime.MicroSecondsFrom(startTime); sl@0: delete dirPtr; sl@0: timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit); sl@0: } sl@0: sl@0: if(gTypes >= 3) sl@0: { sl@0: startTime.HomeTime(); sl@0: r = TheFs.GetDir(dir3,KEntryAttMaskSupported,ESortNone,dirPtr); sl@0: FailIfError(r); sl@0: sl@0: r = dirPtr->Sort(aKey); sl@0: FailIfError(r); sl@0: sl@0: endTime.HomeTime(); sl@0: timeTaken=endTime.MicroSecondsFrom(startTime); sl@0: timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit); sl@0: delete dirPtr; sl@0: } sl@0: } sl@0: sl@0: PrintResult(aStep, 1, aN); sl@0: PrintResultTime(aStep, 2, timeTaken1); sl@0: PrintResultTime(aStep, 3, timeTaken2); sl@0: PrintResultTime(aStep, 4, timeTaken3); sl@0: sl@0: return KErrNone; sl@0: } sl@0: sl@0: /** Sort a directory with different type of files and find a particular one sl@0: sl@0: @param aN Number of files in the directory sl@0: @param aKey Type of sorting to use sl@0: @param aStep Test step sl@0: */ sl@0: LOCAL_C TInt SortFindFile(TInt aN, TEntryKey aKey, TInt aStep ) sl@0: { sl@0: TBuf16<100> dir1; sl@0: TBuf16<100> dir2; sl@0: TBuf16<100> dir3; sl@0: TBuf16<100> temp; sl@0: sl@0: TInt r = 0; sl@0: TTime startTime; sl@0: TTime endTime; sl@0: TTimeIntervalMicroSeconds timeTaken(0); sl@0: TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1; sl@0: sl@0: if(aN <= gFilesLimit) sl@0: { sl@0: CDir* dirPtr; sl@0: TInt i = 0; sl@0: TBool found = EFalse; sl@0: sl@0: dir1 = gSessionPath; sl@0: dir2 = gSessionPath; sl@0: dir3 = gSessionPath; sl@0: sl@0: temp.Format(KDirMultipleName2, 1, aN); sl@0: dir1.Append(temp); sl@0: sl@0: temp.Format(KDirMultipleName2, 2, aN); sl@0: dir2.Append(temp); sl@0: sl@0: temp.Format(KDirMultipleName2, 3, aN); sl@0: dir3.Append(temp); sl@0: sl@0: dir1.Append(_L("*.*")); sl@0: dir2.Append(_L("*.*")); sl@0: dir3.Append(_L("*.*")); sl@0: sl@0: if(gTypes >= 1) sl@0: { sl@0: startTime.HomeTime(); sl@0: r = TheFs.GetDir(dir1, KEntryAttMaskSupported, aKey, dirPtr); sl@0: FailIfError(r); sl@0: sl@0: found = EFalse; sl@0: i = 0; sl@0: while((i < dirPtr->Count()) && (!found)) sl@0: { sl@0: TEntry e = (*dirPtr)[i]; sl@0: if(e.iName == _L("last.txt")) found = ETrue; sl@0: i++; sl@0: } sl@0: sl@0: endTime.HomeTime(); sl@0: delete dirPtr; sl@0: sl@0: timeTaken = endTime.MicroSecondsFrom(startTime); sl@0: timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit); sl@0: } sl@0: sl@0: if(gTypes >= 2) sl@0: { sl@0: startTime.HomeTime(); sl@0: r = TheFs.GetDir(dir2, KEntryAttMaskSupported, aKey, dirPtr); sl@0: FailIfError(r); sl@0: sl@0: found = EFalse; sl@0: i = 0; sl@0: while((i < dirPtr->Count()) && (!found)) sl@0: { sl@0: TEntry e = (*dirPtr)[i]; sl@0: if(e.iName == _L("last.txt")) found = ETrue; sl@0: i++; sl@0: } sl@0: sl@0: endTime.HomeTime(); sl@0: timeTaken = endTime.MicroSecondsFrom(startTime); sl@0: delete dirPtr; sl@0: sl@0: timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit); sl@0: } sl@0: sl@0: if(gTypes >= 3) sl@0: { sl@0: startTime.HomeTime(); sl@0: r = TheFs.GetDir(dir3, KEntryAttMaskSupported, aKey, dirPtr); sl@0: FailIfError(r); sl@0: sl@0: found = EFalse; sl@0: i = 0; sl@0: while((iCount()) && (!found)) sl@0: { sl@0: TEntry e = (*dirPtr)[i]; sl@0: if(e.iName == _L("last.txt")) found = ETrue; sl@0: i++; sl@0: } sl@0: sl@0: endTime.HomeTime(); sl@0: timeTaken = endTime.MicroSecondsFrom(startTime); sl@0: timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit); sl@0: delete dirPtr; sl@0: } sl@0: } sl@0: sl@0: PrintResult(aStep, 1, aN); sl@0: PrintResultTime(aStep, 2, timeTaken1); sl@0: PrintResultTime(aStep, 3, timeTaken2); sl@0: PrintResultTime(aStep, 4, timeTaken3); sl@0: sl@0: return KErrNone; sl@0: } sl@0: sl@0: sl@0: /** Sort a directory and find a file opens it and reads first 4Kb and last 4Kb sl@0: sl@0: @param aN Number of files in the directory sl@0: @param aKey Type of sorting to use sl@0: @param aStep Test step sl@0: */ sl@0: LOCAL_C TInt SortFindFileAndOpen(TInt aN, TEntryKey aKey, TInt aStep ) sl@0: { sl@0: TBuf16<100> dir1; sl@0: TBuf16<100> dir2; sl@0: TBuf16<100> dir3; sl@0: TBuf16<100> temp; sl@0: sl@0: TInt r = 0; sl@0: TTime startTime; sl@0: TTime endTime; sl@0: TTimeIntervalMicroSeconds timeTaken(0); sl@0: TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1; sl@0: sl@0: CDir* dirPtr; sl@0: TInt i = 0, pos = 0; sl@0: TBool found = EFalse; sl@0: RFile file; sl@0: sl@0: if(aN <= gFilesLimit) sl@0: { sl@0: dir1 = gSessionPath; sl@0: dir2 = gSessionPath; sl@0: dir3 = gSessionPath; sl@0: sl@0: temp.Format(KDirMultipleName2, 1, aN); sl@0: dir1.Append(temp); sl@0: sl@0: temp.Format(KDirMultipleName2, 2, aN); sl@0: dir2.Append(temp); sl@0: sl@0: temp.Format(KDirMultipleName2, 3, aN); sl@0: dir3.Append(temp); sl@0: sl@0: dir1.Append(_L("*.*")); sl@0: dir2.Append(_L("*.*")); sl@0: dir3.Append(_L("*.*")); sl@0: sl@0: sl@0: if(gTypes >= 1) sl@0: { sl@0: startTime.HomeTime(); sl@0: r = TheFs.GetDir(dir1, KEntryAttMaskSupported, aKey, dirPtr); sl@0: FailIfError(r); sl@0: sl@0: dir1 = gSessionPath; sl@0: temp.Format(KDirMultipleName2, 1, aN); sl@0: dir1.Append(temp); sl@0: dir1.Append(_L("LAST.TXT")); sl@0: sl@0: found = EFalse; sl@0: i = 0; sl@0: while((i < dirPtr->Count()) && (!found)) sl@0: { sl@0: TEntry e = (*dirPtr)[i]; sl@0: if(e.iName == _L("LAST.TXT")) sl@0: { sl@0: found = ETrue; sl@0: } sl@0: else sl@0: { sl@0: i++; sl@0: } sl@0: } sl@0: sl@0: test(found); sl@0: sl@0: file.Open(TheFs, dir1, EFileShareAny|EFileRead); sl@0: pos = 0; sl@0: file.Seek(ESeekStart, pos); sl@0: r = file.Read(buf); sl@0: FailIfError(r); sl@0: pos = -4 * KOneK; // 4 KB before the end of the file sl@0: file.Seek(ESeekEnd, pos); sl@0: r = file.Read(buf); sl@0: FailIfError(r); sl@0: sl@0: endTime.HomeTime(); sl@0: delete dirPtr; sl@0: file.Close(); sl@0: sl@0: timeTaken = endTime.MicroSecondsFrom(startTime); sl@0: timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit); sl@0: } sl@0: sl@0: if(gTypes >= 2) sl@0: { sl@0: startTime.HomeTime(); sl@0: r = TheFs.GetDir(dir2, KEntryAttMaskSupported, aKey, dirPtr); sl@0: FailIfError(r); sl@0: sl@0: dir2 = gSessionPath; sl@0: temp.Format(KDirMultipleName2, 2, aN); sl@0: dir2.Append(temp); sl@0: dir2.Append(_L("LAST.TXT")); sl@0: sl@0: found = EFalse; sl@0: i = 0; sl@0: while((i < dirPtr->Count()) && (!found)) sl@0: { sl@0: TEntry e = (*dirPtr)[i]; sl@0: if(e.iName == _L("LAST.TXT")) sl@0: { sl@0: found = ETrue; sl@0: } sl@0: else sl@0: { sl@0: i++; sl@0: } sl@0: } sl@0: sl@0: test(found); sl@0: sl@0: file.Open(TheFs, dir2, EFileShareAny|EFileRead); sl@0: pos = 0; sl@0: file.Seek(ESeekStart, pos); sl@0: r = file.Read(buf); sl@0: FailIfError(r); sl@0: pos = -4 * KOneK; // 4 KB before the end of the file sl@0: file.Seek(ESeekEnd, pos); sl@0: r = file.Read(buf); sl@0: FailIfError(r); sl@0: sl@0: endTime.HomeTime(); sl@0: timeTaken = endTime.MicroSecondsFrom(startTime); sl@0: delete dirPtr; sl@0: file.Close(); sl@0: sl@0: timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit); sl@0: } sl@0: sl@0: if(gTypes >= 3) sl@0: { sl@0: startTime.HomeTime(); sl@0: r = TheFs.GetDir(dir3, KEntryAttMaskSupported, aKey, dirPtr); sl@0: FailIfError(r); sl@0: sl@0: dir3 = gSessionPath; sl@0: temp.Format(KDirMultipleName2, 3, aN); sl@0: dir3.Append(temp); sl@0: dir3.Append(_L("LAST.TXT")); sl@0: sl@0: found = EFalse; sl@0: i = 0; sl@0: while((i < dirPtr->Count()) && (!found)) sl@0: { sl@0: TEntry e = (*dirPtr)[i]; sl@0: if(e.iName == _L("LAST.TXT")) sl@0: { sl@0: found = ETrue; sl@0: } sl@0: else sl@0: { sl@0: i++; sl@0: } sl@0: } sl@0: sl@0: file.Open(TheFs, dir3, EFileShareAny|EFileRead); sl@0: pos = 0; sl@0: file.Seek(ESeekStart, pos); sl@0: r = file.Read(buf); sl@0: FailIfError(r); sl@0: pos = -4 * KOneK; // 4 KB before the end of the file sl@0: file.Seek(ESeekEnd, pos); sl@0: r = file.Read(buf); sl@0: FailIfError(r); sl@0: sl@0: endTime.HomeTime(); sl@0: timeTaken = endTime.MicroSecondsFrom(startTime); sl@0: file.Close(); sl@0: sl@0: timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit); sl@0: delete dirPtr; sl@0: } sl@0: } sl@0: sl@0: PrintResult(aStep, 1, aN); sl@0: PrintResultTime(aStep, 2, timeTaken1); sl@0: PrintResultTime(aStep, 3, timeTaken2); sl@0: PrintResultTime(aStep, 4, timeTaken3); sl@0: sl@0: return KErrNone; sl@0: } sl@0: sl@0: /** Times the directory listing sorted by name, extension, size and date sl@0: sl@0: @param aSelector Configuration in case of manual execution sl@0: */ sl@0: LOCAL_C TInt TestDirListing(TAny* aSelector) sl@0: { sl@0: TInt i = 100; sl@0: TInt testStep; sl@0: sl@0: Validate(aSelector); sl@0: sl@0: test.Printf(_L("#~TS_Title_%d,%d: Directory listing sorted by name \n"), gTestHarness, gTestCase); sl@0: sl@0: testStep = 1; sl@0: while(i <= KMaxFiles) sl@0: { sl@0: if(i == 100 || i == 1000 || i == 5000 || i == 10000) sl@0: { sl@0: SortFile(i, ESortByName, testStep++); sl@0: } sl@0: i += 100; sl@0: } sl@0: sl@0: gTestCase++; sl@0: test.Printf(_L("#~TS_Title_%d,%d: Directory listing sorted by extension\n"), gTestHarness, gTestCase); sl@0: sl@0: i = 100; sl@0: testStep = 1; sl@0: while(i <= KMaxFiles) sl@0: { sl@0: if(i == 100 || i == 1000 || i == 5000 || i == 10000) sl@0: { sl@0: SortFile(i, ESortByExt, testStep++); sl@0: } sl@0: i += 100; sl@0: } sl@0: sl@0: gTestCase++; sl@0: test.Printf(_L("#~TS_Title_%d,%d: Directory listing sorted by size \n"), gTestHarness, gTestCase); sl@0: sl@0: i = 100; sl@0: testStep = 1; sl@0: while(i <= KMaxFiles) sl@0: { sl@0: if(i == 100 || i == 1000 || i == 5000 || i == 10000) sl@0: { sl@0: SortFile(i, ESortBySize, testStep++); sl@0: } sl@0: i += 100; sl@0: } sl@0: sl@0: gTestCase++; sl@0: test.Printf(_L("#~TS_Title_%d,%d: Directory listing sorted by date \n"), gTestHarness, gTestCase); sl@0: sl@0: i = 100; sl@0: testStep = 1; sl@0: while(i <= KMaxFiles) sl@0: { sl@0: if(i == 100 || i == 1000 || i == 5000 || i == 10000) sl@0: { sl@0: SortFile(i, ESortByDate, testStep++); sl@0: } sl@0: i += 100; sl@0: } sl@0: sl@0: gTestCase++; sl@0: return KErrNone; sl@0: } sl@0: sl@0: /** Times the operations required to find a file ordering the list of files by orted by name, sl@0: extension, size and date sl@0: sl@0: @param aSelector Configuration in case of manual execution sl@0: */ sl@0: LOCAL_C TInt TestFindFile(TAny* aSelector) sl@0: { sl@0: TInt i = 100; sl@0: TInt testStep; sl@0: sl@0: Validate(aSelector); sl@0: sl@0: test.Printf(_L("#~TS_Title_%d,%d: Find file when sorted by name \n"), gTestHarness, gTestCase); sl@0: sl@0: i = 100; sl@0: testStep = 1; sl@0: while(i <= KMaxFiles) sl@0: { sl@0: if(i == 100 || i == 1000 || i == 5000 || i == 10000) sl@0: { sl@0: SortFindFile(i, ESortByName, testStep++); sl@0: } sl@0: i += 100; sl@0: } sl@0: sl@0: gTestCase++; sl@0: test.Printf(_L("#~TS_Title_%d,%d: Find file when sorted by extension\n"), gTestHarness, gTestCase); sl@0: sl@0: i = 100; sl@0: testStep = 1; sl@0: while(i <= KMaxFiles) sl@0: { sl@0: if(i == 100 || i == 1000 || i == 5000 || i == 10000) sl@0: { sl@0: SortFindFile(i, ESortByExt, testStep++); sl@0: } sl@0: i += 100; sl@0: } sl@0: sl@0: gTestCase++; sl@0: test.Printf(_L("#~TS_Title_%d,%d: Find file when sorted by size \n"), gTestHarness, gTestCase); sl@0: sl@0: i = 100; sl@0: testStep = 1; sl@0: while(i <= KMaxFiles) sl@0: { sl@0: if(i == 100 || i == 1000 || i == 5000 || i == 10000) sl@0: { sl@0: SortFindFile(i, ESortBySize, testStep++); sl@0: } sl@0: i += 100; sl@0: } sl@0: sl@0: gTestCase++; sl@0: test.Printf(_L("#~TS_Title_%d,%d: Find file when sorted by date \n"), gTestHarness, gTestCase); sl@0: sl@0: i = 100; sl@0: testStep = 1; sl@0: while(i <= KMaxFiles) sl@0: { sl@0: if(i == 100 || i == 1000 || i == 5000 || i == 10000) sl@0: { sl@0: SortFindFile(i, ESortByDate, testStep++); sl@0: } sl@0: i += 100; sl@0: } sl@0: sl@0: gTestCase++; sl@0: sl@0: return KErrNone; sl@0: } sl@0: sl@0: /** Times the opening of a file and read of the first 4 Kb when sorted by name, sl@0: extension, size and date sl@0: sl@0: @param aSelector Configuration in case of manual execution sl@0: */ sl@0: LOCAL_C TInt TestOpenReadFile(TAny* aSelector) sl@0: { sl@0: TInt i = 100; sl@0: TInt testStep; sl@0: sl@0: Validate(aSelector); sl@0: sl@0: test.Printf(_L("#~TS_Title_%d,%d: Open and read file when sorted by name \n"), gTestHarness, gTestCase); sl@0: sl@0: i = 100; sl@0: testStep = 1; sl@0: while(i <= KMaxFiles) sl@0: { sl@0: if(i == 100 || i == 1000 || i == 5000 || i == 10000) sl@0: { sl@0: SortFindFileAndOpen(i, ESortByName, testStep++); sl@0: } sl@0: i += 100; sl@0: } sl@0: sl@0: gTestCase++; sl@0: test.Printf(_L("#~TS_Title_%d,%d: Open and read file when sorted by extension\n"), gTestHarness, gTestCase); sl@0: sl@0: i = 100; sl@0: testStep = 1; sl@0: while(i <= KMaxFiles) sl@0: { sl@0: if(i == 100 || i == 1000 || i == 5000 || i == 10000) sl@0: { sl@0: SortFindFileAndOpen(i, ESortByExt, testStep++); sl@0: } sl@0: i += 100; sl@0: } sl@0: sl@0: gTestCase++; sl@0: test.Printf(_L("#~TS_Title_%d,%d: Open and read when sorted by size \n"), gTestHarness, gTestCase); sl@0: sl@0: i=100; sl@0: testStep = 1; sl@0: while(i <= KMaxFiles) sl@0: { sl@0: if(i == 100 || i == 1000 || i == 5000 || i == 10000) sl@0: { sl@0: SortFindFileAndOpen(i, ESortBySize, testStep++); sl@0: } sl@0: i += 100; sl@0: } sl@0: sl@0: gTestCase++; sl@0: test.Printf(_L("#~TS_Title_%d,%d: Open and read file when sorted by date \n"), gTestHarness, gTestCase); sl@0: sl@0: i = 100; sl@0: testStep = 1; sl@0: while(i <= KMaxFiles) sl@0: { sl@0: if(i == 100 || i == 1000 || i == 5000 || i == 10000) sl@0: { sl@0: SortFindFileAndOpen(i, ESortByDate, testStep++); sl@0: } sl@0: i += 100; sl@0: } sl@0: sl@0: gTestCase++; sl@0: return KErrNone; sl@0: } sl@0: sl@0: /** It goes automatically through all the options sl@0: sl@0: @param aSelector Configuration in case of manual execution sl@0: */ sl@0: LOCAL_C TInt TestAll(TAny* aSelector) sl@0: { sl@0: Validate(aSelector); sl@0: sl@0: TestDirListing(aSelector); sl@0: TestFindFile(aSelector); sl@0: TestOpenReadFile(aSelector); sl@0: sl@0: return KErrNone; sl@0: } sl@0: sl@0: /** Call all tests sl@0: sl@0: */ sl@0: GLDEF_C void CallTestsL() sl@0: { sl@0: TInt r = client.CreateLocal(0); sl@0: FailIfError(r); sl@0: sl@0: CSelectionBox* TheSelector = CSelectionBox::NewL(test.Console()); sl@0: sl@0: gFileSize = 8; sl@0: sl@0: // Each test case of the suite has an identifyer for parsing purposes of the results sl@0: gTestHarness = 2; sl@0: gTestCase = 1; sl@0: sl@0: PrintHeaders(1, _L("t_fsrdirload. Directory loading")); sl@0: sl@0: if(gMode==0) sl@0: { // Manual sl@0: gSessionPath = _L("?:\\"); sl@0: TCallBack createFiles(TestFileCreate,TheSelector); sl@0: TCallBack dirListFile(TestDirListing,TheSelector); sl@0: TCallBack findFile(TestFindFile,TheSelector); sl@0: TCallBack openReadFile(TestOpenReadFile,TheSelector); sl@0: TCallBack allFile(TestAll,TheSelector); sl@0: TheSelector->AddDriveSelectorL(TheFs); sl@0: TheSelector->AddLineL(_L("Create all files"),createFiles); sl@0: TheSelector->AddLineL(_L("Directory listings"),dirListFile); sl@0: TheSelector->AddLineL(_L("Find file in the listing"),findFile); sl@0: TheSelector->AddLineL(_L("Open and read first and last 4KB "),openReadFile); sl@0: TheSelector->AddLineL(_L("Three last options together"),allFile); sl@0: TheSelector->Run(); sl@0: } sl@0: else sl@0: { // Automatic sl@0: TestAll(TheSelector); sl@0: } sl@0: sl@0: client.Close(); sl@0: test.Printf(_L("#~TestEnd_%d\n"), gTestHarness); sl@0: delete TheSelector; sl@0: }