changeset 149 | d9f1e5bfe28c |
parent 0 | a41df078684a |
child 200 | 73ea206103e6 |
child 206 | ced41fd9a298 |
135:5e441a173c63 | 149:d9f1e5bfe28c |
---|---|
23 // // .. etc |
23 // // .. etc |
24 // |
24 // |
25 // |
25 // |
26 |
26 |
27 |
27 |
28 #define __E32TEST_EXTENSION__ |
|
28 #include <f32file.h> |
29 #include <f32file.h> |
29 #include <e32test.h> |
30 #include <e32test.h> |
30 #include <e32svr.h> |
31 #include <e32svr.h> |
31 #include "t_server.h" |
32 #include "t_server.h" |
32 #include "t_file64bit.h" |
33 #include "t_file64bit.h" |
55 TInt r; |
56 TInt r; |
56 const TUint KBufSize = 256*K1KiloByte; |
57 const TUint KBufSize = 256*K1KiloByte; |
57 RBuf8 buf; |
58 RBuf8 buf; |
58 |
59 |
59 r = buf.CreateMax(KBufSize); |
60 r = buf.CreateMax(KBufSize); |
60 test(r == KErrNone); |
61 test_KErrNone(r); |
61 |
62 |
62 RFile64 file; |
63 RFile64 file; |
63 TFileName fileName; |
64 TFileName fileName; |
64 fileName.Append(gDriveToTest); |
65 fileName.Append(gDriveToTest); |
65 fileName.Append(KTestPath); |
66 fileName.Append(KTestPath); |
66 fileName.Append(_L("File4GBMinusOne.txt")); |
67 fileName.Append(_L("File4GBMinusOne.txt")); |
67 r = file.Replace(TheFs,fileName, EFileWrite); |
68 r = file.Replace(TheFs,fileName, EFileWrite); |
68 test(r == KErrNone); |
69 test_KErrNone(r); |
69 |
70 |
70 r = file.SetSize(K4GBMinusOne); |
71 r = file.SetSize(K4GBMinusOne); |
71 test(r == KErrNone); |
72 test_KErrNone(r); |
72 |
73 |
73 TInt64 nNumberOfBytesToWrite = 0; |
74 TInt64 nNumberOfBytesToWrite = 0; |
74 TInt64 nNumberOfBytesWritten = 0; |
75 TInt64 nNumberOfBytesWritten = 0; |
75 for (TInt64 pos = 0; pos < K4GBMinusOne; pos += nNumberOfBytesWritten) |
76 for (TInt64 pos = 0; pos < K4GBMinusOne; pos += nNumberOfBytesWritten) |
76 { |
77 { |
87 |
88 |
88 nNumberOfBytesWritten = nNumberOfBytesToWrite; |
89 nNumberOfBytesWritten = nNumberOfBytesToWrite; |
89 } |
90 } |
90 |
91 |
91 r = file.Flush(); |
92 r = file.Flush(); |
92 test(r == KErrNone); |
93 test_KErrNone(r); |
93 test.Printf(_L("\nFile writing is completed!!")); |
94 test.Printf(_L("\nFile writing is completed!!")); |
94 |
95 |
95 |
96 |
96 file.Close(); |
97 file.Close(); |
97 |
98 |
175 // Replaces a single file with another |
176 // Replaces a single file with another |
176 // |
177 // |
177 { |
178 { |
178 test.Printf(_L("%S File Replaced with %S\n"),&anOldName,&aNewName);\ |
179 test.Printf(_L("%S File Replaced with %S\n"),&anOldName,&aNewName);\ |
179 TInt r = TheFs.Replace(anOldName,aNewName); |
180 TInt r = TheFs.Replace(anOldName,aNewName); |
180 test(r == KErrNone); |
181 test_KErrNone(r); |
181 return(*this); |
182 return(*this); |
182 } |
183 } |
183 |
184 |
184 RFsTest& RFsTest::ReadFileSection(const TDesC& aName, TInt64 aPos,TDes8& aBuffer,TInt aLen) |
185 RFsTest& RFsTest::ReadFileSection(const TDesC& aName, TInt64 aPos,TDes8& aBuffer,TInt aLen) |
185 // |
186 // |
188 { |
189 { |
189 test.Printf(_L("Read File Section %S\n"),&aName); |
190 test.Printf(_L("Read File Section %S\n"),&aName); |
190 TInt r = TheFs.ReadFileSection(aName,aPos,aBuffer,aLen); |
191 TInt r = TheFs.ReadFileSection(aName,aPos,aBuffer,aLen); |
191 TInt len = aBuffer.Length(); |
192 TInt len = aBuffer.Length(); |
192 |
193 |
193 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
194 test_KErrNone(r); |
194 { |
195 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse && aPos >= K4GB) |
195 if(aPos < K4GB) |
196 test(len == 0); |
196 test(r == KErrNone); |
|
197 else |
|
198 { |
|
199 test(r == KErrNone); |
|
200 test(len == 0); |
|
201 } |
|
202 } |
|
203 else |
|
204 { |
|
205 test (r == KErrNone); |
|
206 } |
|
207 return(*this); |
197 return(*this); |
208 } |
198 } |
209 |
199 |
210 |
200 |
211 RFsTest& RFsTest::GetDir(const TDesC &aName, TUint anEntryAttMask, TUint anEntrySortKey, CDir *&anEntryList) |
201 RFsTest& RFsTest::GetDir(const TDesC &aName, TUint anEntryAttMask, TUint anEntrySortKey, CDir *&anEntryList) |
213 // Gets a filtered list of a directory's contents. |
203 // Gets a filtered list of a directory's contents. |
214 // |
204 // |
215 { |
205 { |
216 test.Printf(_L("Name of the directory for which listing is required %S\n"),&aName); |
206 test.Printf(_L("Name of the directory for which listing is required %S\n"),&aName); |
217 TInt r = TheFs.GetDir(aName,anEntryAttMask,anEntrySortKey,anEntryList); |
207 TInt r = TheFs.GetDir(aName,anEntryAttMask,anEntrySortKey,anEntryList); |
218 test(r == KErrNone); |
208 test_KErrNone(r); |
219 return(*this); |
209 return(*this); |
220 } |
210 } |
221 |
211 |
222 RFsTest& RFsTest::GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,CDir*& aDirList) |
212 RFsTest& RFsTest::GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,CDir*& aDirList) |
223 // |
213 // |
224 // Gets a filtered list of the directory and the file entries contained in a directory and a |
214 // Gets a filtered list of the directory and the file entries contained in a directory and a |
225 // list of the directory entries only. |
215 // list of the directory entries only. |
226 { |
216 { |
227 test.Printf(_L("Name of the directory for which directory and file listing is required %S\n"),&aName); |
217 test.Printf(_L("Name of the directory for which directory and file listing is required %S\n"),&aName); |
228 TInt r = TheFs.GetDir(aName,anEntryAttMask,anEntrySortKey,anEntryList,aDirList); |
218 TInt r = TheFs.GetDir(aName,anEntryAttMask,anEntrySortKey,anEntryList,aDirList); |
229 test(r == KErrNone); |
219 test_KErrNone(r); |
230 return(*this); |
220 return(*this); |
231 } |
221 } |
232 |
222 |
233 RFsTest& RFsTest::GetDir(const TDesC& aName,const TUidType& anEntryUid,TUint anEntrySortKey,CDir*& aFileList) |
223 RFsTest& RFsTest::GetDir(const TDesC& aName,const TUidType& anEntryUid,TUint anEntrySortKey,CDir*& aFileList) |
234 // |
224 // |
235 // Gets a filtered list of directory contents by UID type. |
225 // Gets a filtered list of directory contents by UID type. |
236 // |
226 // |
237 { |
227 { |
238 test.Printf(_L("Name of the directory for which listing is required %S\n"),&aName); |
228 test.Printf(_L("Name of the directory for which listing is required %S\n"),&aName); |
239 TInt r = TheFs.GetDir(aName,anEntryUid,anEntrySortKey,aFileList); |
229 TInt r = TheFs.GetDir(aName,anEntryUid,anEntrySortKey,aFileList); |
240 test(r == KErrNone); |
230 test_KErrNone(r); |
241 return(*this); |
231 return(*this); |
242 } |
232 } |
243 |
233 |
244 |
234 |
245 RFileTest::RFileTest(const TDesC& aName) |
235 RFileTest::RFileTest(const TDesC& aName) |
254 // Creates and opens a new file for writing, if the file already exists an error is returned |
244 // Creates and opens a new file for writing, if the file already exists an error is returned |
255 // |
245 // |
256 { |
246 { |
257 test.Printf(_L("%S create %S in %d Mode\n"),&iName,&aName,aFileMode); |
247 test.Printf(_L("%S create %S in %d Mode\n"),&iName,&aName,aFileMode); |
258 TInt r = RFile64::Create(TheFs,aName,aFileMode); |
248 TInt r = RFile64::Create(TheFs,aName,aFileMode); |
259 test(r == KErrNone || r == KErrAlreadyExists); |
249 test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
260 return(*this); |
250 return(*this); |
261 } |
251 } |
262 |
252 |
263 RFileTest& RFileTest::Replace(const TDesC& aName) |
253 RFileTest& RFileTest::Replace(const TDesC& aName) |
264 // |
254 // |
266 // if it exists or cretaing a new file if it does not exist. |
256 // if it exists or cretaing a new file if it does not exist. |
267 // |
257 // |
268 { |
258 { |
269 test.Printf(_L("%S replace %S\n"),&iName,&aName); |
259 test.Printf(_L("%S replace %S\n"),&iName,&aName); |
270 TInt r = RFile64::Replace(TheFs,aName,EFileStream|EFileWrite); |
260 TInt r = RFile64::Replace(TheFs,aName,EFileStream|EFileWrite); |
271 test(r == KErrNone); |
261 test_KErrNone(r); |
272 return(*this); |
262 return(*this); |
273 } |
263 } |
274 |
264 |
275 RFileTest& RFileTest::Replace(const TDesC& aName, TUint aFileMode) |
265 RFileTest& RFileTest::Replace(const TDesC& aName, TUint aFileMode) |
276 // |
266 // |
278 // if it exists or cretaing a new file if it does not exist. |
268 // if it exists or cretaing a new file if it does not exist. |
279 // |
269 // |
280 { |
270 { |
281 test.Printf(_L("%S replace %S in %d Mode\n"),&iName,&aName, aFileMode); |
271 test.Printf(_L("%S replace %S in %d Mode\n"),&iName,&aName, aFileMode); |
282 TInt r = RFile64::Replace(TheFs,aName,aFileMode); |
272 TInt r = RFile64::Replace(TheFs,aName,aFileMode); |
283 if (r == KErrNone) |
273 test_Value(r, r == KErrNone || r == KErrBadName); |
284 test(r == KErrNone); |
|
285 else |
|
286 test(r == KErrBadName); |
|
287 return(*this); |
274 return(*this); |
288 } |
275 } |
289 |
276 |
290 RFileTest& RFileTest::Open(const TDesC& aName) |
277 RFileTest& RFileTest::Open(const TDesC& aName) |
291 // |
278 // |
292 // Open a existing file for reading and writing in shared access mode. |
279 // Open a existing file for reading and writing in shared access mode. |
293 // |
280 // |
294 { |
281 { |
295 test.Printf(_L("%S open %S\n"),&iName,&aName); |
282 test.Printf(_L("%S open %S\n"),&iName,&aName); |
296 TInt r = RFile64::Open(TheFs,aName,EFileWrite|EFileShareAny); |
283 TInt r = RFile64::Open(TheFs,aName,EFileWrite|EFileShareAny); |
297 test(r == KErrNone); |
284 test_KErrNone(r); |
298 return(*this); |
285 return(*this); |
299 } |
286 } |
300 |
287 |
301 RFileTest& RFileTest::Open(const TDesC& aName, TUint aFileMode) |
288 RFileTest& RFileTest::Open(const TDesC& aName, TUint aFileMode) |
302 // |
289 // |
303 // Opens an existing file using aFileMode. |
290 // Opens an existing file using aFileMode. |
304 // |
291 // |
305 { |
292 { |
306 test.Printf(_L("%S open %S in %d Mode\n"),&iName,&aName, aFileMode); |
293 test.Printf(_L("%S open %S in %d Mode\n"),&iName,&aName, aFileMode); |
307 TInt r = RFile64::Open(TheFs,aName,aFileMode); |
294 TInt r = RFile64::Open(TheFs,aName,aFileMode); |
308 test(r == KErrNone); |
295 test_KErrNone(r); |
309 return(*this); |
296 return(*this); |
310 } |
297 } |
311 |
298 |
312 RFileTest& RFileTest::Temp(const TDesC& aPath,TFileName& aName,TUint aFileMode) |
299 RFileTest& RFileTest::Temp(const TDesC& aPath,TFileName& aName,TUint aFileMode) |
313 // |
300 // |
314 // Creates and opens a temporary file with a unique name for writing and reading. |
301 // Creates and opens a temporary file with a unique name for writing and reading. |
315 // |
302 // |
316 { |
303 { |
317 test.Printf(_L("%S Temp file %S in %d Mode\n"),&iName,&aName, aFileMode); |
304 test.Printf(_L("%S Temp file %S in %d Mode\n"),&iName,&aName, aFileMode); |
318 TInt r = RFile64::Temp(TheFs,aPath,aName,aFileMode); |
305 TInt r = RFile64::Temp(TheFs,aPath,aName,aFileMode); |
319 test(r == KErrNone); |
306 test_KErrNone(r); |
320 return(*this); |
307 return(*this); |
321 } |
308 } |
322 |
309 |
323 void RFileTest::Close() |
310 void RFileTest::Close() |
324 // |
311 // |
333 // Set a lock on the file. Expected not to fail. |
320 // Set a lock on the file. Expected not to fail. |
334 // |
321 // |
335 { |
322 { |
336 test.Printf(_L("%S lock 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1); |
323 test.Printf(_L("%S lock 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1); |
337 TInt r = RFile64::Lock(aPos,aLen); |
324 TInt r = RFile64::Lock(aPos,aLen); |
338 test(r == KErrNone); |
325 test_KErrNone(r); |
339 return(*this); |
326 return(*this); |
340 } |
327 } |
341 |
328 |
342 RFileTest& RFileTest::LockE(TInt64 aPos, TInt64 aLen) |
329 RFileTest& RFileTest::LockE(TInt64 aPos, TInt64 aLen) |
343 // |
330 // |
344 // Set a lock on the file. Expected to fail. |
331 // Set a lock on the file. Expected to fail. |
345 // |
332 // |
346 { |
333 { |
347 test.Printf(_L("%S lockE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1); |
334 test.Printf(_L("%S lockE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1); |
348 TInt r = RFile64::Lock(aPos,aLen); |
335 TInt r = RFile64::Lock(aPos,aLen); |
349 test(r == KErrLocked); |
336 test_Value(r, r == KErrLocked); |
350 return(*this); |
337 return(*this); |
351 } |
338 } |
352 |
339 |
353 RFileTest& RFileTest::UnLock(TInt64 aPos, TInt64 aLen) |
340 RFileTest& RFileTest::UnLock(TInt64 aPos, TInt64 aLen) |
354 // |
341 // |
355 // Unlock the file. Expected not to fail. |
342 // Unlock the file. Expected not to fail. |
356 // |
343 // |
357 { |
344 { |
358 test.Printf(_L("%S ulock 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1); |
345 test.Printf(_L("%S ulock 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1); |
359 TInt r = RFile64::UnLock(aPos,aLen); |
346 TInt r = RFile64::UnLock(aPos,aLen); |
360 test(r == KErrNone); |
347 test_KErrNone(r); |
361 return(*this); |
348 return(*this); |
362 } |
349 } |
363 |
350 |
364 RFileTest& RFileTest::UnLockE(TInt64 aPos, TInt64 aLen) |
351 RFileTest& RFileTest::UnLockE(TInt64 aPos, TInt64 aLen) |
365 // |
352 // |
366 // Unlock the file. Expected to fail. |
353 // Unlock the file. Expected to fail. |
367 // |
354 // |
368 { |
355 { |
369 test.Printf(_L("%S ulockE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1); |
356 test.Printf(_L("%S ulockE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1); |
370 TInt r = RFile64::UnLock(aPos,aLen); |
357 TInt r = RFile64::UnLock(aPos,aLen); |
371 test(r == KErrNotFound); |
358 test_Value(r, r == KErrNotFound); |
372 return(*this); |
359 return(*this); |
373 } |
360 } |
374 |
361 |
375 RFileTest& RFileTest::Write(const TDesC8& aDes) |
362 RFileTest& RFileTest::Write(const TDesC8& aDes) |
376 // |
363 // |
389 |
376 |
390 |
377 |
391 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
378 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
392 { |
379 { |
393 if((seekPos + aDes.Length()) < K4GB) |
380 if((seekPos + aDes.Length()) < K4GB) |
394 test(r == KErrNone); |
381 { |
382 test_KErrNone(r); |
|
383 } |
|
395 else |
384 else |
396 test(r == KErrNotSupported); |
385 { |
386 test_Value(r, r == KErrNotSupported); |
|
387 } |
|
397 } |
388 } |
398 else |
389 else |
399 { |
390 { |
400 test (r == KErrNone); |
391 test_KErrNone(r); |
401 } |
392 } |
402 return(*this); |
393 return(*this); |
403 } |
394 } |
404 |
395 |
405 RFileTest& RFileTest::Write(const TDesC8 &aDes, TRequestStatus &aStatus) |
396 RFileTest& RFileTest::Write(const TDesC8 &aDes, TRequestStatus &aStatus) |
421 User::WaitForRequest(aStatus); |
412 User::WaitForRequest(aStatus); |
422 } |
413 } |
423 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
414 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
424 { |
415 { |
425 if((seekPos + aDes.Length()) < K4GB) |
416 if((seekPos + aDes.Length()) < K4GB) |
417 { |
|
426 test(aStatus.Int() == KErrNone); |
418 test(aStatus.Int() == KErrNone); |
419 } |
|
427 else |
420 else |
421 { |
|
428 test(aStatus.Int() == KErrNotSupported); |
422 test(aStatus.Int() == KErrNotSupported); |
429 |
423 } |
430 } |
424 } |
431 else |
425 else |
432 { |
426 { |
433 test(aStatus.Int() == KErrNone); |
427 test(aStatus.Int() == KErrNone); |
434 } |
428 } |
450 if( KErrNone == r) // this is to ensure that the written data is committed and not cached. |
444 if( KErrNone == r) // this is to ensure that the written data is committed and not cached. |
451 r = RFile64::Flush(); |
445 r = RFile64::Flush(); |
452 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
446 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
453 { |
447 { |
454 if((seekPos + aLength) < K4GB) |
448 if((seekPos + aLength) < K4GB) |
455 test(r == KErrNone); |
449 { |
450 test_KErrNone(r); |
|
451 } |
|
456 else |
452 else |
457 test(r == KErrNotSupported); |
453 { |
454 test_Value(r, r == KErrNotSupported); |
|
455 } |
|
458 } |
456 } |
459 else |
457 else |
460 { |
458 { |
461 test(r == KErrNone); |
459 test_KErrNone(r); |
462 } |
460 } |
463 return(*this); |
461 return(*this); |
464 } |
462 } |
465 |
463 |
466 RFileTest& RFileTest::Write(const TDesC8& aDes, TInt aLength, TRequestStatus &aStatus) |
464 RFileTest& RFileTest::Write(const TDesC8& aDes, TInt aLength, TRequestStatus &aStatus) |
506 if( KErrNone == r) // this is to ensure that the written data is committed and not cached. |
504 if( KErrNone == r) // this is to ensure that the written data is committed and not cached. |
507 r = RFile64::Flush(); |
505 r = RFile64::Flush(); |
508 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
506 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
509 { |
507 { |
510 if ((aPos + aDes.Length()) < K4GB) |
508 if ((aPos + aDes.Length()) < K4GB) |
511 test(r == KErrNone); |
509 { |
510 test_KErrNone(r); |
|
511 } |
|
512 else |
512 else |
513 test(r == KErrNotSupported); |
513 { |
514 test_Value(r, r == KErrNotSupported); |
|
515 } |
|
514 } |
516 } |
515 else |
517 else |
516 { |
518 { |
517 test(r == KErrNone); |
519 test_KErrNone(r); |
518 } |
520 } |
519 return(*this); |
521 return(*this); |
520 } |
522 } |
521 |
523 |
522 RFileTest& RFileTest::WriteU(TUint aPos, const TDesC8& aDes) |
524 RFileTest& RFileTest::WriteU(TUint aPos, const TDesC8& aDes) |
527 { |
529 { |
528 test.Printf(_L("%S write %08x\n"),&iName,aPos); |
530 test.Printf(_L("%S write %08x\n"),&iName,aPos); |
529 TInt r = RFile64::Write(aPos,aDes); |
531 TInt r = RFile64::Write(aPos,aDes); |
530 if( KErrNone == r) // this is to ensure that the written data is committed and not cached. |
532 if( KErrNone == r) // this is to ensure that the written data is committed and not cached. |
531 r = RFile64::Flush(); |
533 r = RFile64::Flush(); |
532 test(r == KErrNone); |
534 test_KErrNone(r); |
533 return(*this); |
535 return(*this); |
534 } |
536 } |
535 |
537 |
536 |
538 |
537 RFileTest& RFileTest::Write(TInt64 aPos, const TDesC8& aDes, TInt aLen) |
539 RFileTest& RFileTest::Write(TInt64 aPos, const TDesC8& aDes, TInt aLen) |
546 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
548 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
547 { |
549 { |
548 if ((aPos + aLen) < K4GB) |
550 if ((aPos + aLen) < K4GB) |
549 { |
551 { |
550 if (aLen < 0) |
552 if (aLen < 0) |
551 test(r == KErrArgument); |
553 { |
554 test_Value(r, r == KErrArgument); |
|
555 } |
|
552 else |
556 else |
553 test(r == KErrNone); |
557 { |
558 test_KErrNone(r); |
|
559 } |
|
554 } |
560 } |
555 else |
561 else |
556 test(r == KErrNotSupported); |
562 { |
563 test_Value(r, r == KErrNotSupported); |
|
564 } |
|
557 } |
565 } |
558 else |
566 else |
559 { |
567 { |
560 if (aLen < 0) |
568 if (aLen < 0) |
561 test(r == KErrArgument); |
569 { |
570 test_Value(r, r == KErrArgument); |
|
571 } |
|
562 else |
572 else |
563 test(r == KErrNone); |
573 { |
574 test_KErrNone(r); |
|
575 } |
|
564 } |
576 } |
565 return(*this); |
577 return(*this); |
566 } |
578 } |
567 |
579 |
568 RFileTest& RFileTest::WriteU(TUint aPos, const TDesC8& aDes, TInt aLen) |
580 RFileTest& RFileTest::WriteU(TUint aPos, const TDesC8& aDes, TInt aLen) |
573 { |
585 { |
574 test.Printf(_L("%S write %08x-%08x\n"),&iName,aPos,aPos+aLen-1); |
586 test.Printf(_L("%S write %08x-%08x\n"),&iName,aPos,aPos+aLen-1); |
575 TInt r = RFile64::Write(aPos,aDes,aLen); |
587 TInt r = RFile64::Write(aPos,aDes,aLen); |
576 if( KErrNone == r) // this is to ensure that the written data is committed and not cached. |
588 if( KErrNone == r) // this is to ensure that the written data is committed and not cached. |
577 r = RFile64::Flush(); |
589 r = RFile64::Flush(); |
578 test(r == KErrNone); |
590 test_KErrNone(r); |
579 return(*this); |
591 return(*this); |
580 } |
592 } |
581 |
593 |
582 |
594 |
583 RFileTest& RFileTest::WriteE(TInt64 aPos, const TDesC8& aDes, TInt aLen) |
595 RFileTest& RFileTest::WriteE(TInt64 aPos, const TDesC8& aDes, TInt aLen) |
585 // Write to the file. Expected to fail. |
597 // Write to the file. Expected to fail. |
586 // |
598 // |
587 { |
599 { |
588 test.Printf(_L("%S writeE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1); |
600 test.Printf(_L("%S writeE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1); |
589 TInt r = RFile64::Write(aPos,aDes,aLen); |
601 TInt r = RFile64::Write(aPos,aDes,aLen); |
590 if (aLen < 0) |
602 test_Value(r, r == (aLen < 0) ? KErrArgument : KErrLocked); |
591 test(r == KErrArgument); |
|
592 else |
|
593 test(r == KErrLocked); |
|
594 return(*this); |
603 return(*this); |
595 } |
604 } |
596 |
605 |
597 RFileTest& RFileTest::Write(TInt64 aPos, const TDesC8& aDes, TInt aLen, TRequestStatus &aStatus) |
606 RFileTest& RFileTest::Write(TInt64 aPos, const TDesC8& aDes, TInt aLen, TRequestStatus &aStatus) |
598 // |
607 // |
699 // Read from the file. Expected not to fail (Synchronous). |
708 // Read from the file. Expected not to fail (Synchronous). |
700 // |
709 // |
701 { |
710 { |
702 test.Printf(_L("%S read \n"),&iName); |
711 test.Printf(_L("%S read \n"),&iName); |
703 TInt r = RFile64::Read(aDes); |
712 TInt r = RFile64::Read(aDes); |
704 test(r == KErrNone); |
713 test_KErrNone(r); |
705 return(*this); |
714 return(*this); |
706 } |
715 } |
707 |
716 |
708 RFileTest& RFileTest::Read(TDes8& aDes, TRequestStatus& aStatus) |
717 RFileTest& RFileTest::Read(TDes8& aDes, TRequestStatus& aStatus) |
709 // |
718 // |
768 // Read from the file. Expected not to fail (Synchronous). |
777 // Read from the file. Expected not to fail (Synchronous). |
769 // |
778 // |
770 { |
779 { |
771 test.Printf(_L("%S read 0x%08x bytes\n"),&iName,aLen); |
780 test.Printf(_L("%S read 0x%08x bytes\n"),&iName,aLen); |
772 TInt r = RFile64::Read(aDes,aLen); |
781 TInt r = RFile64::Read(aDes,aLen); |
773 if(aLen < 0) |
782 test_Value(r, r == (aLen < 0) ? KErrArgument : KErrNone); |
774 test(r == KErrArgument); |
|
775 else |
|
776 test(r == KErrNone); |
|
777 return(*this); |
783 return(*this); |
778 } |
784 } |
779 |
785 |
780 RFileTest& RFileTest::Read(TInt64 aPos, TDes8& aDes, TInt aLen) |
786 RFileTest& RFileTest::Read(TInt64 aPos, TDes8& aDes, TInt aLen) |
781 // |
787 // |
783 // |
789 // |
784 { |
790 { |
785 test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1); |
791 test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1); |
786 TInt r = RFile64::Read(aPos,aDes,aLen); |
792 TInt r = RFile64::Read(aPos,aDes,aLen); |
787 TInt len = aDes.Length(); |
793 TInt len = aDes.Length(); |
788 if(aLen < 0) |
794 test_Value(r, r == (aLen < 0) ? KErrArgument : KErrNone); |
789 test(r == KErrArgument); |
|
790 else |
|
791 test(r == KErrNone); |
|
792 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
795 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
793 { |
796 { |
794 if(aPos >= K4GB) |
797 if(aPos >= K4GB) |
795 test(len == 0); |
798 test(len == 0); |
796 } |
799 } |
802 // Reads the specified number of bytes from the file at a specified offset. Expected to fail. |
805 // Reads the specified number of bytes from the file at a specified offset. Expected to fail. |
803 // |
806 // |
804 { |
807 { |
805 test.Printf(_L("%S readE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1); |
808 test.Printf(_L("%S readE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1); |
806 TInt r = RFile64::Read(aPos,aDes,aLen); |
809 TInt r = RFile64::Read(aPos,aDes,aLen); |
807 test(r == KErrLocked); |
810 test_Value(r, r == KErrLocked); |
808 return(*this); |
811 return(*this); |
809 } |
812 } |
810 |
813 |
811 RFileTest& RFileTest::Read(TInt64 aPos, TDes8& aDes, TInt aLen, TRequestStatus& aStatus) |
814 RFileTest& RFileTest::Read(TInt64 aPos, TDes8& aDes, TInt aLen, TRequestStatus& aStatus) |
812 // |
815 // |
834 // Reads from the file at the specfied offset with in the file (Synchronous). |
837 // Reads from the file at the specfied offset with in the file (Synchronous). |
835 // |
838 // |
836 { |
839 { |
837 test.Printf(_L("%S read 0x%lx\n"),&iName,aPos); |
840 test.Printf(_L("%S read 0x%lx\n"),&iName,aPos); |
838 TInt r = RFile64::Read(aPos,aDes); |
841 TInt r = RFile64::Read(aPos,aDes); |
839 test(r == KErrNone); |
842 test_KErrNone(r); |
840 return(*this); |
843 return(*this); |
841 } |
844 } |
842 |
845 |
843 RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes) |
846 RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes) |
844 // |
847 // |
846 // Offset is specified as a TUint value. |
849 // Offset is specified as a TUint value. |
847 // |
850 // |
848 { |
851 { |
849 test.Printf(_L("%S read 0x%lx\n"),&iName,aPos); |
852 test.Printf(_L("%S read 0x%lx\n"),&iName,aPos); |
850 TInt r = RFile64::Read(aPos,aDes); |
853 TInt r = RFile64::Read(aPos,aDes); |
851 test(r == KErrNone); |
854 test_KErrNone(r); |
852 return(*this); |
855 return(*this); |
853 } |
856 } |
854 |
857 |
855 RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes,TRequestStatus& aStatus) |
858 RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes,TRequestStatus& aStatus) |
856 // |
859 // |
871 // Offset is specified as a TUint value. |
874 // Offset is specified as a TUint value. |
872 // |
875 // |
873 { |
876 { |
874 test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1); |
877 test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1); |
875 TInt r = RFile64::Read(aPos,aDes,aLen); |
878 TInt r = RFile64::Read(aPos,aDes,aLen); |
876 if(aLen < 0) |
879 test_Value(r, r == (aLen < 0) ? KErrArgument : KErrNone); |
877 test(r == KErrArgument); |
|
878 else |
|
879 test(r == KErrNone); |
|
880 return(*this); |
880 return(*this); |
881 } |
881 } |
882 |
882 |
883 RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes, TInt aLen, TRequestStatus& aStatus) |
883 RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes, TInt aLen, TRequestStatus& aStatus) |
884 // |
884 // |
917 test.Printf(_L("%S size: 0x%lx\n"),&iName,aSize); |
917 test.Printf(_L("%S size: 0x%lx\n"),&iName,aSize); |
918 TInt r = RFile64::SetSize(aSize); |
918 TInt r = RFile64::SetSize(aSize); |
919 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
919 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
920 { |
920 { |
921 if(aSize < K4GB) |
921 if(aSize < K4GB) |
922 test(r == KErrNone); |
922 { |
923 test_KErrNone(r); |
|
924 } |
|
923 else |
925 else |
924 test(r == KErrNotSupported); |
926 { |
927 test_Value(r, r == KErrNotSupported); |
|
928 } |
|
925 } |
929 } |
926 else |
930 else |
927 { |
931 { |
928 test(r == KErrNone); |
932 test_KErrNone(r); |
929 } |
933 } |
930 return(*this); |
934 return(*this); |
931 } |
935 } |
932 |
936 |
933 RFileTest& RFileTest::SetSizeE(TInt64 aSize) |
937 RFileTest& RFileTest::SetSizeE(TInt64 aSize) |
935 // Set the size of the file. Expected to fail. |
939 // Set the size of the file. Expected to fail. |
936 // |
940 // |
937 { |
941 { |
938 test.Printf(_L("%S sizeE: 0x%lx\n"),&iName,aSize); |
942 test.Printf(_L("%S sizeE: 0x%lx\n"),&iName,aSize); |
939 TInt r = RFile64::SetSize(aSize); |
943 TInt r = RFile64::SetSize(aSize); |
940 test(r == KErrLocked); |
944 test_Value(r, r == KErrLocked); |
941 return(*this); |
945 return(*this); |
942 } |
946 } |
943 |
947 |
944 RFileTest& RFileTest::Size(TInt64& aSize) |
948 RFileTest& RFileTest::Size(TInt64& aSize) |
945 // |
949 // |
950 test.Printf(_L("%S size: 0x%lx\n"),&iName,aSize); |
954 test.Printf(_L("%S size: 0x%lx\n"),&iName,aSize); |
951 |
955 |
952 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
956 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) |
953 { |
957 { |
954 if(aSize < K4GB) |
958 if(aSize < K4GB) |
955 test(r == KErrNone); |
959 { |
960 test_KErrNone(r); |
|
961 } |
|
956 else |
962 else |
957 test(r == KErrTooBig); |
963 { |
964 test_Value(r, r == KErrTooBig); |
|
965 } |
|
958 } |
966 } |
959 else |
967 else |
960 { |
968 { |
961 test(r == KErrNone); |
969 test_KErrNone(r); |
962 } |
970 } |
963 return(*this); |
971 return(*this); |
964 |
972 |
965 } |
973 } |
966 RFileTest& RFileTest::Seek(TSeek aMode, TInt64& aPos) |
974 RFileTest& RFileTest::Seek(TSeek aMode, TInt64& aPos) |
968 // Sets the current file position. Expected not to fail. |
976 // Sets the current file position. Expected not to fail. |
969 // |
977 // |
970 { |
978 { |
971 test.Printf(_L("Seek to pos %LD in %d Mode\n"),aPos, aMode); |
979 test.Printf(_L("Seek to pos %LD in %d Mode\n"),aPos, aMode); |
972 TInt r = RFile64::Seek(aMode, aPos); |
980 TInt r = RFile64::Seek(aMode, aPos); |
973 if(aPos < 0) |
981 test_Value(r, r == (aPos < 0) ? KErrArgument : KErrNone); |
974 test(r == KErrArgument); |
|
975 else |
|
976 test(r == KErrNone); |
|
977 return(*this); |
982 return(*this); |
978 } |
983 } |
979 |
984 |
980 /** |
985 /** |
981 @SYMTestCaseID PBASE-T_FILE64BIT-0756 |
986 @SYMTestCaseID PBASE-T_FILE64BIT-0756 |
1010 TestRFile1.Close(); |
1015 TestRFile1.Close(); |
1011 |
1016 |
1012 |
1017 |
1013 test.Next(_L("2GB File: Open")); |
1018 test.Next(_L("2GB File: Open")); |
1014 TInt r = TheFs.Entry(fileName, entry); |
1019 TInt r = TheFs.Entry(fileName, entry); |
1015 test(r == KErrNone); |
1020 test_KErrNone(r); |
1016 test((TUint) entry.iSize == testSize); |
1021 test((TUint) entry.iSize == testSize); |
1017 |
1022 |
1018 TestRFile1.Open(fileName, EFileRead); |
1023 TestRFile1.Open(fileName, EFileRead); |
1019 |
1024 |
1020 |
1025 |
1021 TestRFile1.Size(size); |
1026 TestRFile1.Size(size); |
1022 test(size == testSize); |
1027 test(size == testSize); |
1023 |
1028 |
1024 TestRFile1.Close(); |
1029 TestRFile1.Close(); |
1025 r = TheFs.Delete(fileName); |
1030 r = TheFs.Delete(fileName); |
1026 test(r == KErrNone); |
1031 test_KErrNone(r); |
1027 } |
1032 } |
1028 |
1033 |
1029 /** |
1034 /** |
1030 @SYMTestCaseID PBASE-T_FILE64BIT-0757 |
1035 @SYMTestCaseID PBASE-T_FILE64BIT-0757 |
1031 @SYMTestPriority High |
1036 @SYMTestPriority High |
1058 TestRFile1.SetSize(testSize); |
1063 TestRFile1.SetSize(testSize); |
1059 TestRFile1.Close(); |
1064 TestRFile1.Close(); |
1060 |
1065 |
1061 test.Next(_L("3GB File: Open")); |
1066 test.Next(_L("3GB File: Open")); |
1062 r = TheFs.Entry(fileName, entry); |
1067 r = TheFs.Entry(fileName, entry); |
1063 test(r == KErrNone); |
1068 test_KErrNone(r); |
1064 test((TUint) entry.iSize == testSize); |
1069 test((TUint) entry.iSize == testSize); |
1065 |
1070 |
1066 TestRFile1.Open(fileName,EFileRead); |
1071 TestRFile1.Open(fileName,EFileRead); |
1067 |
1072 |
1068 TestRFile1.Size(size); |
1073 TestRFile1.Size(size); |
1069 test(size == testSize); |
1074 test(size == testSize); |
1070 TestRFile1.Close(); |
1075 TestRFile1.Close(); |
1071 |
1076 |
1072 r = TheFs.Delete(fileName); |
1077 r = TheFs.Delete(fileName); |
1073 test(r == KErrNone); |
1078 test_KErrNone(r); |
1074 } |
1079 } |
1075 |
1080 |
1076 /** |
1081 /** |
1077 @SYMTestCaseID PBASE-T_FILE64BIT-0758 |
1082 @SYMTestCaseID PBASE-T_FILE64BIT-0758 |
1078 @SYMTestPriority High |
1083 @SYMTestPriority High |
1105 TestRFile1.SetSize(testSize); |
1110 TestRFile1.SetSize(testSize); |
1106 TestRFile1.Close(); |
1111 TestRFile1.Close(); |
1107 |
1112 |
1108 test.Next(_L("4GB-1 File: Open")); |
1113 test.Next(_L("4GB-1 File: Open")); |
1109 r = TheFs.Entry(fileName, entry); |
1114 r = TheFs.Entry(fileName, entry); |
1110 test(r == KErrNone); |
1115 test_KErrNone(r); |
1111 |
1116 |
1112 test((TUint) entry.iSize == testSize); |
1117 test((TUint) entry.iSize == testSize); |
1113 |
1118 |
1114 TestRFile1.Open(fileName, EFileRead); |
1119 TestRFile1.Open(fileName, EFileRead); |
1115 |
1120 |
1117 |
1122 |
1118 test(size == testSize); |
1123 test(size == testSize); |
1119 TestRFile1.Close(); |
1124 TestRFile1.Close(); |
1120 |
1125 |
1121 r = TheFs.Delete(fileName); |
1126 r = TheFs.Delete(fileName); |
1122 test(r == KErrNone); |
1127 test_KErrNone(r); |
1123 } |
1128 } |
1124 |
1129 |
1125 /** |
1130 /** |
1126 @SYMTestCaseID PBASE-T_FILE64BIT-0759 |
1131 @SYMTestCaseID PBASE-T_FILE64BIT-0759 |
1127 @SYMTestPriority High |
1132 @SYMTestPriority High |
1154 TestRFile1.SetSize(testSize); |
1159 TestRFile1.SetSize(testSize); |
1155 TestRFile1.Close(); |
1160 TestRFile1.Close(); |
1156 |
1161 |
1157 test.Next(_L("4GB File: Open")); |
1162 test.Next(_L("4GB File: Open")); |
1158 r = TheFs.Entry(fileName, entry); |
1163 r = TheFs.Entry(fileName, entry); |
1159 test(r == KErrNone); |
1164 test_KErrNone(r); |
1160 |
1165 |
1161 if ((TUint) entry.iSize == testSize) |
1166 if ((TUint) entry.iSize == testSize) |
1162 { |
1167 { |
1163 TestRFile1.Open(fileName, EFileRead); |
1168 TestRFile1.Open(fileName, EFileRead); |
1164 TestRFile1.Size(size); |
1169 TestRFile1.Size(size); |
1165 test(size == testSize); |
1170 test(size == testSize); |
1166 TestRFile1.Close(); |
1171 TestRFile1.Close(); |
1167 } |
1172 } |
1168 |
1173 |
1169 r = TheFs.Delete(fileName); |
1174 r = TheFs.Delete(fileName); |
1170 test(r == KErrNone); |
1175 test_KErrNone(r); |
1171 |
1176 |
1172 } |
1177 } |
1173 |
1178 |
1174 /** |
1179 /** |
1175 @SYMTestCaseID PBASE-T_FILE64BIT-0760 |
1180 @SYMTestCaseID PBASE-T_FILE64BIT-0760 |
1252 } |
1257 } |
1253 TestRFile1.Close(); |
1258 TestRFile1.Close(); |
1254 |
1259 |
1255 RFile64 file64; |
1260 RFile64 file64; |
1256 TInt r = file64.Open(TheFs,fileName,EDeleteOnClose); |
1261 TInt r = file64.Open(TheFs,fileName,EDeleteOnClose); |
1257 test (r == KErrArgument); |
1262 test_Value(r, r == KErrArgument); |
1258 |
1263 |
1259 r = TheFs.Delete(fileName); |
1264 r = TheFs.Delete(fileName); |
1260 test(r == KErrNone); |
1265 test_KErrNone(r); |
1261 |
1266 |
1262 } |
1267 } |
1263 |
1268 |
1264 /** |
1269 /** |
1265 @SYMTestCaseID PBASE-T_FILE64BIT-0761 |
1270 @SYMTestCaseID PBASE-T_FILE64BIT-0761 |
1308 fileName.Append(KTestPath); |
1313 fileName.Append(KTestPath); |
1309 fileName.Append(_L("File4GBMinusOne.txt")); |
1314 fileName.Append(_L("File4GBMinusOne.txt")); |
1310 |
1315 |
1311 test.Start(_L("Test opening a file using RFile and RFile64 in file sharing mode\n")); |
1316 test.Start(_L("Test opening a file using RFile and RFile64 in file sharing mode\n")); |
1312 TInt r = file.Replace(TheFs,fileName,EFileShareAny|EFileWrite); |
1317 TInt r = file.Replace(TheFs,fileName,EFileShareAny|EFileWrite); |
1313 test(r == KErrNone); |
1318 test_KErrNone(r); |
1314 |
1319 |
1315 TBuf8<100> writeBuf; |
1320 TBuf8<100> writeBuf; |
1316 TBuf8<100> readBuf; |
1321 TBuf8<100> readBuf; |
1317 writeBuf.Zero(); |
1322 writeBuf.Zero(); |
1318 for(count = 0; count < 100; count++) |
1323 for(count = 0; count < 100; count++) |
1320 writeBuf.Append(count); |
1325 writeBuf.Append(count); |
1321 } |
1326 } |
1322 |
1327 |
1323 test.Next(_L("Write 100 bytes to the file\n")); |
1328 test.Next(_L("Write 100 bytes to the file\n")); |
1324 r = file.Write(0, writeBuf, 100); |
1329 r = file.Write(0, writeBuf, 100); |
1325 test(r == KErrNone); |
1330 test_KErrNone(r); |
1326 |
1331 |
1327 test.Next(_L("Read 100 bytes from position 0")); |
1332 test.Next(_L("Read 100 bytes from position 0")); |
1328 r = file.Read(0, readBuf, 100); |
1333 r = file.Read(0, readBuf, 100); |
1329 test(r == KErrNone); |
1334 test_KErrNone(r); |
1330 |
1335 |
1331 test.Next(_L("Compare the read data to the written data")); |
1336 test.Next(_L("Compare the read data to the written data")); |
1332 test(readBuf == writeBuf); |
1337 test(readBuf == writeBuf); |
1333 |
1338 |
1334 |
1339 |
1338 test.Next(_L("Set the file size to 4GB-1\n")); |
1343 test.Next(_L("Set the file size to 4GB-1\n")); |
1339 TestRFile1.SetSize(K4GBMinusOne); |
1344 TestRFile1.SetSize(K4GBMinusOne); |
1340 |
1345 |
1341 test.Next(_L("Query the file size using Rfile::Size()\n")); |
1346 test.Next(_L("Query the file size using Rfile::Size()\n")); |
1342 r = file.Size(size); |
1347 r = file.Size(size); |
1343 test (r == KErrTooBig); |
1348 test_Value(r, r == KErrTooBig); |
1344 |
1349 |
1345 test.Next(_L("Seek to the file position using 2GB+5 using RFile::Seek()\n")); |
1350 test.Next(_L("Seek to the file position using 2GB+5 using RFile::Seek()\n")); |
1346 TUint seekPos1 = K2GB + 5; |
1351 TUint seekPos1 = K2GB + 5; |
1347 TInt seekPos = (TInt)seekPos1; |
1352 TInt seekPos = (TInt)seekPos1; |
1348 r = file.Seek(ESeekStart,seekPos); |
1353 r = file.Seek(ESeekStart,seekPos); |
1349 test(r == KErrArgument); |
1354 test_Value(r, r == KErrArgument); |
1350 |
1355 |
1351 test.Next(_L("Get the file size using RFile64::Size()\n")); |
1356 test.Next(_L("Get the file size using RFile64::Size()\n")); |
1352 TestRFile1.Size(size64); |
1357 TestRFile1.Size(size64); |
1353 |
1358 |
1354 test.Next(_L("Seek to the file position 4GB-10 using RFile64::Seek()\n")); |
1359 test.Next(_L("Seek to the file position 4GB-10 using RFile64::Seek()\n")); |
1372 TestRFile1.Close(); |
1377 TestRFile1.Close(); |
1373 file.Close(); |
1378 file.Close(); |
1374 |
1379 |
1375 test.Next(_L("Open the file using Rfile::Open()\n")); |
1380 test.Next(_L("Open the file using Rfile::Open()\n")); |
1376 r = file.Open(TheFs,fileName,EFileShareAny|EFileWrite); |
1381 r = file.Open(TheFs,fileName,EFileShareAny|EFileWrite); |
1377 test(r == KErrTooBig); |
1382 test_Value(r, r == KErrTooBig); |
1378 |
1383 |
1379 test.Next(_L("Open the file using Rfile64::Open() and close\n")); |
1384 test.Next(_L("Open the file using Rfile64::Open() and close\n")); |
1380 TestRFile1.Open(fileName,EFileShareAny|EFileWrite); |
1385 TestRFile1.Open(fileName,EFileShareAny|EFileWrite); |
1381 TestRFile1.Close(); |
1386 TestRFile1.Close(); |
1382 |
1387 |
1383 r = TheFs.Delete(fileName); |
1388 r = TheFs.Delete(fileName); |
1384 test(r == KErrNone); |
1389 test_KErrNone(r); |
1385 } |
1390 } |
1386 |
1391 |
1387 /** |
1392 /** |
1388 @SYMTestCaseID PBASE-T_FILE64BIT-0762 |
1393 @SYMTestCaseID PBASE-T_FILE64BIT-0762 |
1389 @SYMTestPriority High |
1394 @SYMTestPriority High |
1423 TFileName testDir; |
1428 TFileName testDir; |
1424 testDir.Append(gDriveToTest); |
1429 testDir.Append(gDriveToTest); |
1425 testDir.Append(KTestPath); |
1430 testDir.Append(KTestPath); |
1426 |
1431 |
1427 TInt r = TheFs.MkDir(testDir); |
1432 TInt r = TheFs.MkDir(testDir); |
1428 test(r == KErrNone || r == KErrAlreadyExists); |
1433 test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
1429 |
1434 |
1430 TFileName fileName; |
1435 TFileName fileName; |
1431 TestRFile1.Temp(testDir, fileName, EFileWrite|EDeleteOnClose); |
1436 TestRFile1.Temp(testDir, fileName, EFileWrite|EDeleteOnClose); |
1432 |
1437 |
1433 test.Next(_L("Set the file size to 4GB-1\n")); |
1438 test.Next(_L("Set the file size to 4GB-1\n")); |
1484 |
1489 |
1485 TestRFile1.Close(); |
1490 TestRFile1.Close(); |
1486 |
1491 |
1487 test.Next(_L("Delete the temporary file\n")); |
1492 test.Next(_L("Delete the temporary file\n")); |
1488 r = TheFs.Delete(fileName); |
1493 r = TheFs.Delete(fileName); |
1489 test(r == KErrNotFound); |
1494 test_Value(r, r == KErrNotFound); |
1490 |
1495 |
1491 test.Next(_L("Create a temporary file using RFile64::Temp without EDeleteOnClose flag\n")); |
1496 test.Next(_L("Create a temporary file using RFile64::Temp without EDeleteOnClose flag\n")); |
1492 TestRFile1.Temp(testDir, fileName, EFileWrite); |
1497 TestRFile1.Temp(testDir, fileName, EFileWrite); |
1493 |
1498 |
1494 test.Next(_L("Close the file\n")); |
1499 test.Next(_L("Close the file\n")); |
1495 TestRFile1.Close(); |
1500 TestRFile1.Close(); |
1496 |
1501 |
1497 test.Next(_L("Delete the temporary the file\n")); |
1502 test.Next(_L("Delete the temporary the file\n")); |
1498 r = TheFs.Delete(fileName); |
1503 r = TheFs.Delete(fileName); |
1499 test(r == KErrNone); |
1504 test_KErrNone(r); |
1500 |
1505 |
1501 } |
1506 } |
1502 |
1507 |
1503 /** |
1508 /** |
1504 @SYMTestCaseID PBASE-T_FILE64BIT-0763 |
1509 @SYMTestCaseID PBASE-T_FILE64BIT-0763 |
1623 TestRFile1.Create(fileName,EFileWrite); |
1628 TestRFile1.Create(fileName,EFileWrite); |
1624 |
1629 |
1625 test.Next(_L("create a file with InvalidPath and fileName\n")); |
1630 test.Next(_L("create a file with InvalidPath and fileName\n")); |
1626 RFile64 file64; |
1631 RFile64 file64; |
1627 TInt r = file64.Create(TheFs, _L("C:\\InvalidPathName\\FileName"),EFileWrite); |
1632 TInt r = file64.Create(TheFs, _L("C:\\InvalidPathName\\FileName"),EFileWrite); |
1628 test(r == KErrPathNotFound); |
1633 test_Value(r, r == KErrPathNotFound); |
1629 |
1634 |
1630 r = TheFs.Delete(fileName); |
1635 r = TheFs.Delete(fileName); |
1631 test(r == KErrNone); |
1636 test_KErrNone(r); |
1632 } |
1637 } |
1633 |
1638 |
1634 /** |
1639 /** |
1635 @SYMTestCaseID PBASE-T_FILE64BIT-0764 |
1640 @SYMTestCaseID PBASE-T_FILE64BIT-0764 |
1636 @SYMTestPriority High |
1641 @SYMTestPriority High |
1773 TestRFile1.Close(); |
1778 TestRFile1.Close(); |
1774 |
1779 |
1775 test.Next(_L("Replace a file FileLargeOne.txt with invalid path\n")); |
1780 test.Next(_L("Replace a file FileLargeOne.txt with invalid path\n")); |
1776 RFile64 file64; |
1781 RFile64 file64; |
1777 TInt r = file64.Replace(TheFs,_L("C:\\InvalidPath\\FileLargeOne.Txt"),EFileWrite); |
1782 TInt r = file64.Replace(TheFs,_L("C:\\InvalidPath\\FileLargeOne.Txt"),EFileWrite); |
1778 test (r == KErrPathNotFound); |
1783 test_Value(r, r == KErrPathNotFound); |
1779 |
1784 |
1780 r = TheFs.Delete(fileName); |
1785 r = TheFs.Delete(fileName); |
1781 test(r == KErrNone); |
1786 test_KErrNone(r); |
1782 } |
1787 } |
1783 |
1788 |
1784 /** |
1789 /** |
1785 @SYMTestCaseID PBASE-T_FILE64BIT-0765 |
1790 @SYMTestCaseID PBASE-T_FILE64BIT-0765 |
1786 @SYMTestPriority High |
1791 @SYMTestPriority High |
1868 test(readBuffer == _L8("ABCDEFGHIJ")); |
1873 test(readBuffer == _L8("ABCDEFGHIJ")); |
1869 |
1874 |
1870 test.Next(_L("Close the file and delete\n")); |
1875 test.Next(_L("Close the file and delete\n")); |
1871 TestRFile1.Close(); |
1876 TestRFile1.Close(); |
1872 TInt r = TheFs.Delete(fileNameReplace); |
1877 TInt r = TheFs.Delete(fileNameReplace); |
1873 test(r == KErrNone); |
1878 test_KErrNone(r); |
1874 } |
1879 } |
1875 |
1880 |
1876 /** |
1881 /** |
1877 @SYMTestCaseID PBASE-T_FILE64BIT-0766 |
1882 @SYMTestCaseID PBASE-T_FILE64BIT-0766 |
1878 @SYMTestPriority High |
1883 @SYMTestPriority High |
1899 { |
1904 { |
1900 test.Next(_L("Tests for checking RFile64::AdoptFromClient()")); |
1905 test.Next(_L("Tests for checking RFile64::AdoptFromClient()")); |
1901 |
1906 |
1902 RProcess p; |
1907 RProcess p; |
1903 TInt r = p.Create(_L("FHServer64Bit.exe"), KNullDesC); |
1908 TInt r = p.Create(_L("FHServer64Bit.exe"), KNullDesC); |
1904 test(r == KErrNone); |
1909 test_KErrNone(r); |
1905 |
1910 |
1906 |
1911 |
1907 test.Next(_L("Connect to the File server \n")); |
1912 test.Next(_L("Connect to the File server \n")); |
1908 RFs fs; |
1913 RFs fs; |
1909 r = fs.Connect(); |
1914 r = fs.Connect(); |
1910 test(r == KErrNone); |
1915 test_KErrNone(r); |
1911 |
1916 |
1912 // Check the number of open file handles |
1917 // Check the number of open file handles |
1913 TInt resCount = fs.ResourceCount(); |
1918 TInt resCount = fs.ResourceCount(); |
1914 test(resCount == 0); |
1919 test(resCount == 0); |
1915 |
1920 |
1916 r = fs.ShareProtected(); |
1921 r = fs.ShareProtected(); |
1917 test(r == KErrNone); |
1922 test_KErrNone(r); |
1918 |
1923 |
1919 r = fs.CreatePrivatePath(gDrive); |
1924 r = fs.CreatePrivatePath(gDrive); |
1920 test(r == KErrNone); |
1925 test_KErrNone(r); |
1921 r = fs.SetSessionToPrivate(gDrive); |
1926 r = fs.SetSessionToPrivate(gDrive); |
1922 |
1927 |
1923 test.Next(_L("Create a file and set the file size to 4GB-1\n")); |
1928 test.Next(_L("Create a file and set the file size to 4GB-1\n")); |
1924 RFile64 file1; |
1929 RFile64 file1; |
1925 r = file1.Replace(fs,KClientFileName,EFileWrite); |
1930 r = file1.Replace(fs,KClientFileName,EFileWrite); |
1926 test(r == KErrNone); |
1931 test_KErrNone(r); |
1927 r = file1.SetSize(K4GB-1); |
1932 r = file1.SetSize(K4GB-1); |
1928 test(r == KErrNone); |
1933 test_KErrNone(r); |
1929 |
1934 |
1930 test.Next(_L("Write few bytes to the location 4GB-10, length = 9bytes\n")); |
1935 test.Next(_L("Write few bytes to the location 4GB-10, length = 9bytes\n")); |
1931 r = file1.Write(K4GB-10,KTestData3(),9); |
1936 r = file1.Write(K4GB-10,KTestData3(),9); |
1932 test(r == KErrNone); |
1937 test_KErrNone(r); |
1933 file1.Close(); |
1938 file1.Close(); |
1934 |
1939 |
1935 r = p.SetParameter(3, gDrive); |
1940 r = p.SetParameter(3, gDrive); |
1936 test(r == KErrNone); |
1941 test_KErrNone(r); |
1937 |
1942 |
1938 p.Resume(); |
1943 p.Resume(); |
1939 |
1944 |
1940 |
1945 |
1941 test.Next(_L("Transfer the file handle using TransferToServer() close the file\n")); |
1946 test.Next(_L("Transfer the file handle using TransferToServer() close the file\n")); |
1943 do |
1948 do |
1944 { |
1949 { |
1945 r = handsvr.Connect(); |
1950 r = handsvr.Connect(); |
1946 } |
1951 } |
1947 while(r == KErrNotFound); |
1952 while(r == KErrNotFound); |
1948 test(r == KErrNone); |
1953 test_KErrNone(r); |
1949 |
1954 |
1950 r = handsvr.SetTestDrive(gDrive); |
1955 r = handsvr.SetTestDrive(gDrive); |
1951 test(r == KErrNone); |
1956 test_KErrNone(r); |
1952 |
1957 |
1953 r = fs.SetSessionToPrivate(gDrive); |
1958 r = fs.SetSessionToPrivate(gDrive); |
1954 test(r == KErrNone); |
1959 test_KErrNone(r); |
1955 |
1960 |
1956 r = file1.Open(fs,KClientFileName,EFileRead); |
1961 r = file1.Open(fs,KClientFileName,EFileRead); |
1957 test(r == KErrNone); |
1962 test_KErrNone(r); |
1958 |
1963 |
1959 // pass the file handle to FHServer |
1964 // pass the file handle to FHServer |
1960 test.Next(_L("RFile::TransferToServer()")); |
1965 test.Next(_L("RFile::TransferToServer()")); |
1961 |
1966 |
1962 TIpcArgs ipcArgs; |
1967 TIpcArgs ipcArgs; |
1963 r = file1.TransferToServer(ipcArgs, 0, 1); |
1968 r = file1.TransferToServer(ipcArgs, 0, 1); |
1964 test(r == KErrNone); |
1969 test_KErrNone(r); |
1965 |
1970 |
1966 test.Next(_L("Adopt the already open file from a client using RFile64::AdoptFromClient()\n")); |
1971 test.Next(_L("Adopt the already open file from a client using RFile64::AdoptFromClient()\n")); |
1967 r = handsvr.PassFileHandleProcessLargeFileClient(ipcArgs); |
1972 r = handsvr.PassFileHandleProcessLargeFileClient(ipcArgs); |
1968 test(r == KErrNone); |
1973 test_KErrNone(r); |
1969 |
1974 |
1970 // verify that the original file handle's position is unchanged |
1975 // verify that the original file handle's position is unchanged |
1971 TInt64 pos = 0; |
1976 TInt64 pos = 0; |
1972 r = file1.Seek(ESeekCurrent, pos); |
1977 r = file1.Seek(ESeekCurrent, pos); |
1973 test(r == KErrNone); |
1978 test_KErrNone(r); |
1974 test(pos == 0); |
1979 test(pos == 0); |
1975 // make sure we can still use it |
1980 // make sure we can still use it |
1976 |
1981 |
1977 test.Next(_L("Read the file from position 4GB-10 and compare the data\n")); |
1982 test.Next(_L("Read the file from position 4GB-10 and compare the data\n")); |
1978 TBuf8<9> rbuf; |
1983 TBuf8<9> rbuf; |
1979 r = file1.Read(K4GB-10,rbuf); |
1984 r = file1.Read(K4GB-10,rbuf); |
1980 test(r == KErrNone); |
1985 test_KErrNone(r); |
1981 test (rbuf == KTestData3); |
1986 test (rbuf == KTestData3); |
1982 |
1987 |
1983 // Close the file |
1988 // Close the file |
1984 file1.Close(); |
1989 file1.Close(); |
1985 handsvr.Exit(); |
1990 handsvr.Exit(); |
1986 handsvr.Close(); |
1991 handsvr.Close(); |
1987 r = fs.MkDir(_L("C:\\mdir")); |
1992 r = fs.MkDir(_L("C:\\mdir")); |
1988 test(r == KErrNone || r == KErrAlreadyExists); |
1993 test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
1989 |
1994 |
1990 // Check the number of open file handles |
1995 // Check the number of open file handles |
1991 resCount = fs.ResourceCount(); |
1996 resCount = fs.ResourceCount(); |
1992 test(resCount == 0); |
1997 test(resCount == 0); |
1993 |
1998 |
1994 r = fs.Delete(KClientFileName); |
1999 r = fs.Delete(KClientFileName); |
1995 test(r == KErrNone); |
2000 test_KErrNone(r); |
1996 fs.Close(); |
2001 fs.Close(); |
1997 } |
2002 } |
1998 |
2003 |
1999 /** |
2004 /** |
2000 @SYMTestCaseID PBASE-T_FILE64BIT-0767 |
2005 @SYMTestCaseID PBASE-T_FILE64BIT-0767 |
2029 test.Next(_L("Tests for checking RFile64::AdoptFromCreator()")); |
2034 test.Next(_L("Tests for checking RFile64::AdoptFromCreator()")); |
2030 //create test server |
2035 //create test server |
2031 test.Next(_L("Create a process named FHServer64Bit.exe\n")); |
2036 test.Next(_L("Create a process named FHServer64Bit.exe\n")); |
2032 RProcess p; |
2037 RProcess p; |
2033 r = p.Create(_L("FHServer64Bit.exe"), KNullDesC); |
2038 r = p.Create(_L("FHServer64Bit.exe"), KNullDesC); |
2034 test(r == KErrNone); |
2039 test_KErrNone(r); |
2035 |
2040 |
2036 test.Next(_L("Connect to the file server\n")); |
2041 test.Next(_L("Connect to the file server\n")); |
2037 RFs fs; |
2042 RFs fs; |
2038 r = fs.Connect(); |
2043 r = fs.Connect(); |
2039 test(r == KErrNone); |
2044 test_KErrNone(r); |
2040 |
2045 |
2041 // Check the number of open file handles |
2046 // Check the number of open file handles |
2042 TInt resCount = fs.ResourceCount(); |
2047 TInt resCount = fs.ResourceCount(); |
2043 test(resCount == 0); |
2048 test(resCount == 0); |
2044 |
2049 |
2045 r = fs.ShareProtected(); |
2050 r = fs.ShareProtected(); |
2046 test(r == KErrNone); |
2051 test_KErrNone(r); |
2047 |
2052 |
2048 r = fs.CreatePrivatePath(gDrive); |
2053 r = fs.CreatePrivatePath(gDrive); |
2049 test(r == KErrNone); |
2054 test_KErrNone(r); |
2050 r = fs.SetSessionToPrivate(gDrive); |
2055 r = fs.SetSessionToPrivate(gDrive); |
2051 |
2056 |
2052 test.Next(_L("Create a file and set the file size to 4GB-1\n")); |
2057 test.Next(_L("Create a file and set the file size to 4GB-1\n")); |
2053 RFile64 file1; |
2058 RFile64 file1; |
2054 r = file1.Replace(fs,KClientFileName,EFileWrite); |
2059 r = file1.Replace(fs,KClientFileName,EFileWrite); |
2055 test(r == KErrNone); |
2060 test_KErrNone(r); |
2056 r = file1.SetSize(K4GB-1); |
2061 r = file1.SetSize(K4GB-1); |
2057 test(r == KErrNone); |
2062 test_KErrNone(r); |
2058 |
2063 |
2059 test.Next(_L("Write few bytes to the location 4GB-10, length = 3bytes\n")); |
2064 test.Next(_L("Write few bytes to the location 4GB-10, length = 3bytes\n")); |
2060 r = file1.Write(K4GB-10,KTestData2(),3); |
2065 r = file1.Write(K4GB-10,KTestData2(),3); |
2061 test(r == KErrNone); |
2066 test_KErrNone(r); |
2062 file1.Close(); |
2067 file1.Close(); |
2063 |
2068 |
2064 r = file1.Open(fs, KClientFileName, EFileWrite); |
2069 r = file1.Open(fs, KClientFileName, EFileWrite); |
2065 |
2070 |
2066 test(r == KErrNone); |
2071 test_KErrNone(r); |
2067 |
2072 |
2068 // NB slot 0 is reserved for the command line |
2073 // NB slot 0 is reserved for the command line |
2069 |
2074 |
2070 test.Next(_L("Transfer the file handle using TransferToProcess() close the file")); |
2075 test.Next(_L("Transfer the file handle using TransferToProcess() close the file")); |
2071 |
2076 |
2072 r = file1.TransferToProcess(p, 1, 2); |
2077 r = file1.TransferToProcess(p, 1, 2); |
2073 |
2078 |
2074 r = p.SetParameter(3, gDrive); |
2079 r = p.SetParameter(3, gDrive); |
2075 test(r == KErrNone); |
2080 test_KErrNone(r); |
2076 |
2081 |
2077 r = fs.SetSessionToPrivate(gDrive); |
2082 r = fs.SetSessionToPrivate(gDrive); |
2078 test(r == KErrNone); |
2083 test_KErrNone(r); |
2079 |
2084 |
2080 // make sure we can still read from the file |
2085 // make sure we can still read from the file |
2081 TBuf8<3> rbuf; |
2086 TBuf8<3> rbuf; |
2082 r = file1.Read(K4GB-10,rbuf,3); |
2087 r = file1.Read(K4GB-10,rbuf,3); |
2083 test(r == KErrNone); |
2088 test_KErrNone(r); |
2084 r = rbuf.CompareF(KTestData2()); |
2089 r = rbuf.CompareF(KTestData2()); |
2085 test(r == KErrNone); |
2090 test_KErrNone(r); |
2086 file1.Close(); |
2091 file1.Close(); |
2087 |
2092 |
2088 r = fs.MkDir(_L("C:\\mdir")); |
2093 r = fs.MkDir(_L("C:\\mdir")); |
2089 test(r == KErrNone || r == KErrAlreadyExists); |
2094 test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
2090 |
2095 |
2091 // Check the number of open file handles - |
2096 // Check the number of open file handles - |
2092 // should be 1 (the one duplicated for the other process) |
2097 // should be 1 (the one duplicated for the other process) |
2093 resCount = fs.ResourceCount(); |
2098 resCount = fs.ResourceCount(); |
2094 test(resCount == 1); |
2099 test(resCount == 1); |
2104 do |
2109 do |
2105 { |
2110 { |
2106 r = handsvr.Connect(); |
2111 r = handsvr.Connect(); |
2107 } |
2112 } |
2108 while(r == KErrNotFound); |
2113 while(r == KErrNotFound); |
2109 test(r == KErrNone); |
2114 test_KErrNone(r); |
2110 r = handsvr.SetTestDrive(gDrive); |
2115 r = handsvr.SetTestDrive(gDrive); |
2111 test(r == KErrNone); |
2116 test_KErrNone(r); |
2112 |
2117 |
2113 // wait for server to read the file |
2118 // wait for server to read the file |
2114 r = handsvr.PassFileHandleProcessLargeFileCreator(); |
2119 r = handsvr.PassFileHandleProcessLargeFileCreator(); |
2115 test (r == KErrNone); |
2120 test_KErrNone(r); |
2116 |
2121 |
2117 |
2122 |
2118 // cleanup |
2123 // cleanup |
2119 handsvr.Exit(); |
2124 handsvr.Exit(); |
2120 handsvr.Close(); |
2125 handsvr.Close(); |
2149 TInt r; |
2154 TInt r; |
2150 |
2155 |
2151 test.Next(_L("Connect to the file server\n")); |
2156 test.Next(_L("Connect to the file server\n")); |
2152 RFs fs; |
2157 RFs fs; |
2153 r = fs.Connect(); |
2158 r = fs.Connect(); |
2154 test(r == KErrNone); |
2159 test_KErrNone(r); |
2155 |
2160 |
2156 // Check the number of open file handles |
2161 // Check the number of open file handles |
2157 TInt resCount = fs.ResourceCount(); |
2162 TInt resCount = fs.ResourceCount(); |
2158 test(resCount == 0); |
2163 test(resCount == 0); |
2159 |
2164 |
2160 r = fs.ShareProtected(); |
2165 r = fs.ShareProtected(); |
2161 test(r == KErrNone); |
2166 test_KErrNone(r); |
2162 |
2167 |
2163 r = fs.CreatePrivatePath(gDrive); |
2168 r = fs.CreatePrivatePath(gDrive); |
2164 test(r == KErrNone); |
2169 test_KErrNone(r); |
2165 r = fs.SetSessionToPrivate(gDrive); |
2170 r = fs.SetSessionToPrivate(gDrive); |
2166 |
2171 |
2167 test.Next(_L("Create a file and set the file size to 4GB-1\n")); |
2172 test.Next(_L("Create a file and set the file size to 4GB-1\n")); |
2168 RFile64 file1; |
2173 RFile64 file1; |
2169 r = file1.Replace(fs,KClientFileName,EFileWrite); |
2174 r = file1.Replace(fs,KClientFileName,EFileWrite); |
2170 test(r == KErrNone); |
2175 test_KErrNone(r); |
2171 r = file1.SetSize(K4GB-1); |
2176 r = file1.SetSize(K4GB-1); |
2172 test(r == KErrNone); |
2177 test_KErrNone(r); |
2173 |
2178 |
2174 |
2179 |
2175 r = file1.Write(K4GB-10,KTestData3(),9); |
2180 r = file1.Write(K4GB-10,KTestData3(),9); |
2176 test(r == KErrNone); |
2181 test_KErrNone(r); |
2177 |
2182 |
2178 file1.Close(); |
2183 file1.Close(); |
2179 r = fs.Delete(KClientFileName); |
2184 r = fs.Delete(KClientFileName); |
2180 test(r == KErrNone); |
2185 test_KErrNone(r); |
2181 |
2186 |
2182 RProcess p; |
2187 RProcess p; |
2183 r = p.Create(_L("FHServer64Bit.exe"), KNullDesC); |
2188 r = p.Create(_L("FHServer64Bit.exe"), KNullDesC); |
2184 test(r == KErrNone); |
2189 test_KErrNone(r); |
2185 // Request an open file (write mode) from the server |
2190 // Request an open file (write mode) from the server |
2186 // using RFile64::AdoptFromServer() |
2191 // using RFile64::AdoptFromServer() |
2187 |
2192 |
2188 test.Next(_L("Adopt an already open file from a server using RFile64::AdoptFromServer()\n")); |
2193 test.Next(_L("Adopt an already open file from a server using RFile64::AdoptFromServer()\n")); |
2189 p.Resume(); |
2194 p.Resume(); |
2191 do |
2196 do |
2192 { |
2197 { |
2193 r = handsvr.Connect(); |
2198 r = handsvr.Connect(); |
2194 } |
2199 } |
2195 while(r == KErrNotFound); |
2200 while(r == KErrNotFound); |
2196 test(r == KErrNone); |
2201 test_KErrNone(r); |
2197 |
2202 |
2198 r = handsvr.SetTestDrive(gDrive); |
2203 r = handsvr.SetTestDrive(gDrive); |
2199 test(r == KErrNone); |
2204 test_KErrNone(r); |
2200 |
2205 |
2201 TInt ssh; |
2206 TInt ssh; |
2202 TInt fsh = handsvr.GetFileHandleLargeFile2(ssh, EFileWrite); |
2207 TInt fsh = handsvr.GetFileHandleLargeFile2(ssh, EFileWrite); |
2203 test (fsh >= 0); |
2208 test (fsh >= 0); |
2204 |
2209 |
2213 // adopt the file handle from FHServer |
2218 // adopt the file handle from FHServer |
2214 test.Next(_L("RFile64::AdoptFromServer()")); |
2219 test.Next(_L("RFile64::AdoptFromServer()")); |
2215 |
2220 |
2216 RFile64 file; |
2221 RFile64 file; |
2217 r = file.AdoptFromServer(fsh, ssh); |
2222 r = file.AdoptFromServer(fsh, ssh); |
2218 test(r == KErrNone); |
2223 test_KErrNone(r); |
2219 |
2224 |
2220 test.Next(_L("Read the file from position 4GB-10 and compare the data\n")); |
2225 test.Next(_L("Read the file from position 4GB-10 and compare the data\n")); |
2221 TBuf8<9> rbuf; |
2226 TBuf8<9> rbuf; |
2222 r = file.Read(K4GB-10,rbuf); |
2227 r = file.Read(K4GB-10,rbuf); |
2223 test(r == KErrNone); |
2228 test_KErrNone(r); |
2224 // server should write KTestData1 ("Server!!!") to file |
2229 // server should write KTestData1 ("Server!!!") to file |
2225 test (rbuf == KTestData4); |
2230 test (rbuf == KTestData4); |
2226 |
2231 |
2227 TFileName fileName; |
2232 TFileName fileName; |
2228 r = file.FullName(fileName); |
2233 r = file.FullName(fileName); |
2229 test(r == KErrNone); |
2234 test_KErrNone(r); |
2230 |
2235 |
2231 file.Close(); |
2236 file.Close(); |
2232 //cleanup |
2237 //cleanup |
2233 r = fs.Delete(fileName); |
2238 r = fs.Delete(fileName); |
2234 test(r == KErrNone); |
2239 test_KErrNone(r); |
2235 |
2240 |
2236 TFileName sessionPath; |
2241 TFileName sessionPath; |
2237 r = fs.SessionPath(sessionPath); |
2242 r = fs.SessionPath(sessionPath); |
2238 test(r == KErrNone); |
2243 test_KErrNone(r); |
2239 |
2244 |
2240 r = fs.RmDir(sessionPath); |
2245 r = fs.RmDir(sessionPath); |
2241 test(r == KErrNone); |
2246 test_KErrNone(r); |
2242 |
2247 |
2243 fs.Close(); |
2248 fs.Close(); |
2244 |
2249 |
2245 } |
2250 } |
2246 |
2251 |
2269 TUint pos; |
2274 TUint pos; |
2270 TBuf8<KBufSize> readBuf1; |
2275 TBuf8<KBufSize> readBuf1; |
2271 TBuf8<KBufSize> readBuf2; |
2276 TBuf8<KBufSize> readBuf2; |
2272 TUint i; |
2277 TUint i; |
2273 TInt r = GenerateBigFileContents(); |
2278 TInt r = GenerateBigFileContents(); |
2274 test(r == KErrNone); |
2279 test_KErrNone(r); |
2275 |
2280 |
2276 test.Next(_L("Open & Read Synchronously Large File From Diff Offset:")); |
2281 test.Next(_L("Open & Read Synchronously Large File From Diff Offset:")); |
2277 |
2282 |
2278 TFileName fileName; |
2283 TFileName fileName; |
2279 fileName.Append(gDriveToTest); |
2284 fileName.Append(gDriveToTest); |
2899 TestRFile1.Read(pos, readBuf, 0, status7); |
2904 TestRFile1.Read(pos, readBuf, 0, status7); |
2900 |
2905 |
2901 TestRFile1.Close(); |
2906 TestRFile1.Close(); |
2902 |
2907 |
2903 TInt r = TheFs.Delete(fileName); |
2908 TInt r = TheFs.Delete(fileName); |
2904 test(r == KErrNone); |
2909 test_KErrNone(r); |
2905 } |
2910 } |
2906 |
2911 |
2907 /** |
2912 /** |
2908 @SYMTestCaseID PBASE-T_FILE64BIT-0773 |
2913 @SYMTestCaseID PBASE-T_FILE64BIT-0773 |
2909 @SYMTestPriority High |
2914 @SYMTestPriority High |
3036 test(readBuffer256.Length() == 0); |
3041 test(readBuffer256.Length() == 0); |
3037 } |
3042 } |
3038 TestRFile1.Close(); |
3043 TestRFile1.Close(); |
3039 |
3044 |
3040 TInt r = TheFs.Delete(fileName); |
3045 TInt r = TheFs.Delete(fileName); |
3041 test(r == KErrNone); |
3046 test_KErrNone(r); |
3042 } |
3047 } |
3043 |
3048 |
3044 /** |
3049 /** |
3045 @SYMTestCaseID PBASE-T_FILE64BIT-0774 |
3050 @SYMTestCaseID PBASE-T_FILE64BIT-0774 |
3046 @SYMTestPriority High |
3051 @SYMTestPriority High |
3175 test(readBuf256.Length() == 0); |
3180 test(readBuf256.Length() == 0); |
3176 } |
3181 } |
3177 TestRFile1.Close(); |
3182 TestRFile1.Close(); |
3178 |
3183 |
3179 TInt r = TheFs.Delete(fileName); |
3184 TInt r = TheFs.Delete(fileName); |
3180 test(r == KErrNone); |
3185 test_KErrNone(r); |
3181 } |
3186 } |
3182 |
3187 |
3183 /** |
3188 /** |
3184 @SYMTestCaseID PBASE-T_FILE64BIT-0775 |
3189 @SYMTestCaseID PBASE-T_FILE64BIT-0775 |
3185 @SYMTestPriority High |
3190 @SYMTestPriority High |
3340 } |
3345 } |
3341 TestRFile1.Write(0,wrBuf256,-1); |
3346 TestRFile1.Write(0,wrBuf256,-1); |
3342 TestRFile1.Close(); |
3347 TestRFile1.Close(); |
3343 |
3348 |
3344 TInt r = TheFs.Delete(fileName); |
3349 TInt r = TheFs.Delete(fileName); |
3345 test(r == KErrNone); |
3350 test_KErrNone(r); |
3346 } |
3351 } |
3347 |
3352 |
3348 /** |
3353 /** |
3349 @SYMTestCaseID PBASE-T_FILE64BIT-0776 |
3354 @SYMTestCaseID PBASE-T_FILE64BIT-0776 |
3350 @SYMTestPriority High |
3355 @SYMTestPriority High |
3520 TRequestStatus status7 = KRequestPending; |
3525 TRequestStatus status7 = KRequestPending; |
3521 TestRFile1.Write(0,wrBuf256,-1,status7); |
3526 TestRFile1.Write(0,wrBuf256,-1,status7); |
3522 TestRFile1.Close(); |
3527 TestRFile1.Close(); |
3523 |
3528 |
3524 TInt r = TheFs.Delete(fileName); |
3529 TInt r = TheFs.Delete(fileName); |
3525 test(r == KErrNone); |
3530 test_KErrNone(r); |
3526 } |
3531 } |
3527 |
3532 |
3528 /** |
3533 /** |
3529 @SYMTestCaseID PBASE-T_FILE64BIT-0777 |
3534 @SYMTestCaseID PBASE-T_FILE64BIT-0777 |
3530 @SYMTestPriority High |
3535 @SYMTestPriority High |
3592 } |
3597 } |
3593 |
3598 |
3594 TestRFile1.Close(); |
3599 TestRFile1.Close(); |
3595 |
3600 |
3596 TInt r = TheFs.Delete(fileName); |
3601 TInt r = TheFs.Delete(fileName); |
3597 test(r == KErrNone); |
3602 test_KErrNone(r); |
3598 } |
3603 } |
3599 |
3604 |
3600 |
3605 |
3601 /** |
3606 /** |
3602 @SYMTestCaseID PBASE-T_FILE64BIT-0778 |
3607 @SYMTestCaseID PBASE-T_FILE64BIT-0778 |
3701 TestRFile2.UnLock(K4GB, 10); |
3706 TestRFile2.UnLock(K4GB, 10); |
3702 } |
3707 } |
3703 |
3708 |
3704 TestRFile2.Close(); |
3709 TestRFile2.Close(); |
3705 TInt r = TheFs.Delete(fileName); |
3710 TInt r = TheFs.Delete(fileName); |
3706 test(r == KErrNone); |
3711 test_KErrNone(r); |
3707 } |
3712 } |
3708 |
3713 |
3709 /** |
3714 /** |
3710 @SYMTestCaseID PBASE-T_FILE64BIT-0779 |
3715 @SYMTestCaseID PBASE-T_FILE64BIT-0779 |
3711 @SYMTestPriority High |
3716 @SYMTestPriority High |
3795 test(seekPos == 512); |
3800 test(seekPos == 512); |
3796 |
3801 |
3797 TestRFile1.Close(); |
3802 TestRFile1.Close(); |
3798 |
3803 |
3799 TInt r = TheFs.Delete(fileName); |
3804 TInt r = TheFs.Delete(fileName); |
3800 test(r == KErrNone); |
3805 test_KErrNone(r); |
3801 } |
3806 } |
3802 |
3807 |
3803 /** |
3808 /** |
3804 @SYMTestCaseID PBASE-T_FILE64BIT-0780 |
3809 @SYMTestCaseID PBASE-T_FILE64BIT-0780 |
3805 @SYMTestPriority High |
3810 @SYMTestPriority High |
3902 |
3907 |
3903 |
3908 |
3904 TestRFile1.Close(); |
3909 TestRFile1.Close(); |
3905 |
3910 |
3906 TInt r = TheFs.Delete(fileName); |
3911 TInt r = TheFs.Delete(fileName); |
3907 test(r == KErrNone); |
3912 test_KErrNone(r); |
3908 } |
3913 } |
3909 |
3914 |
3910 /** |
3915 /** |
3911 @SYMTestCaseID PBASE-T_FILE64BIT-0781 |
3916 @SYMTestCaseID PBASE-T_FILE64BIT-0781 |
3912 @SYMTestPriority High |
3917 @SYMTestPriority High |
4009 TestRFile1.Read(K4GBMinusTen,testData6,9); |
4014 TestRFile1.Read(K4GBMinusTen,testData6,9); |
4010 test(testData6 == _L8("IJKLMnOPx")); |
4015 test(testData6 == _L8("IJKLMnOPx")); |
4011 TestRFile1.Close(); |
4016 TestRFile1.Close(); |
4012 |
4017 |
4013 TInt r = TheFs.Delete(fileName); |
4018 TInt r = TheFs.Delete(fileName); |
4014 test(r == KErrNone); |
4019 test_KErrNone(r); |
4015 } |
4020 } |
4016 |
4021 |
4017 /** |
4022 /** |
4018 @SYMTestCaseID PBASE-T_FILE64BIT-0782 |
4023 @SYMTestCaseID PBASE-T_FILE64BIT-0782 |
4019 @SYMTestPriority High |
4024 @SYMTestPriority High |
4046 fileName.Append(gDriveToTest); |
4051 fileName.Append(gDriveToTest); |
4047 fileName.Append(KTestPath); |
4052 fileName.Append(KTestPath); |
4048 fileName.Append(_L("File4GBMinusOne.txt")); |
4053 fileName.Append(_L("File4GBMinusOne.txt")); |
4049 |
4054 |
4050 TInt r = file.Replace(TheFs,fileName,EFileWrite); |
4055 TInt r = file.Replace(TheFs,fileName,EFileWrite); |
4051 test(r == KErrNone); |
4056 test_KErrNone(r); |
4052 r = file.SetSize(K4GBMinusOne); |
4057 r = file.SetSize(K4GBMinusOne); |
4053 test(r == KErrNone); |
4058 test_KErrNone(r); |
4054 file.Close(); |
4059 file.Close(); |
4055 |
4060 |
4056 test.Next(_L("Read from a big file using RFs::ReadFileSection() from position 3GB-1,52byte lengths of data\n")); |
4061 test.Next(_L("Read from a big file using RFs::ReadFileSection() from position 3GB-1,52byte lengths of data\n")); |
4057 TestRFs.ReadFileSection(fileName,K3GBMinusOne,testDes,52); |
4062 TestRFs.ReadFileSection(fileName,K3GBMinusOne,testDes,52); |
4058 |
4063 |
4079 { |
4084 { |
4080 TestRFs.ReadFileSection(fileName,K4GB,readBuf,52); |
4085 TestRFs.ReadFileSection(fileName,K4GB,readBuf,52); |
4081 } |
4086 } |
4082 |
4087 |
4083 r = TheFs.Delete(fileName); |
4088 r = TheFs.Delete(fileName); |
4084 test(r == KErrNone); |
4089 test_KErrNone(r); |
4085 } |
4090 } |
4086 |
4091 |
4087 /** |
4092 /** |
4088 @SYMTestCaseID PBASE-T_FILE64BIT-0783 |
4093 @SYMTestCaseID PBASE-T_FILE64BIT-0783 |
4089 @SYMTestPriority High |
4094 @SYMTestPriority High |
4143 TestRFile1.Close(); |
4148 TestRFile1.Close(); |
4144 |
4149 |
4145 test.Next(_L("Get the directory listing, sort by size\n")); |
4150 test.Next(_L("Get the directory listing, sort by size\n")); |
4146 RDir dir; |
4151 RDir dir; |
4147 TInt r = dir.Open(TheFs, dirName, KEntryAttNormal); |
4152 TInt r = dir.Open(TheFs, dirName, KEntryAttNormal); |
4148 test (r == KErrNone); |
4153 test_KErrNone(r); |
4149 |
4154 |
4150 TEntryArray entryArray; |
4155 TEntryArray entryArray; |
4151 r = dir.Read(entryArray); |
4156 r = dir.Read(entryArray); |
4152 test (r == KErrEof); |
4157 test_Value(r, r == KErrEof); |
4153 |
4158 |
4154 test.Next(_L("Check the files count in the directory. Number of files in a directory is 4\n")); |
4159 test.Next(_L("Check the files count in the directory. Number of files in a directory is 4\n")); |
4155 test(entryArray.Count() == gFilesInDirectory); |
4160 test(entryArray.Count() == gFilesInDirectory); |
4156 |
4161 |
4157 test.Next(_L("Get the entry list & Check the files are listed in order of file sizes\n")); |
4162 test.Next(_L("Get the entry list & Check the files are listed in order of file sizes\n")); |
4295 dirName.Append(KTestPath); |
4300 dirName.Append(KTestPath); |
4296 |
4301 |
4297 test.Next(_L("Open the directory containing large file, using RDir open()\n")); |
4302 test.Next(_L("Open the directory containing large file, using RDir open()\n")); |
4298 RDir dir; |
4303 RDir dir; |
4299 TInt r = dir.Open(TheFs, dirName, KEntryAttNormal); |
4304 TInt r = dir.Open(TheFs, dirName, KEntryAttNormal); |
4300 test (r == KErrNone); |
4305 test_KErrNone(r); |
4301 |
4306 |
4302 test.Next(_L("Read the directory entry using TEntryArray as parameter\n")); |
4307 test.Next(_L("Read the directory entry using TEntryArray as parameter\n")); |
4303 TEntryArray entryArray; |
4308 TEntryArray entryArray; |
4304 r = dir.Read(entryArray); |
4309 r = dir.Read(entryArray); |
4305 test (r == KErrEof); |
4310 test_Value(r, r == KErrEof); |
4306 |
4311 |
4307 test.Next(_L("Check the count\n")); |
4312 test.Next(_L("Check the count\n")); |
4308 test(entryArray.Count() == gFilesInDirectory); |
4313 test(entryArray.Count() == gFilesInDirectory); |
4309 |
4314 |
4310 test.Next(_L("Close using RDir\n")); |
4315 test.Next(_L("Close using RDir\n")); |
4339 TFileName testDir0; |
4344 TFileName testDir0; |
4340 testDir0.Append(gDriveToTest); |
4345 testDir0.Append(gDriveToTest); |
4341 testDir0.Append(_L("F32-TEST")); |
4346 testDir0.Append(_L("F32-TEST")); |
4342 |
4347 |
4343 TInt r = TheFs.MkDir(testDir0); |
4348 TInt r = TheFs.MkDir(testDir0); |
4344 test(r == KErrNone || r == KErrAlreadyExists); |
4349 test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
4345 |
4350 |
4346 test.Next(_L("Sort with number of entries =0\n")); |
4351 test.Next(_L("Sort with number of entries =0\n")); |
4347 TestRFs.GetDir(testDir0, KEntryAttMaskSupported, ESortBySize, anEntryList); |
4352 TestRFs.GetDir(testDir0, KEntryAttMaskSupported, ESortBySize, anEntryList); |
4348 test(anEntryList->Count() == 0); |
4353 test(anEntryList->Count() == 0); |
4349 delete anEntryList; |
4354 delete anEntryList; |
4466 file3GB.Append(gDriveToTest); |
4471 file3GB.Append(gDriveToTest); |
4467 file3GB.Append(KTestPath); |
4472 file3GB.Append(KTestPath); |
4468 file3GB.Append(_L("File3GB.txt")); |
4473 file3GB.Append(_L("File3GB.txt")); |
4469 |
4474 |
4470 TInt r = TheFs.Delete(file4GBMinusOne); |
4475 TInt r = TheFs.Delete(file4GBMinusOne); |
4471 test(r == KErrNone); |
4476 test_KErrNone(r); |
4472 r = TheFs.Delete(file2GBMinusOne); |
4477 r = TheFs.Delete(file2GBMinusOne); |
4473 test(r == KErrNone); |
4478 test_KErrNone(r); |
4474 r = TheFs.Delete(file2GB); |
4479 r = TheFs.Delete(file2GB); |
4475 test(r == KErrNone); |
4480 test_KErrNone(r); |
4476 r = TheFs.Delete(file3GB); |
4481 r = TheFs.Delete(file3GB); |
4477 test(r == KErrNone); |
4482 test_KErrNone(r); |
4478 } |
4483 } |
4479 |
4484 |
4480 /** |
4485 /** |
4481 @SYMTestCaseID PBASE-T_FILE64BIT-0788 |
4486 @SYMTestCaseID PBASE-T_FILE64BIT-0788 |
4482 @SYMTestPriority High |
4487 @SYMTestPriority High |
4519 RFile64 file64; |
4524 RFile64 file64; |
4520 TInt64 sizeK3GB = K3GB; |
4525 TInt64 sizeK3GB = K3GB; |
4521 |
4526 |
4522 test.Next(_L("Open test file and get the file size using RFile64::Size() and set the file handle to TFileText object\n")); |
4527 test.Next(_L("Open test file and get the file size using RFile64::Size() and set the file handle to TFileText object\n")); |
4523 r = file64.Replace(TheFs,fileName,EFileRead|EFileWrite); |
4528 r = file64.Replace(TheFs,fileName,EFileRead|EFileWrite); |
4524 test(r == KErrNone); |
4529 test_KErrNone(r); |
4525 r = file64.SetSize(sizeK3GB); |
4530 r = file64.SetSize(sizeK3GB); |
4526 test(r == KErrNone); |
4531 test_KErrNone(r); |
4527 TFileText fileText; |
4532 TFileText fileText; |
4528 fileText.Set(file64); |
4533 fileText.Set(file64); |
4529 |
4534 |
4530 test.Next(_L("Seek to the file end using TFileText::Seek()\n")); |
4535 test.Next(_L("Seek to the file end using TFileText::Seek()\n")); |
4531 r = fileText.Seek(ESeekEnd); |
4536 r = fileText.Seek(ESeekEnd); |
4532 test(r == KErrNone); |
4537 test_KErrNone(r); |
4533 |
4538 |
4534 test.Next(_L("Get current file position using RFile64::Seek() and verify it is at file end.\n")); |
4539 test.Next(_L("Get current file position using RFile64::Seek() and verify it is at file end.\n")); |
4535 TInt64 pos = 0; |
4540 TInt64 pos = 0; |
4536 r = file64.Seek(ESeekCurrent, pos); |
4541 r = file64.Seek(ESeekCurrent, pos); |
4537 test(r == KErrNone); |
4542 test_KErrNone(r); |
4538 test(pos == sizeK3GB); |
4543 test(pos == sizeK3GB); |
4539 |
4544 |
4540 test.Next(_L("Write data to the file using RFile64::Write\n")); |
4545 test.Next(_L("Write data to the file using RFile64::Write\n")); |
4541 HBufC* record = HBufC::NewL(10); |
4546 HBufC* record = HBufC::NewL(10); |
4542 record->Des().SetLength(10); |
4547 record->Des().SetLength(10); |
4543 record->Des().Fill('A'); |
4548 record->Des().Fill('A'); |
4544 TPtrC8 bufPtr; |
4549 TPtrC8 bufPtr; |
4545 bufPtr.Set((TUint8*)record->Ptr(),record->Size()); // Size() returns length in bytes |
4550 bufPtr.Set((TUint8*)record->Ptr(),record->Size()); // Size() returns length in bytes |
4546 r = file64.Write(pos,bufPtr); |
4551 r = file64.Write(pos,bufPtr); |
4547 test(r == KErrNone); |
4552 test_KErrNone(r); |
4548 |
4553 |
4549 test.Next(_L("Read data using TFileText::Read\n")); |
4554 test.Next(_L("Read data using TFileText::Read\n")); |
4550 TBuf<20> fileTextReadBuf; |
4555 TBuf<20> fileTextReadBuf; |
4551 file64.Seek(ESeekStart,pos);//seek to the position where the data has been written |
4556 file64.Seek(ESeekStart,pos);//seek to the position where the data has been written |
4552 r = fileText.Read(fileTextReadBuf); |
4557 r = fileText.Read(fileTextReadBuf); |
4553 test(fileTextReadBuf == _L("AAAAAAAAAA")); |
4558 test(fileTextReadBuf == _L("AAAAAAAAAA")); |
4554 |
4559 |
4555 test.Next(_L("Seek to the file end using TFileText::Seek(ESeekEnd)\n")); |
4560 test.Next(_L("Seek to the file end using TFileText::Seek(ESeekEnd)\n")); |
4556 r = fileText.Seek(ESeekEnd); |
4561 r = fileText.Seek(ESeekEnd); |
4557 test(r == KErrNone); |
4562 test_KErrNone(r); |
4558 |
4563 |
4559 test.Next(_L("Write known data using TFileText::Write\n")); |
4564 test.Next(_L("Write known data using TFileText::Write\n")); |
4560 TBuf<20> fileTextWriteBuf(_L("AAAAAAAAAA")); |
4565 TBuf<20> fileTextWriteBuf(_L("AAAAAAAAAA")); |
4561 pos = 0; |
4566 pos = 0; |
4562 r = file64.Seek(ESeekCurrent,pos); |
4567 r = file64.Seek(ESeekCurrent,pos); |
4563 r = fileText.Write(fileTextWriteBuf); |
4568 r = fileText.Write(fileTextWriteBuf); |
4564 test(r == KErrNone); |
4569 test_KErrNone(r); |
4565 |
4570 |
4566 test.Next(_L("Read the data using RFile64::Read\n")); |
4571 test.Next(_L("Read the data using RFile64::Read\n")); |
4567 TBuf8<20> file64ReadBuf; |
4572 TBuf8<20> file64ReadBuf; |
4568 file64ReadBuf.Zero(); |
4573 file64ReadBuf.Zero(); |
4569 r = file64.Read(pos,file64ReadBuf); |
4574 r = file64.Read(pos,file64ReadBuf); |
4570 r = bufPtr.Compare(file64ReadBuf); |
4575 r = bufPtr.Compare(file64ReadBuf); |
4571 test (r == KErrNone); |
4576 test_KErrNone(r); |
4572 |
4577 |
4573 file64.Close(); |
4578 file64.Close(); |
4574 |
4579 |
4575 r = TheFs.Delete(fileName); |
4580 r = TheFs.Delete(fileName); |
4576 test(r == KErrNone); |
4581 test_KErrNone(r); |
4577 User::Free(record); |
4582 User::Free(record); |
4578 } |
4583 } |
4579 |
4584 |
4580 |
4585 |
4581 /** |
4586 /** |
4664 |
4669 |
4665 TestRFile2.Close(); |
4670 TestRFile2.Close(); |
4666 TestRFile1.Close(); |
4671 TestRFile1.Close(); |
4667 |
4672 |
4668 TInt r = TheFs.Delete(fileName); |
4673 TInt r = TheFs.Delete(fileName); |
4669 test(r == KErrNone); |
4674 test_KErrNone(r); |
4670 test.End(); |
4675 test.End(); |
4671 } |
4676 } |
4672 |
4677 |
4673 /** |
4678 /** |
4674 @SYMTestCaseID PBASE-T_FILE64BIT-0790 |
4679 @SYMTestCaseID PBASE-T_FILE64BIT-0790 |
4744 fileName1.Append(gDriveToTest); |
4749 fileName1.Append(gDriveToTest); |
4745 fileName1.Append(KTestPath); |
4750 fileName1.Append(KTestPath); |
4746 fileName1.Append(_L("File2GB.txt")); |
4751 fileName1.Append(_L("File2GB.txt")); |
4747 RFile64 file; |
4752 RFile64 file; |
4748 TInt r = file.Replace(TheFs, fileName1, EFileWrite); |
4753 TInt r = file.Replace(TheFs, fileName1, EFileWrite); |
4749 test (r == KErrNone); |
4754 test_KErrNone(r); |
4750 file.SetSize(K2GB); |
4755 file.SetSize(K2GB); |
4751 test (r == KErrNone); |
4756 test_KErrNone(r); |
4752 file.Close(); |
4757 file.Close(); |
4753 TestRFs.ReadFileSection(fileName1,0,readBuf,100); |
4758 TestRFs.ReadFileSection(fileName1,0,readBuf,100); |
4754 r = TheFs.Delete(fileName1); |
4759 r = TheFs.Delete(fileName1); |
4755 test (r == KErrNone); |
4760 test_KErrNone(r); |
4756 test.Next(_L("Creating test pattern")); |
4761 test.Next(_L("Creating test pattern")); |
4757 |
4762 |
4758 TBuf8<0x63> writeBuf63; |
4763 TBuf8<0x63> writeBuf63; |
4759 TBuf8<0x63> readBuf63; |
4764 TBuf8<0x63> readBuf63; |
4760 for (TInt count = 0; count < 0x63; count++) |
4765 for (TInt count = 0; count < 0x63; count++) |
4784 |
4789 |
4785 TestRFile2.Close(); |
4790 TestRFile2.Close(); |
4786 TestRFile1.Close(); |
4791 TestRFile1.Close(); |
4787 |
4792 |
4788 r = TheFs.Delete(fileName); |
4793 r = TheFs.Delete(fileName); |
4789 test(r == KErrNone); |
4794 test_KErrNone(r); |
4790 test.End(); |
4795 test.End(); |
4791 } |
4796 } |
4792 |
4797 |
4793 /** |
4798 /** |
4794 @SYMTestCaseID PBASE-T_FILE64BIT-2349 |
4799 @SYMTestCaseID PBASE-T_FILE64BIT-2349 |
4935 } |
4940 } |
4936 |
4941 |
4937 TestRFile1.Close(); |
4942 TestRFile1.Close(); |
4938 |
4943 |
4939 TInt r = TheFs.Delete(fileName); |
4944 TInt r = TheFs.Delete(fileName); |
4940 test(r == KErrNone); |
4945 test_KErrNone(r); |
4941 test.End(); |
4946 test.End(); |
4942 } |
4947 } |
4943 |
4948 |
4944 /** |
4949 /** |
4945 @SYMTestCaseID PBASE-T_FILE64BIT-2350 |
4950 @SYMTestCaseID PBASE-T_FILE64BIT-2350 |
5074 TestRFile1.Read(readBufx63, status8); // validating the content |
5079 TestRFile1.Read(readBufx63, status8); // validating the content |
5075 } |
5080 } |
5076 TestRFile1.Close(); |
5081 TestRFile1.Close(); |
5077 |
5082 |
5078 TInt r = TheFs.Delete(fileName); |
5083 TInt r = TheFs.Delete(fileName); |
5079 test(r == KErrNone); |
5084 test_KErrNone(r); |
5080 test.End(); |
5085 test.End(); |
5081 } |
5086 } |
5082 |
5087 |
5083 /** |
5088 /** |
5084 @SYMTestCaseID PBASE-T_FILE64BIT-2351 |
5089 @SYMTestCaseID PBASE-T_FILE64BIT-2351 |
5221 } |
5226 } |
5222 |
5227 |
5223 TestRFile1.Close(); |
5228 TestRFile1.Close(); |
5224 |
5229 |
5225 TInt r = TheFs.Delete(fileName); |
5230 TInt r = TheFs.Delete(fileName); |
5226 test(r == KErrNone); |
5231 test_KErrNone(r); |
5227 test.End(); |
5232 test.End(); |
5228 } |
5233 } |
5229 /** |
5234 /** |
5230 @SYMTestCaseID PBASE-T_FILE64BIT-2352 |
5235 @SYMTestCaseID PBASE-T_FILE64BIT-2352 |
5231 @SYMTestPriority High |
5236 @SYMTestPriority High |
5373 TRequestStatus status8 = KRequestPending;; |
5378 TRequestStatus status8 = KRequestPending;; |
5374 TestRFile1.Read(readBufx63,99,status8); |
5379 TestRFile1.Read(readBufx63,99,status8); |
5375 } |
5380 } |
5376 TestRFile1.Close(); |
5381 TestRFile1.Close(); |
5377 TInt r = TheFs.Delete(fileName); |
5382 TInt r = TheFs.Delete(fileName); |
5378 test(r == KErrNone); |
5383 test_KErrNone(r); |
5379 test.End(); |
5384 test.End(); |
5380 } |
5385 } |
5381 /** |
5386 /** |
5382 @SYMTestCaseID PBASE-T_FILE64BIT-2353 |
5387 @SYMTestCaseID PBASE-T_FILE64BIT-2353 |
5383 @SYMTestPriority High |
5388 @SYMTestPriority High |
5457 test(writeBuf == readBuf); // Written data == Read data |
5462 test(writeBuf == readBuf); // Written data == Read data |
5458 } |
5463 } |
5459 } |
5464 } |
5460 TestRFile1.Close(); |
5465 TestRFile1.Close(); |
5461 TInt r = TheFs.Delete(fileName); |
5466 TInt r = TheFs.Delete(fileName); |
5462 test(r == KErrNone); |
5467 test_KErrNone(r); |
5463 } |
5468 } |
5464 /** |
5469 /** |
5465 @SYMTestCaseID PBASE-T_FILE64BIT-2354 |
5470 @SYMTestCaseID PBASE-T_FILE64BIT-2354 |
5466 @SYMTestPriority High |
5471 @SYMTestPriority High |
5467 @SYMTestRequirement REQ9532 |
5472 @SYMTestRequirement REQ9532 |
5585 TestRFile1.Write(_L8("1234567891")); |
5590 TestRFile1.Write(_L8("1234567891")); |
5586 TestRFile1.Close(); |
5591 TestRFile1.Close(); |
5587 |
5592 |
5588 test.Next(_L("Copy the files from one folder to another using CFileMan::Copy()\n")); |
5593 test.Next(_L("Copy the files from one folder to another using CFileMan::Copy()\n")); |
5589 TInt r = fileMan->Copy(filePathOld, filePathNew, CFileMan::ERecurse | CFileMan::EOverWrite); |
5594 TInt r = fileMan->Copy(filePathOld, filePathNew, CFileMan::ERecurse | CFileMan::EOverWrite); |
5590 test(r == KErrNone || r == KErrTooBig); |
5595 test_Value(r, r == KErrNone || r == KErrTooBig); |
5591 |
5596 |
5592 test.Next(_L("Get the directory entry and find how many files are copied\n")); |
5597 test.Next(_L("Get the directory entry and find how many files are copied\n")); |
5593 // check SMALL and LARGE files have been copied |
5598 // check SMALL and LARGE files have been copied |
5594 r = dir.Open(TheFs, filePathNew, KEntryAttNormal); |
5599 r = dir.Open(TheFs, filePathNew, KEntryAttNormal); |
5595 test (r == KErrNone); |
5600 test_KErrNone(r); |
5596 r = dir.Read(entryArray); |
5601 r = dir.Read(entryArray); |
5597 test (r == KErrEof); |
5602 test_Value(r, r == KErrEof); |
5598 test(entryArray.Count() == gFilesInDirectory); |
5603 test(entryArray.Count() == gFilesInDirectory); |
5599 dir.Close(); |
5604 dir.Close(); |
5600 |
5605 |
5601 // then delete the new directory |
5606 // then delete the new directory |
5602 r = fileMan->Delete(filePathNew); |
5607 r = fileMan->Delete(filePathNew); |
5603 test(r == KErrNone); |
5608 test_KErrNone(r); |
5604 |
5609 |
5605 test.Next(_L("Set file man observer\n")); |
5610 test.Next(_L("Set file man observer\n")); |
5606 // attempt to copy to new directory again - this time with an observer |
5611 // attempt to copy to new directory again - this time with an observer |
5607 fileMan->SetObserver(observer); |
5612 fileMan->SetObserver(observer); |
5608 |
5613 |
5609 test.Next(_L("Copy the files from one folder to another, source folder has 3 small files and a large file\n")); |
5614 test.Next(_L("Copy the files from one folder to another, source folder has 3 small files and a large file\n")); |
5610 r = fileMan->Copy(filePathOld, filePathNew, CFileMan::ERecurse | CFileMan::EOverWrite); |
5615 r = fileMan->Copy(filePathOld, filePathNew, CFileMan::ERecurse | CFileMan::EOverWrite); |
5611 test(r == KErrNone || r == KErrTooBig); |
5616 test_Value(r, r == KErrNone || r == KErrTooBig); |
5612 |
5617 |
5613 test.Next(_L("Check observer for number of successful copy and failed copy\n")); |
5618 test.Next(_L("Check observer for number of successful copy and failed copy\n")); |
5614 // test that 3 small files and 1 large file were copied |
5619 // test that 3 small files and 1 large file were copied |
5615 // (For 8 GB disk, the 4GB file is missing) |
5620 // (For 8 GB disk, the 4GB file is missing) |
5616 test(observer->iNotifyEndedSuccesses == gFilesInDirectory); |
5621 test(observer->iNotifyEndedSuccesses == gFilesInDirectory); |
5617 test(observer->iNotifyEndedFailures == 0); |
5622 test(observer->iNotifyEndedFailures == 0); |
5618 |
5623 |
5619 test.Next(_L("Get the directory entry and find how many files copied\n")); |
5624 test.Next(_L("Get the directory entry and find how many files copied\n")); |
5620 // check SMALL files have been copied |
5625 // check SMALL files have been copied |
5621 r = dir.Open(TheFs, filePathNew, KEntryAttNormal); |
5626 r = dir.Open(TheFs, filePathNew, KEntryAttNormal); |
5622 test (r == KErrNone); |
5627 test_KErrNone(r); |
5623 r = dir.Read(entryArray); |
5628 r = dir.Read(entryArray); |
5624 test (r == KErrEof); |
5629 test_Value(r, r == KErrEof); |
5625 |
5630 |
5626 test(entryArray.Count() == gFilesInDirectory); |
5631 test(entryArray.Count() == gFilesInDirectory); |
5627 dir.Close(); |
5632 dir.Close(); |
5628 |
5633 |
5629 // then delete the new directory |
5634 // then delete the new directory |
5630 r = fileMan->Delete(filePathNew); |
5635 r = fileMan->Delete(filePathNew); |
5631 test(r == KErrNone); |
5636 test_KErrNone(r); |
5632 |
5637 |
5633 delete observer; |
5638 delete observer; |
5634 delete fileMan; |
5639 delete fileMan; |
5635 |
5640 |
5636 r = TheFs.Delete(fileSmall1); |
5641 r = TheFs.Delete(fileSmall1); |
5637 test(r == KErrNone); |
5642 test_KErrNone(r); |
5638 r = TheFs.Delete(fileSmall2); |
5643 r = TheFs.Delete(fileSmall2); |
5639 test(r == KErrNone); |
5644 test_KErrNone(r); |
5640 r = TheFs.Delete(fileSmall3); |
5645 r = TheFs.Delete(fileSmall3); |
5641 test(r == KErrNone); |
5646 test_KErrNone(r); |
5642 r = TheFs.Delete(fileLarge1); |
5647 r = TheFs.Delete(fileLarge1); |
5643 test(r == KErrNone); |
5648 test_KErrNone(r); |
5644 } |
5649 } |
5645 /** |
5650 /** |
5646 @SYMTestCaseID PBASE-T_FILE64BIT-2355 |
5651 @SYMTestCaseID PBASE-T_FILE64BIT-2355 |
5647 @SYMTestPriority High |
5652 @SYMTestPriority High |
5648 @SYMTestRequirement REQ9532 |
5653 @SYMTestRequirement REQ9532 |
5716 TestRFile1.Close(); |
5721 TestRFile1.Close(); |
5717 |
5722 |
5718 |
5723 |
5719 // move to new directory |
5724 // move to new directory |
5720 TInt r = fileMan->Move(filePathOld, filePathNew, CFileMan::ERecurse | CFileMan::EOverWrite); |
5725 TInt r = fileMan->Move(filePathOld, filePathNew, CFileMan::ERecurse | CFileMan::EOverWrite); |
5721 test(r == KErrNone || r == KErrTooBig); |
5726 test_Value(r, r == KErrNone || r == KErrTooBig); |
5722 |
5727 |
5723 // check SMALL and LARGE files have been moved |
5728 // check SMALL and LARGE files have been moved |
5724 RDir dir; |
5729 RDir dir; |
5725 r = dir.Open(TheFs, filePathNew, KEntryAttNormal); |
5730 r = dir.Open(TheFs, filePathNew, KEntryAttNormal); |
5726 test (r == KErrNone); |
5731 test_KErrNone(r); |
5727 TEntryArray entryArray; |
5732 TEntryArray entryArray; |
5728 r = dir.Read(entryArray); |
5733 r = dir.Read(entryArray); |
5729 test (r == KErrEof); |
5734 test_Value(r, r == KErrEof); |
5730 test(entryArray.Count() == 4); |
5735 test(entryArray.Count() == 4); |
5731 dir.Close(); |
5736 dir.Close(); |
5732 |
5737 |
5733 // then delete the new directory |
5738 // then delete the new directory |
5734 r = fileMan->Delete(filePathNew); |
5739 r = fileMan->Delete(filePathNew); |
5735 test(r == KErrNone); |
5740 test_KErrNone(r); |
5736 delete fileMan; |
5741 delete fileMan; |
5737 } |
5742 } |
5738 |
5743 |
5739 |
5744 |
5740 static void TestOpenFiles() |
5745 static void TestOpenFiles() |
5754 static void TestAdoptFiles() |
5759 static void TestAdoptFiles() |
5755 { |
5760 { |
5756 TInt r; |
5761 TInt r; |
5757 RFs fs; |
5762 RFs fs; |
5758 r = fs.Connect(); |
5763 r = fs.Connect(); |
5759 test(r == KErrNone); |
5764 test_KErrNone(r); |
5760 r = fs.ShareProtected(); |
5765 r = fs.ShareProtected(); |
5761 test(r == KErrNone); |
5766 test_KErrNone(r); |
5762 TFileName sessionp; |
5767 TFileName sessionp; |
5763 fs.SessionPath(sessionp); |
5768 fs.SessionPath(sessionp); |
5764 r = fs.MkDirAll(sessionp); |
5769 r = fs.MkDirAll(sessionp); |
5765 test(r == KErrNone || r == KErrAlreadyExists); |
5770 test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
5766 fs.Close(); |
5771 fs.Close(); |
5767 TestRFile64AdoptFromCreator(); |
5772 TestRFile64AdoptFromCreator(); |
5768 TestRFile64AdoptFromClient(); |
5773 TestRFile64AdoptFromClient(); |
5769 TestRFile64AdoptFromServer(); |
5774 TestRFile64AdoptFromServer(); |
5770 } |
5775 } |
5900 TRequestStatus status1=KRequestPending; |
5905 TRequestStatus status1=KRequestPending; |
5901 TRequestStatus status2=KRequestPending; |
5906 TRequestStatus status2=KRequestPending; |
5902 |
5907 |
5903 // If a zero length is passed into the Write function, KErrNone should be returned. |
5908 // If a zero length is passed into the Write function, KErrNone should be returned. |
5904 r=aFile.Write(aPos,gBuf); |
5909 r=aFile.Write(aPos,gBuf); |
5905 test(r==KErrNone); |
5910 test_KErrNone(r); |
5906 |
5911 |
5907 // If the length is a negative, KErrArgument should be returned. |
5912 // If the length is a negative, KErrArgument should be returned. |
5908 r=aFile.Write(aPos,gBuf,aLen); |
5913 r=aFile.Write(aPos,gBuf,aLen); |
5909 test(r==KErrArgument); |
5914 test_Value(r, r == KErrArgument); |
5910 |
5915 |
5911 // Test the asynchronous requests |
5916 // Test the asynchronous requests |
5912 aFile.Write(aPos,gBuf,aLen,status1); |
5917 aFile.Write(aPos,gBuf,aLen,status1); |
5913 aFile.Write(aPos,gBuf,aLen,status2); |
5918 aFile.Write(aPos,gBuf,aLen,status2); |
5914 User::WaitForRequest(status1); |
5919 User::WaitForRequest(status1); |
5916 User::WaitForRequest(status2); |
5921 User::WaitForRequest(status2); |
5917 test(status2.Int()==KErrArgument); |
5922 test(status2.Int()==KErrArgument); |
5918 |
5923 |
5919 aFile.Close(); |
5924 aFile.Close(); |
5920 r = TheFs.Delete(_L("\\testRFile64NegLen.txt")); |
5925 r = TheFs.Delete(_L("\\testRFile64NegLen.txt")); |
5921 test(r == KErrNone); |
5926 test_KErrNone(r); |
5922 test.End(); |
5927 test.End(); |
5923 } |
5928 } |
5924 //------------------------------------------------------------------------------------------------------------------- |
5929 //------------------------------------------------------------------------------------------------------------------- |
5925 |
5930 |
5926 static TInt PrepareDisk(TInt aDrive) |
5931 static TInt PrepareDisk(TInt aDrive) |
5978 |
5983 |
5979 void CallTestsL() |
5984 void CallTestsL() |
5980 { |
5985 { |
5981 TInt r; |
5986 TInt r; |
5982 r = RFs::CharToDrive(gDriveToTest, gDrive); |
5987 r = RFs::CharToDrive(gDriveToTest, gDrive); |
5983 test(r == KErrNone); |
5988 test_KErrNone(r); |
5984 |
5989 |
5985 //-- set up console output |
5990 //-- set up console output |
5986 F32_Test_Utils::SetConsole(test.Console()); |
5991 F32_Test_Utils::SetConsole(test.Console()); |
5987 |
5992 |
5988 PrintDrvInfo(TheFs, gDrive); |
5993 PrintDrvInfo(TheFs, gDrive); |
6027 // Delete the test directory |
6032 // Delete the test directory |
6028 TFileName dirName; |
6033 TFileName dirName; |
6029 dirName.Append(gDriveToTest); |
6034 dirName.Append(gDriveToTest); |
6030 dirName.Append(KTestPath); |
6035 dirName.Append(KTestPath); |
6031 r = TheFs.RmDir(dirName); |
6036 r = TheFs.RmDir(dirName); |
6032 test(r == KErrNone); |
6037 test_KErrNone(r); |
6033 } |
6038 } |
6034 |
6039 |
6035 |
6040 |
6036 |
6041 |
6037 |
6042 |
6038 |
6043 |
6039 |
6044 |
6040 |
6045 |