diff -r 2d65c2f76d7b -r 947f0dc9f7a8 kerneltest/f32test/server/b_gen.cpp --- a/kerneltest/f32test/server/b_gen.cpp Tue Feb 02 01:24:03 2010 +0200 +++ b/kerneltest/f32test/server/b_gen.cpp Fri Apr 16 16:24:37 2010 +0300 @@ -20,12 +20,10 @@ #include "t_server.h" #include "t_chlffs.h" -#ifdef __VC32__ - // Solve compilation problem caused by non-English locale - #pragma setlocale("english") -#endif +#include "f32_test_utils.h" +using namespace F32_Test_Utils; -GLDEF_D RTest test(_L("B_GEN")); +RTest test(_L("B_GEN")); // // File test - general test of local filing system routines // (finishes with formating current device). @@ -34,70 +32,42 @@ #define MINIMUM_DATE (315532800L) #define DateTests 10 -// GLREF_D P_DEVICE p_file; -// GLREF_D P_DEVICE p_wind,p_screen,p_cons; -GLDEF_D TBuf<0x100> gNameBuf; -GLDEF_D TBuf<0x100> gNameOut; -GLDEF_D RFile gFile; -GLDEF_D RFile gFileErr; -GLDEF_D RFile gFile2; -GLDEF_D RDir gDir; -GLDEF_D RFormat gFormat; -//GLDEF_D void *chan1,*chan2; -GLDEF_D TFileName fBuf; -//GLDEF_D TUint8 fBuf[P_FNAMESIZE]; - - -LOCAL_D TBuf8<0x4000> gDataBuf; -LOCAL_D TEntry gFileEntry; -// LOCAL_D P_DINFO volInfo; -LOCAL_D TVolumeInfo volInfo; -// LOCAL_D P_NINFO nInfo; -LOCAL_D TFileName pathBuf; +TBuf<0x100> gNameBuf; +TBuf<0x100> gNameOut; +RFile gFile; +RFile gFileErr; +RFile gFile2; +RDir gDir; +RFormat gFormat; +TFileName fBuf; +TInt gDriveNum = -1; -LOCAL_D TInt NameErr=KErrBadName; -LOCAL_D TInt DirErr=KErrPathNotFound; -LOCAL_D TInt AccessErr=KErrAccessDenied; -LOCAL_D TInt LockedErr=KErrInUse; -LOCAL_D TInt ExistsErr=KErrAlreadyExists; -LOCAL_D TInt NotExistsErr=KErrNotFound; -LOCAL_D TInt EofErr=KErrEof; -LOCAL_D TInt DeviceErr=KErrNotReady; -//LOCAL_D TInt NoFileSystemErr=KErrNotReady; -//LOCAL_D TInt NotSupportedErr=KErrNotSupported; -LOCAL_D TInt ReadOnlyErr=KErrAccessDenied; - -LOCAL_D TInt P_FASTREAM=EFileStream; -LOCAL_D TInt P_FAEXEC=0; -LOCAL_D TInt P_FAMOD=KEntryAttArchive; -LOCAL_D TInt P_FAREAD=KEntryAttReadOnly; -//LOCAL_D TInt P_FAHIDDEN=KEntryAttHidden; -//LOCAL_D TInt P_FASYSTEM=KEntryAttSystem; -//LOCAL_C TInt P_FAVOLUME=KEntryAttVolume; -LOCAL_C TInt P_FADIR=KEntryAttDir; -LOCAL_C TInt P_FRANDOM=0; -LOCAL_C TInt P_FABS=ESeekStart; - -LOCAL_C TInt P_FUPDATE=EFileWrite; +static TBuf8<0x4000> gDataBuf; +static TEntry gFileEntry; +static TVolumeInfo volInfo; +static TFileName pathBuf; -LOCAL_C void doError(const TDesC &aMess, TInt anErr, TInt line) + + + +static void doError(const TDesC &aMess, TInt anErr, TInt line) { test.Printf(_L("%S failed at line %d. Error %d\n"),&aMess, line, anErr); test(0); } #define Error(aMess, anErr) doError(aMess, anErr, __LINE__) -LOCAL_C void doError2(const TDesC &aMess, TInt anErr, TInt line, TInt callLine) +static void doError2(const TDesC &aMess, TInt anErr, TInt line, TInt callLine) { test.Printf(_L("%S failed at line %d. Error %d. Called from line %d\n"),&aMess, line, anErr, callLine); \ test(0); } #define Error2(aMess, anErr, line) doError2(aMess, anErr, __LINE__, line) -LOCAL_C void testWrite(const TDesC& aName,TInt aLen,TInt32 aSize,TBool aShouldChange) +static void testWrite(const TDesC& aName,TInt aLen,TInt32 aSize,TBool aShouldChange) // // Write to a file // @@ -123,7 +93,7 @@ Error(_L("Size check 602"),0); } -LOCAL_C void testSetEof(const TDesC& aName,TUint32 aPos,TBool aShouldChange) +static void testSetEof(const TDesC& aName,TUint32 aPos,TBool aShouldChange) // // Set the end of a file // @@ -148,7 +118,7 @@ } -LOCAL_C void testDir(const TDesC& aDirName) +static void testDir(const TDesC& aDirName) // // Create a directory // @@ -173,7 +143,7 @@ /* -LOCAL_C void testNodeInfo(const TDesC& aName,TInt type,TInt anErr) +static void testNodeInfo(const TDesC& aName,TInt type,TInt anErr) // // Test p_ninfo. // @@ -193,7 +163,7 @@ } */ -LOCAL_C void testDeviceInfo(const TDesC& aDeviceName,TInt anErr) +static void testDeviceInfo(const TDesC& aDeviceName,TInt anErr) // // Test p_dinfo. // @@ -218,7 +188,7 @@ } } -LOCAL_C void testFileInfo(const TDesC& aFileName,TInt anErr) +static void testFileInfo(const TDesC& aFileName,TInt anErr) // // Test entry info // @@ -232,14 +202,14 @@ { if (aFileName.Length()>=2 && aFileName[0]=='Z' && aFileName[1]==':') { - if ((gFileEntry.iAtt&(P_FAREAD|P_FAEXEC|P_FASTREAM)) != (TUint32)(P_FAREAD|P_FAEXEC|P_FASTREAM) && gFileEntry.iAtt!=KEntryAttDir) + if ((gFileEntry.iAtt&(KEntryAttReadOnly|EFileStream)) != (TUint32)(KEntryAttReadOnly|EFileStream) && gFileEntry.iAtt!=KEntryAttDir) Error(_L("Info status check Z:\\"),0); } else { if (gFileEntry.iAtt&KEntryAttDir) return; // Found directory entry - if (gFileEntry.iAtt!=(TUint32)(P_FASTREAM|P_FAMOD)) + if (gFileEntry.iAtt!=(TUint32)(EFileStream|KEntryAttArchive)) Error(_L("Info status check"),0); if (gFileEntry.iSize!=0L) Error(_L("Info size check"),0); @@ -247,7 +217,7 @@ } } -LOCAL_C void testRenameFromRoot(const TDesC& aRName,const TDesC& aDName) +static void testRenameFromRoot(const TDesC& aRName,const TDesC& aDName) // // // @@ -259,11 +229,11 @@ if ((c=gFile.Open(TheFs,aDName,EFileStream))!=KErrNone) Error(_L("Open 92"),c); gFile.Close(); - if ((c=TheFs.Delete(aRName))!=NotExistsErr) + if ((c=TheFs.Delete(aRName))!=KErrNotFound) Error(_L("Delete 92"),c); } -LOCAL_C void testRenameToRoot(const TDesC& pName,const TDesC& rName) +static void testRenameToRoot(const TDesC& pName,const TDesC& rName) // // // @@ -278,11 +248,11 @@ if ((c=gFile.Open(TheFs,rName,EFileStream))!=KErrNone) Error(_L("Open 91"),c); gFile.Close(); - if ((c=TheFs.Delete(pName))!=NotExistsErr) + if ((c=TheFs.Delete(pName))!=KErrNotFound) Error(_L("Delete 91"),c); } -LOCAL_C void verifyTestPat1() +static void verifyTestPat1() // // // @@ -320,7 +290,7 @@ test(err == KErrNone); } -LOCAL_C void testRename() +static void testRename() // // Test TheFs.Rename function. // @@ -332,7 +302,7 @@ test.Printf(_L("Test TheFs.Rename\n")); test.Printf(_L("Test rename into root\n")); - if ((c=gFile.Replace(TheFs,_L("\\TESTPAT1.DAT"),EFileStream|P_FUPDATE))!=KErrNone) + if ((c=gFile.Replace(TheFs,_L("\\TESTPAT1.DAT"),EFileStream|EFileWrite))!=KErrNone) Error(_L("Create testpat1"),c); gDataBuf.Fill('X',512); if ((c=gFile.Write(gDataBuf,512))!=KErrNone) @@ -369,28 +339,28 @@ Error(_L("Delete 80"),c); test.Printf(_L("Test rename with wild cards\n")); - if ((c=TheFs.Rename(_L("*.*"),_L("FRED")))!=NameErr) + if ((c=TheFs.Rename(_L("*.*"),_L("FRED")))!=KErrBadName) Error(_L("Rename 100"),c); - if ((c=TheFs.Rename(_L("?"),_L("FRED")))!=NameErr) + if ((c=TheFs.Rename(_L("?"),_L("FRED")))!=KErrBadName) Error(_L("Rename 101"),c); - if ((c=TheFs.Rename(_L(""),_L("FRED")))!=KErrBadName) // NameErr) + if ((c=TheFs.Rename(_L(""),_L("FRED")))!=KErrBadName) // KErrBadName) Error(_L("Rename 101.11"),c); - if ((c=TheFs.Rename(_L("."),_L("FRED")))!=NameErr) + if ((c=TheFs.Rename(_L("."),_L("FRED")))!=KErrBadName) Error(_L("Rename 101.12"),c); - if ((c=TheFs.Rename(_L("NOEXIST"),_L("*")))!=NameErr) + if ((c=TheFs.Rename(_L("NOEXIST"),_L("*")))!=KErrBadName) Error(_L("Rename 101.1"),c); if ((c=gFile.Create(TheFs,_L("FILE1"),EFileStream))!=KErrNone) Error(_L("Create 101.2"),c); gFile.Close(); - if ((c=TheFs.Rename(_L("FILE1"),_L("AAA?")))!=NameErr) + if ((c=TheFs.Rename(_L("FILE1"),_L("AAA?")))!=KErrBadName) Error(_L("Rename 101.3"),c); - if ((c=TheFs.Rename(_L("FILE1"),_L("")))!=KErrBadName) // NameErr) + if ((c=TheFs.Rename(_L("FILE1"),_L("")))!=KErrBadName) // KErrBadName) Error(_L("Rename 101.41"),c); - if ((c=TheFs.Rename(_L(""),_L("")))!=KErrBadName) // NameErr) + if ((c=TheFs.Rename(_L(""),_L("")))!=KErrBadName) // KErrBadName) Error(_L("Rename 101.42"),c); if ((c=TheFs.Delete(_L("FILE1")))!=KErrNone) Error(_L("Delete 101.5"),c); - if ((c=TheFs.Rename(_L("\\"),_L("FRED")))!=NameErr) + if ((c=TheFs.Rename(_L("\\"),_L("FRED")))!=KErrBadName) Error(_L("Rename 101.6"),c); test.Printf(_L("Test rename of directories\n")); @@ -400,7 +370,7 @@ Error(_L("Rename 103.1"),c); if ((c=TheFs.Rename(_L("\\A2345678.123"),_L("\\DIR2")))!=KErrNone) Error(_L("Rename 103.2"),c); - if ((c=TheFs.Rename(_L("\\DIR2"),_L("\\A234567.1234")))!=KErrNone) // ****** NameErr) Long filenames are supported + if ((c=TheFs.Rename(_L("\\DIR2"),_L("\\A234567.1234")))!=KErrNone) // ****** KErrBadName) Long filenames are supported Error(_L("Rename 103.3"),c); if ((c=TheFs.Rename(_L("\\A234567.1234"),_L("\\DIR2")))!=KErrNone) Error(_L("Rename 103.3"),c); @@ -410,18 +380,18 @@ test.Printf(_L("Test rename of open files\n")); if ((c=gFile.Create(TheFs,_L("\\DIR1\\FILE1"),EFileStreamText))!=KErrNone) Error(_L("Create 105"),c); - if ((c=TheFs.Rename(_L("\\DIR1\\FILE1"),_L("\\DIR1\\FILE1")))!=LockedErr) + if ((c=TheFs.Rename(_L("\\DIR1\\FILE1"),_L("\\DIR1\\FILE1")))!=KErrInUse) Error(_L("Rename 106"),c); - if ((c=TheFs.Rename(_L("\\DIR1\\FILE1"),_L("\\DIR2\\FILE1")))!=LockedErr) + if ((c=TheFs.Rename(_L("\\DIR1\\FILE1"),_L("\\DIR2\\FILE1")))!=KErrInUse) Error(_L("Rename 106.1"),c); - if ((c=gFile2.Open(TheFs,_L("\\DIR2\\FILE1"),EFileStream))!=NotExistsErr) + if ((c=gFile2.Open(TheFs,_L("\\DIR2\\FILE1"),EFileStream))!=KErrNotFound) Error(_L("Create 105"),c); gFile.Close(); test.Printf(_L("Test rename to same name\n")); - if ((c=TheFs.Rename(_L("\\DIR1\\FILE1"),_L("\\DIR1\\FILE1")))!=KErrNone) // !=ExistsErr) + if ((c=TheFs.Rename(_L("\\DIR1\\FILE1"),_L("\\DIR1\\FILE1")))!=KErrNone) // !=KErrAlreadyExists) Error(_L("Rename 105.1"),c); - if ((c=TheFs.Rename(_L("\\DIR1"),_L("\\DIR1")))!=KErrNone) // !=ExistsErr) + if ((c=TheFs.Rename(_L("\\DIR1"),_L("\\DIR1")))!=KErrNone) // !=KErrAlreadyExists) Error(_L("Rename 105.2"),c); test.Printf(_L("Test rename of read-only files\n")); // IS ALLOWED // @@ -430,15 +400,15 @@ if ((c=TheFs.Entry(_L("\\DIR1\\FILE1"),gFileEntry))!=KErrNone) Error(_L("File info 106.1"),c); test.Printf(_L("STATUS=%04x\n"),gFileEntry.iAtt); - if (gFileEntry.iAtt!=(TUint32)(P_FAREAD|P_FASTREAM|P_FAMOD)) + if (gFileEntry.iAtt!=(TUint32)(KEntryAttReadOnly|EFileStream|KEntryAttArchive)) Error(_L("Status check 106.2"),0); if ((c=TheFs.Entry(_L("\\DIR1"),gFileEntry))!=KErrNone) Error(_L("File info 106.3"),c); test.Printf(_L("STATUS=%04x\n"),gFileEntry.iAtt); - if (gFileEntry.iAtt!=(TUint32)(P_FASTREAM|P_FADIR)) + if (gFileEntry.iAtt!=(TUint32)(EFileStream|KEntryAttDir)) Error(_L("Status check 106.4"),0); - if ((c=TheFs.Rename(_L("\\DIR1\\FILE1"),_L("\\DIR1\\FILE1")))!=KErrNone) // !=ExistsErr) + if ((c=TheFs.Rename(_L("\\DIR1\\FILE1"),_L("\\DIR1\\FILE1")))!=KErrNone) // !=KErrAlreadyExists) Error(_L("Rename 107"),c); if ((c=TheFs.Rename(_L("\\DIR1\\FILE1"),_L("\\DIR1\\FILE2")))!=KErrNone) Error(_L("Rename 108"),c); @@ -460,9 +430,9 @@ gFile.Close(); test.Printf(_L("Test rename of directories across directories\n")); - if ((c=TheFs.Rename(_L("\\DIR1"),_L("\\DIR2\\DIR1")))!=KErrNone) // ******** AccessErr) + if ((c=TheFs.Rename(_L("\\DIR1"),_L("\\DIR2\\DIR1")))!=KErrNone) // ******** KErrAccessDenied) Error(_L("Rename 114"),c); - if ((c=TheFs.Rename(_L("\\DIR1"),_L("\\")))!=NameErr) + if ((c=TheFs.Rename(_L("\\DIR1"),_L("\\")))!=KErrBadName) Error(_L("Rename 114.1"),c); if ((c=TheFs.Delete(_L("\\DIR2\\FILE1")))!=KErrNone) @@ -475,7 +445,7 @@ TestINC103141(); // PDEF104017 } -LOCAL_C void testDelete() +static void testDelete() // // Test RFs::Delete function. // @@ -488,11 +458,11 @@ Error(_L("Make dir 500"),c); if ((c=gFile.Create(TheFs,_L("\\TESTDIR\\NAME.EXT"),EFileStream))!=KErrNone) Error(_L("Create"),c); - if ((c=TheFs.Delete(_L("\\TESTDIR\\")))!=KErrBadName) // ******* AccessErr) + if ((c=TheFs.Delete(_L("\\TESTDIR\\")))!=KErrBadName) // ******* KErrAccessDenied) Error(_L("Delete 501"),c); test.Printf(_L("Test delete open file\n")); - if ((c=TheFs.Delete(_L("\\TESTDIR\\NAME.EXT")))!=LockedErr) + if ((c=TheFs.Delete(_L("\\TESTDIR\\NAME.EXT")))!=KErrInUse) Error(_L("Delete 502"),c); gFile.Close(); if ((c=TheFs.Delete(_L("\\TESTDIR\\NAME.EXT")))!=KErrNone) @@ -501,7 +471,7 @@ Error(_L("Delete 504"),c); } -LOCAL_C void testUnique(TUint fileFormat) +static void testUnique(TUint fileFormat) // // Test RFile::Temp // @@ -525,7 +495,7 @@ Error(_L("Delete"),c); } -LOCAL_C void testFileName(const TDesC& aFileName,TInt res) +static void testFileName(const TDesC& aFileName,TInt res) // // // @@ -556,8 +526,7 @@ } } -#if defined(_UNICODE) -LOCAL_C void testFileName(const TDesC8& aFileName,TInt res) +static void testFileName(const TDesC8& aFileName,TInt res) // // Defined to cope with all the instances of testFileName(gDataBuf,...) // @@ -565,9 +534,8 @@ TPtrC gDataBuf16((TText*)aFileName.Ptr(),gDataBuf.Size()/sizeof(TText8)); testFileName(gDataBuf16,res); } -#endif -LOCAL_C void testVolumeName(const TDesC& aVolumeName,TInt aResultExpected) +static void testVolumeName(const TDesC& aVolumeName,TInt aResultExpected) // // // @@ -605,7 +573,7 @@ } #define testMakeDir(aDirName, res) TestMakeDirLine(aDirName, res, __LINE__) -LOCAL_C void TestMakeDirLine(const TDesC& aDirName,TInt res, TInt line) +static void TestMakeDirLine(const TDesC& aDirName,TInt res, TInt line) // // // @@ -633,7 +601,7 @@ if ((c=gDir.Open(TheFs,buf,KEntryAttMaskSupported))!=KErrNone) Error2(_L("Directory open 1"),c, line); gDataBuf[0]=0; - if ((c=gDir.Read(gFileEntry))!=EofErr) + if ((c=gDir.Read(gFileEntry))!=KErrEof) { test.Printf(_L("buf=\"%S\"\n"),&gFileEntry.iName); Error2(_L("Directory read"),c, line); @@ -663,8 +631,8 @@ } } -#if defined(_UNICODE) -LOCAL_C void TestMakeDirLine(const TDesC8& aDirName, TInt res, TInt line) + +static void TestMakeDirLine(const TDesC8& aDirName, TInt res, TInt line) // // Defined to cope with all the instances of testMakeDir(gDataBuf,...) // @@ -674,10 +642,10 @@ // Not sizeof(TText16) since gDataBuf is a TBuf*! TestMakeDirLine(gDataBuf16, res, line); } -#endif + #ifdef TEST_MEDIA -LOCAL_C void testMedia(const TDesC& instructions,TInt anErr) +static void testMedia(const TDesC& instructions,TInt anErr) // // // @@ -713,11 +681,25 @@ } #endif -GLDEF_C void CallTestsL() -// -// Do All tests -// +void CallTestsL() { + + //-- set up console output + F32_Test_Utils::SetConsole(test.Console()); + + TInt nRes=TheFs.CharToDrive(gDriveToTest, gDriveNum); + test(nRes==KErrNone); + + PrintDrvInfo(TheFs, gDriveNum); + + //-- quick format the drive, if it isn't the emulator's C: + if(!Is_Win32(TheFs, gDriveNum)) + { + nRes = FormatDrive(TheFs, gDriveNum, ETrue); + test(nRes==KErrNone); + } + + //----------------------------------- TInt c; TInt i,count; TInt pos; @@ -743,15 +725,15 @@ testDir(_L("Z:\\*.*")); test.Printf(_L("Test names containing '\\'\n")); - if ((c=gFile.Create(TheFs,_L("Q\\ZZZ"),EFileWrite))!=NameErr) + if ((c=gFile.Create(TheFs,_L("Q\\ZZZ"),EFileWrite))!=KErrBadName) Error(_L("Create 1"),c); test.Printf(_L("Test create in non-exist directory\n")); - if ((c=gFile.Create(TheFs,_L("\\Q1DDX\\ZZZ"),EFileWrite))!=DirErr) + if ((c=gFile.Create(TheFs,_L("\\Q1DDX\\ZZZ"),EFileWrite))!=KErrPathNotFound) Error(_L("Create 2"),c); test.Printf(_L("Test filenames starting with '.'\n")); - if ((c=gFile.Create(TheFs,_L("\\.ZZZ"),EFileWrite))!=KErrNone) // ****** NameErr) + if ((c=gFile.Create(TheFs,_L("\\.ZZZ"),EFileWrite))!=KErrNone) // ****** KErrBadName) Error(_L("Create 3"),c); gFile.Close(); if ((c=TheFs.Delete(_L("\\.ZZZ")))!=KErrNone) @@ -819,18 +801,18 @@ testDelete(); testRename(); test.Printf(_L("Test get file info\n")); -// testFileInfo(_L("*.*"),NameErr); ********** Allowed (?) - testFileInfo(_L(""),KErrNone); // NameErr); - testFileInfo(_L("\\"),NameErr); - testFileInfo(_L("."),NameErr); - testFileInfo(_L(".."),NameErr); - testFileInfo(_L("a.1234"),KErrNotFound); // ********* NameErr); - testFileInfo(_L("a23456789"),KErrNotFound); // ********* NameErr); - testFileInfo(_L(".a"),KErrNotFound); // ********** NameErr); - testFileInfo(_L("?"),NameErr); - testFileInfo(_L("NOEXIST"),NotExistsErr); - testFileInfo(_L("\\NODIR\\NAME"),DirErr); - testFileInfo(_L("L:\\NAME"),DeviceErr); +// testFileInfo(_L("*.*"),KErrBadName); ********** Allowed (?) + testFileInfo(_L(""),KErrNone); // KErrBadName); + testFileInfo(_L("\\"),KErrBadName); + testFileInfo(_L("."),KErrBadName); + testFileInfo(_L(".."),KErrBadName); + testFileInfo(_L("a.1234"),KErrNotFound); // ********* KErrBadName); + testFileInfo(_L("a23456789"),KErrNotFound); // ********* KErrBadName); + testFileInfo(_L(".a"),KErrNotFound); // ********** KErrBadName); + testFileInfo(_L("?"),KErrBadName); + testFileInfo(_L("NOEXIST"),KErrNotFound); + testFileInfo(_L("\\NODIR\\NAME"),KErrPathNotFound); + testFileInfo(_L("L:\\NAME"),KErrNotReady); gNameBuf.SetLength(0); if ((c=gFile.Temp(TheFs,gNameBuf,gNameOut,EFileStream))!=KErrNone) Error(_L("Open 1.1"),c); @@ -842,7 +824,7 @@ test.Printf(_L("Test get device info\n")); testDeviceInfo(_L(""),FALSE); // NULL is current device // - testDeviceInfo(_L("L:"),DeviceErr); + testDeviceInfo(_L("L:"),KErrNotReady); testDeviceInfo(_L("Z:"),FALSE); testDeviceInfo(fBuf,FALSE); @@ -865,88 +847,88 @@ // testNodeInfo(_L("...::"),0,E_GEN_FSYS); // testFileInfo(_L("Z:SYS$WSRV.IMG"),FALSE); -// testFileInfo(_L("Z:\\SYS$WSRV.IMG"),NameErr); // \ not allowed - no path // +// testFileInfo(_L("Z:\\SYS$WSRV.IMG"),KErrBadName); // \ not allowed - no path // // testFileInfo(_L("Z:*"),FALSE); // Z: allows *'s ! // -// testFileInfo(_L("Z:SYS$WSRV."),NotExistsErr); +// testFileInfo(_L("Z:SYS$WSRV."),KErrNotFound); // testFileInfo(_L("XXX::"),NoFileSystemErr); if(PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin)) testFileInfo(_L("Z:\\Sys\\Bin\\ESHELL.EXE"),FALSE); // we now have paths // else testFileInfo(_L("Z:\\System\\Bin\\ESHELL.EXE"),FALSE); // we now have paths // // testFileInfo(_L("Z:*"),KErrPathNotFound); // session path gets inserted ,FALSE); -// testFileInfo(_L("Z:SYS$WSRV."),NotExistsErr); +// testFileInfo(_L("Z:SYS$WSRV."),KErrNotFound); // testFileInfo(_L("H:"),KErrBadName); // ************** NoFileSystemErr); test.Printf(_L("Test weird filenames\n")); // Test SPACES // - testFileName(_L("A B"),KErrNone); // ******* NameErr); - testFileName(_L(" AB"),KErrNone); // ******* NameErr); - testFileName(_L(" AB "),KErrNone); // ******* NameErr); + testFileName(_L("A B"),KErrNone); // ******* KErrBadName); + testFileName(_L(" AB"),KErrNone); // ******* KErrBadName); + testFileName(_L(" AB "),KErrNone); // ******* KErrBadName); testFileName(_L(" AB"),KErrNone); testFileName(_L(" AB . cdef"),KErrNone); testFileName(_L(" AB . cdef "),KErrNone); - testFileName(_L("A2345678 "),KErrNone); // ******* NameErr); - testFileName(_L("A2345678.XY "),KErrNone); // ******* NameErr); - testFileName(_L("A2345678.XYZ "),KErrNone); // ******* NameErr); - testFileName(_L("A2345678 XYZ"),KErrNone); // ******* NameErr); - testFileName(_L(" "),NameErr); - testFileName(_L("\\A B\\NAME"),KErrPathNotFound); // ******* NameErr); - testFileName(_L("\\ \\NAME"),NameErr); - testFileName(_L("\\asdf\\qer\\ \\asdf\\NAME"),NameErr); - testFileName(_L(" "),NameErr); - testFileName(_L("C:\\asdf\\ "),NameErr); + testFileName(_L("A2345678 "),KErrNone); // ******* KErrBadName); + testFileName(_L("A2345678.XY "),KErrNone); // ******* KErrBadName); + testFileName(_L("A2345678.XYZ "),KErrNone); // ******* KErrBadName); + testFileName(_L("A2345678 XYZ"),KErrNone); // ******* KErrBadName); + testFileName(_L(" "),KErrBadName); + testFileName(_L("\\A B\\NAME"),KErrPathNotFound); // ******* KErrBadName); + testFileName(_L("\\ \\NAME"),KErrBadName); + testFileName(_L("\\asdf\\qer\\ \\asdf\\NAME"),KErrBadName); + testFileName(_L(" "),KErrBadName); + testFileName(_L("C:\\asdf\\ "),KErrBadName); // Test short names // - testFileName(_L(""),NameErr); - testFileName(_L("\\"),NameErr); + testFileName(_L(""),KErrBadName); + testFileName(_L("\\"),KErrBadName); testFileName(_L("1"),FALSE); - testFileName(_L(".1"),KErrNone); // ******* NameErr); - testFileName(_L(".1"),KErrNone); // ******* NameErr); - testFileName(_L("\\.1"),KErrNone); // ******* NameErr); + testFileName(_L(".1"),KErrNone); // ******* KErrBadName); + testFileName(_L(".1"),KErrNone); // ******* KErrBadName); + testFileName(_L("\\.1"),KErrNone); // ******* KErrBadName); testFileName(_L("1.1"),FALSE); // Test long names // testFileName(_L("12345678.123"),FALSE); - testFileName(_L("123456789.123"),KErrNone); // ******* NameErr); - testFileName(_L("12345678.1234"),KErrNone); // ******* NameErr); - testFileName(_L("1.1234"),KErrNone); // ******* NameErr); - testFileName(_L("123456789"),KErrNone); // ******* NameErr); + testFileName(_L("123456789.123"),KErrNone); // ******* KErrBadName); + testFileName(_L("12345678.1234"),KErrNone); // ******* KErrBadName); + testFileName(_L("1.1234"),KErrNone); // ******* KErrBadName); + testFileName(_L("123456789"),KErrNone); // ******* KErrBadName); gDataBuf.SetLength(256); gDataBuf.Fill('A',255); - testFileName(gDataBuf,NameErr); + testFileName(gDataBuf,KErrBadName); gDataBuf.SetLength(257); gDataBuf.Fill('B',256); - testFileName(gDataBuf,NameErr); + testFileName(gDataBuf,KErrBadName); gDataBuf.SetLength(258); gDataBuf.Fill('C',257); - testFileName(gDataBuf,NameErr); + testFileName(gDataBuf,KErrBadName); gDataBuf.SetLength(4096); gDataBuf.Fill('D',4095); - testFileName(gDataBuf,NameErr); + testFileName(gDataBuf,KErrBadName); // Test DOTS // testFileName(_L("A.X"),FALSE); - testFileName(_L("A..X"),KErrNone); // ******* NameErr); - testFileName(_L("A.........X"),KErrNone); // ******* NameErr); + testFileName(_L("A..X"),KErrNone); // ******* KErrBadName); + testFileName(_L("A.........X"),KErrNone); // ******* KErrBadName); testFileName(_L("A."),FALSE); - testFileName(_L(".X"),KErrNone); // ******* NameErr); - testFileName(_L("."),NameErr); - testFileName(_L(".."),NameErr); -// testFileName(_L("..."),KErrNone); // NameErr); // !!! ********* NT error KErrAccessDenied (?) - testFileName(_L("\\a.x\\NAME"),DirErr); // DirErr == KErrPathNotFound - testFileName(_L("\\a..x\\NAME"),DirErr); // ******** NameErr); - testFileName(_L("\\.\\NAME"),NameErr); - testFileName(_L("\\..\\NAME"),NameErr); -// testFileName(_L("\\...\\NAME"),KErrPathNotFound); // ******** NameErr); // !! NT treats ... as .. ?? + testFileName(_L(".X"),KErrNone); // ******* KErrBadName); + testFileName(_L("."),KErrBadName); + testFileName(_L(".."),KErrBadName); +// testFileName(_L("..."),KErrNone); // KErrBadName); // !!! ********* NT error KErrAccessDenied (?) + testFileName(_L("\\a.x\\NAME"),KErrPathNotFound); // KErrPathNotFound == KErrPathNotFound + testFileName(_L("\\a..x\\NAME"),KErrPathNotFound); // ******** KErrBadName); + testFileName(_L("\\.\\NAME"),KErrBadName); + testFileName(_L("\\..\\NAME"),KErrBadName); +// testFileName(_L("\\...\\NAME"),KErrPathNotFound); // ******** KErrBadName); // !! NT treats ... as .. ?? // Test WILD CARDS // - testFileName(_L("*.*"),NameErr); - testFileName(_L("*"),NameErr); - testFileName(_L("\\*"),NameErr); - testFileName(_L("?"),NameErr); - testFileName(_L("\\?"),NameErr); - testFileName(_L("\\A?B\\NAME"),NameErr); - testFileName(_L("\\A*B\\NAME"),NameErr); - testFileName(_L("\\*\\NAME"),NameErr); - testFileName(_L("\\********.***\\NAME"),NameErr); - testFileName(_L("A?X"),NameErr); + testFileName(_L("*.*"),KErrBadName); + testFileName(_L("*"),KErrBadName); + testFileName(_L("\\*"),KErrBadName); + testFileName(_L("?"),KErrBadName); + testFileName(_L("\\?"),KErrBadName); + testFileName(_L("\\A?B\\NAME"),KErrBadName); + testFileName(_L("\\A*B\\NAME"),KErrBadName); + testFileName(_L("\\*\\NAME"),KErrBadName); + testFileName(_L("\\********.***\\NAME"),KErrBadName); + testFileName(_L("A?X"),KErrBadName); test.Printf(_L("Test set volume name\n")); // New behaviour: SetVolumeName accepts any string < 12 chars @@ -1011,64 +993,64 @@ // Test path testMakeDir(_L("\\A2345678.A23\\NAME"),FALSE); - testMakeDir(_L("\\A23456789.A23\\NAME"),KErrNone); // ******** NameErr); - testMakeDir(_L("\\A2345678.A234\\NAME"),KErrNone); // ******** NameErr); - testMakeDir(_L("\\A.1234\\NAME"),KErrNone); // ********* NameErr); + testMakeDir(_L("\\A23456789.A23\\NAME"),KErrNone); // ******** KErrBadName); + testMakeDir(_L("\\A2345678.A234\\NAME"),KErrNone); // ******** KErrBadName); + testMakeDir(_L("\\A.1234\\NAME"),KErrNone); // ********* KErrBadName); testMakeDir(_L("\\A2345678\\NAME"),FALSE); - testMakeDir(_L("\\A23456789\\NAME"),KErrNone); // ******** NameErr); + testMakeDir(_L("\\A23456789\\NAME"),KErrNone); // ******** KErrBadName); testMakeDir(_L("\\A.X\\NAME"),FALSE); - testMakeDir(_L("\\A..X\\NAME"),KErrNone); // ******** NameErr); - testMakeDir(_L("\\A.\\NAME"),NameErr); - testMakeDir(_L("\\.X\\NAME"),KErrNone); // ******** NameErr); - testMakeDir(_L("\\.\\NAME"),NameErr); - testMakeDir(_L("\\..\\NAME"),NameErr); - testMakeDir(_L("\\\\NAME"),NameErr); - testMakeDir(_L("\\\\"),NameErr); - testMakeDir(_L("\\A\\A2\\A23\\a2345678\\a2345678.\\a2345678.1\\a2345678.123"),NameErr); - testMakeDir(_L("\\A\\A2\\A23\\a2345678\\a2345678.\\a2345678.1\\a2345678..123"),NameErr); // ******* NameErr); - testMakeDir(_L("\\A\\A2\\A23\\a2345678\\a2345678.\\a2345678.1\\a2345678.1234"),NameErr); // ******* NameErr); + testMakeDir(_L("\\A..X\\NAME"),KErrNone); // ******** KErrBadName); + testMakeDir(_L("\\A.\\NAME"),KErrBadName); + testMakeDir(_L("\\.X\\NAME"),KErrNone); // ******** KErrBadName); + testMakeDir(_L("\\.\\NAME"),KErrBadName); + testMakeDir(_L("\\..\\NAME"),KErrBadName); + testMakeDir(_L("\\\\NAME"),KErrBadName); + testMakeDir(_L("\\\\"),KErrBadName); + testMakeDir(_L("\\A\\A2\\A23\\a2345678\\a2345678.\\a2345678.1\\a2345678.123"),KErrBadName); + testMakeDir(_L("\\A\\A2\\A23\\a2345678\\a2345678.\\a2345678.1\\a2345678..123"),KErrBadName); // ******* KErrBadName); + testMakeDir(_L("\\A\\A2\\A23\\a2345678\\a2345678.\\a2345678.1\\a2345678.1234"),KErrBadName); // ******* KErrBadName); gDataBuf.SetLength(256); gDataBuf.Fill('V',255); - testMakeDir(gDataBuf,NameErr); + testMakeDir(gDataBuf,KErrBadName); gDataBuf.SetLength(257); gDataBuf.Fill('W',256); - testMakeDir(gDataBuf,NameErr); + testMakeDir(gDataBuf,KErrBadName); gDataBuf.SetLength(258); gDataBuf.Fill('X',257); - testMakeDir(gDataBuf,NameErr); + testMakeDir(gDataBuf,KErrBadName); gDataBuf.SetLength(259); gDataBuf.Fill('Y',258); - testMakeDir(gDataBuf,NameErr); + testMakeDir(gDataBuf,KErrBadName); gDataBuf.SetLength(4096); gDataBuf.Fill('Z',4095); - testMakeDir(gDataBuf,NameErr); + testMakeDir(gDataBuf,KErrBadName); // Test names - testMakeDir(_L("A..X"),KErrAlreadyExists); // ******* NameErr); + testMakeDir(_L("A..X"),KErrAlreadyExists); // ******* KErrBadName); testMakeDir(_L("\\A\\"),FALSE); testMakeDir(_L("\\12345678.123\\"),FALSE); - testMakeDir(_L("\\.\\"),NameErr); - testMakeDir(_L("\\..\\"),NameErr); + testMakeDir(_L("\\.\\"),KErrBadName); + testMakeDir(_L("\\..\\"),KErrBadName); testMakeDir(_L("\\X\\"),FALSE); - testMakeDir(_L("\\12345678.1234\\"),KErrNone); // ******* NameErr); - testMakeDir(_L("\\123456789\\"),KErrNone); // ******** NameErr); + testMakeDir(_L("\\12345678.1234\\"),KErrNone); // ******* KErrBadName); + testMakeDir(_L("\\123456789\\"),KErrNone); // ******** KErrBadName); // Test max levels testMakeDir(_L("\\A\\B\\C\\D\\E\\F\\G\\H\\I\\J\\K\\L\\M\\N\\O\\P\\Q\\R\\S\\T\\U\\V\\W\\X\\Y\\Z"),FALSE); testMakeDir(_L("\\00000000.000\\11111111.111\\22222222.222\\33333333.333\\45678901.3"),FALSE); testMakeDir(_L("\\00000000.000\\11111111.111\\22222222.222\\33333333.333\\45678901.34"),FALSE); testMakeDir(_L("\\00000000.000\\11111111.111\\22222222.222\\33333333.333\\45678901.345"),FALSE); testMakeDir(_L("\\00000000.000\\11111111.111\\22222222.222\\33333333.333\\45678901.3\\xxxxxxxx.xxx"),FALSE); - testMakeDir(_L("\\00000000.000\\11111111.111\\22222222.222\\33333333.333\\45678901.34\\xxxxxxxx.xxx"),KErrNone); // ******* NameErr); - testMakeDir(_L("\\00000000.000\\11111111.111\\22222222.222\\33333333.333\\45678901.345\\xxxxxxxx.xxx"),KErrNone); // ******* NameErr); + testMakeDir(_L("\\00000000.000\\11111111.111\\22222222.222\\33333333.333\\45678901.34\\xxxxxxxx.xxx"),KErrNone); // ******* KErrBadName); + testMakeDir(_L("\\00000000.000\\11111111.111\\22222222.222\\33333333.333\\45678901.345\\xxxxxxxx.xxx"),KErrNone); // ******* KErrBadName); testMakeDir(_L("\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\23"),FALSE); testMakeDir(_L("\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\23456789.123"),FALSE); testMakeDir(_L("\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\23\\5"),FALSE); testMakeDir(_L("\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\23\\56789012.456"),FALSE); - testMakeDir(_L("\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\234\\6"),KErrNone); // ******** NameErr); - testMakeDir(_L("Z:\\ROMDIR\\"),KErrAccessDenied); // *********** NotSupportedErr); + testMakeDir(_L("\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\2\\4\\6\\8\\0\\234\\6"),KErrNone); // ******** KErrBadName); + testMakeDir(_L("Z:\\ROMDIR\\"),KErrAccessDenied); // test.Printf(_L("Test setEof to same length\n")); gNameBuf.SetLength(0); - if ((c=gFile.Temp(TheFs,gNameBuf,gNameOut,EFileStream|P_FUPDATE))!=KErrNone) + if ((c=gFile.Temp(TheFs,gNameBuf,gNameOut,EFileStream|EFileWrite))!=KErrNone) Error(_L("Open 50"),c); gFile.Close(); testSetEof(gNameOut,0L,FALSE); // should be no change // @@ -1092,29 +1074,29 @@ test.Printf(_L("Test read of zero bytes\n")); gNameBuf.SetLength(0); - if ((c=gFile.Temp(TheFs,gNameBuf,gNameOut,EFileStream|P_FUPDATE))!=KErrNone) + if ((c=gFile.Temp(TheFs,gNameBuf,gNameOut,EFileStream|EFileWrite))!=KErrNone) Error(_L("Open 60"),c); - if ((c=gFile.Read(gDataBuf,0))!=KErrNone) // ******** EofErr) + if ((c=gFile.Read(gDataBuf,0))!=KErrNone) // ******** KErrEof) Error(_L("Read 61"),c); - if ((c=gFile.Read(gDataBuf,0))!=KErrNone) // ******** EofErr) + if ((c=gFile.Read(gDataBuf,0))!=KErrNone) // ******** KErrEof) Error(_L("Read 62"),c); if ((c=gFile.Write(gDataBuf,0))!=KErrNone) Error(_L("Write 63"),c); - if ((c=gFile.Read(gDataBuf,0))!=KErrNone) // ******** EofErr) + if ((c=gFile.Read(gDataBuf,0))!=KErrNone) // ******** KErrEof) Error(_L("Read 64"),c); gFile.Close(); - if ((c=gFile.Open(TheFs,gNameOut,EFileStream|P_FUPDATE|P_FRANDOM))!=KErrNone) + if ((c=gFile.Open(TheFs,gNameOut,EFileStream|EFileWrite))!=KErrNone) Error(_L("Open 70"),c); - if ((c=gFile.Read(gDataBuf,0))!=KErrNone) // ******** EofErr) + if ((c=gFile.Read(gDataBuf,0))!=KErrNone) // ******** KErrEof) Error(_L("Read 71"),c); gDataBuf.SetLength(1); gDataBuf[0]=0xf0; if ((c=gFile.Write(gDataBuf,1))!=KErrNone) Error(_L("Write 72"),c); - if ((c=gFile.Read(gDataBuf,0))!=KErrNone) // ********* EofErr) + if ((c=gFile.Read(gDataBuf,0))!=KErrNone) // ********* KErrEof) Error(_L("Read 73"),c); pos=0L; - if ((c=gFile.Seek((TSeek)P_FABS,pos))!=KErrNone) + if ((c=gFile.Seek((TSeek)ESeekStart,pos))!=KErrNone) Error(_L("Seek 74"),c); gDataBuf.SetLength(1); gDataBuf[0]=0x83; @@ -1129,9 +1111,9 @@ Error(_L("Read 77"),c); if (gDataBuf[0]!=0xf0) Error(_L("buffer 1 check"),0); - if ((c=gFile.Read(gDataBuf,0))!=KErrNone) // ******** EofErr) + if ((c=gFile.Read(gDataBuf,0))!=KErrNone) // ******** KErrEof) Error(_L("Read 78"),c); - if ((c=gFile.Read(gDataBuf,16384))!=KErrNone) // ******* EofErr) + if ((c=gFile.Read(gDataBuf,16384))!=KErrNone) // ******* KErrEof) Error(_L("Read 79"),c); gFile.Close(); if ((c=TheFs.Delete(gNameOut))!=KErrNone) @@ -1139,7 +1121,7 @@ test.Printf(_L("Test write of zero bytes\n")); gNameBuf.SetLength(0); - if ((c=gFile.Temp(TheFs,gNameBuf,gNameOut,EFileStream|P_FUPDATE))!=KErrNone) + if ((c=gFile.Temp(TheFs,gNameBuf,gNameOut,EFileStream|EFileWrite))!=KErrNone) Error(_L("Open 50"),c); gFile.Close(); // ********** Error(_L("Close"),c); close has no return value @@ -1159,45 +1141,45 @@ test.Printf(_L("Test ReadOnly files\n")); gNameBuf.SetLength(0); - if ((c=gFile.Create(TheFs,_L("TEST1.TMP"),EFileStream|P_FUPDATE))!=KErrNone) + if ((c=gFile.Create(TheFs,_L("TEST1.TMP"),EFileStream|EFileWrite))!=KErrNone) Error(_L("Create 40"),c); gFile.Close(); - if ((c=gFile.Temp(TheFs,gNameBuf,gNameOut,EFileStream|P_FUPDATE))!=KErrNone) + if ((c=gFile.Temp(TheFs,gNameBuf,gNameOut,EFileStream|EFileWrite))!=KErrNone) Error(_L("Open 40"),c); mask=0; attrib=KEntryAttReadOnly; // Remove writable // - if ((c=TheFs.SetAtt(gNameOut,attrib,mask))!=LockedErr) + if ((c=TheFs.SetAtt(gNameOut,attrib,mask))!=KErrInUse) Error(_L("TheFs.SetAtt not locked"),c); gFile.Close(); if ((c=TheFs.SetAtt(gNameOut,attrib,mask))!=KErrNone) Error(_L("Att 41"),c); - if ((c=gFile.Open(TheFs,gNameOut,EFileStream|P_FUPDATE))!=AccessErr) + if ((c=gFile.Open(TheFs,gNameOut,EFileStream|EFileWrite))!=KErrAccessDenied) Error(_L("Open 41"),c); if ((c=gFile.Open(TheFs,gNameOut,EFileStream))!=KErrNone) Error(_L("Open 42"),c); - if ((c=gFileErr.Open(TheFs,gNameOut,EFileStream))!=LockedErr) + if ((c=gFileErr.Open(TheFs,gNameOut,EFileStream))!=KErrInUse) Error(_L("Open 43"),c); - if ((c=TheFs.Rename(_L("TEST1.TMP"),gNameOut))!=ExistsErr) + if ((c=TheFs.Rename(_L("TEST1.TMP"),gNameOut))!=KErrAlreadyExists) Error(_L("Rename 43.1"),c); - if ((c=gFileErr.Create(TheFs,gNameOut,EFileStream))!=ExistsErr) // LockedErr) + if ((c=gFileErr.Create(TheFs,gNameOut,EFileStream))!=KErrAlreadyExists) // KErrInUse) Error(_L("Open 44"),c); - if ((c=gFileErr.Replace(TheFs,gNameOut,EFileStream))!=LockedErr) + if ((c=gFileErr.Replace(TheFs,gNameOut,EFileStream))!=KErrInUse) Error(_L("Open 45"),c); gFile.Close(); - if ((c=gFile.Create(TheFs,gNameOut,EFileStream))!=ExistsErr) + if ((c=gFile.Create(TheFs,gNameOut,EFileStream))!=KErrAlreadyExists) Error(_L("Create 46"),c); - if ((c=gFile.Replace(TheFs,gNameOut,EFileStream))!=AccessErr) + if ((c=gFile.Replace(TheFs,gNameOut,EFileStream))!=KErrAccessDenied) Error(_L("Replace 47"),c); if ((c=gFile.Create(TheFs,_L("FILE1.TMP"),EFileStream))!=KErrNone) Error(_L("Create 48"),c); - if ((c=TheFs.Rename(_L("FILE1.TMP"),_L("FILE2.TMP")))!=LockedErr) + if ((c=TheFs.Rename(_L("FILE1.TMP"),_L("FILE2.TMP")))!=KErrInUse) Error(_L("Rename 49"),c); gFile.Close(); if ((c=TheFs.Rename(_L("FILE1.TMP"),_L("FILE2.TMP")))!=KErrNone) Error(_L("Rename 50"),c); - if ((c=TheFs.Rename(_L("FILE2.TMP"),gNameOut))!=ExistsErr) + if ((c=TheFs.Rename(_L("FILE2.TMP"),gNameOut))!=KErrAlreadyExists) Error(_L("Rename 51"),c); - if ((c=TheFs.Delete(gNameOut))!=AccessErr) + if ((c=TheFs.Delete(gNameOut))!=KErrAccessDenied) Error(_L("Delete"),c); mask=KEntryAttReadOnly; attrib=0; @@ -1217,13 +1199,13 @@ if ((c=gFile.Open(TheFs,_L("B_GEN.001"),EFileStream))!=KErrNone) Error(_L("Open 30"),c); pos=1L; - if ((c=gFile.SetSize(pos))!=ReadOnlyErr) + if ((c=gFile.SetSize(pos))!=KErrAccessDenied) Error(_L("Set EOF 30"),c); if ((c=TheFs.Entry(_L("B_GEN.001"),gFileEntry))!=KErrNone) Error(_L("File info 30"),c); if (gFileEntry.iSize!=0L) Error(_L("Size check 30"),0); - if ((c=gFile.Write(gDataBuf,1))!=ReadOnlyErr) + if ((c=gFile.Write(gDataBuf,1))!=KErrAccessDenied) Error(_L("Write 30"),c); if ((c=TheFs.Entry(_L("B_GEN.001"),gFileEntry))!=KErrNone) Error(_L("File info 31"),c); @@ -1240,28 +1222,55 @@ test.Printf(_L("Test dir entries are written out\n")); gNameBuf.SetLength(0); - if ((c=gFile.Temp(TheFs,gNameBuf,gNameOut,EFileStream|P_FRANDOM))!=KErrNone) + + if ((c=gFile.Temp(TheFs,gNameBuf,gNameOut,EFileStream))!=KErrNone) Error(_L("Open 20"),c); + if ((c=TheFs.Entry(gNameOut,gFileEntry))!=KErrNone) Error(_L("File info 0"),c); - if ((gFileEntry.iAtt & P_FAMOD)==0) + + if ((gFileEntry.iAtt & KEntryAttArchive)==0) Error(_L("Status 20"),0); + test.Printf(_L("Size=%u\n"),gFileEntry.iSize); + if (gFileEntry.iSize!=0L) Error(_L("Size check 0"),0); + saveTime=gFileEntry.iModified; test.Printf(_L("Wait 3 seconds...\n")); User::After(3000000L); gDataBuf.SetLength(1); + if ((c=gFile.Write(gDataBuf,1))!=KErrNone) Error(_L("Write 1"),c); + + /* === pay attention to the code below if the "not updating file timestamp on Flush" mode is enabled (at least on FAT) + //-- the timestamp in the "real" entry on the media (RFs::Entry()) and what we get by RFile::Modified() + //-- can differ even after flushing file. The timestamp will be updated only on _closing_ the file. + //-- This behaviour can be an optimisation to reduce number of media writes due to updating file timestamps. + gFile.Close(); + nRes = gFile.Open(TheFs, gNameOut, EFileWrite); + test(nRes == KErrNone); + //-- restore the expected position in the file + TInt pos1 = 0; + nRes = gFile.Seek(ESeekEnd, pos1); + test(nRes == KErrNone); + //------------------------------------ + */ + + if ((c=TheFs.Entry(gNameOut,gFileEntry))!=KErrNone) Error(_L("File info 1"),c); + test.Printf(_L("Size=%u\n"),gFileEntry.iSize); if (gFileEntry.iSize!=1L) Error(_L("Size check 1"),0); + if (gFileEntry.iModified==saveTime) Error(_L("Time update"),0); + + gDataBuf.SetLength(16384); if ((c=gFile.Write(gDataBuf,16384))!=KErrNone) Error(_L("Write 2"),c); @@ -1271,7 +1280,7 @@ if (gFileEntry.iSize!=16385L) Error(_L("Size check 2"),0); pos=0L; - if ((c=gFile.Seek((TSeek)P_FABS,pos))!=KErrNone) + if ((c=gFile.Seek((TSeek)ESeekStart,pos))!=KErrNone) Error(_L("Seek 0"),c); if ((c=gFile.Write(gDataBuf,1))!=KErrNone) Error(_L("Write 3"),c); @@ -1281,7 +1290,7 @@ if (gFileEntry.iSize!=16385L) Error(_L("Size check 3"),0); pos=0L; - if ((c=gFile.Seek((TSeek)P_FABS,pos))!=KErrNone) + if ((c=gFile.Seek((TSeek)ESeekStart,pos))!=KErrNone) Error(_L("Seek 1"),c); if ((c=gFile.Write(gDataBuf,16384))!=KErrNone) Error(_L("Write 4"),c); @@ -1323,46 +1332,46 @@ Error(_L("File info 8"),c); if (gFileEntry.iSize!=0L) Error(_L("Size check 7"),0); - mask=P_FAMOD; + mask=KEntryAttArchive; attrib=0; if ((c=TheFs.SetAtt(gNameOut,attrib,mask))!=KErrNone) Error(_L("Att 20"),c); // - if ((c=gFile.Open(TheFs,gNameOut,EFileStream|P_FUPDATE|P_FRANDOM))!=KErrNone) + if ((c=gFile.Open(TheFs,gNameOut,EFileStream|EFileWrite))!=KErrNone) Error(_L("Open 21"),c); if ((c=TheFs.Entry(gNameOut,gFileEntry))!=KErrNone) Error(_L("File info 9"),c); - if (gFileEntry.iAtt & P_FAMOD) + if (gFileEntry.iAtt & KEntryAttArchive) Error(_L("Status 21"),0); if ((c=gFile.Write(gDataBuf,0))!=KErrNone) Error(_L("Write 21"),c); if ((c=TheFs.Entry(gNameOut,gFileEntry))!=KErrNone) Error(_L("File info 9"),c); - if ((gFileEntry.iAtt & P_FAMOD)) // write 0 should not modify // + if ((gFileEntry.iAtt & KEntryAttArchive)) // write 0 should not modify // Error(_L("Status 22"),0); gFile.Close(); - mask=P_FAMOD; + mask=KEntryAttArchive; attrib=0; if ((c=TheFs.SetAtt(gNameOut,attrib,mask))!=KErrNone) Error(_L("Att 20"),c); - if ((c=gFile.Open(TheFs,gNameOut,EFileStream|P_FUPDATE|P_FRANDOM))!=KErrNone) + if ((c=gFile.Open(TheFs,gNameOut,EFileStream|EFileWrite))!=KErrNone) Error(_L("Open 22"),c); if ((c=TheFs.Entry(gNameOut,gFileEntry))!=KErrNone) Error(_L("File info 9"),c); - if (gFileEntry.iAtt & P_FAMOD) + if (gFileEntry.iAtt & KEntryAttArchive) Error(_L("Status 23"),0); pos=0L; if ((c=gFile.SetSize(pos))!=KErrNone) // no change // Error(_L("Set EOF 21"),c); if ((c=TheFs.Entry(gNameOut,gFileEntry))!=KErrNone) Error(_L("File info 9"),c); - if ((gFileEntry.iAtt & P_FAMOD)) + if ((gFileEntry.iAtt & KEntryAttArchive)) Error(_L("Status 24"),0); gFile.Close(); if ((c=TheFs.Entry(gNameOut,gFileEntry))!=KErrNone) Error(_L("File info 0"),c); - if ((c=gFile.Open(TheFs,gNameOut,EFileStream|P_FUPDATE|P_FRANDOM))!=KErrNone) + if ((c=gFile.Open(TheFs,gNameOut,EFileStream|EFileWrite))!=KErrNone) Error(_L("Open 23"),c); saveTime=gFileEntry.iModified; test.Printf(_L("Wait 3 seconds...\n")); @@ -1376,7 +1385,7 @@ Error(_L("File info 61"),c); if (gFileEntry.iModified!=saveTime) Error(_L("Close new time"),0); - if ((c=gFile.Open(TheFs,gNameOut,EFileStream|P_FUPDATE|P_FRANDOM))!=KErrNone) + if ((c=gFile.Open(TheFs,gNameOut,EFileStream|EFileWrite))!=KErrNone) Error(_L("Open 24"),c); if ((c=gFile.Write(gDataBuf,1))!=KErrNone) Error(_L("Write 60"),c); @@ -1405,7 +1414,7 @@ if ((c=gFile.Open(TheFs,gNameOut,EFileStream))!=KErrNone) Error(_L("Open 10"),c); // Temp file is created as writable. TTime fileTime(0); - if ((c=gFile.SetModified(fileTime))!=AccessErr) // LockedErr) + if ((c=gFile.SetModified(fileTime))!=KErrAccessDenied) // KErrInUse) Error(_L("Set file date 10"),c); gFile.Close(); @@ -1441,48 +1450,26 @@ gNameOut.SetLength(0); if ((c=gFile.Temp(TheFs,gNameBuf,gNameOut,EFileStream))!=KErrNone) Error(_L("Open 1"),c); - if ((c=gFormat.Open(TheFs,fBuf,EFullFormat,count))!=LockedErr) + if ((c=gFormat.Open(TheFs,fBuf,EFullFormat,count))!=KErrInUse) Error(_L("Format lock check 1"),c); - if ((c=gFormat.Open(TheFs,fBuf,EQuickFormat,count))!=LockedErr) + if ((c=gFormat.Open(TheFs,fBuf,EQuickFormat,count))!=KErrInUse) Error(_L("Format lock check 2"),c); gFile.Close(); if ((c=gFormat.Open(TheFs,fBuf,EFullFormat,count))!=KErrNone) { - if (c==LockedErr || c==AccessErr) + if (c==KErrInUse || c==KErrAccessDenied) { test.Printf(_L("Format: locked, no test\n")); - goto noFormat; } + else + { Error(_L("Format lock check"),c); } + } -// if ((c=p_read(chan2,&count,2))<0) -// { -// if (c==NotSupportedErr) -// { -// test.Printf(_L("Format: not supported, no test\n")); -// goto noFormatClose; -// } -// Error(_L("Read format count"),c); -// } -// for (i=1;;i++) -// { -// if ((c=g(chan2,&val,2))<0) -// { -// if (c==EofErr) -// break; -// Error(_L("Format"),c); -// } -// test.Printf(_L("\r%05u %05u\n"),i,val); -// } -// if ((i-1)!=count) -// Error(_L("Format count"),i); -// noFormatClose: -// if ((c=p_close(chan2))!=KErrNone) -// Error(_L("Close"),c); -noFormat: gFormat.Close(); + DeleteTestDirectory(); }