equal
deleted
inserted
replaced
11 // Contributors: |
11 // Contributors: |
12 // |
12 // |
13 // Description: |
13 // Description: |
14 // |
14 // |
15 |
15 |
|
16 #define __E32TEST_EXTENSION__ |
16 #include <f32file.h> |
17 #include <f32file.h> |
17 #include <e32test.h> |
18 #include <e32test.h> |
18 #include <e32math.h> |
19 #include <e32math.h> |
19 #include <e32hal.h> |
20 #include <e32hal.h> |
20 #include "t_server.h" |
21 #include "t_server.h" |
134 gDir.Close(); |
135 gDir.Close(); |
135 |
136 |
136 TChar drive(aDirName[0]); |
137 TChar drive(aDirName[0]); |
137 TInt driveNo; |
138 TInt driveNo; |
138 c=RFs::CharToDrive(drive,driveNo); |
139 c=RFs::CharToDrive(drive,driveNo); |
139 test(c==KErrNone); |
140 test_KErrNone(c); |
140 if ((c=TheFs.Volume(volInfo,driveNo))!=KErrNone) |
141 if ((c=TheFs.Volume(volInfo,driveNo))!=KErrNone) |
141 Error(_L("Device info 1000"),c); |
142 Error(_L("Device info 1000"),c); |
142 } |
143 } |
143 |
144 |
144 |
145 |
173 test.Printf(_L("Device info: %S\n"),&aDeviceName); |
174 test.Printf(_L("Device info: %S\n"),&aDeviceName); |
174 TInt drive=KDefaultDrive; |
175 TInt drive=KDefaultDrive; |
175 if (aDeviceName.Length()) |
176 if (aDeviceName.Length()) |
176 { |
177 { |
177 c=RFs::CharToDrive(aDeviceName[0],drive); |
178 c=RFs::CharToDrive(aDeviceName[0],drive); |
178 test(c==KErrNone); |
179 test_KErrNone(c); |
179 } |
180 } |
180 if ((c=TheFs.Volume(volInfo,drive))!=anErr) |
181 if ((c=TheFs.Volume(volInfo,drive))!=anErr) |
181 Error(_L("Device info"),c); |
182 Error(_L("Device info"),c); |
182 if (anErr==0) |
183 if (anErr==0) |
183 { |
184 { |
281 TBuf<32> dirname; |
282 TBuf<32> dirname; |
282 dirname.Copy(KDir1); |
283 dirname.Copy(KDir1); |
283 dirname.Append(KPathDelimiter); |
284 dirname.Append(KPathDelimiter); |
284 MakeDir(dirname); |
285 MakeDir(dirname); |
285 TInt err = TheFs.Rename(KDir1, KDir2); |
286 TInt err = TheFs.Rename(KDir1, KDir2); |
286 test(err == KErrNone); |
287 test_KErrNone(err); |
287 err = TheFs.RmDir(dirname); |
288 err = TheFs.RmDir(dirname); |
288 test(err == KErrNone); |
289 test_KErrNone(err); |
289 err = TheFs.RmDir(KDir1); |
290 err = TheFs.RmDir(KDir1); |
290 test(err == KErrNone); |
291 test_KErrNone(err); |
291 } |
292 } |
292 |
293 |
293 static void testRename() |
294 static void testRename() |
294 // |
295 // |
295 // Test TheFs.Rename function. |
296 // Test TheFs.Rename function. |
590 Error2(_L("Make directory 1"),c, line); |
591 Error2(_L("Make directory 1"),c, line); |
591 if (res==FALSE) |
592 if (res==FALSE) |
592 { |
593 { |
593 TParse parse; |
594 TParse parse; |
594 c=TheFs.Parse(aDirName,parse); |
595 c=TheFs.Parse(aDirName,parse); |
595 test(c==KErrNone); |
596 test_KErrNone(c); |
596 buf=parse.Path(); |
597 buf=parse.Path(); |
597 buf.Append(_L("*")); |
598 buf.Append(_L("*")); |
598 if (buf.Length()<=64) |
599 if (buf.Length()<=64) |
599 { |
600 { |
600 test.Printf(_L("Open dir...\n")); |
601 test.Printf(_L("Open dir...\n")); |
686 |
687 |
687 //-- set up console output |
688 //-- set up console output |
688 F32_Test_Utils::SetConsole(test.Console()); |
689 F32_Test_Utils::SetConsole(test.Console()); |
689 |
690 |
690 TInt nRes=TheFs.CharToDrive(gDriveToTest, gDriveNum); |
691 TInt nRes=TheFs.CharToDrive(gDriveToTest, gDriveNum); |
691 test(nRes==KErrNone); |
692 test_KErrNone(nRes); |
692 |
693 |
693 PrintDrvInfo(TheFs, gDriveNum); |
694 PrintDrvInfo(TheFs, gDriveNum); |
694 |
695 |
695 //-- quick format the drive, if it isn't the emulator's C: |
696 //-- quick format the drive, if it isn't the emulator's C: |
696 if(!Is_Win32(TheFs, gDriveNum)) |
697 if(!Is_Win32(TheFs, gDriveNum)) |
697 { |
698 { |
698 nRes = FormatDrive(TheFs, gDriveNum, ETrue); |
699 nRes = FormatDrive(TheFs, gDriveNum, ETrue); |
699 test(nRes==KErrNone); |
700 test_KErrNone(nRes); |
700 } |
701 } |
701 |
702 |
702 //----------------------------------- |
703 //----------------------------------- |
703 TInt c; |
704 TInt c; |
704 TInt i,count; |
705 TInt i,count; |
1249 //-- the timestamp in the "real" entry on the media (RFs::Entry()) and what we get by RFile::Modified() |
1250 //-- the timestamp in the "real" entry on the media (RFs::Entry()) and what we get by RFile::Modified() |
1250 //-- can differ even after flushing file. The timestamp will be updated only on _closing_ the file. |
1251 //-- can differ even after flushing file. The timestamp will be updated only on _closing_ the file. |
1251 //-- This behaviour can be an optimisation to reduce number of media writes due to updating file timestamps. |
1252 //-- This behaviour can be an optimisation to reduce number of media writes due to updating file timestamps. |
1252 gFile.Close(); |
1253 gFile.Close(); |
1253 nRes = gFile.Open(TheFs, gNameOut, EFileWrite); |
1254 nRes = gFile.Open(TheFs, gNameOut, EFileWrite); |
1254 test(nRes == KErrNone); |
1255 test_KErrNone(nRes); |
1255 //-- restore the expected position in the file |
1256 //-- restore the expected position in the file |
1256 TInt pos1 = 0; |
1257 TInt pos1 = 0; |
1257 nRes = gFile.Seek(ESeekEnd, pos1); |
1258 nRes = gFile.Seek(ESeekEnd, pos1); |
1258 test(nRes == KErrNone); |
1259 test_KErrNone(nRes); |
1259 //------------------------------------ |
1260 //------------------------------------ |
1260 */ |
1261 */ |
1261 |
1262 |
1262 |
1263 |
1263 if ((c=TheFs.Entry(gNameOut,gFileEntry))!=KErrNone) |
1264 if ((c=TheFs.Entry(gNameOut,gFileEntry))!=KErrNone) |