diff -r 000000000000 -r a41df078684a kerneltest/f32test/server/t_vfat.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/f32test/server/t_vfat.cpp Mon Oct 19 15:55:17 2009 +0100 @@ -0,0 +1,339 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// f32test\server\t_vfat.cpp +// +// + +#include +#include +#include +#include "t_server.h" + +RTest test(_L("T_VFAT")); + +static void Test1() +// +// Create 71 8.3 files +// Rename each of them to vfat filenames (% order) +// Chkdsk +// Check entries +// + { + + test.Next(_L("Test rename")); + TInt totalFiles=103; + TInt orderMod=61; + TFileName nameshort=_L("File"); + TFileName namelong=_L("File.+',;'=[]"); + TInt i; + TBuf8<256> data; + + for (i=0;i tempName=nameshort; + tempName.AppendNum(i); + data.SetLength(i); + MakeFile(tempName,data); + } + + TInt count=totalFiles; + while(count--) + { + TInt fileNum=(orderMod*count)%totalFiles; + TBuf<32> shortName=nameshort; + shortName.AppendNum(fileNum); + TBuf<32> longName=namelong; + longName.AppendNum(fileNum); + TInt r=TheFs.Rename(shortName,longName); + test(r==KErrNone); + } + + TInt r=TheFs.CheckDisk(gSessionPath); + test(r==KErrNone || r==KErrNotSupported); + + CDir* dirList; + r=TheFs.GetDir(_L("*.*"),KEntryAttMaskSupported,ESortBySize,dirList); + test(r==KErrNone); + test(dirList->Count()==totalFiles); + for (i=0;i longName=namelong; + longName.AppendNum(i); + TEntry entry; + entry=(*dirList)[i]; + test(entry.iName.MatchF(longName)!=KErrNotFound); + } + + delete dirList; + } + + +#ifdef __WINS__ +const TInt gMaxIterations=1000; +#else +const TInt gMaxIterations=1000; // Have pity on a poor 18MHz CPU +#endif + +const TInt gMaxFiles=256; +TBuf gDataBuf; +TBuf8 buf; +TFileName gFileName[gMaxFiles]; + +LOCAL_C void Test2() +// +// Random test +// Generate random numbers fileNum, fileOp. +// fileOp = 1, shortname +// fileOp = 2, longName +// fileOp = 3, delete file +// + { + + TInt i; + test.Next(_L("Random test")); + TInt64 seed=51703; + TInt maxIterations=gMaxIterations; + TInt maxFileOps=3; + TInt checkFrequency=100; // 1 in xxxx + + for(i=0;i