Update contrib.
1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // //File Name: f32test/server/t_file64bit.cpp
15 // //Description:This file contains implementation for checking the 64bit file
16 // // server functionality. All the affected APIs are tested.
17 // //While generating a file for reading, the contents are generated such that
18 // //every four bytes of the file contains its location. So the file would be
20 // // 0000: 00 00 00 00
21 // // 0004: 04 00 00 00
22 // // 0008: 08 00 00 00
32 #include "t_file64bit.h"
33 #include "..\\fileshare\\handshare64bit.h"
34 #include <f32pluginutils.h>
35 #include <massstorage.h>
37 #include "f32_test_utils.h"
39 using namespace F32_Test_Utils;
41 RTest test(_L("T_FILE64BIT Tests"));
43 _LIT(KTestPath, ":\\F32-TST\\TFILE64BIT\\");
45 // to test any file system that supports file sizes of greater than 4GB -1,
46 // this value shall be set.
47 TBool KFileSizeMaxLargerThan4GBMinusOne = EFalse;
51 TInt GenerateBigFileContents()
53 test.Printf(_L("GenerateBigFileContents()\n"));
56 const TUint KBufSize = 256*K1KiloByte;
59 r = buf.CreateMax(KBufSize);
64 fileName.Append(gDriveToTest);
65 fileName.Append(KTestPath);
66 fileName.Append(_L("File4GBMinusOne.txt"));
67 r = file.Replace(TheFs,fileName, EFileWrite);
70 r = file.SetSize(K4GBMinusOne);
73 TInt64 nNumberOfBytesToWrite = 0;
74 TInt64 nNumberOfBytesWritten = 0;
75 for (TInt64 pos = 0; pos < K4GBMinusOne; pos += nNumberOfBytesWritten)
77 // Prepare the write buffer
78 for (TUint n = 0; n<KBufSize; n += 4)
80 *((TUint*) &buf[n]) = I64LOW(pos + n);
83 nNumberOfBytesToWrite = Min(MAKE_TINT64(0,KBufSize), K4GBMinusOne - pos);
84 TPtrC8 pText(buf.Ptr(), KBufSize);
86 file.Write(pText, (TInt)nNumberOfBytesToWrite);
88 nNumberOfBytesWritten = nNumberOfBytesToWrite;
93 test.Printf(_L("\nFile writing is completed!!"));
103 TInt RFileHandleSharer64Bit::Connect()
105 return CreateSession(KServerName, TVersion(1,0,0));
109 TInt RFileHandleSharer64Bit::Exit()
111 return SendReceive(EMsgExit, TIpcArgs(NULL));
114 TInt RFileHandleSharer64Bit::SetTestDrive(TInt aDrive)
116 return SendReceive(EMsgDrive, TIpcArgs(aDrive));
119 TInt RFileHandleSharer64Bit::PassFileHandleProcessLargeFileClient(TIpcArgs& aIpcArgs)
121 return SendReceive(EMsgPassFileHandleProcessLargeFileClient, aIpcArgs);
124 TInt RFileHandleSharer64Bit::PassFileHandleProcessLargeFileCreator()
126 return SendReceive(EMsgPassFileHandleProcessLargeFileCreator);
129 TInt RFileHandleSharer64Bit::GetFileHandleLargeFile2(TInt &aHandle, TFileMode aFileMode)
132 TInt fsh = SendReceive(EMsgGetFileHandleLargeFile, TIpcArgs(&fh, aFileMode));
137 void RFileHandleSharer64Bit::Sync()
139 SendReceive(EMsgSync, TIpcArgs());
143 CFileManObserver::CFileManObserver(CFileMan* aFileMan)
145 __DECLARE_NAME(_S("CFileManObserver"));
149 MFileManObserver::TControl CFileManObserver::NotifyFileManStarted()
151 return(MFileManObserver::EContinue);
154 MFileManObserver::TControl CFileManObserver::NotifyFileManOperation()
156 return(MFileManObserver::EContinue);
159 MFileManObserver::TControl CFileManObserver::NotifyFileManEnded()
161 TInt lastError = iFileMan->GetLastError();
162 TFileName fileName = iFileMan->CurrentEntry().iName;
163 test.Printf(_L("NotifyFileManEnded(): Error %d File %S\n"),lastError, &fileName);
164 if (lastError == KErrNone)
165 iNotifyEndedSuccesses++;
167 iNotifyEndedFailures++;
168 return(MFileManObserver::EContinue);
173 RFsTest& RFsTest::Replace(const TDesC &anOldName, const TDesC &aNewName)
175 // Replaces a single file with another
178 test.Printf(_L("%S File Replaced with %S\n"),&anOldName,&aNewName);\
179 TInt r = TheFs.Replace(anOldName,aNewName);
184 RFsTest& RFsTest::ReadFileSection(const TDesC& aName, TInt64 aPos,TDes8& aBuffer,TInt aLen)
186 // Reads data from the file without opening it. Expected not to fail.
189 test.Printf(_L("Read File Section %S\n"),&aName);
190 TInt r = TheFs.ReadFileSection(aName,aPos,aBuffer,aLen);
191 TInt len = aBuffer.Length();
193 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
205 test (r == KErrNone);
211 RFsTest& RFsTest::GetDir(const TDesC &aName, TUint anEntryAttMask, TUint anEntrySortKey, CDir *&anEntryList)
213 // Gets a filtered list of a directory's contents.
216 test.Printf(_L("Name of the directory for which listing is required %S\n"),&aName);
217 TInt r = TheFs.GetDir(aName,anEntryAttMask,anEntrySortKey,anEntryList);
222 RFsTest& RFsTest::GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,CDir*& aDirList)
224 // Gets a filtered list of the directory and the file entries contained in a directory and a
225 // list of the directory entries only.
227 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);
233 RFsTest& RFsTest::GetDir(const TDesC& aName,const TUidType& anEntryUid,TUint anEntrySortKey,CDir*& aFileList)
235 // Gets a filtered list of directory contents by UID type.
238 test.Printf(_L("Name of the directory for which listing is required %S\n"),&aName);
239 TInt r = TheFs.GetDir(aName,anEntryUid,anEntrySortKey,aFileList);
245 RFileTest::RFileTest(const TDesC& aName)
252 RFileTest& RFileTest::Create(const TDesC& aName, TUint aFileMode)
254 // Creates and opens a new file for writing, if the file already exists an error is returned
257 test.Printf(_L("%S create %S in %d Mode\n"),&iName,&aName,aFileMode);
258 TInt r = RFile64::Create(TheFs,aName,aFileMode);
259 test(r == KErrNone || r == KErrAlreadyExists);
263 RFileTest& RFileTest::Replace(const TDesC& aName)
265 // Opens a file for writing, replacing the content of any existing file of the same name
266 // if it exists or cretaing a new file if it does not exist.
269 test.Printf(_L("%S replace %S\n"),&iName,&aName);
270 TInt r = RFile64::Replace(TheFs,aName,EFileStream|EFileWrite);
275 RFileTest& RFileTest::Replace(const TDesC& aName, TUint aFileMode)
277 // Opens a file in aFileMode, replacing the content of any existing file of the same name
278 // if it exists or cretaing a new file if it does not exist.
281 test.Printf(_L("%S replace %S in %d Mode\n"),&iName,&aName, aFileMode);
282 TInt r = RFile64::Replace(TheFs,aName,aFileMode);
286 test(r == KErrBadName);
290 RFileTest& RFileTest::Open(const TDesC& aName)
292 // Open a existing file for reading and writing in shared access mode.
295 test.Printf(_L("%S open %S\n"),&iName,&aName);
296 TInt r = RFile64::Open(TheFs,aName,EFileWrite|EFileShareAny);
301 RFileTest& RFileTest::Open(const TDesC& aName, TUint aFileMode)
303 // Opens an existing file using aFileMode.
306 test.Printf(_L("%S open %S in %d Mode\n"),&iName,&aName, aFileMode);
307 TInt r = RFile64::Open(TheFs,aName,aFileMode);
312 RFileTest& RFileTest::Temp(const TDesC& aPath,TFileName& aName,TUint aFileMode)
314 // Creates and opens a temporary file with a unique name for writing and reading.
317 test.Printf(_L("%S Temp file %S in %d Mode\n"),&iName,&aName, aFileMode);
318 TInt r = RFile64::Temp(TheFs,aPath,aName,aFileMode);
323 void RFileTest::Close()
331 RFileTest& RFileTest::Lock(TInt64 aPos, TInt64 aLen)
333 // Set a lock on the file. Expected not to fail.
336 test.Printf(_L("%S lock 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
337 TInt r = RFile64::Lock(aPos,aLen);
342 RFileTest& RFileTest::LockE(TInt64 aPos, TInt64 aLen)
344 // Set a lock on the file. Expected to fail.
347 test.Printf(_L("%S lockE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
348 TInt r = RFile64::Lock(aPos,aLen);
349 test(r == KErrLocked);
353 RFileTest& RFileTest::UnLock(TInt64 aPos, TInt64 aLen)
355 // Unlock the file. Expected not to fail.
358 test.Printf(_L("%S ulock 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
359 TInt r = RFile64::UnLock(aPos,aLen);
364 RFileTest& RFileTest::UnLockE(TInt64 aPos, TInt64 aLen)
366 // Unlock the file. Expected to fail.
369 test.Printf(_L("%S ulockE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
370 TInt r = RFile64::UnLock(aPos,aLen);
371 test(r == KErrNotFound);
375 RFileTest& RFileTest::Write(const TDesC8& aDes)
377 // Write to the file.
380 test.Printf(_L("%S write\n"),&iName);
383 TInt rr = RFile64::Seek(ESeekCurrent,seekPos);
384 test(rr == KErrNone);
386 TInt r = RFile64::Write(aDes);
387 if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
388 r = RFile64::Flush();
391 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
393 if((seekPos + aDes.Length()) < K4GB)
396 test(r == KErrNotSupported);
400 test (r == KErrNone);
405 RFileTest& RFileTest::Write(const TDesC8 &aDes, TRequestStatus &aStatus)
407 // Write to the file.
410 test.Printf(_L("%S write\n"),&iName);
413 TInt rr = RFile64::Seek(ESeekCurrent,seekPos);
414 test(rr == KErrNone);
416 RFile64::Write(aDes, aStatus);
417 User::WaitForRequest(aStatus);
418 if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
420 RFile64::Flush(aStatus);
421 User::WaitForRequest(aStatus);
423 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
425 if((seekPos + aDes.Length()) < K4GB)
426 test(aStatus.Int() == KErrNone);
428 test(aStatus.Int() == KErrNotSupported);
433 test(aStatus.Int() == KErrNone);
438 RFileTest& RFileTest::Write(const TDesC8& aDes, TInt aLength)
440 // Write aLength specified number of bytes to the file.
443 test.Printf(_L("%S write\n"),&iName);
446 TInt rr = RFile64::Seek(ESeekCurrent,seekPos);
447 test(rr == KErrNone);
449 TInt r = RFile64::Write(aDes, aLength);
450 if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
451 r = RFile64::Flush();
452 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
454 if((seekPos + aLength) < K4GB)
457 test(r == KErrNotSupported);
466 RFileTest& RFileTest::Write(const TDesC8& aDes, TInt aLength, TRequestStatus &aStatus)
468 // Write aLength specified number of bytes to the file. Expected not to fail (Asynchronous).
471 test.Printf(_L("%S write\n"),&iName);
474 TInt rr = RFile64::Seek(ESeekCurrent,seekPos);
475 test(rr == KErrNone);
477 RFile64::Write(aDes,aLength,aStatus);
478 User::WaitForRequest(aStatus);
479 if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
481 RFile64::Flush(aStatus);
482 User::WaitForRequest(aStatus);
485 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
487 if((seekPos + aLength) < K4GB)
488 test(aStatus.Int() == KErrNone);
490 test(aStatus.Int() == KErrNotSupported);
494 test(aStatus.Int() == KErrNone);
499 RFileTest& RFileTest::WriteP(TInt64 aPos, const TDesC8& aDes)
501 // Write to the file. Expected not to fail.
504 test.Printf(_L("%S write 0x%lx\n"),&iName,aPos);
505 TInt r = RFile64::Write(aPos,aDes);
506 if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
507 r = RFile64::Flush();
508 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
510 if ((aPos + aDes.Length()) < K4GB)
513 test(r == KErrNotSupported);
522 RFileTest& RFileTest::WriteU(TUint aPos, const TDesC8& aDes)
524 // Write to the file. Expected not to fail.
525 // Position is a TUint value
528 test.Printf(_L("%S write %08x\n"),&iName,aPos);
529 TInt r = RFile64::Write(aPos,aDes);
530 if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
531 r = RFile64::Flush();
537 RFileTest& RFileTest::Write(TInt64 aPos, const TDesC8& aDes, TInt aLen)
539 // Write to the file. Synchronous Expected not to fail.
542 test.Printf(_L("%S write 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
543 TInt r = RFile64::Write(aPos,aDes,aLen);
544 if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
545 r = RFile64::Flush();
546 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
548 if ((aPos + aLen) < K4GB)
551 test(r == KErrArgument);
556 test(r == KErrNotSupported);
561 test(r == KErrArgument);
568 RFileTest& RFileTest::WriteU(TUint aPos, const TDesC8& aDes, TInt aLen)
570 // Write to the file. Synchronous Expected not to fail.
571 // Position is a TUint value
574 test.Printf(_L("%S write %08x-%08x\n"),&iName,aPos,aPos+aLen-1);
575 TInt r = RFile64::Write(aPos,aDes,aLen);
576 if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
577 r = RFile64::Flush();
583 RFileTest& RFileTest::WriteE(TInt64 aPos, const TDesC8& aDes, TInt aLen)
585 // Write to the file. Expected to fail.
588 test.Printf(_L("%S writeE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
589 TInt r = RFile64::Write(aPos,aDes,aLen);
591 test(r == KErrArgument);
593 test(r == KErrLocked);
597 RFileTest& RFileTest::Write(TInt64 aPos, const TDesC8& aDes, TInt aLen, TRequestStatus &aStatus)
599 // Write to the file. Asynchronous
601 test.Printf(_L("%S write 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
602 RFile64::Write(aPos,aDes,aLen,aStatus);
603 User::WaitForRequest(aStatus);
604 if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
606 RFile64::Flush(aStatus);
607 User::WaitForRequest(aStatus);
611 test(aStatus.Int() == KErrArgument);
614 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
616 if((aPos + aLen) < K4GB)
617 test(aStatus.Int() == KErrNone);
619 test(aStatus.Int() == KErrNotSupported);
622 test(aStatus.Int() == KErrNone);
627 RFileTest& RFileTest::Write(TInt64 aPos, const TDesC8& aDes, TRequestStatus &aStatus)
629 // Write to the file (Asynchronous).
631 test.Printf(_L("%S write 0x%lx\n"),&iName,aPos);
632 RFile64::Write(aPos,aDes,aStatus);
633 User::WaitForRequest(aStatus);
634 if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
636 RFile64::Flush(aStatus);
637 User::WaitForRequest(aStatus);
641 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
643 if((aPos + aDes.Length()) < K4GB)
644 test(aStatus.Int() == KErrNone);
646 test(aStatus.Int() == KErrNotSupported);
650 test(aStatus.Int() == KErrNone);
655 RFileTest& RFileTest::WriteU(TUint aPos, const TDesC8& aDes, TRequestStatus &aStatus)
657 // Write to the file (Asynchronous).
658 // Position is a TUint value
661 test.Printf(_L("%S write %08x\n"),&iName,aPos);
662 RFile64::Write(aPos,aDes,aStatus);
663 User::WaitForRequest(aStatus);
664 if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
666 RFile64::Flush(aStatus);
667 User::WaitForRequest(aStatus);
669 test(aStatus.Int() == KErrNone);
673 RFileTest& RFileTest::WriteU(TUint aPos, const TDesC8& aDes, TInt aLen, TRequestStatus &aStatus)
675 // Write to the file. Asynchronous
676 // Position is a TUint value
679 test.Printf(_L("%S write %08x-%08x\n"),&iName,aPos,aPos+aLen-1);
680 RFile64::Write(aPos,aDes,aLen,aStatus);
681 User::WaitForRequest(aStatus);
682 if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
684 RFile64::Flush(aStatus);
685 User::WaitForRequest(aStatus);
689 test(aStatus.Int() == KErrArgument);
691 test(aStatus.Int() == KErrNone);
697 RFileTest& RFileTest::Read(TDes8& aDes)
699 // Read from the file. Expected not to fail (Synchronous).
702 test.Printf(_L("%S read \n"),&iName);
703 TInt r = RFile64::Read(aDes);
708 RFileTest& RFileTest::Read(TDes8& aDes, TRequestStatus& aStatus)
710 // Read from the file. Expected not to fail (Asynchronous).
714 test.Printf(_L("%S read \n"),&iName);
715 RFile64::Read(aDes, aStatus);
716 User::WaitForRequest(aStatus);
717 TInt len = aDes.Length();
718 TInt rr = RFile64::Size(size);
719 test(rr == KErrNone);
720 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
723 test(aStatus.Int() == KErrNone);
726 test(aStatus.Int() == KErrNone);
732 test(aStatus.Int() == KErrNone);
737 RFileTest& RFileTest::Read(TDes8& aDes,TInt aLen,TRequestStatus& aStatus)
739 // Read from the file. Expected not to fail (Asynchronous).
743 test.Printf(_L("%S read \n"),&iName);
744 RFile64::Read(aDes,aLen,aStatus);
745 User::WaitForRequest(aStatus);
746 TInt len = aDes.Length();
747 TInt rr = RFile64::Size(size);
748 test(rr == KErrNone);
749 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
752 test(aStatus.Int() == KErrNone);
755 test(aStatus.Int() == KErrNone);
761 test(aStatus.Int() == KErrNone);
766 RFileTest& RFileTest::Read(TDes8 &aDes, TInt aLen)
768 // Read from the file. Expected not to fail (Synchronous).
771 test.Printf(_L("%S read 0x%08x bytes\n"),&iName,aLen);
772 TInt r = RFile64::Read(aDes,aLen);
774 test(r == KErrArgument);
780 RFileTest& RFileTest::Read(TInt64 aPos, TDes8& aDes, TInt aLen)
782 // Read from the file. Expected not to fail (Synchronous).
785 test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
786 TInt r = RFile64::Read(aPos,aDes,aLen);
787 TInt len = aDes.Length();
789 test(r == KErrArgument);
792 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
800 RFileTest& RFileTest::ReadE(TInt64 aPos, TDes8& aDes, TInt aLen)
802 // Reads the specified number of bytes from the file at a specified offset. Expected to fail.
805 test.Printf(_L("%S readE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
806 TInt r = RFile64::Read(aPos,aDes,aLen);
807 test(r == KErrLocked);
811 RFileTest& RFileTest::Read(TInt64 aPos, TDes8& aDes, TInt aLen, TRequestStatus& aStatus)
813 // Reads the specified number of bytes from the file at a specified offset, Expected not to fail (Asynchronous).
816 test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
817 RFile64::Read(aPos,aDes,aLen,aStatus);
818 User::WaitForRequest(aStatus);
819 TInt len = aDes.Length();
821 test(aStatus.Int() == KErrArgument);
823 test(aStatus.Int() == KErrNone);
824 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
832 RFileTest& RFileTest::ReadP(TInt64 aPos, TDes8& aDes)
834 // Reads from the file at the specfied offset with in the file (Synchronous).
837 test.Printf(_L("%S read 0x%lx\n"),&iName,aPos);
838 TInt r = RFile64::Read(aPos,aDes);
843 RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes)
845 // Reads from the file at the specfied offset with in the file (Synchronous).
846 // Offset is specified as a TUint value.
849 test.Printf(_L("%S read 0x%lx\n"),&iName,aPos);
850 TInt r = RFile64::Read(aPos,aDes);
855 RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes,TRequestStatus& aStatus)
857 // Reads from the file at the specfied offset with in the file (Asynchronous).
858 // Offset is specified as a TUint value.
861 test.Printf(_L("%S read 0x%lx\n"),&iName,aPos);
862 RFile64::Read(aPos,aDes,aStatus);
863 User::WaitForRequest(aStatus);
864 test(aStatus.Int() == KErrNone);
868 RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes, TInt aLen)
870 // Read from the file. Expected not to fail (Synchronous).
871 // Offset is specified as a TUint value.
874 test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
875 TInt r = RFile64::Read(aPos,aDes,aLen);
877 test(r == KErrArgument);
883 RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes, TInt aLen, TRequestStatus& aStatus)
885 // Reads the specified number of bytes from the file at a specified offset, Expected not to fail (Asynchronous).
886 // Offset is specified as a TUint value.
889 test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
890 RFile64::Read(aPos,aDes,aLen,aStatus);
891 User::WaitForRequest(aStatus);
893 test(aStatus.Int() == KErrArgument);
895 test(aStatus.Int() == KErrNone);
900 RFileTest& RFileTest::Read(TInt64 aPos, TDes8& aDes, TRequestStatus& aStatus)
902 // Reads from the file at the specfied offset with in the file (Asynchronous).
905 test.Printf(_L("%S read 0x%lx\n"),&iName,aPos);
906 RFile64::Read(aPos,aDes,aStatus);
907 User::WaitForRequest(aStatus);
908 test(aStatus.Int() == KErrNone);
912 RFileTest& RFileTest::SetSize(TInt64 aSize)
914 // Set the size of the file. Expected not to fail.
917 test.Printf(_L("%S size: 0x%lx\n"),&iName,aSize);
918 TInt r = RFile64::SetSize(aSize);
919 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
924 test(r == KErrNotSupported);
933 RFileTest& RFileTest::SetSizeE(TInt64 aSize)
935 // Set the size of the file. Expected to fail.
938 test.Printf(_L("%S sizeE: 0x%lx\n"),&iName,aSize);
939 TInt r = RFile64::SetSize(aSize);
940 test(r == KErrLocked);
944 RFileTest& RFileTest::Size(TInt64& aSize)
946 // Gets the current file size. Expected not to fail.
949 TInt r = RFile64::Size(aSize);
950 test.Printf(_L("%S size: 0x%lx\n"),&iName,aSize);
952 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
957 test(r == KErrTooBig);
966 RFileTest& RFileTest::Seek(TSeek aMode, TInt64& aPos)
968 // Sets the current file position. Expected not to fail.
971 test.Printf(_L("Seek to pos %LD in %d Mode\n"),aPos, aMode);
972 TInt r = RFile64::Seek(aMode, aPos);
974 test(r == KErrArgument);
981 @SYMTestCaseID PBASE-T_FILE64BIT-0756
982 @SYMTestPriority High
983 @SYMTestRequirement REQ9531
985 @SYMTestCaseDesc Test opening a large file = 2GB in size
987 1) Gets the entry details for a file using RFs::Entry(). The original file size=2GB
988 2) Open a large file whose size = 2GB, with File Mode = EFileRead
990 @SYMTestExpectedResults
992 2) KErrNone, File open successful
993 3) File closed successfully
994 @SYMTestStatus Implemented
999 TInt64 testSize, size = 0;
1001 fileName.Append(gDriveToTest);
1002 fileName.Append(KTestPath);
1003 fileName.Append(_L("File2GB.txt"));
1007 test.Next(_L("Create the file using RFile64::Replace and set the size and close"));
1008 TestRFile1.Replace(fileName);
1009 TestRFile1.SetSize(testSize);
1013 test.Next(_L("2GB File: Open"));
1014 TInt r = TheFs.Entry(fileName, entry);
1015 test(r == KErrNone);
1016 test((TUint) entry.iSize == testSize);
1018 TestRFile1.Open(fileName, EFileRead);
1021 TestRFile1.Size(size);
1022 test(size == testSize);
1025 r = TheFs.Delete(fileName);
1026 test(r == KErrNone);
1030 @SYMTestCaseID PBASE-T_FILE64BIT-0757
1031 @SYMTestPriority High
1032 @SYMTestRequirement REQ9531
1034 @SYMTestCaseDesc Test opening a large file = 3GB in size
1036 1) Gets the entry details for a file using RFs::GetEntry(). The original file size=3GB
1037 2) Open a large file whose size = 3GB, with File Mode = EFileRead
1039 @SYMTestExpectedResults
1041 2) KErrNone, File open successful
1042 3) File closed successfully
1043 @SYMTestStatus Implemented
1049 TInt64 testSize, size = 0;
1051 fileName.Append(gDriveToTest);
1052 fileName.Append(KTestPath);
1053 fileName.Append(_L("File3GB.txt"));
1056 test.Next(_L("Create the file using RFile64::Replace and set the size and close"));
1057 TestRFile1.Replace(fileName);
1058 TestRFile1.SetSize(testSize);
1061 test.Next(_L("3GB File: Open"));
1062 r = TheFs.Entry(fileName, entry);
1063 test(r == KErrNone);
1064 test((TUint) entry.iSize == testSize);
1066 TestRFile1.Open(fileName,EFileRead);
1068 TestRFile1.Size(size);
1069 test(size == testSize);
1072 r = TheFs.Delete(fileName);
1073 test(r == KErrNone);
1077 @SYMTestCaseID PBASE-T_FILE64BIT-0758
1078 @SYMTestPriority High
1079 @SYMTestRequirement REQ9531
1081 @SYMTestCaseDesc Test opening a large file < 4GB in size
1083 1) Gets the entry details for a file using RFs::GetEntry(). The original file size=4GB-1
1084 2) Open a large file whose size = 4GB-1, with File Mode = EFileRead
1086 @SYMTestExpectedResults
1087 1) File size = 4GB-1
1088 2) KErrNone, File open successful
1089 3) File closed successfully
1090 @SYMTestStatus Implemented
1092 void TestOpen4GBMinusOne()
1096 TInt64 testSize, size = 0;
1098 fileName.Append(gDriveToTest);
1099 fileName.Append(KTestPath);
1100 fileName.Append(_L("File4GBMinusOne.txt"));
1103 test.Next(_L("Create the file using RFile64::Replace and set the size and close"));
1104 TestRFile1.Replace(fileName);
1105 TestRFile1.SetSize(testSize);
1108 test.Next(_L("4GB-1 File: Open"));
1109 r = TheFs.Entry(fileName, entry);
1110 test(r == KErrNone);
1112 test((TUint) entry.iSize == testSize);
1114 TestRFile1.Open(fileName, EFileRead);
1116 TestRFile1.Size(size);
1118 test(size == testSize);
1121 r = TheFs.Delete(fileName);
1122 test(r == KErrNone);
1126 @SYMTestCaseID PBASE-T_FILE64BIT-0759
1127 @SYMTestPriority High
1128 @SYMTestRequirement REQ9531
1130 @SYMTestCaseDesc Test opening a large file 4GB in size
1132 1) Gets the entry details for a file using RFs::GetEntry(). The original file size=4GB
1133 2) Open a large file whose size = 4GB, with File Mode = EFileRead
1135 @SYMTestExpectedResults
1137 2) KErrNone, File open successful
1138 3) File closed successfully
1139 @SYMTestStatus Implemented
1145 TInt64 testSize, size = 0;
1147 fileName.Append(gDriveToTest);
1148 fileName.Append(KTestPath);
1149 fileName.Append(_L("File4GB.txt"));
1152 test.Next(_L("Create the file using RFile64::Replace and set the size and close"));
1153 TestRFile1.Replace(fileName);
1154 TestRFile1.SetSize(testSize);
1157 test.Next(_L("4GB File: Open"));
1158 r = TheFs.Entry(fileName, entry);
1159 test(r == KErrNone);
1161 if ((TUint) entry.iSize == testSize)
1163 TestRFile1.Open(fileName, EFileRead);
1164 TestRFile1.Size(size);
1165 test(size == testSize);
1169 r = TheFs.Delete(fileName);
1170 test(r == KErrNone);
1175 @SYMTestCaseID PBASE-T_FILE64BIT-0760
1176 @SYMTestPriority High
1177 @SYMTestRequirement REQ9531
1179 @SYMTestCaseDesc Tests opening a large file > 2GB in size
1181 1) Create a new file named "File4GBMinusOne.txt"
1182 2) Open the file with file mode = EFileWrite
1183 3) Set the file size to 4GB-1
1184 4) Write few bytes to the file and close
1186 6) Open the file "File4GBMinusOne.txt"
1187 7) If FAT32 file system, set the file size to 4GB
1189 9) Open the file with file mode = EDeleteOnClose
1190 @SYMTestExpectedResults
1191 1) File creation successful with KErrNone
1192 2) File open successful with KErrNone
1193 3) KErrNone, Sets the file size to 4GB-1
1194 4) KErrNone, write is successful and file closed successfully
1195 5) File closed successfully
1196 6) KErrNone, file open successful
1197 7) KErrNotSupported. For next generation file system KErrNone is expected
1198 8) File closed successfully
1199 9) File open failed with KErrArgument
1200 @SYMTestStatus Implemented
1202 void TestOpenMoreThan2GB()
1204 // constants and literals
1205 test.Next(_L("\nTest Files of size more than 2GB\n"));
1208 TBuf8<KBUFSIZE> readBuf;
1210 fileName.Append(gDriveToTest);
1211 fileName.Append(KTestPath);
1212 fileName.Append(_L("File4GBMinusOne.txt"));
1214 test.Start(_L("Test to create a large file > 2GB\n"));
1216 TestRFile1.Replace(fileName);
1217 test.Next(_L("Set the file size to 4GB-1\n"));
1219 size = K4GBMinusOne;
1220 TestRFile1.SetSize(size);
1224 for(TInt count = 0; count < 10; count++)
1226 writeBuf.Append(count);
1229 test.Next(_L("Write 10 bytes to the file\n"));
1230 TestRFile1.Write(0, writeBuf, 10);
1231 test.Next(_L("Read 10 bytes from position 0\n"));
1232 TestRFile1.Read(0, readBuf, 10);
1233 test(writeBuf == readBuf);
1239 test.Printf(_L("\nFile size is less than 4 GB !!!!\n"));
1244 test.Next(_L("Open the file File4GBMinusOne.txt\n"));
1245 TestRFile1.Open(fileName);
1247 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1249 test.Next (_L("Set the file size to 4GB\n"));
1251 TestRFile1.SetSize(size);
1256 TInt r = file64.Open(TheFs,fileName,EDeleteOnClose);
1257 test (r == KErrArgument);
1259 r = TheFs.Delete(fileName);
1260 test(r == KErrNone);
1265 @SYMTestCaseID PBASE-T_FILE64BIT-0761
1266 @SYMTestPriority High
1267 @SYMTestRequirement REQ9531
1269 @SYMTestCaseDesc Tests opening a file using RFile and RFile64 in file sharing mode
1271 1) Create a file using RFile::Replace()
1272 2) Open the file using RFile::Open() and file mode = EFileShareAny
1273 3) Write 100 bytes to the file and close the file
1274 4) Open the same file using RFile64::Open() and file mode = EFileShareAny
1275 5) Set the file size to 4GB-1 using RFile64::SetSize().
1276 6) Get the file size using RFile::Size()
1277 7) Seek to the file position 2GB+5 using RFile::Seek()
1278 8) Get the file size using RFile64::Size()
1279 9) Seek to the file position 4GB-10 using RFile64::Seek()
1280 10) Read from the file position 4GB-10 using RFile::Read() of length 5 bytes
1282 12) Open the file using RFile::Open().
1283 13) Open the file using RFile64::Open() and close the file.
1284 @SYMTestExpectedResults
1285 1) File created successful with KErrNone.
1286 2) File opened successfully with KErrNone.
1287 3) Write successful with KErrNone.
1288 4) File opened successfully with KErrNone.
1289 5) File size set successfully with KErrNone.
1290 6) Fail with KErrNotSupported.
1291 7) Seek operation fail with KErrArgument.
1292 8) FileSize == 4GB-1.
1294 10) Read fail with KErrNotSupported.
1295 11) File closed successfully.
1296 12) File Open failed with KErrTooBig.
1297 13) File open successfully with KErrNone and file closed successfully.
1298 @SYMTestStatus Implemented
1300 void TestOpenRFileRFile64()
1307 fileName.Append(gDriveToTest);
1308 fileName.Append(KTestPath);
1309 fileName.Append(_L("File4GBMinusOne.txt"));
1311 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);
1313 test(r == KErrNone);
1315 TBuf8<100> writeBuf;
1318 for(count = 0; count < 100; count++)
1320 writeBuf.Append(count);
1323 test.Next(_L("Write 100 bytes to the file\n"));
1324 r = file.Write(0, writeBuf, 100);
1325 test(r == KErrNone);
1327 test.Next(_L("Read 100 bytes from position 0"));
1328 r = file.Read(0, readBuf, 100);
1329 test(r == KErrNone);
1331 test.Next(_L("Compare the read data to the written data"));
1332 test(readBuf == writeBuf);
1335 test.Next(_L("Open the same file using RFile64::Open"));
1336 TestRFile1.Open(fileName,EFileShareAny|EFileWrite);
1338 test.Next(_L("Set the file size to 4GB-1\n"));
1339 TestRFile1.SetSize(K4GBMinusOne);
1341 test.Next(_L("Query the file size using Rfile::Size()\n"));
1342 r = file.Size(size);
1343 test (r == KErrTooBig);
1345 test.Next(_L("Seek to the file position using 2GB+5 using RFile::Seek()\n"));
1346 TUint seekPos1 = K2GB + 5;
1347 TInt seekPos = (TInt)seekPos1;
1348 r = file.Seek(ESeekStart,seekPos);
1349 test(r == KErrArgument);
1351 test.Next(_L("Get the file size using RFile64::Size()\n"));
1352 TestRFile1.Size(size64);
1354 test.Next(_L("Seek to the file position 4GB-10 using RFile64::Seek()\n"));
1355 TInt64 seekPos64 = K4GB - 10;
1356 TestRFile1.Seek(ESeekStart,seekPos64);
1358 TBuf8<5> writeBuf64;
1361 for(count = 0; count < 5; count++)
1363 writeBuf64.Append(count);
1366 test.Next(_L("Read from the file position 4GB-10 using RFile::Read() of length 5 bytes\n"));
1367 TestRFile1.Write(seekPos64,writeBuf64,5);
1368 TestRFile1.Seek(ESeekStart,seekPos64);
1369 TestRFile1.Read(seekPos64,readBuf64,5);
1370 test(readBuf64 == writeBuf64);
1375 test.Next(_L("Open the file using Rfile::Open()\n"));
1376 r = file.Open(TheFs,fileName,EFileShareAny|EFileWrite);
1377 test(r == KErrTooBig);
1379 test.Next(_L("Open the file using Rfile64::Open() and close\n"));
1380 TestRFile1.Open(fileName,EFileShareAny|EFileWrite);
1383 r = TheFs.Delete(fileName);
1384 test(r == KErrNone);
1388 @SYMTestCaseID PBASE-T_FILE64BIT-0762
1389 @SYMTestPriority High
1390 @SYMTestRequirement REQ9531
1392 @SYMTestCaseDesc Tests the temporary file creation using RFile64::Temp()
1394 1) Create a Temporary file using RFile64::Temp() in write mode and DeleteOnClose
1395 2) Set the file size to 4GB-1
1396 3) Write 100 bytes to the file at position 2GB+1
1397 4) Write 1 byte to file position 4GB-2
1398 5) Write 10 bytes to file position 0.
1399 6) Write 1 byte to file position 4GB+1
1400 7) Read and compare the data at position 2GB+1,4GB-2,0 and close the file
1401 8) Delete the temporary file.
1402 9) Create a temporary file using RFile64::Temp() in write mode and without DeleteOnClose flag
1404 11) Delete the temporary file
1405 @SYMTestExpectedResults
1406 1) Temporary file created successfully
1407 2) File size = 4GB-1
1408 3) Write successful with KErrNone
1409 4) Write successful with KErrNone
1410 5) Write successful with KErrNone
1411 6) Write fail with KErrNotSupported
1412 7) Read data == written data
1413 8) KErrNotFound, since the file is already deleted on close
1414 9) File created successfully
1416 11) File deleted successfully
1418 @SYMTestStatus Implemented
1420 void TestCreateTempFile()
1424 testDir.Append(gDriveToTest);
1425 testDir.Append(KTestPath);
1427 TInt r = TheFs.MkDir(testDir);
1428 test(r == KErrNone || r == KErrAlreadyExists);
1431 TestRFile1.Temp(testDir, fileName, EFileWrite|EDeleteOnClose);
1433 test.Next(_L("Set the file size to 4GB-1\n"));
1434 TestRFile1.SetSize(K4GBMinusOne);
1437 TestRFile1.Size(size);
1438 test (size == K4GBMinusOne);
1440 TBuf8<0x64> writeBuf;
1441 TBuf8<0x64> readBuf;
1443 for(count = 0; count < 100; count++)
1445 writeBuf.Append(count);
1447 TInt64 seekPos = K2GB + 1;
1448 test.Next(_L("Write 100 bytes to the file at position 2GB+1\n"));
1449 TestRFile1.Write(seekPos, writeBuf, 100);
1450 test.Next(_L("Read 100 bytes from position 2GB+1"));
1451 TestRFile1.Read(seekPos, readBuf, 100);
1452 test(writeBuf == readBuf);
1454 test.Next(_L("Write 1 byte to the file at position 4GB-2\n"));
1455 TBuf8<01> writeBuf1Byte;
1456 TBuf8<01> readBuf1Byte;
1457 writeBuf1Byte.Zero();
1458 writeBuf1Byte.Append(0);
1459 seekPos = K4GBMinusTwo;
1460 TestRFile1.Write(seekPos, writeBuf1Byte, 1);
1462 test.Next(_L("Read 1 byte from position 4GB-2"));
1463 seekPos = K4GBMinusTwo;
1464 TestRFile1.Read(seekPos, readBuf1Byte, 1);
1465 test(writeBuf1Byte == readBuf1Byte);
1467 test.Next(_L("Write 10 bytes to the file at position 0\n"));
1468 TBuf8<10> writeBuf10Byte;
1469 TBuf8<10> readBuf10Byte;
1470 writeBuf10Byte.Zero();
1471 for(count = 0; count < 10; count++)
1473 writeBuf10Byte.Append(count);
1475 TestRFile1.Write(0, writeBuf10Byte, 10);
1477 test.Next(_L("Read 10 byte from position 0"));
1478 TestRFile1.Read(0, readBuf10Byte, 10);
1479 test(writeBuf10Byte == readBuf10Byte);
1481 test.Next(_L("Write 1 byte to the file at position 4GB+1\n"));
1483 TestRFile1.Write(seekPos, writeBuf1Byte, 1);
1487 test.Next(_L("Delete the temporary file\n"));
1488 r = TheFs.Delete(fileName);
1489 test(r == KErrNotFound);
1491 test.Next(_L("Create a temporary file using RFile64::Temp without EDeleteOnClose flag\n"));
1492 TestRFile1.Temp(testDir, fileName, EFileWrite);
1494 test.Next(_L("Close the file\n"));
1497 test.Next(_L("Delete the temporary the file\n"));
1498 r = TheFs.Delete(fileName);
1499 test(r == KErrNone);
1504 @SYMTestCaseID PBASE-T_FILE64BIT-0763
1505 @SYMTestPriority High
1506 @SYMTestRequirement REQ9531
1508 @SYMTestCaseDesc Tests the file creation using RFile64::Create()
1510 1) Create a file FileLargeOne.txt in write mode.
1511 2) Set the file size to 3GB-4KB
1512 3) Seek the file: Mode = ESeekEnd
1513 4) Write to a file with current position and length =4KB
1514 5) Get the file size.
1515 6) Write to a file at position 0 and length = 100 bytes.
1516 7) Write to a file at position 4GB -2 and length = 1 byte
1517 8) Write to a file at position 4GB -2 and length = 3 byte
1518 9) Read and compare the data written at position 0, 4GB-1
1520 11) Create the file FileLargeOne.txt in write mode.
1521 12) Create a file with invalid path and file name.
1522 @SYMTestExpectedResults
1523 1) File created successfully with KErrNone
1524 2) File size = 3GB-4KB
1526 4) Write successful with KErrNone
1528 6) Write successful with KErrNone
1529 7) Write successful with KErrNone
1530 8) Write fails with KErrNotSupported.
1531 9) Read data == written data.
1532 10) File closed successfully.
1533 11) File creation failed with KErrAlreadyExists
1534 12) File Creation failed with KErrPathNotFound.
1535 @SYMTestStatus Implemented
1537 void TestCreateRFile64()
1541 fileName.Append(gDriveToTest);
1542 fileName.Append(KTestPath);
1543 fileName.Append(_L("FileLargeOne.txt"));
1545 test.Next(_L("create a file named FileLargeOne.txt\n"));
1546 TestRFile1.Create(fileName, EFileWrite);
1548 test.Next(_L("set the file size to 3GB - 4KB\n"));
1549 TestRFile1.SetSize(K3GB-K4KB);
1552 TestRFile1.Size(size);
1553 test (size == K3GB-K4KB);
1555 test.Next(_L("seek to the end of the file\n"));
1557 TestRFile1.Seek(ESeekEnd,seekPos);
1558 test(seekPos == K3GB-K4KB);
1560 test.Next(_L("write to the file current position and length = 4KB\n"));
1561 TBuf8<4096> writeBufK4KB;
1562 TBuf8<4096> readBufK4KB;
1563 for (count = 0; count < 4096; count++)
1565 writeBufK4KB.Append(count+1);
1568 TestRFile1.Write(writeBufK4KB,K4KB);
1570 test.Next(_L("read from the file from position K3GB-K4KB and length = 4KB\n"));
1571 seekPos = K3GB - K4KB;
1572 TestRFile1.Read(seekPos,readBufK4KB,K4KB);
1573 test(writeBufK4KB == readBufK4KB);
1575 test.Next(_L("get the size of the file\n"));
1577 TestRFile1.Size(size);
1580 test.Next(_L("write to the file at position 0 and length = 100bytes\n"));
1581 TBuf8<0x64> writeBuf100B;
1582 TBuf8<0x64> readBuf100B;
1583 writeBuf100B.Zero();
1584 for(count = 0; count < 100; count++)
1586 writeBuf100B.Append(count);
1589 TestRFile1.Write(seekPos, writeBuf100B, 100);
1591 test.Next(_L("Read 100 bytes from position 0"));
1592 TestRFile1.Read(seekPos, readBuf100B, 100);
1593 test(writeBuf100B == readBuf100B);
1595 test.Next(_L("Write 1 byte to the file at position 4GB-2\n"));
1596 TBuf8<01> writeBuf1Byte;
1597 TBuf8<01> readBuf1Byte;
1598 writeBuf1Byte.Zero();
1599 writeBuf1Byte.Append(0);
1600 seekPos = K4GBMinusTwo;
1601 TestRFile1.SetSize(K4GB-1);
1602 TestRFile1.Write(seekPos, writeBuf1Byte, 1);
1604 test.Next(_L("Read 1 byte from position 4GB-2"));
1605 seekPos = K4GBMinusTwo;
1606 TestRFile1.Read(seekPos, readBuf1Byte, 1);
1607 test(writeBuf1Byte == readBuf1Byte);
1609 test.Next(_L("Write 3 bytes to the file at position 4GB-1\n"));
1610 TBuf8<3> writeBuf3Byte;
1612 writeBuf3Byte.Zero();
1613 for(count = 0; count < 3; count++)
1615 writeBuf3Byte.Append(count);
1617 seekPos = K4GBMinusTwo;
1618 TestRFile1.Write(seekPos, writeBuf1Byte, 3);
1622 test.Next(_L("create a file named FileLargeOne.txt(KErrAlreadyExists)\n"));
1623 TestRFile1.Create(fileName,EFileWrite);
1625 test.Next(_L("create a file with InvalidPath and fileName\n"));
1627 TInt r = file64.Create(TheFs, _L("C:\\InvalidPathName\\FileName"),EFileWrite);
1628 test(r == KErrPathNotFound);
1630 r = TheFs.Delete(fileName);
1631 test(r == KErrNone);
1635 @SYMTestCaseID PBASE-T_FILE64BIT-0764
1636 @SYMTestPriority High
1637 @SYMTestRequirement REQ9531
1639 @SYMTestCaseDesc Tests the file creation using RFile64::Replace()
1641 1) Replace a file FileLargeOne.txt in write mode using RFile64::Replace.
1642 2) Set the file size to 4GB-1
1643 3) Write to a file with position = 4GB-4KB-2 and length = 4KB
1644 4) Get the file size
1645 5) Seek the file: Mode = ESeekEnd,pos = 0.
1646 6) Write to a file with current position, length = 1 byte
1647 7) Seek the file: Mode = ESeekStart
1648 8) Write to a file with current position and length = 4KB
1649 9) Seek the file: Mode = ESeekEnd
1650 10)Read from the current position and length = 1 byte and compare with written data
1651 11)Seek the file: Mode = ESeekStart
1652 12)Read the data from the current position and length = 4KB and compare with written data
1654 14)Replace a file FileLargeOne.txt in write mode
1655 15)Get the file size
1657 17)Replace a file FileLargeOne.txt with invalid path
1658 @SYMTestExpectedResults
1659 1) File created successfully with KErrNone
1660 2) File size = 4GB-1
1661 3) Write successful with KErrNone
1662 4) File size = 4GB-1
1664 6) Write successful with KErrNone
1666 8) Write successful with KErrNone
1668 10)Written data == Read data
1670 12)Written data == Read data
1672 14)File creatd successfully with KErrNone
1675 17)File creation failed with KErrPathNotFound.
1676 @SYMTestStatus Implemented
1678 void TestReplaceRFile64()
1681 fileName.Append(gDriveToTest);
1682 fileName.Append(KTestPath);
1683 fileName.Append(_L("FileLargeOne.txt"));
1685 test.Next(_L("Replace a file named FileLargeOne.txt\n"));
1686 TestRFile1.Replace(fileName, EFileWrite);
1688 test.Next(_L("Set the size of the file to 4GB-1\n"));
1689 TestRFile1.SetSize(K4GB-1);
1691 TBuf8<4096> writeBufK4KB;
1692 TBuf8<4096> readBufK4KB;
1693 for (TInt count = 0; count < 4096; count++)
1695 writeBufK4KB.Append(count+1);
1698 test.Next(_L("Write to a file with position = 4GB-4KB-2 and length = 4KB\n"));
1699 TInt64 pos = K4GB-K4KB-2;
1700 TestRFile1.Write(pos,writeBufK4KB,K4KB);
1702 test.Next(_L("Read from 4GB-4KB-1 and compare data\n"));
1703 TestRFile1.Read(pos,readBufK4KB,K4KB);
1704 test(writeBufK4KB == readBufK4KB);
1706 test.Next(_L("Get the file size\n"));
1708 TestRFile1.Size(size);
1709 test (size == K4GB-1);
1711 test.Next(_L("Seek the file: Mode = ESeekEnd,pos = 0.\n"));
1713 TestRFile1.Seek(ESeekEnd,seekPos);
1714 test(seekPos == K4GB-1);
1716 test.Next(_L("Write to a file with current position, length = 1 byte\n"));
1717 TBuf8<1> writeBuf1B(_L8("0"));
1720 if(!KFileSizeMaxLargerThan4GBMinusOne)
1723 TestRFile1.Write(seekPos,writeBuf1B,1); //-- now seek pos is K4GB
1726 test.Next(_L("Seek the file: Mode = ESeekStart\n"));
1728 TestRFile1.Seek(ESeekStart,seekPos);
1730 test.Next(_L("Write to a file with current position and length = 4KB\n"));
1731 TestRFile1.Write(seekPos,writeBufK4KB,K4KB);
1733 test.Next(_L("Seek the file: Mode = ESeekEnd\n"));
1735 TestRFile1.Seek(ESeekEnd,seekPos);
1737 if(KFileSizeMaxLargerThan4GBMinusOne)
1738 {//-- file is larger than 4G-1
1739 test(seekPos == K4GB);
1743 test(seekPos == K4GB-1);
1749 test.Next(_L("Read from pos = 4GB-1 and compare data\n"));
1750 TestRFile1.Read(seekPos,readBuf1B,1);
1751 test(writeBuf1B == readBuf1B);
1753 test.Next(_L("Seek the file: Mode = ESeekStart\n"));
1755 TestRFile1.Seek(ESeekStart,seekPos);
1757 test.Next(_L("Read from the file and compare written data\n"));
1758 TestRFile1.Read(seekPos,readBufK4KB,K4KB);
1759 test (writeBufK4KB == readBufK4KB);
1761 test.Next(_L("Close the file\n"));
1764 test.Next(_L("Replace a file FileLargeOne.txt in write mode\n"));
1765 TestRFile1.Replace(fileName, EFileWrite);
1767 test.Next(_L("Get the file size\n"));
1769 TestRFile1.Size(size);
1772 test.Next(_L("Close the file\n"));
1775 test.Next(_L("Replace a file FileLargeOne.txt with invalid path\n"));
1777 TInt r = file64.Replace(TheFs,_L("C:\\InvalidPath\\FileLargeOne.Txt"),EFileWrite);
1778 test (r == KErrPathNotFound);
1780 r = TheFs.Delete(fileName);
1781 test(r == KErrNone);
1785 @SYMTestCaseID PBASE-T_FILE64BIT-0765
1786 @SYMTestPriority High
1787 @SYMTestRequirement REQXXXX
1789 @SYMTestCaseDesc Tests the file replace using RFs::Replace()
1791 1) Create a file named FileLargeOne.txt using RFile64::Replace()
1792 2) Set the file size to 3GB and get the file size
1793 3) Write 10 bytes to location 2GB+10 and close the file
1794 4) Replace the file named ReNameFileLargeOne.txt using RFs::Replace()
1795 5) Open the file ReNameFileLargeOne.txt
1796 6) Set the file size to 4GB-1
1797 7) Write 10 bytes to the location 3GB+10
1798 8) Read the above file from the location 3GB+10
1799 9) Compare the read and the written data
1801 @SYMTestExpectedResults
1802 1) File created successfully with KErrNone
1804 3) Write successful with KErrNone and file closed
1805 4) FileLargeOne.txt is replaced with ReNameFileLargeOne.txt successfully
1806 5) File ReNameFileLargeOne.txt is opened successfully
1808 7) Write successful with KErrNone
1809 8) Read is successful with KErrNone
1810 9) Written data == Read data
1812 @SYMTestStatus Implemented
1814 void TestReplaceRFile64RFs()
1818 fileName.Append(gDriveToTest);
1819 fileName.Append(KTestPath);
1820 fileName.Append(_L("FileLargeOne.txt"));
1822 test.Next(_L("Replace a file named FileLargeOne.txt\n"));
1823 TestRFile1.Replace(fileName, EFileWrite);
1825 test.Next(_L("Set the file size to 3GB and get the file size\n"));
1826 TestRFile1.SetSize(K3GB);
1828 TestRFile1.Size(size);
1829 test (size == K3GB);
1832 test.Next(_L("Write 10 bytes to location 2GB+10 and close the file\n"));
1835 for (TInt count = 0; count < 10; count++)
1837 writeBuf.Append(count+1);
1839 TInt64 pos = K2GB+10;
1840 TestRFile1.Write(pos,writeBuf,10);
1841 TestRFile1.Read(pos,readBuf,10);
1842 test(readBuf == writeBuf);
1845 test.Next(_L("Replace the file named ReNameFileLargeOne.txt using RFs::Replace()\n"));
1846 TFileName fileNameReplace;
1847 fileNameReplace.Append(gDriveToTest);
1848 fileNameReplace.Append(KTestPath);
1849 fileNameReplace.Append(_L("ReNameFileLargeOne.txt\n"));
1850 TestRFs.Replace(fileName,fileNameReplace);
1852 test.Next(_L("Open the file ReNameFileLargeOne.txt\n"));
1853 TestRFile1.Open(fileNameReplace,EFileWrite);
1855 test.Next(_L("Set the file size to 4GB-1\n"));
1856 TestRFile1.SetSize(K4GB-1);
1858 TestRFile1.Size(size);
1859 test (size == K4GB-1);
1861 test.Next(_L("Write 10 bytes to the location 3GB+10\n"));
1863 TestRFile1.Write(pos,_L8("ABCDEFGHIJ"),10);
1865 test.Next(_L("Read the above file from the location 3GB+10 and compare\n"));
1866 TBuf8<10> readBuffer;
1867 TestRFile1.Read(pos,readBuffer,10);
1868 test(readBuffer == _L8("ABCDEFGHIJ"));
1870 test.Next(_L("Close the file and delete\n"));
1872 TInt r = TheFs.Delete(fileNameReplace);
1873 test(r == KErrNone);
1877 @SYMTestCaseID PBASE-T_FILE64BIT-0766
1878 @SYMTestPriority High
1879 @SYMTestRequirement REQXXXX
1881 @SYMTestCaseDesc Test the file creation using RFile64::AdoptFromClient()
1883 1) Connect to the File server
1884 2) Create a file and set the file size to 4GB-1
1885 3) Write few bytes to the location 4GB-10, length = 9bytes
1886 4) Transfer the file handle using TransferToServer() close the file
1887 5) Adopt the already open file from a client using RFile64::Adopt::AdoptFromClient()
1888 6) Read the file from position 4GB-10 and compare the data
1889 @SYMTestExpectedResults
1890 1) Connection successful
1891 2) File created successfully
1892 3) Write successful with KErrNone
1893 4) KErrNone, Transfer to server is successful
1894 5) successfully Allows the server to adopt an already open file from a client process
1895 6) File read should be successful and Read Data = Test Data
1896 @SYMTestStatus Implemented
1898 void TestRFile64AdoptFromClient()
1900 test.Next(_L("Tests for checking RFile64::AdoptFromClient()"));
1903 TInt r = p.Create(_L("FHServer64Bit.exe"), KNullDesC);
1904 test(r == KErrNone);
1907 test.Next(_L("Connect to the File server \n"));
1910 test(r == KErrNone);
1912 // Check the number of open file handles
1913 TInt resCount = fs.ResourceCount();
1914 test(resCount == 0);
1916 r = fs.ShareProtected();
1917 test(r == KErrNone);
1919 r = fs.CreatePrivatePath(gDrive);
1920 test(r == KErrNone);
1921 r = fs.SetSessionToPrivate(gDrive);
1923 test.Next(_L("Create a file and set the file size to 4GB-1\n"));
1925 r = file1.Replace(fs,KClientFileName,EFileWrite);
1926 test(r == KErrNone);
1927 r = file1.SetSize(K4GB-1);
1928 test(r == KErrNone);
1930 test.Next(_L("Write few bytes to the location 4GB-10, length = 9bytes\n"));
1931 r = file1.Write(K4GB-10,KTestData3(),9);
1932 test(r == KErrNone);
1935 r = p.SetParameter(3, gDrive);
1936 test(r == KErrNone);
1941 test.Next(_L("Transfer the file handle using TransferToServer() close the file\n"));
1942 RFileHandleSharer64Bit handsvr;
1945 r = handsvr.Connect();
1947 while(r == KErrNotFound);
1948 test(r == KErrNone);
1950 r = handsvr.SetTestDrive(gDrive);
1951 test(r == KErrNone);
1953 r = fs.SetSessionToPrivate(gDrive);
1954 test(r == KErrNone);
1956 r = file1.Open(fs,KClientFileName,EFileRead);
1957 test(r == KErrNone);
1959 // pass the file handle to FHServer
1960 test.Next(_L("RFile::TransferToServer()"));
1963 r = file1.TransferToServer(ipcArgs, 0, 1);
1964 test(r == KErrNone);
1966 test.Next(_L("Adopt the already open file from a client using RFile64::AdoptFromClient()\n"));
1967 r = handsvr.PassFileHandleProcessLargeFileClient(ipcArgs);
1968 test(r == KErrNone);
1970 // verify that the original file handle's position is unchanged
1972 r = file1.Seek(ESeekCurrent, pos);
1973 test(r == KErrNone);
1975 // make sure we can still use it
1977 test.Next(_L("Read the file from position 4GB-10 and compare the data\n"));
1979 r = file1.Read(K4GB-10,rbuf);
1980 test(r == KErrNone);
1981 test (rbuf == KTestData3);
1987 r = fs.MkDir(_L("C:\\mdir"));
1988 test(r == KErrNone || r == KErrAlreadyExists);
1990 // Check the number of open file handles
1991 resCount = fs.ResourceCount();
1992 test(resCount == 0);
1994 r = fs.Delete(KClientFileName);
1995 test(r == KErrNone);
2000 @SYMTestCaseID PBASE-T_FILE64BIT-0767
2001 @SYMTestPriority High
2002 @SYMTestRequirement REQXXXX
2004 @SYMTestCaseDesc Test the file creation using RFile64::AdoptFromCreator()
2006 1) Create a process named "FHServer64Bit.exe"
2007 2) Connect to the File server
2008 3) Create a file and set the file size to 4GB-1
2009 4) Write few bytes to the location 4GB-10, length = 3 bytes
2010 5) Transfer the file handle using TransferToProcess() close the file
2011 6) Resume the process "FHServer64bit.exe"
2012 7) Adopts the already open file from a client using RFile64::AdoptFromCreator()
2013 8) Read the file from position 4GB-10 and compare the data
2014 @SYMTestExpectedResults
2015 1) Process is created successfully with KErrnone
2016 2) Connection successful
2017 3) File created successfully
2018 4) Write successful with KErrNone
2019 5) KErrNone, Transfer to other process is successful
2020 6) Server process should be resumed
2021 7) successfully Allows the server to adopt an already open file from a client process
2022 8) File read should be successful and Read Data = Test Data
2023 @SYMTestStatus Implemented
2026 void TestRFile64AdoptFromCreator()
2029 test.Next(_L("Tests for checking RFile64::AdoptFromCreator()"));
2030 //create test server
2031 test.Next(_L("Create a process named FHServer64Bit.exe\n"));
2033 r = p.Create(_L("FHServer64Bit.exe"), KNullDesC);
2034 test(r == KErrNone);
2036 test.Next(_L("Connect to the file server\n"));
2039 test(r == KErrNone);
2041 // Check the number of open file handles
2042 TInt resCount = fs.ResourceCount();
2043 test(resCount == 0);
2045 r = fs.ShareProtected();
2046 test(r == KErrNone);
2048 r = fs.CreatePrivatePath(gDrive);
2049 test(r == KErrNone);
2050 r = fs.SetSessionToPrivate(gDrive);
2052 test.Next(_L("Create a file and set the file size to 4GB-1\n"));
2054 r = file1.Replace(fs,KClientFileName,EFileWrite);
2055 test(r == KErrNone);
2056 r = file1.SetSize(K4GB-1);
2057 test(r == KErrNone);
2059 test.Next(_L("Write few bytes to the location 4GB-10, length = 3bytes\n"));
2060 r = file1.Write(K4GB-10,KTestData2(),3);
2061 test(r == KErrNone);
2064 r = file1.Open(fs, KClientFileName, EFileWrite);
2066 test(r == KErrNone);
2068 // NB slot 0 is reserved for the command line
2070 test.Next(_L("Transfer the file handle using TransferToProcess() close the file"));
2072 r = file1.TransferToProcess(p, 1, 2);
2074 r = p.SetParameter(3, gDrive);
2075 test(r == KErrNone);
2077 r = fs.SetSessionToPrivate(gDrive);
2078 test(r == KErrNone);
2080 // make sure we can still read from the file
2082 r = file1.Read(K4GB-10,rbuf,3);
2083 test(r == KErrNone);
2084 r = rbuf.CompareF(KTestData2());
2085 test(r == KErrNone);
2088 r = fs.MkDir(_L("C:\\mdir"));
2089 test(r == KErrNone || r == KErrAlreadyExists);
2091 // Check the number of open file handles -
2092 // should be 1 (the one duplicated for the other process)
2093 resCount = fs.ResourceCount();
2094 test(resCount == 1);
2098 test.Next(_L("Resume the process FHServer64bit.exe "));
2099 // Start the server thread
2102 // connect to the server
2103 RFileHandleSharer64Bit handsvr;
2106 r = handsvr.Connect();
2108 while(r == KErrNotFound);
2109 test(r == KErrNone);
2110 r = handsvr.SetTestDrive(gDrive);
2111 test(r == KErrNone);
2113 // wait for server to read the file
2114 r = handsvr.PassFileHandleProcessLargeFileCreator();
2115 test (r == KErrNone);
2125 @SYMTestCaseID PBASE-T_FILE64BIT-0768
2126 @SYMTestPriority High
2127 @SYMTestRequirement REQXXXX
2129 @SYMTestCaseDesc Test the file creation using RFile64::AdoptFromServer()
2131 1) Connect to the File server
2132 2) Create a file and set the file size to 4GB-1
2133 3) Write few bytes to the location 4GB-10, length = 9bytes
2134 4) Adopt an already open file from a server using RFile64::AdoptFromServer()
2135 5) Read the file from position 4GB-10 and compare the data
2136 @SYMTestExpectedResults
2137 1) Connection successful
2138 2) File created successfully
2139 3) Write successful with KErrNone
2140 4) successfully Allows the client to adopt an already open file from a server process
2141 5) File read should be successful and Read Data = Test Data
2142 @SYMTestStatus Implemented
2145 void TestRFile64AdoptFromServer()
2148 test.Next(_L("Tests for checking RFile64::AdoptFromServer()"));
2151 test.Next(_L("Connect to the file server\n"));
2154 test(r == KErrNone);
2156 // Check the number of open file handles
2157 TInt resCount = fs.ResourceCount();
2158 test(resCount == 0);
2160 r = fs.ShareProtected();
2161 test(r == KErrNone);
2163 r = fs.CreatePrivatePath(gDrive);
2164 test(r == KErrNone);
2165 r = fs.SetSessionToPrivate(gDrive);
2167 test.Next(_L("Create a file and set the file size to 4GB-1\n"));
2169 r = file1.Replace(fs,KClientFileName,EFileWrite);
2170 test(r == KErrNone);
2171 r = file1.SetSize(K4GB-1);
2172 test(r == KErrNone);
2175 r = file1.Write(K4GB-10,KTestData3(),9);
2176 test(r == KErrNone);
2179 r = fs.Delete(KClientFileName);
2180 test(r == KErrNone);
2183 r = p.Create(_L("FHServer64Bit.exe"), KNullDesC);
2184 test(r == KErrNone);
2185 // Request an open file (write mode) from the server
2186 // using RFile64::AdoptFromServer()
2188 test.Next(_L("Adopt an already open file from a server using RFile64::AdoptFromServer()\n"));
2190 RFileHandleSharer64Bit handsvr;
2193 r = handsvr.Connect();
2195 while(r == KErrNotFound);
2196 test(r == KErrNone);
2198 r = handsvr.SetTestDrive(gDrive);
2199 test(r == KErrNone);
2202 TInt fsh = handsvr.GetFileHandleLargeFile2(ssh, EFileWrite);
2205 // Closing the handle to the server ensures the server has closed it's
2206 // RFs and RFile handles - this provides a means of testing whether we
2207 // can still adopt the RFile even if the server has closed it's one.
2209 handsvr.Sync(); // make sure server has finished doing what it's doing
2213 // adopt the file handle from FHServer
2214 test.Next(_L("RFile64::AdoptFromServer()"));
2217 r = file.AdoptFromServer(fsh, ssh);
2218 test(r == KErrNone);
2220 test.Next(_L("Read the file from position 4GB-10 and compare the data\n"));
2222 r = file.Read(K4GB-10,rbuf);
2223 test(r == KErrNone);
2224 // server should write KTestData1 ("Server!!!") to file
2225 test (rbuf == KTestData4);
2228 r = file.FullName(fileName);
2229 test(r == KErrNone);
2233 r = fs.Delete(fileName);
2234 test(r == KErrNone);
2236 TFileName sessionPath;
2237 r = fs.SessionPath(sessionPath);
2238 test(r == KErrNone);
2240 r = fs.RmDir(sessionPath);
2241 test(r == KErrNone);
2249 @SYMTestCaseID PBASE-T_FILE64BIT-0769
2250 @SYMTestPriority High
2251 @SYMTestRequirement REQ9526
2253 @SYMTestCaseDesc Tests for reading a big file synchronously with specified position
2255 1) Big file is read synchronously in a thread, with aPos = 0;
2256 2) Big file is read synchronously in a thread, with aPos = 2GB-1;
2257 3) Big file is read synchronously in a thread. With aPos = 4GB -2. File size= 4GB-1.
2258 4) Check for FAT32 file system, Read from a big file synchronously in a thread with aPos = 4GB.
2259 @SYMTestExpectedResults
2260 1) KErrNone, file is read successfully
2261 2) KErrNone, file is read successfully
2262 3) KErrNone, file is read successfully
2263 4) KErrNone and zero length descriptor, if NGFS is supported we should get the valid data
2264 @SYMTestStatus Implemented
2266 void TestOpenAndReadSyncLargeFile()
2268 const TUint KBufSize = KKB;
2270 TBuf8<KBufSize> readBuf1;
2271 TBuf8<KBufSize> readBuf2;
2273 TInt r = GenerateBigFileContents();
2274 test(r == KErrNone);
2276 test.Next(_L("Open & Read Synchronously Large File From Diff Offset:"));
2279 fileName.Append(gDriveToTest);
2280 fileName.Append(KTestPath);
2281 fileName.Append(_L("File4GBMinusOne.txt"));
2282 TestRFile1.Open(fileName,EFileRead);
2284 test.Next(_L("Big file is read synchronously in a thread, with aPos = 0\n"));
2285 // Sync read from pos = 0
2288 TestRFile1.ReadP(pos, readBuf1);
2290 test.Next(_L("Compare the data read to the expected data\n"));
2291 for(i = pos; i< pos + (KBufSize / 4); i+=4)
2293 TUint j = * ((TUint*) &readBuf1[i - pos]);
2297 test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB-1\n"));
2298 // Sync read from pos = 2GB-1
2301 TestRFile1.ReadP(pos, readBuf2);
2303 test.Next(_L("Compare the data read to the expected data\n"));
2304 for(i = pos; i< pos + (KBufSize / 4); i+=4)
2306 TUint j = * ((TUint*) &readBuf2[i - pos]);
2311 test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB-2\n"));
2312 TBuf8<1> readBuffer;
2314 TestRFile1.ReadP(pos, readBuffer);
2315 test(readBuffer.Length() == 1);
2317 // tests need to be repeated for calling the TUint variant of RFile64::Read()
2319 TestRFile1.ReadU(pos, readBuf1);
2321 test.Next(_L("Compare the data read to the expected data\n"));
2322 for(i = pos; i< pos + (KBufSize / 4); i+=4)
2324 TUint j = * ((TUint*) &readBuf1[i - pos]);
2328 test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB\n"));
2329 // Sync read from pos = 2GB
2332 TestRFile1.ReadU(pos, readBuf2);
2334 test.Next(_L("Compare the data read to the expected data\n"));
2335 for(i = pos; i< pos + (KBufSize / 4); i+=4)
2337 TUint j = * ((TUint*) &readBuf2[i - pos]);
2342 test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB-2\n"));
2344 TestRFile1.ReadU(pos, readBuffer);
2345 test(readBuffer.Length() == 1);
2347 // tests need to be repeated for calling the current position variant of RFile64::Read()
2349 TestRFile1.Seek(ESeekStart,seekPos);
2350 TestRFile1.Read(readBuf1);
2352 test.Next(_L("Compare the data read to the expected data\n"));
2353 for(i = (TUint)seekPos; i< seekPos + (KBufSize / 4); i+=4)
2355 TUint j = * ((TUint*) &readBuf1[i - (TUint)seekPos]);
2359 test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB\n"));
2360 // Sync read from pos = 2GB
2362 TestRFile1.Seek(ESeekStart,seekPos);
2364 TestRFile1.Read(readBuf2);
2366 test.Next(_L("Compare the data read to the expected data\n"));
2367 for(i = (TUint)seekPos; i< seekPos + (KBufSize / 4); i+=4)
2369 TUint j = * ((TUint*) &readBuf2[i - (TUint)seekPos]);
2374 test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB-2\n"));
2375 seekPos = K4GBMinusTwo;
2376 TestRFile1.Seek(ESeekStart,seekPos);
2377 TestRFile1.Read(readBuffer);
2378 test(readBuffer.Length() == 1);
2381 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
2383 TInt64 pos64 = K4GB;
2384 TestRFile1.ReadP(pos64, readBuf1);
2385 test(readBuf1.Length() == 0);
2391 @SYMTestCaseID PBASE-T_FILE64BIT-0770
2392 @SYMTestPriority High
2393 @SYMTestRequirement REQ9526
2395 @SYMTestCaseDesc Tests for reading a big file asynchronously with specified position
2397 1) Big file is read asynchronously in a thread, with aPos = 0;
2398 2) Big file is read asynchronously in a thread, with aPos = 2GB-1;
2399 3) Big file is read asynchronously in a thread. With aPos = 4GB -1.
2400 4) Check for FAT32 file system, Read from a big file asynchronously in a thread with aPos = 4GB.
2401 @SYMTestExpectedResults
2402 1) KErrNone, file is read successfully
2403 2) KErrNone, file is read successfully
2404 3) KErrNone, file is read successfully
2405 4) KErrNone and zero length descriptor. If NGFS is supported we should get the valid data.
2406 @SYMTestStatus Implemented
2408 void TestOpenAndReadAsyncLargeFile()
2410 const TUint KBufSize = KKB;
2411 TInt64 fileSize, size = 0;
2414 TBuf8<KBufSize> readBuf;
2415 readBuf.SetLength(KBufSize);
2418 test.Next(_L("Open & Read Asynchronously Large File From Diff Offset:"));
2421 fileName.Append(gDriveToTest);
2422 fileName.Append(KTestPath);
2423 fileName.Append(_L("File4GBMinusOne.txt"));
2424 TestRFile1.Open(fileName,EFileRead);
2426 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0\n"));
2427 // Async read from pos = 0
2428 TRequestStatus status1 = KRequestPending;
2430 TestRFile1.Read(pos, readBuf, status1);
2432 test.Next(_L("Compare the data read to the expected data\n"));
2433 for(i = pos; i< pos + (KBufSize / 4); i+=4)
2435 TUint j = * ((TUint*) &readBuf[i - pos]);
2439 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB-1\n"));
2440 // Async read from pos = 2GB-1
2441 TRequestStatus status2 = KRequestPending;
2443 TestRFile1.Read(pos, readBuf, status2);
2445 test.Next(_L("Compare the data read to the expected data\n"));
2446 for(i = pos; i< pos + (KBufSize / 4); i+=4)
2448 TUint j = * ((TUint*) &readBuf[i - pos]);
2452 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1\n"));
2453 TBuf8<0x1> readBuf1;
2454 // Async read from pos = 4GB-1
2455 TRequestStatus status3 = KRequestPending;
2457 TestRFile1.Read(pos, readBuf1, status3);
2458 test(readBuf1.Length() == 1);
2460 fileSize = K4GBMinusOne;
2461 TestRFile1.Size(size);
2462 test(size == fileSize);
2464 //tests need to be repeated for calling the TUint variant of RFile64::Read()
2466 TestRFile1.ReadU(pos, readBuf, status1);
2468 test.Next(_L("Compare the data read to the expected data\n"));
2469 for(i = pos; i< pos + (KBufSize / 4); i+=4)
2471 TUint j = * ((TUint*) &readBuf[i - pos]);
2475 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB-1\n"));
2476 // Async read from pos = 2GB-1
2477 status2 = KRequestPending;
2479 TestRFile1.ReadU(pos, readBuf, status2);
2481 test.Next(_L("Compare the data read to the expected data\n"));
2482 for(i = pos; i< pos + (KBufSize / 4); i+=4)
2484 TUint j = * ((TUint*) &readBuf[i - pos]);
2488 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1\n"));
2489 // Async read from pos = 4GB-1
2490 status3 = KRequestPending;
2492 TestRFile1.ReadU(pos, readBuf1, status3);
2493 test(readBuf1.Length() == 1);
2495 // tests need to be repeated for calling the current position variant of RFile64::Read()
2497 TestRFile1.Seek(ESeekStart,seekPos);
2498 TestRFile1.Read(readBuf, status1);
2500 test.Next(_L("Compare the data read to the expected data\n"));
2501 for(i = (TUint)seekPos; i< seekPos + (KBufSize / 4); i+=4)
2503 TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
2507 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB-1\n"));
2508 // Async read from pos = 2GB-1
2509 status2 = KRequestPending;
2511 TestRFile1.Seek(ESeekStart,seekPos);
2512 TestRFile1.Read(readBuf, status2);
2514 test.Next(_L("Compare the data read to the expected data\n"));
2515 for(i = (TUint)seekPos; i< seekPos + (KBufSize / 4); i+=4)
2517 TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
2521 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1\n"));
2522 // Async read from pos = 4GB-1
2523 status3 = KRequestPending;
2524 seekPos = K4GBMinusTwo;
2525 TestRFile1.Seek(ESeekStart,seekPos);
2526 TestRFile1.Read(readBuf1, status3);
2527 test(readBuf1.Length() == 1);
2530 // Async read from pos = 4GB
2531 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
2533 TRequestStatus status5 = KRequestPending;
2536 TestRFile1.Read(pos64, readBuf, status5);
2537 test(readBuf.Length() == 0);
2544 @SYMTestCaseID PBASE-T_FILE64BIT-0771
2545 @SYMTestPriority High
2546 @SYMTestRequirement REQ9526
2548 @SYMTestCaseDesc Tests for reading a big file synchronously with specified position and length
2550 1) Big file is read synchronously in a thread, with aPos = 0 and length = 256bytes
2551 2) Big file is read synchronously in a thread, with aPos = 2GB-1 and length = 2KB
2552 3) Big file is read synchronously in a thread, with aPos = 4GB -1 and length = 10 bytes
2553 4) Check for FAT32 file system. Read from a big file, synchronously in a thread with aPos = 4GB and length = 1KB
2554 5) Big file is read synchronously in a thread, with aPos = 0 and length = -1
2555 6) Big file is read synchronously in a thread, with aPos = 0 and length = 0 bytes
2556 @SYMTestExpectedResults
2557 1) KErrNone, file is read successfully
2558 2) KErrNone, file is read successfully
2559 3) KErrNone, file is read successfully
2560 4) KErrNone, with zero length descriptor. If NGFS is supported we should get the valid data
2563 @SYMTestStatus Implemented
2566 void TestOpenAndReadSyncLargeFileWithLen()
2570 TBuf8<KMAXBUFSIZE> readBuf;
2571 readBuf.SetLength(KMAXBUFSIZE);
2573 test.Next(_L("Open & Read Synchronously Large File From Different Offset and Length:"));
2576 fileName.Append(gDriveToTest);
2577 fileName.Append(KTestPath);
2578 fileName.Append(_L("File4GBMinusOne.txt"));
2579 TestRFile1.Open(fileName,EFileRead);
2581 test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = 256bytes:"));
2582 // Sync read from pos = 0 and length = 256
2584 TestRFile1.Read(pos, readBuf, 256);
2585 test(readBuf.Length() == 256);
2587 test.Next(_L("Compare the data read to the expected data\n"));
2588 for(i = (TUint)pos; i< pos + (256 / 4); i+=4)
2590 TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
2594 test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB and length = K2KB:"));
2595 // Sync read from pos = 2GB and length = K2KB
2597 TestRFile1.Read(pos, readBuf, K2KB);
2598 test(readBuf.Length() == K2KB);
2600 test.Next(_L("Compare the data read to the expected data\n"));
2601 for(i = (TUint)pos; i< pos + (K2KB / 4); i+=4)
2603 TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
2608 test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB -1 and length = 10:"));
2609 // Sync read from pos = 4GB-1 and length = 10
2611 TestRFile1.Read(pos, readBuf, 10);
2612 test(readBuf.Length() == 1);
2615 // Sync read from pos = 4GB and length = KKB
2617 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
2620 TestRFile1.Read(pos, readBuf, KKB);
2621 test(readBuf.Length() == 0);
2624 test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = -1"));
2625 // Sync read from pos = 0 and length = -1
2627 TestRFile1.Read(pos, readBuf, -1);
2629 //tests need to repeated for TUint variant of RFile64::Read()
2631 test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = 256bytes:"));
2632 // Sync read from pos = 0 and length = 256
2634 TestRFile1.ReadU((TUint)pos, readBuf, 256);
2635 test(readBuf.Length() == 256);
2637 test.Next(_L("Compare the data read to the expected data\n"));
2638 for(i = (TUint)pos; i< pos + (256 / 4); i+=4)
2640 TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
2644 test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB and length = K2KB:"));
2645 // Sync read from pos = 2GB and length = K2KB
2647 TestRFile1.ReadU((TUint)pos, readBuf, K2KB);
2648 test(readBuf.Length() == K2KB);
2650 test.Next(_L("Compare the data read to the expected data\n"));
2651 for(i = (TUint)pos; i< pos + (K2KB / 4); i+=4)
2653 TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
2658 test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB -1 and length = 10:"));
2659 // Sync read from pos = 4GB-1 and length = 10
2661 TestRFile1.ReadU((TUint)pos, readBuf, 10);
2662 test(readBuf.Length() == 1);
2664 //tests need to repeated for current position variant of RFile64::Read()
2665 test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = 256bytes:"));
2666 // Sync read from pos = 0 and length = 256
2668 TestRFile1.Seek(ESeekStart,seekPos);
2669 TestRFile1.Read(readBuf, 256);
2670 test(readBuf.Length() == 256);
2672 test.Next(_L("Compare the data read to the expected data\n"));
2673 for(i = (TUint)seekPos; i< seekPos + (256 / 4); i+=4)
2675 TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
2679 test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB and length = K2KB:"));
2680 // Sync read from pos = 2GB and length = K2KB
2682 TestRFile1.Seek(ESeekStart,seekPos);
2683 TestRFile1.Read(readBuf, K2KB);
2684 test(readBuf.Length() == K2KB);
2686 test.Next(_L("Compare the data read to the expected data\n"));
2687 for(i = (TUint)seekPos; i< seekPos + (K2KB / 4); i+=4)
2689 TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
2694 test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB -1 and length = 10:"));
2695 // Sync read from pos = 4GB-1 and length = 10
2696 seekPos = K4GBMinusTwo;
2697 TestRFile1.Seek(ESeekStart,seekPos);
2698 TestRFile1.Read(readBuf, 10);
2699 test(readBuf.Length() == 1);
2702 // Sync read from pos = 4GB and length = KKB
2704 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
2707 TestRFile1.Read(pos, readBuf, KKB);
2708 test(readBuf.Length() == 0);
2711 test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = -1"));
2712 // Sync read from pos = 0 and length = -1
2714 TestRFile1.Read(pos, readBuf, -1);
2718 test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = 0 bytes"));
2719 // Sync read from pos = 0 and length = 0
2721 TestRFile1.Read(pos, readBuf, 0);
2722 test(readBuf.Length() == 0);
2727 @SYMTestCaseID PBASE-T_FILE64BIT-0772
2728 @SYMTestPriority High
2729 @SYMTestRequirement REQ9526
2731 @SYMTestCaseDesc Tests for reading a big file asynchronously with specified position and length
2733 1) Big file is read asynchronously in a thread, with aPos = 0 and length = 256 bytes
2734 2) Big file is read asynchronously in a thread, with aPos = 2GB-1 and length = 1KB
2735 3) Big file is read asynchronously in a thread, with aPos = 4GB-1 and length = 1KB
2736 4) Big file is read asynchronously in a thread, with aPos = 4GB and length = 256 bytes
2737 5) Big file is read asynchronously in a thread, with aPos = 0 and length = -1
2738 6) Big file is read asynchronously in a thread, with aPos = 0 and length = 0 bytes
2739 @SYMTestExpectedResults
2740 1) KErrNone, file is read successfully
2741 2) KErrNone, file is read successfully
2742 3) KErrNone, file is read successfully
2743 4) KErrNone, with zero length descriptor. If NGFS is supported KErrNone with valid data
2746 @SYMTestStatus Implemented
2748 void TestOpenAndReadAsyncLargeFileWithLen()
2752 TBuf8<KMAXBUFSIZE> readBuf;
2753 readBuf.SetLength(KMAXBUFSIZE);
2755 test.Next(_L("Open & Read Asynchronously Large File From Different Offset & Length:"));
2758 fileName.Append(gDriveToTest);
2759 fileName.Append(KTestPath);
2760 fileName.Append(_L("File4GBMinusOne.txt"));
2761 TestRFile1.Open(fileName,EFileRead);
2763 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0 and length = 256 bytes\n"));
2764 // Async read from pos = 0 and length = 256
2765 TRequestStatus status1 = KRequestPending;
2767 TestRFile1.Read(pos, readBuf, 256, status1);
2768 test(readBuf.Length() == 256);
2770 test.Next(_L("Compare the data read to the expected data\n"));
2771 for(i = (TUint)pos; i< pos + (256 / 4); i+=4)
2773 TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
2777 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB and length = KKB bytes\n"));
2778 // Async read from pos = 2GB and length = KKb
2779 TRequestStatus status2 = KRequestPending;
2781 TestRFile1.Read(pos, readBuf, KKB, status2);
2782 test(readBuf.Length() == KKB);
2784 test.Next(_L("Compare the data read to the expected data\n"));
2785 for(i = (TUint)pos; i< pos + (KKB / 4); i+=4)
2787 TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
2792 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1 and length = KKb bytes\n"));
2793 // Async read from pos = 4GB-1 and length = KKb
2794 TRequestStatus status3 = KRequestPending;
2796 TestRFile1.Read(pos, readBuf, KKB, status3);
2797 test(readBuf.Length() == 1);
2799 // tests need to be repeated for TUint variant of RFile64::Read()
2800 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0 and length = 256 bytes\n"));
2801 // Async read from pos = 0 and length = 256
2802 status1 = KRequestPending;
2804 TestRFile1.ReadU((TUint)pos, readBuf, 256, status1);
2805 test(readBuf.Length() == 256);
2807 test.Next(_L("Compare the data read to the expected data\n"));
2808 for(i = (TUint)pos; i< pos + (256 / 4); i+=4)
2810 TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
2814 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB and length = KKB bytes\n"));
2815 // Async read from pos = 2GB and length = KKb
2816 status2 = KRequestPending;
2818 TestRFile1.ReadU((TUint)pos, readBuf, KKB, status2);
2819 test(readBuf.Length() == KKB);
2821 test.Next(_L("Compare the data read to the expected data\n"));
2822 for(i = (TUint)pos; i< pos + (KKB / 4); i+=4)
2824 TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
2829 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1 and length = KKb bytes\n"));
2830 // Async read from pos = 4GB-1 and length = KKb
2831 status3 = KRequestPending;
2833 TestRFile1.ReadU((TUint)pos, readBuf, KKB, status3);
2834 test(readBuf.Length() == 1);
2836 // tests need to be repeated for current position variant of RFile64::Read()
2837 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0 and length = 256 bytes\n"));
2838 // Async read from pos = 0 and length = 256
2839 status1 = KRequestPending;
2841 TestRFile1.Seek(ESeekStart,seekPos);
2842 TestRFile1.Read(readBuf, 256, status1);
2843 test(readBuf.Length() == 256);
2845 test.Next(_L("Compare the data read to the expected data\n"));
2846 for(i = (TUint)seekPos; i< seekPos + (256 / 4); i+=4)
2848 TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
2852 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB and length = KKB bytes\n"));
2853 // Async read from pos = 2GB and length = KKb
2854 status2 = KRequestPending;
2856 TestRFile1.Seek(ESeekStart,seekPos);
2857 TestRFile1.Read(readBuf, KKB, status2);
2858 test(readBuf.Length() == KKB);
2860 test.Next(_L("Compare the data read to the expected data\n"));
2861 for(i = (TUint)seekPos; i< seekPos + (KKB / 4); i+=4)
2863 TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
2868 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1 and length = KKb bytes\n"));
2869 // Async read from pos = 4GB-1 and length = KKb
2870 status3 = KRequestPending;
2871 seekPos = K4GBMinusTwo;
2872 TestRFile1.Seek(ESeekStart,seekPos);
2873 TestRFile1.Read(readBuf, KKB, status3);
2874 test(readBuf.Length() == 1);
2877 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB and length = 256 bytes\n"));
2878 // Async read from pos = 4GB and length = 256
2881 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
2883 TRequestStatus status5 = KRequestPending;
2885 TestRFile1.Read(pos, readBuf, 256, status5);
2886 test(readBuf.Length() == 0);
2889 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0 and length = -1 bytes\n"));
2890 // Async read from pos = 0 and length = -1
2891 TRequestStatus status6 = KRequestPending;
2893 TestRFile1.Read(pos, readBuf, -1, status6);
2895 test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0 and length = 0 bytes\n"));
2896 // Async read from pos = 0 and length = 0
2897 TRequestStatus status7 = KRequestPending;
2899 TestRFile1.Read(pos, readBuf, 0, status7);
2903 TInt r = TheFs.Delete(fileName);
2904 test(r == KErrNone);
2908 @SYMTestCaseID PBASE-T_FILE64BIT-0773
2909 @SYMTestPriority High
2910 @SYMTestRequirement REQ9526
2912 @SYMTestCaseDesc Tests for writing to a big file synchronously with specified position
2914 1) Write to a big file synchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1
2915 2) Write to a big file synchronously in a thread, with aPos = 2GB-1 and data = 1KB
2916 3) Write to a big file synchronously in a thread, with aPos = 4GB-1 and data = 1 byte
2917 4) Write a big file synchronously in a thread, with aPos = 4GB and data = 256 bytes
2918 @SYMTestExpectedResults
2919 1) KErrNone, write is successful
2920 2) KErrNone, write is successful
2921 3) KErrNone, write is successful
2922 4) KErrNotSupported, if NGFS is supported KErrNone and write is successful
2923 @SYMTestStatus Implemented
2926 void TestOpenAndWriteSyncLargeFile()
2928 test.Next(_L("Open & Write Synchronously Large File From Different Offset:"));
2932 fileName.Append(gDriveToTest);
2933 fileName.Append(KTestPath);
2934 fileName.Append(_L("File4GBMinusOne.txt"));
2935 TestRFile1.Replace(fileName, EFileWrite);
2936 TestRFile1.SetSize(K4GBMinusOne);
2939 TestRFile1.Size(size);
2940 test(size == K4GBMinusOne);
2943 test.Next(_L("Write to a big file synchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1\n"));
2944 TBuf8<0x100> writeBuf100;
2945 TBuf8<0x100> readBuf100;
2947 writeBuf100.FillZ();
2948 for (count = 0; count < 0x100; count++)
2950 writeBuf100.Append((TChar)count);
2952 TestRFile1.WriteP(0,writeBuf100);
2953 TestRFile1.Size(size);
2954 TestRFile1.ReadP(0,readBuf100);
2955 test(writeBuf100 == readBuf100);
2957 test.Next(_L("Write to a big file synchronously in a thread, with aPos = 2GB-1 and data = 1KB\n"));
2958 TBuf8<0x400> writeBuf400;
2959 TBuf8<0x400> readBuf400;
2961 writeBuf400.FillZ();
2962 for (count = 0; count < 0x400; count++)
2964 writeBuf400.Append(count+20);
2966 TestRFile1.WriteP(K2GBMinusOne,writeBuf400);
2967 TestRFile1.ReadP(K2GBMinusOne,readBuf400); // just for validation
2968 test(writeBuf400 == readBuf400);
2970 test.Next(_L("Write to a big file synchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
2971 TBuf8<1> testReadBuf;
2972 TestRFile1.WriteP(K4GBMinusTwo,_L8("1"));
2973 TestRFile1.ReadP(K4GBMinusTwo, testReadBuf);
2974 test(testReadBuf.Length() == 1);
2976 //tests need to be repeated for TUint variant of RFile64::Write()
2977 readBuf100.Zero(); //to ensure that the previous data is removed
2978 test.Next(_L("Write to a big file synchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1\n"));
2980 TestRFile1.WriteU(pos,writeBuf100);
2981 TestRFile1.ReadU(pos,readBuf100);
2982 test(writeBuf100 == readBuf100);
2984 test.Next(_L("Write to a big file synchronously in a thread, with aPos = 2GB-1 and data = 1KB\n"));
2985 readBuf400.Zero();//to ensure that the previous data is removed
2987 TestRFile1.WriteU(pos,writeBuf400);
2988 TestRFile1.ReadU(pos,readBuf400); // just for validation
2989 test(writeBuf400 == readBuf400);
2992 test.Next(_L("Write to a big file synchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
2994 testReadBuf.Zero();//to ensure that the previous data is removed
2995 TestRFile1.WriteU(pos,_L8("1"));
2996 TestRFile1.ReadU(pos, testReadBuf);
2997 test(testReadBuf.Length() == 1);
3000 //tests need to be repeated for current position variant of RFile64::Write()
3001 //testing with only current position as 4GB-2(boundary condition)
3003 test.Next(_L("Write to a big file synchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
3004 TInt64 seekPos = K4GBMinusTwo;
3005 testReadBuf.Zero();//to ensure that the previous data is removed
3006 TestRFile1.Seek(ESeekStart,seekPos);
3007 TestRFile1.Write(_L8("1"));
3008 TestRFile1.Seek(ESeekStart,seekPos);
3009 TestRFile1.Read(testReadBuf);
3010 test(testReadBuf.Length() == 1);
3014 test.Next(_L("Write a big file synchronously in a thread, with aPos = 4GB and data = 256 bytes\n"));
3017 TBuf8<0x100> writeBuffer256;
3018 TBuf8<0x100> readBuffer256;
3019 writeBuffer256.Zero();
3020 writeBuffer256.FillZ();
3021 readBuffer256.Zero();
3022 readBuffer256.FillZ();
3024 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
3026 for (TInt count = 0; count < 256; count++)
3028 writeBuffer256.Append((TChar)count);
3030 TestRFile1.WriteP(K4GB,writeBuffer256);
3031 User::After(100000);
3032 // Validation for boundary condition 4GB
3033 TestRFile1.ReadP(K4GB,readBuffer256);
3034 TInt rr = readBuffer256.Length();
3035 test(rr == KErrNone);
3036 test(readBuffer256.Length() == 0);
3040 TInt r = TheFs.Delete(fileName);
3041 test(r == KErrNone);
3045 @SYMTestCaseID PBASE-T_FILE64BIT-0774
3046 @SYMTestPriority High
3047 @SYMTestRequirement REQ9526
3049 @SYMTestCaseDesc Tests for writing to a big file asynchronously with specified position
3051 1) Write to a big file asynchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1
3052 2) Write to a big file asynchronously in a thread, with aPos = 2GB-1 and data = 1KB
3053 3) Write to a big file asynchronously in a thread, with aPos = 4GB-1 and data = 1 byte
3054 4) Check for FAT32 file system. Write to a big file asynchronously in a thread with aPos = 4GB and data length = 256 bytes
3055 @SYMTestExpectedResults
3056 1) KErrNone, write is successful
3057 2) KErrNone, write is successful
3058 3) KErrNone, write is successful
3059 4) KErrNotSupported, if NGFS is available KErrNone and write is successful.
3060 @SYMTestStatus Implemented
3063 void TestOpenAndWriteAsyncLargeFile()
3065 test.Next(_L("Open & Write Asynchronously Large File From Different Offset:"));
3069 fileName.Append(gDriveToTest);
3070 fileName.Append(KTestPath);
3071 fileName.Append(_L("File4GBMinusOne.txt"));
3072 TestRFile1.Replace(fileName, EFileWrite);
3074 TestRFile1.SetSize(K4GBMinusOne);
3076 TestRFile1.Size(size);
3078 test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1\n"));
3079 TBuf8<0x100> writeBuf100;
3080 TBuf8<0x100> readBuf100;
3082 writeBuf100.FillZ();
3083 for (count = 0; count < 0x100; count++)
3085 writeBuf100.Append((TChar)count);
3087 TRequestStatus status1 = KRequestPending;
3088 TestRFile1.Write(0,writeBuf100,status1);
3089 TestRFile1.ReadP(0,readBuf100);
3090 test (writeBuf100 == readBuf100);
3092 test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 2GB-1 and data = 1KB\n"));
3093 TBuf8<0x400> writeBuf400;
3094 TBuf8<0x400> readBuf400;
3096 writeBuf400.FillZ();
3097 for (count = 0; count < 0x400; count++)
3099 writeBuf400.Append(count+20);
3101 TRequestStatus status2 = KRequestPending;
3102 TestRFile1.Write(K2GBMinusOne,writeBuf400,status2);
3103 TestRFile1.ReadP(K2GBMinusOne,readBuf400); // just for validation
3104 test(writeBuf400 == readBuf400);
3106 test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
3107 TBuf8<0x1> writeBuf;
3111 for (count = 0; count < 0x1; count++)
3113 writeBuf.Append((TChar)(count+17));
3115 TRequestStatus status3 = KRequestPending;
3116 TestRFile1.Write(K4GBMinusTwo,writeBuf,status3);
3117 TestRFile1.ReadP(K4GBMinusTwo,readBuf);
3118 test(readBuf.Length() == 1);
3120 //tests need to be repeated for TUint variant of RFile64::Write()
3121 test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1\n"));
3122 readBuf100.Zero();//to ensure that the previous data is removed
3123 status1 = KRequestPending;
3125 TestRFile1.WriteU(pos,writeBuf100,status1);
3126 TestRFile1.ReadU(pos,readBuf100);
3127 test (writeBuf100 == readBuf100);
3129 test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 2GB-1 and data = 1KB\n"));
3130 readBuf400.Zero();//to ensure that the previous data is removed
3131 status2 = KRequestPending;
3133 TestRFile1.WriteU(pos,writeBuf400,status2);
3134 TestRFile1.ReadU(pos,readBuf400); // just for validation
3135 test(writeBuf400 == readBuf400);
3137 test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
3138 readBuf.Zero();//to ensure that the previous data is removed
3139 status3 = KRequestPending;
3141 TestRFile1.WriteU(pos,writeBuf,status3);
3142 TestRFile1.ReadU(pos,readBuf);
3143 test(readBuf.Length() == 1);
3146 //tests need to be repeated for current position variant of RFile64::Write()
3147 //testing with only current position as 4GB-2(boundary condition)
3149 test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
3150 readBuf.Zero();//to ensure that the previous data is removed
3151 status3 = KRequestPending;
3152 TInt64 seekPos = K4GBMinusTwo;
3153 TestRFile1.Seek(ESeekStart,seekPos);
3154 TestRFile1.Write(writeBuf,status3);
3155 TestRFile1.Seek(ESeekStart,seekPos);
3156 TestRFile1.Read(readBuf);
3157 test(readBuf.Length() == 1);
3160 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
3162 TBuf8<0x100> writeBuf256;
3163 TBuf8<0x100> readBuf256;
3165 writeBuf256.FillZ();
3166 for (TInt count = 0; count < 0x100; count++)
3168 writeBuf256.Append((TChar)(count+7));
3170 TRequestStatus status4 = KRequestPending;
3171 TestRFile1.Write(K4GB,writeBuf256,status4);
3172 User::After(100000);
3173 // Validation for boundary condition 4GB
3174 TestRFile1.ReadP(K4GB,readBuf256);
3175 test(readBuf256.Length() == 0);
3179 TInt r = TheFs.Delete(fileName);
3180 test(r == KErrNone);
3184 @SYMTestCaseID PBASE-T_FILE64BIT-0775
3185 @SYMTestPriority High
3186 @SYMTestRequirement REQ9526
3188 @SYMTestCaseDesc Tests for writing to a big file synchronously with specified position and length
3190 1) Write to a big file synchronously in a thread with aPos = 0, data = 256 bytes and length = 255 bytes
3191 2) Write to a big file synchronously in a thread with aPos = 2GB -1, data = 1KB and length = 200 bytes
3192 3) Write to a big file synchronously in a thread with aPos = 4GB-10 and data = 1KB and length = 10 bytes
3193 4) Check for FAT32 file system. Write to a big file synchronously in a thread with aPos = 4GB, data length = 256 bytes and length = 10 bytes
3194 5) Write to a big file synchronously in a thread with aPos = 0 , data = 256 bytes and length =0 bytes
3195 6) Write to a big file synchronously in a thread with aPos = 0 , data = 256 bytes and length = -1
3196 @SYMTestExpectedResults
3197 1) KErrNone, write is successful
3198 2) KErrNone, write is successful
3199 3) KErrNone, write is successful
3200 4) KErrNotSupported. If NGFS is supported and write is successful
3203 @SYMTestStatus Implemented
3206 void TestOpenAndWriteSyncLargeFileWithLen()
3208 test.Next(_L("Open & Write Synchronously Large File From Different Offset and length:"));
3212 fileName.Append(gDriveToTest);
3213 fileName.Append(KTestPath);
3214 fileName.Append(_L("File4GBMinusOne.txt"));
3215 TestRFile1.Replace(fileName, EFileWrite);
3217 TestRFile1.SetSize(K4GBMinusOne);
3219 test.Next(_L("Write to a big file synchronously in a thread with aPos = 0, data = 256 bytes and length = 255 bytes\n"));
3220 TBuf8<0x100> writeBuf100;
3221 TBuf8<0x100> readBuf100;
3222 TBuf8<0x100> validateBuf100;
3224 writeBuf100.FillZ();
3225 validateBuf100.Zero();
3226 for (count = 0; count < 0x100; count++)
3228 writeBuf100.Append((TChar)count);
3230 validateBuf100.Append((TChar)count);
3232 TestRFile1.Write(0,writeBuf100,255);
3233 TestRFile1.Read(0,readBuf100,255);
3234 test(validateBuf100 == readBuf100);
3236 test.Next(_L("Write to a big file synchronously in a thread with aPos = 2GB -1, data = 1KB and length = 200 bytes\n"));
3237 TBuf8<0x400> writeBuf400;
3238 TBuf8<0x400> readBuf400;
3239 TBuf8<0x400> validateBuf400;
3241 writeBuf400.FillZ();
3242 for (count = 0; count < 0x400; count++)
3244 writeBuf400.Append(count+20);
3246 validateBuf400.Append(count+20);
3248 TestRFile1.Write(K2GBMinusOne,writeBuf400,200);
3249 TestRFile1.Read(K2GBMinusOne,readBuf400,200);
3250 test(validateBuf400 == readBuf400);
3252 test.Next(_L("Write to a big file synchronously in a thread with aPos = 4GB-10 and data = 1KB and length = 10 bytes\n"));
3253 TBuf8<0x400> writeBuf1024;
3254 TBuf8<0x400> readBuf1024;
3255 TBuf8<0x400> validateBuf1024;
3256 writeBuf1024.Zero();
3257 writeBuf1024.FillZ();
3258 for (count = 0; count < 0x400; count++)
3260 writeBuf1024.Append(count+3);
3262 validateBuf1024.Append(count+3);
3264 TestRFile1.Write(K4GBMinusTen,writeBuf1024,9);
3265 TestRFile1.Read(K4GBMinusTen,readBuf1024,9);
3266 test(validateBuf1024 == readBuf1024);
3268 //tests need to be repeated for TUint variant of RFile64::Write()
3269 test.Next(_L("Write to a big file synchronously in a thread with aPos = 0, data = 256 bytes and length = 255 bytes\n"));
3270 readBuf100.Zero();//to ensure that the previous data is removed
3272 TestRFile1.WriteU(pos,writeBuf100,255);
3273 TestRFile1.ReadU(pos,readBuf100,255);
3274 test(validateBuf100 == readBuf100);
3276 test.Next(_L("Write to a big file synchronously in a thread with aPos = 2GB -1, data = 1KB and length = 200 bytes\n"));
3277 readBuf400.Zero();//to ensure that the previous data is removed
3279 TestRFile1.WriteU(pos,writeBuf400,200);
3280 TestRFile1.ReadU(pos,readBuf400,200);
3281 test(validateBuf400 == readBuf400);
3283 test.Next(_L("Write to a big file synchronously in a thread with aPos = 4GB-10 and data = 1KB and length = 10 bytes\n"));
3284 readBuf1024.Zero();//to ensure that the previous data is removed
3286 TestRFile1.WriteU(pos,writeBuf1024,9);
3287 TestRFile1.ReadU(pos,readBuf1024,9);
3288 test(validateBuf1024 == readBuf1024);
3291 //tests need to be repeated for current position variant of RFile64::Write()
3292 //testing with only current position as 4GB-2(boundary condition)
3294 test.Next(_L("Write to a big file synchronously in a thread with aPos = 4GB-10 and data = 1KB and length = 10 bytes\n"));
3295 readBuf1024.Zero();//to ensure that the previous data is removed
3296 TInt64 seekPos = K4GBMinusTen;
3297 TestRFile1.Seek(ESeekStart,seekPos);
3298 TestRFile1.Write(writeBuf1024,9);
3299 TestRFile1.Seek(ESeekStart,seekPos);
3300 TestRFile1.Read(readBuf1024,9);
3301 test(validateBuf1024 == readBuf1024);
3305 test.Next(_L("Check for FAT32 file system. Write to a big file synchronously in a thread with aPos = 4GB, data length = 256 bytes and length = 10 bytes\n"));
3306 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
3308 TBuf8<0x100> writeBuf256;
3309 TBuf8<0x100> readBuf256;
3311 writeBuf256.FillZ();
3312 for (TInt count = 0; count < 0x100; count++)
3314 writeBuf256.Append(count+6);
3316 TestRFile1.Write(K4GB,writeBuf256,10);
3317 TestRFile1.Read(K4GB,readBuf256,10);
3318 test(readBuf256.Length() == 0);
3320 test.Next(_L(" Write to a big file synchronously in a thread with aPos = 0 , data = 256 bytes and length =0 bytes\n"));
3321 TBuf8<0x100> wrBuf256;
3322 TBuf8<0x100> reBuf256;
3325 for (count = 0; count < 0x100; count++)
3327 wrBuf256.Append(count+6);
3329 TestRFile1.Write(0,wrBuf256,0);
3330 TestRFile1.Read(0,reBuf256,0);
3331 test(reBuf256.Length() == 0);
3333 test.Next(_L("Write to a big file synchronously in a thread with aPos = 0 , data = 256 bytes and length = -1\n"));
3334 TBuf8<0x100> wBuf256;
3337 for (count = 0; count < 0x100; count++)
3339 wBuf256.Append(count+3);
3341 TestRFile1.Write(0,wrBuf256,-1);
3344 TInt r = TheFs.Delete(fileName);
3345 test(r == KErrNone);
3349 @SYMTestCaseID PBASE-T_FILE64BIT-0776
3350 @SYMTestPriority High
3351 @SYMTestRequirement REQ9526
3353 @SYMTestCaseDesc Tests for writing to a big file asynchronously with specified position and length
3355 1) Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = 255 bytes
3356 2) Write to a big file asynchronously in a thread, with aPos = 2GB-1, data = 1KB and length = 200 bytes
3357 3) Write to a big file asynchronously in a thread, with aPos = 4GB-10, data = 10 bytes and length = 10 bytes
3358 4) Check for FAT32 file system. Write to a big file asynchronously in a thread, with aPos = 4GB+1, data = 256 bytes and length = 10 bytes
3359 5) Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = 0 bytes
3360 6) Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = -1bytes
3361 @SYMTestExpectedResults
3362 1) KErrNone, write is successful
3363 2) KErrNone, write is successful
3364 3) KErrNone, write is successful
3365 4) KErrNotSupported. If NGFS is supported KErrNone and write is successful
3368 @SYMTestStatus Implemented
3371 void TestOpenAndWriteAsyncLargeFileWithLen()
3373 test.Next(_L("Open & Write Asynchronously Large File From Different Offset and length:"));
3377 fileName.Append(gDriveToTest);
3378 fileName.Append(KTestPath);
3379 fileName.Append(_L("File4GBMinusOne.txt"));
3380 TestRFile1.Replace(fileName, EFileWrite);
3382 TestRFile1.SetSize(K4GBMinusOne);
3384 test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = 255 bytes \n"));
3385 TBuf8<0x100> writeBuf100;
3386 TBuf8<0x100> readBuf100;
3387 TBuf8<0x100> validateBuf100;
3389 writeBuf100.FillZ();
3390 validateBuf100.Zero();
3391 for (count = 0; count < 0x100; count++)
3393 writeBuf100.Append((TChar)count);
3395 validateBuf100.Append((TChar)count);
3397 TRequestStatus status1 = KRequestPending;
3398 TestRFile1.Write(0,writeBuf100,255,status1);
3399 TestRFile1.Read(0,readBuf100,255);
3400 test(validateBuf100 == readBuf100);
3402 test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 2GB-1, data = 1KB and length = 200 bytes\n"));
3403 TBuf8<0x400> writeBuf400;
3404 TBuf8<0x400> readBuf400;
3405 TBuf8<0x400> validateBuf400;
3407 writeBuf400.FillZ();
3408 validateBuf400.Zero();
3409 for (count = 0; count < 0x400; count++)
3411 writeBuf400.Append(count+20);
3413 validateBuf400.Append(count+20);
3415 TRequestStatus status2 = KRequestPending;
3416 TestRFile1.Write(K2GBMinusOne,writeBuf400,200,status2);
3417 TestRFile1.Read(K2GBMinusOne,readBuf400,200);
3418 test(validateBuf400 == readBuf400);
3420 test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-10, data = 10 bytes and length = 10 bytes\n"));
3421 TBuf8<0x0A> writeBuf0A;
3422 TBuf8<0x0A> readBuf0A;
3423 TBuf8<0x0A> validateBuf0A;
3426 validateBuf0A.Zero();
3427 for (count = 0; count < 0x0A; count++)
3429 writeBuf0A.Append(count+3);
3431 validateBuf0A.Append(count+3);
3433 TRequestStatus status3 = KRequestPending;
3434 TestRFile1.Write(K4GBMinusTen,writeBuf0A,9,status3);
3435 TestRFile1.Read(K4GBMinusTen,readBuf0A,9);
3436 test(validateBuf0A == readBuf0A);
3438 //tests need to be repeated for TUint variant of RFile64::Write()
3440 test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = 255 bytes \n"));
3441 readBuf100.Zero();//to ensure that the previous data is removed
3442 status1 = KRequestPending;
3444 TestRFile1.WriteU(pos,writeBuf100,255,status1);
3445 TestRFile1.ReadU(pos,readBuf100,255);
3446 test(validateBuf100 == readBuf100);
3448 test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 2GB-1, data = 1KB and length = 200 bytes\n"));
3449 readBuf400.Zero();//to ensure that the previous data is removed
3450 status2 = KRequestPending;
3452 TestRFile1.Write(pos,writeBuf400,200,status2);
3453 TestRFile1.Read(pos,readBuf400,200);
3454 test(validateBuf400 == readBuf400);
3456 test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-10, data = 10 bytes and length = 10 bytes\n"));
3457 readBuf0A.Zero();//to ensure that the previous data is removed
3458 status3 = KRequestPending;
3460 TestRFile1.Write(pos,writeBuf0A,9,status3);
3461 TestRFile1.Read(pos,readBuf0A,9);
3462 test(validateBuf0A == readBuf0A);
3465 //tests need to be repeated for current position variant of RFile64::Write()
3466 //testing with only current position as 4GB-2(boundary condition)
3468 test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-10, data = 10 bytes and length = 10 bytes\n"));
3469 readBuf0A.Zero();//to ensure that the previous data is removed
3470 status3 = KRequestPending;
3471 TInt64 seekPos = K4GBMinusTen;
3472 TestRFile1.Seek(ESeekStart,seekPos);
3473 TestRFile1.Write(writeBuf0A,9,status3);
3474 TestRFile1.Seek(ESeekStart,seekPos);
3475 TestRFile1.Read(readBuf0A,9);
3476 test(validateBuf0A == readBuf0A);
3480 test.Next(_L("Check for FAT32 file system. Write to a big file asynchronously in a thread, with aPos = 4GB+1, data = 256 bytes and length = 10 bytes\n"));
3482 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
3484 TBuf8<0x100> writeBuf256;
3485 TBuf8<0x100> readBuf256;
3487 writeBuf256.FillZ();
3488 for (TInt count = 0; count < 0x100; count++)
3490 writeBuf256.Append(count+6);
3492 TRequestStatus status5 = KRequestPending;
3493 TestRFile1.Write(K4GBPlusOne,writeBuf256,10,status5);
3494 TestRFile1.Read(K4GBPlusOne,readBuf256,10);
3495 test(readBuf256.Length() == 0);
3498 test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = 0 bytes\n"));
3499 TBuf8<0x100> wrBuf256;
3500 TBuf8<0x100> reBuf256;
3503 for (count = 0; count < 0x100; count++)
3505 wrBuf256.Append(count+6);
3507 TRequestStatus status6 = KRequestPending;
3508 TestRFile1.Write(0,wrBuf256,0,status6);
3509 TestRFile1.Read(0,reBuf256,0);
3510 test(reBuf256.Length() == 0);
3512 test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = -1bytes \n"));
3513 TBuf8<0x100> wBuf256;
3516 for (count = 0; count < 0x100; count++)
3518 wBuf256.Append(count+3);
3520 TRequestStatus status7 = KRequestPending;
3521 TestRFile1.Write(0,wrBuf256,-1,status7);
3524 TInt r = TheFs.Delete(fileName);
3525 test(r == KErrNone);
3529 @SYMTestCaseID PBASE-T_FILE64BIT-0777
3530 @SYMTestPriority High
3531 @SYMTestRequirement REQ9526
3533 @SYMTestCaseDesc Tests for locking a large file using RFile64::Lock()
3535 1) Lock a big file with aPos = 0, aLength = 2GB-1
3536 2) Lock a big file with aPos = 0, aLength = 2GB-1 ( i.e. again Lock with same parameters). This is to test multiple locks to same region.
3537 3) Extend the Lock with aPos = 0, aLength = 2GB+10.This tests overlapped locks.
3538 4) Extend the Lock with aPos = 2GB-100, aLength = 200. This also tests overlapped locks.
3539 5) Lock with aPos = 100, aLength = 2GB-100.This tries to lock sub region of a Lock
3540 6) Lock same file with aPos = 2GB-1 and aLength = 200. Lock same file with aPos = 2GB + 300 and aLength =200.
3541 7) Lock a big file with aPos = 0, aLength = 4GB-1.Tests boundary condition.
3542 8) Lock a file with aPos =4GB and aLength=10
3543 @SYMTestExpectedResults
3544 1) KErrNone, lock is successful
3545 2) KErrLocked, lock is unsuccessful
3546 3) KErrLocked, lock is unsuccessful
3547 4) KErrLocked, lock is unsuccessful
3548 5) KErrLocked, lock is unsuccessful
3549 6) KErrNone, lock is successful
3550 7) KErrLocked, lock is successful
3552 @SYMTestStatus Implemented
3557 test.Next(_L("Tests for locking a big file:"));
3560 fileName.Append(gDriveToTest);
3561 fileName.Append(KTestPath);
3562 fileName.Append(_L("File4GBMinusOne.txt"));
3563 TestRFile1.Replace(fileName, EFileRead);
3565 test.Next(_L("Lock a big file with aPos = 0, aLength = 2GB-1\n"));
3566 TestRFile1.Lock(0, K2GBMinusOne);
3569 test.Next(_L(" Attempt to lock the same region again\n"));
3570 TestRFile1.LockE(0, K2GBMinusOne);
3572 test.Next(_L("Extend the Lock with aPos = 0, aLength = 2GB+10\n"));
3573 TestRFile1.LockE(0, K2GBPlusTen);
3575 test.Next(_L("Extend the Lock with aPos = 2GB-100, aLength = 200\n"));
3576 TestRFile1.LockE(K2GBMinus100, 200);
3578 test.Next(_L("Lock with aPos = 100, aLength = 2GB-100.\n"));
3579 TestRFile1.LockE(100, K2GBMinus100);
3581 test.Next(_L("Lock same file with aPos = 2GB-1 and aLength = 200\n"));
3582 TestRFile1.Lock(K2GBMinusOne, 200);
3584 test.Next(_L("Lock a big file with aPos = 0, aLength = 4GB-1\n"));
3585 TestRFile1.LockE(0, K4GBMinusOne);
3588 if(KFileSizeMaxLargerThan4GBMinusOne)
3590 test.Next(_L("Lock a file with aPos =4GB and aLength=10\n"));
3591 TestRFile1.Lock(K4GB + 2, 10);
3596 TInt r = TheFs.Delete(fileName);
3597 test(r == KErrNone);
3602 @SYMTestCaseID PBASE-T_FILE64BIT-0778
3603 @SYMTestPriority High
3604 @SYMTestRequirement REQ9526
3606 @SYMTestCaseDesc Tests the File unlock functionality using RFile64::UnLock()
3608 1) UnLock a big file, same region which is locked with aPos = 0, aLength = 2GB-1.
3609 2) UnLock a big file, which is not locked with aPos = 0, aLength = 2GB-1.
3610 3) UnLock a big file twice, same region which is locked with aPos = 0, aLength = 2GB-1.
3611 4) UnLock a big file in a region which is sub region of Lock. aPos = 10, aLength = 2GB-100. File should have been locked with aPos = 0, aLength = 2GB-1.
3612 5) UnLock a big file in a region which is extended region of Lock, with aPos = 0, aLength = 2GB +100. File should have been locked with aPos = 0, aLength = 2GB-1.
3613 6) UnLock a big file to test boundary condition, with aPos = 0, aLength = 4GB-1.The file should have been locked with same arguments.
3614 7) UnLock different regions of a file which were locked in same order with aPos = 0, aLength = 2GB+200.
3615 Second Unlock aPos = 2GB+300 and aLength =200.
3616 Third UnLock aPos = 2GB+600 and aLength = 200.
3617 8) UnLock different regions of a file which were locked in different order with aPos = 0, aLength = 2GB+100.
3618 Second Unlock aPos = 2GB+300 and aLength =200.
3619 Third UnLock aPos = 2GB+600 and aLength = 200.
3620 9) UnLock multiple locked regions with aPos = 0, aLength = 2GB-1.The file should have been locked in same region but with different locks
3621 10)Unlock a locked file with aPos = 4GB and aLength = 10bytes
3623 @SYMTestExpectedResults
3634 @SYMTestStatus Implemented
3637 void TestFileUnlock()
3639 test.Next(_L("Tests for Unlocking a big file:\n"));
3642 fileName.Append(gDriveToTest);
3643 fileName.Append(KTestPath);
3644 fileName.Append(_L("File4GBMinusOne.txt"));
3645 TestRFile2.Replace(fileName, EFileRead);
3647 test.Next(_L("UnLock a big file, same region which is locked with aPos = 0, aLength = 2GB-1.\n"));
3648 TestRFile2.Lock(0, K2GBMinusOne);
3649 TestRFile2.UnLock(0, K2GBMinusOne);
3650 TestRFile2.UnLockE(0, K2GBMinusOne);
3652 test.Next(_L("UnLock a big file, which is not locked with aPos = 0, aLength = 2GB-1\n"));
3653 TestRFile2.UnLockE(0, K2GBMinusOne);
3655 test.Next(_L("UnLock a big file twice, same region which is locked with aPos = 0, aLength = 2GB-1\n"));
3656 TestRFile2.Lock(0, K2GBMinusOne);
3657 TestRFile2.UnLockE(10, K2GBMinus100);
3658 TestRFile2.UnLock(0, K2GBMinusOne);
3660 test.Next(_L("UnLock a big file in a region which is sub region of Lock. aPos = 10, aLength = 2GB-100. File should have been locked with aPos = 0, aLength = 2GB-1\n"));
3661 TestRFile2.Lock(0, K2GBMinusOne);
3662 TestRFile2.UnLockE(10, K2GBMinus100);
3663 TestRFile2.UnLock(0, K2GBMinusOne);
3665 test.Next(_L("UnLock a big file in a region which is extended region of Lock, with aPos = 0, aLength = 2GB +100. File should have been locked with aPos = 0, aLength = 2GB-1.\n"));
3666 TestRFile2.Lock(0, K2GBMinusOne);
3667 TestRFile2.UnLockE(10, K2GBPlus100);
3668 TestRFile2.UnLock(0, K2GBMinusOne);
3670 test.Next(_L("UnLock a big file to test boundary condition, with aPos = 0, aLength = 4GB-1.The file should have been locked with same arguments\n"));
3671 TestRFile2.Lock(0, K4GBMinusOne);
3672 TestRFile2.UnLock(0, K4GBMinusOne);
3674 test.Next(_L("UnLock different regions of a file which were locked in same order with aPos = 0, aLength = 2GB+200\n"));
3675 TestRFile2.Lock(0, K2GBPlus200);
3676 TestRFile2.Lock(K2GBPlus300, 200);
3677 TestRFile2.Lock(K2GBPlus600, 200);
3678 TestRFile2.UnLock(0, K2GBPlus200);
3679 TestRFile2.UnLock(K2GBPlus300, 200);
3680 TestRFile2.UnLock(K2GBPlus600, 200);
3682 test.Next(_L("UnLock different regions of a file which were locked in different order with aPos = 0, aLength = 2GB+100\n"));
3683 TestRFile2.Lock(0, K2GBPlus100);
3684 TestRFile2.Lock(K2GBPlus600, 200);
3685 TestRFile2.Lock(K2GBPlus300, 200);
3686 TestRFile2.UnLock(K2GBPlus600, 200);
3687 TestRFile2.UnLock(K2GBPlus300, 200);
3688 TestRFile2.UnLock(0, K2GBPlus100);
3690 test.Next(_L("UnLock multiple locked regions with aPos = 0, aLength = 2GB-1.The file should have been locked in same region but with different locks\n"));
3691 TestRFile2.Lock(0, 100);
3692 TestRFile2.Lock(100, K2GBMinusOne);
3693 TestRFile2.UnLockE(0, K2GBMinusOne);
3696 if(KFileSizeMaxLargerThan4GBMinusOne)
3699 test.Next(_L("Unlock a locked file with aPos = 4GB and aLength = 10bytes\n"));
3700 TestRFile2.Lock(K4GB, 10);
3701 TestRFile2.UnLock(K4GB, 10);
3705 TInt r = TheFs.Delete(fileName);
3706 test(r == KErrNone);
3710 @SYMTestCaseID PBASE-T_FILE64BIT-0779
3711 @SYMTestPriority High
3712 @SYMTestRequirement REQ9526
3714 @SYMTestCaseDesc Tests for file seek operation using RFile64::Seek()
3716 1) Set the file size as 20
3717 2) Seek mode = ESeekEnd, seek position = 80, call RFile64::Seek()
3718 3) Check Seek position
3719 4) Set file size = 512
3720 5) Seek mode =ESeekStart, assign seek position =513, get the seek position using RFile64::Seek()
3721 6) Check the seek position
3722 7) Seek mode = ESeekEnd, get the seek position using RFile64::Seek()
3723 8) Check the seek position
3724 9) Seek position =-530, seek mode = ESeekEnd, Get the seek position using RFile64::Seek()
3725 10)Check the seek position
3726 11)Seek position =-10, seek mode = ESeekEnd, get the seek position using RFile64::Seek()
3727 12)Seek position =-10, seek mode = ESeekStart, get the seek position using RFile64::Seek()
3728 13)Seek position =0, seek mode = ESeekEnd, get the seek position using RFile64::Seek()
3729 @SYMTestExpectedResults
3732 3) Seek position = 20
3735 6) Seek position = 513
3737 8) Seek position = 512
3740 11)Seek position =502
3741 12)KErrArgument, seek position unchanged
3742 13)Seek position =512
3743 @SYMTestStatus Implemented
3751 fileName.Append(gDriveToTest);
3752 fileName.Append(KTestPath);
3753 fileName.Append(_L("seektest.txt"));
3754 TestRFile1.Replace(fileName);
3757 test.Next(_L("Set the file size as 20\n"));
3758 TestRFile1.SetSize(20);
3760 test.Next(_L("Seek mode = ESeekEnd, seek position = 80, call RFile64::Seek() "));
3762 TestRFile1.Seek(ESeekEnd, seekPos);
3763 test(seekPos == 20);
3765 test.Next(_L("Set the file size as 512\n"));
3766 TestRFile1.SetSize(512);
3768 test.Next(_L("Seek mode =ESeekStart, assign seek position =513, get the seek position using RFile64::Seek()\n"));
3770 TestRFile1.Seek(ESeekStart, seekPos);
3771 test(seekPos == 513);
3773 test.Next(_L("Seek mode = ESeekEnd, get the seek position using RFile64::Seek()\n"));
3774 TestRFile1.Seek(ESeekEnd, seekPos);
3775 test(seekPos == 512);
3777 test.Next(_L("Seek position =-530, seek mode = ESeekEnd, Get the seek position using RFile64::Seek()\n"));
3779 TestRFile1.Seek(ESeekEnd, seekPos);
3782 test.Next(_L("Seek position =-10, seek mode = ESeekEnd, get the seek position using RFile64::Seek()\n"));
3784 TestRFile1.Seek(ESeekEnd, seekPos);
3785 test(seekPos == 502);
3787 test.Next(_L("Seek position =-10, seek mode = ESeekStart, get the seek position using RFile64::Seek()\n"));
3789 TestRFile1.Seek(ESeekStart,seekPos);
3790 test(seekPos == -10);
3792 test.Next(_L("Seek position =0, seek mode = ESeekEnd, get the seek position using RFile64::Seek()\n"));
3794 TestRFile1.Seek(ESeekEnd,seekPos);
3795 test(seekPos == 512);
3799 TInt r = TheFs.Delete(fileName);
3800 test(r == KErrNone);
3804 @SYMTestCaseID PBASE-T_FILE64BIT-0780
3805 @SYMTestPriority High
3806 @SYMTestRequirement REQ9526
3808 @SYMTestCaseDesc Test file seek operation for large file
3810 1) Set the file size as 2GB-1
3811 2) Seek mode = ESeekEnd, seek position = 2GB+80, call RFile64::Seek()
3812 3) Check Seek position
3813 4) Set file size = 4GB -1
3814 5) Seek mode = ESeekStart, assign seek position = 4GB-1, get the seek position using RFile64::Seek()
3815 6) Check the seek position
3816 7) Seek mode = ESeekEnd, get the seek position using RFile64::Seek()
3817 8) Check the seek position
3818 9) Seek position = (4GB), seek mode = ESeekEnd, Get the seek position using RFile64::Seek()
3819 10)Check the seek position
3820 11)Seek position =-10, seek mode = ESeekEnd, get the seek position using RFile64::Seek()
3821 12)Seek position =-10, seek mode = ESeekStart, get the seek position using RFile64::Seek()
3822 13)Seek position =0, seek mode = ESeekEnd, get the seek position using RFile64::Seek()
3823 @SYMTestExpectedResults
3826 3) Seek position = 2GB-1
3829 6) Seek position = 4GB-1
3831 8) Seek position = 4GB-1
3834 11)Seek position =4GB-10
3835 12)KErrArgument, seek position unchanged
3836 13)Seek position =4GB - 1
3837 @SYMTestStatus Implemented
3840 void TestFileSeekBigFile()
3847 fileName.Append(gDriveToTest);
3848 fileName.Append(KTestPath);
3849 fileName.Append(_L("File4GBMinusOne.txt"));
3850 TestRFile1.Replace(fileName, EFileRead|EFileWrite);
3852 test.Next(_L("Set the file size as 2GB-1\n"));
3853 TestRFile1.SetSize(K2GBMinusOne);
3855 test.Next(_L("Seek mode = ESeekEnd, seek position = 2GB+80, call RFile64::Seek()\n"));
3856 seekPos = K2GBPlus80;
3857 TestRFile1.Seek(ESeekEnd, seekPos);
3858 test(seekPos == K2GBMinusOne);
3860 test.Next(_L("Set the file size to 4GB-1\n"));
3861 TestRFile1.SetSize(K4GBMinusOne);
3863 test.Next(_L("Seek mode = ESeekStart, assign seek position = 4GB-1, get the seek position using RFile64::Seek()\n"));
3864 seekPos = K4GBMinusOne;
3865 TestRFile1.Seek(ESeekStart, seekPos);
3866 test(seekPos == K4GBMinusOne);
3868 test.Next(_L("Seek mode = ESeekEnd, get the seek position using RFile64::Seek()\n"));
3869 TestRFile1.Seek(ESeekEnd, seekPos);
3870 test(seekPos == K4GBMinusOne);
3872 if(KFileSizeMaxLargerThan4GBMinusOne)
3874 TestRFile1.SetSize(K4GB);
3875 TestRFile1.Seek(ESeekEnd, seekPos);
3876 test(seekPos == K4GB);
3878 TestRFile1.Seek(ESeekEnd, seekPos);
3879 test(seekPos == K4GB-10);
3881 TestRFile1.Seek(ESeekStart,seekPos);
3882 test(seekPos == -10);
3884 TestRFile1.Seek(ESeekEnd,seekPos);
3885 test(seekPos == K4GB);
3889 TestRFile1.SetSize(K4GB);
3890 TestRFile1.Seek(ESeekEnd, seekPos);
3891 test(seekPos == K4GBMinusOne);
3893 TestRFile1.Seek(ESeekEnd, seekPos);
3894 test(seekPos == K4GBMinusOne-10);
3896 TestRFile1.Seek(ESeekStart,seekPos);
3897 test(seekPos == -10);
3899 TestRFile1.Seek(ESeekEnd,seekPos);
3900 test(seekPos == K4GBMinusOne);
3906 TInt r = TheFs.Delete(fileName);
3907 test(r == KErrNone);
3911 @SYMTestCaseID PBASE-T_FILE64BIT-0781
3912 @SYMTestPriority High
3913 @SYMTestRequirement REQ9527
3915 @SYMTestCaseDesc Test RFile64::SetSize() and RFile64::Size() functionality
3917 1) Set the file size =128KB
3918 2) Write a test data = "ABCDEFGH", at position = 0
3919 3) Get the file size
3920 4) Read the data from position = 0
3921 5) Compare the read data with written data
3922 6) Set the file size to = 2GB-1
3923 7) Write test data = "IJKLMnOPxY IJKLMnOPx", length=20 bytes, at position 2GB-10
3924 8) Get the file size
3925 9) Read the data from the position 2GB-10
3926 10)Compare the read data
3927 11)Set the file size = 4GB-1
3928 12)Write test data = "IJKLMnOPxY IJKLMnOPx", length=10 bytes, at position 4GB-10
3929 13)Get the file size
3930 14)Read the data from the position 4GB-10
3931 15)Compare the read data
3932 @SYMTestExpectedResults
3934 2) KErrNone, write is successful
3935 3) KErrNone, File Size = 128KB
3936 4) KErrNone, read is successful
3937 5) Read data == Written data
3939 7) KErrNone, write is successful
3940 8) KErrNone File Size = 2GB+10
3941 9) KErrNone, read is successful
3942 10)Read data == Written data
3944 12)KErrNone, write is successful for 10 bytes
3945 13)KErrNone File Size == 4GB-1
3946 14)KErrNone, read is successful
3947 15)Read data == Written data
3948 @SYMTestStatus Implemented
3953 test.Next(_L("Create a large file"));
3956 fileName.Append(gDriveToTest);
3957 fileName.Append(KTestPath);
3958 fileName.Append(_L("File4GBMinusOne.txt"));
3959 TestRFile1.Replace(fileName, EFileRead|EFileWrite);
3963 test.Next(_L("Set the file size =128KB\n"));
3964 TestRFile1.SetSize(131072); // 128KB
3966 test.Next(_L("Write a test data = ABCDEFGH, at position = 0\n"));
3967 TBuf8<16> testData = _L8("ABCDEFGH");
3968 TestRFile1.WriteP(0,testData);
3971 test.Next(_L("Get the file size\n"));
3972 TestRFile1.Size(size);
3973 test(size == 131072) ;
3975 test.Next(_L("Read and compare the data from position = 0\n"));
3976 TBuf8<16> testData2;
3977 TestRFile1.Read(0,testData2,8);
3978 test(testData == testData2);
3980 test.Next(_L("Set the file size =2GB - 1 \n"));
3981 TestRFile1.SetSize(K2GBMinusOne); // 2GB-1
3983 test.Next(_L("Write test data = IJKLMnOPxY IJKLMnOPx ,length=20 bytes, at position 2GB-10\n"));
3984 TBuf8<20> testData3 = _L8("IJKLMnOPxY IJKLMnOPx");
3985 TestRFile1.Write(K2GBMinusTen,testData3, 20);
3987 test.Next(_L("Get the file size\n"));
3988 TestRFile1.Size(size);
3989 test(size == K2GBPlusTen);
3991 test.Next(_L("Read and compare the data from position = 2GB-10\n"));
3992 TBuf8<10> testData4;
3993 TestRFile1.Read(K2GBMinusTen,testData4,10);
3994 test(testData4 == _L8("IJKLMnOPxY"));
3996 test.Next(_L("Set the file size =2GB - 1 \n"));
3997 TestRFile1.SetSize(K4GBMinusOne); // 4GB-1
3999 test.Next(_L("Write test data = IJKLMnOPxY IJKLMnOPx, length=10 bytes, at position 4GB-10\n"));
4000 TBuf8<20> testData5 = _L8("IJKLMnOPxY IJKLMnOPx");
4001 TestRFile1.Write(K4GBMinusTen,testData5,9);
4003 test.Next(_L("Get the file size\n"));
4004 TestRFile1.Size(size);
4005 test(size == K4GBMinusOne);
4007 test.Next(_L("Read the data from the position 4GB-10\n"));
4008 TBuf8<10> testData6;
4009 TestRFile1.Read(K4GBMinusTen,testData6,9);
4010 test(testData6 == _L8("IJKLMnOPx"));
4013 TInt r = TheFs.Delete(fileName);
4014 test(r == KErrNone);
4018 @SYMTestCaseID PBASE-T_FILE64BIT-0782
4019 @SYMTestPriority High
4020 @SYMTestRequirement REQ9528
4022 @SYMTestCaseDesc Tests for reading a data from a big file without opening it
4024 1) Read from a big file using RFs::ReadFileSection() from position 3GB-1,52byte lengths of data
4025 2) Open a big file in EFileShareAny | EFileRead mode and read from it using RFs::ReadFileSection() from position 3GB-1, 52byte lengths of data
4026 3) Open a big file in EFileShareExclusive | EFileRead mode and read from it using RFs::ReadFileSection( ) from position 3GB-1, 52byte lengths of data
4027 4) Open a big file in EFileShareExclusive | EFileWrite mode and read from it using RFs::ReadFileSection( ) from position 3GB-1, 52byte lengths of data
4028 5) Check for FAT32 file system. Read from a big file using RFs::ReadFileSection( ) from position equal to 4GB, 52byte lengths of data
4029 @SYMTestExpectedResults
4030 1) KErrNone, read is successful
4031 2) KErrNone, open and read both are successful
4032 3) KErrNone, open and read both are successful
4033 4) KErrNone, open and read both are successful
4034 5) KErrNone with zero length descriptor,if NGFS is supported we should get the valid data
4035 @SYMTestStatus Implemented
4037 void TestReadFilesection()
4039 test.Next(_L("Read data from a large file using RFs::ReadFileSection\n"));
4046 fileName.Append(gDriveToTest);
4047 fileName.Append(KTestPath);
4048 fileName.Append(_L("File4GBMinusOne.txt"));
4050 TInt r = file.Replace(TheFs,fileName,EFileWrite);
4051 test(r == KErrNone);
4052 r = file.SetSize(K4GBMinusOne);
4053 test(r == KErrNone);
4056 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);
4059 test.Next(_L("Open a big file in EFileShareAny | EFileRead mode and read from it using RFs::ReadFileSection() from position 3GB-1, 52byte lengths of data\n"));
4060 TestRFile1.Open(fileName,EFileShareAny|EFileRead);
4061 TestRFs.ReadFileSection(fileName,0,testDes,52);
4062 test(testDes.Length() == 52);
4065 test.Next(_L("Open a big file in EFileShareExclusive | EFileRead mode and read from it using RFs::ReadFileSection( ) from position 3GB-1, 52byte lengths of data\n"));
4066 TestRFile1.Open(fileName,EFileShareExclusive|EFileRead);
4067 TestRFs.ReadFileSection(fileName,K3GBMinusOne,testDes,52);
4070 test.Next(_L("Open a big file in EFileShareExclusive | EFileWrite mode and read from it using RFs::ReadFileSection( ) from position 3GB-1, 52byte lengths of data\n"));
4071 TestRFile1.Open(fileName,EFileShareExclusive|EFileWrite);
4072 TestRFs.ReadFileSection(fileName,K3GBMinusOne,testDes,52);
4076 test.Next(_L("Check for FAT32 file system. Read from a big file using RFs::ReadFileSection( ) from position equal to 4GB, 52byte lengths of data\n"));
4078 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
4080 TestRFs.ReadFileSection(fileName,K4GB,readBuf,52);
4083 r = TheFs.Delete(fileName);
4084 test(r == KErrNone);
4088 @SYMTestCaseID PBASE-T_FILE64BIT-0783
4089 @SYMTestPriority High
4090 @SYMTestRequirement REQ9530
4092 @SYMTestCaseDesc Check that we can get a valid directory listing of a directory containing large files using RDir and then CDir
4093 TInt RFs::GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList) const;
4095 1) Get the directory listing, sort by size
4096 2) Check the files count in the directory. Number of files in a directory is 4
4097 3) Get the entry list & Check the files are listed in order of file sizes
4098 @SYMTestExpectedResults
4100 2) 4 Files in the directory
4101 3) File size should match and arranged in ascending order
4102 @SYMTestStatus Implemented
4104 void TestGetDirectory()
4106 test.Next(_L("Read a directory containing large files using RDir"));
4109 dirName.Append(gDriveToTest);
4110 dirName.Append(KTestPath);
4112 TFileName file4GBMinusOne;
4113 file4GBMinusOne.Append(gDriveToTest);
4114 file4GBMinusOne.Append(KTestPath);
4115 file4GBMinusOne.Append(_L("File4GBMinusOne.txt"));
4116 TFileName file2GBMinusOne;
4117 file2GBMinusOne.Append(gDriveToTest);
4118 file2GBMinusOne.Append(KTestPath);
4119 file2GBMinusOne.Append(_L("File2GBMinusOne.txt"));
4121 file2GB.Append(gDriveToTest);
4122 file2GB.Append(KTestPath);
4123 file2GB.Append(_L("File2GB.txt"));
4125 file3GB.Append(gDriveToTest);
4126 file3GB.Append(KTestPath);
4127 file3GB.Append(_L("File3GB.txt"));
4129 TestRFile1.Replace(file4GBMinusOne);
4130 TestRFile1.SetSize(K4GBMinusOne);
4133 TestRFile1.Replace(file2GBMinusOne);
4134 TestRFile1.SetSize(K2GBMinusOne);
4137 TestRFile1.Replace(file2GB);
4138 TestRFile1.SetSize(K2GB);
4141 TestRFile1.Replace(file3GB);
4142 TestRFile1.SetSize(K3GB);
4145 test.Next(_L("Get the directory listing, sort by size\n"));
4147 TInt r = dir.Open(TheFs, dirName, KEntryAttNormal);
4148 test (r == KErrNone);
4150 TEntryArray entryArray;
4151 r = dir.Read(entryArray);
4152 test (r == KErrEof);
4154 test.Next(_L("Check the files count in the directory. Number of files in a directory is 4\n"));
4155 test(entryArray.Count() == gFilesInDirectory);
4157 test.Next(_L("Get the entry list & Check the files are listed in order of file sizes\n"));
4159 for (n = 0; n<entryArray.Count(); n++)
4161 const TEntry& entry = entryArray[n];
4162 if (entry.iName.MatchF(KFile2GBMinusOne()) == 0)
4163 test(entry.FileSize() == K2GBMinusOne);
4164 else if (entry.iName.MatchF(KFile2GB()) == 0)
4165 test(entry.FileSize() == K2GB);
4166 else if (entry.iName.MatchF(KFile3GB()) == 0)
4167 test(entry.FileSize() == K3GB);
4168 else if (entry.iName.MatchF(KFile4GBMinusOne()) == 0)
4169 test(entry.FileSize() == K4GBMinusOne);
4176 test.Next(_L("Read a directory containing large files using CDir & sort by size"));
4177 CDir* dirList = NULL;
4178 TestRFs.GetDir(dirName, KEntryAttMaskSupported, ESortBySize, dirList);
4179 test(dirList->Count() == gFilesInDirectory);
4180 for (n = 0; n<dirList->Count(); n++)
4183 entry = (*dirList)[n];
4184 if (entry.iName.MatchF(KFile2GBMinusOne()) == 0)
4185 test(entry.FileSize() == K2GBMinusOne);
4186 else if (entry.iName.MatchF(KFile2GB()) == 0)
4187 test(entry.FileSize() == K2GB);
4188 else if (entry.iName.MatchF(KFile3GB()) == 0)
4189 test(entry.FileSize() == K3GB);
4190 else if (entry.iName.MatchF(KFile4GBMinusOne()) == 0)
4191 test(entry.FileSize() == K4GBMinusOne);
4201 @SYMTestCaseID PBASE-T_FILE64BIT-0784
4202 @SYMTestPriority High
4203 @SYMTestRequirement REQ9533
4205 @SYMTestCaseDesc Tests functionality of TEntry
4207 1) Set the File Size to 4GB-1 using RFile64::SetSize()
4209 3) Get the file size, using TEntry::FileSize()
4210 4) Get the file size using iSize (i.e. without type cast to TUint)
4211 5) Check for FAT32 file system. Set the file size to 4GB
4212 6) Get the file size, using TEntry::FileSize()
4213 7) Compare the File size with expected size
4214 @SYMTestExpectedResults
4217 3) File size = 4GB-1
4219 5) KErrNotSupported for FAT32 and KErrNone for NGFS
4220 6) FAT32 file size = 4GB-1 and NGFS file size = 4GB
4221 7) File size = 4GB-1
4222 @SYMTestStatus Implemented
4226 test.Next(_L("Tests functionality for TEntry"));
4229 fileName.Append(gDriveToTest);
4230 fileName.Append(KTestPath);
4231 fileName.Append(_L("File4GBMinusOne.txt"));
4232 TestRFile1.Replace(fileName, EFileRead|EFileWrite);
4238 test.Next(_L("Set the File Size to 4GB-1 using RFile64::SetSize()\n"));
4239 TestRFile1.SetSize(K4GBMinusOne);
4241 test.Next(_L("Get the entry\n"));
4242 TestRFs.GetDir(fileName, KEntryAttMaskSupported, ESortBySize, anEntryList);
4243 for (TInt n = 0; n<anEntryList->Count(); n++)
4245 entry = (*anEntryList)[n];
4246 if (entry.iName.MatchF(KFile4GBMinusOne()) == 0)
4248 test(entry.FileSize() == K4GBMinusOne);
4252 test.Next(_L("Get the file size, using TEntry::FileSize()\n"));
4253 size = entry.FileSize();
4254 test(size == K4GBMinusOne);
4255 test(entry.iSize == -1);
4259 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
4261 TestRFile1.SetSize(K4GB);
4262 size = entry.FileSize();
4263 test(size == K4GBMinusOne);
4271 @SYMTestCaseID PBASE-T_FILE64BIT-0785
4272 @SYMTestPriority High
4273 @SYMTestRequirement REQ9530
4275 @SYMTestCaseDesc Test the RDir read functionality with large file
4277 1) Open the directory containing large file, using RDir open()
4278 2) Read the directory entry using TEntryArray as parameter
4281 @SYMTestExpectedResults
4282 1) KErrNone, open is successful
4285 4) Closes the directory
4286 @SYMTestStatus Implemented
4289 void TestReadDirectory()
4291 test.Next(_L("RDir::Read()"));
4294 dirName.Append(gDriveToTest);
4295 dirName.Append(KTestPath);
4297 test.Next(_L("Open the directory containing large file, using RDir open()\n"));
4299 TInt r = dir.Open(TheFs, dirName, KEntryAttNormal);
4300 test (r == KErrNone);
4302 test.Next(_L("Read the directory entry using TEntryArray as parameter\n"));
4303 TEntryArray entryArray;
4304 r = dir.Read(entryArray);
4305 test (r == KErrEof);
4307 test.Next(_L("Check the count\n"));
4308 test(entryArray.Count() == gFilesInDirectory);
4310 test.Next(_L("Close using RDir\n"));
4315 @SYMTestCaseID PBASE-T_FILE64BIT-0786
4316 @SYMTestPriority High
4317 @SYMTestRequirement REQ9530
4319 @SYMTestCaseDesc Test the sorting of directory entries using CDir::Sort()
4321 1) Sort with number of entries =0
4322 2) Sort the directory entries with large files, sort key = ESortBySize
4323 3) Get the entries count
4324 4) Check the files are arranged in increasing file size
4325 @SYMTestExpectedResults
4327 2) KErrNone, sort is successful
4329 4) sequence should be in increasing order
4330 @SYMTestStatus Implemented
4333 void TestSortDirectory()
4340 testDir0.Append(gDriveToTest);
4341 testDir0.Append(_L("F32-TEST"));
4343 TInt r = TheFs.MkDir(testDir0);
4344 test(r == KErrNone || r == KErrAlreadyExists);
4346 test.Next(_L("Sort with number of entries =0\n"));
4347 TestRFs.GetDir(testDir0, KEntryAttMaskSupported, ESortBySize, anEntryList);
4348 test(anEntryList->Count() == 0);
4352 test.Next(_L(" Sort the directory entries with large files, sort key = ESortBySize\n"));
4354 testDir.Append(gDriveToTest);
4355 testDir.Append(KTestPath);
4357 TestRFs.GetDir(testDir, KEntryAttMaskSupported, ESortBySize, aDirList);
4359 test.Next(_L("Get the entries count\n"));
4360 test(aDirList->Count() == gFilesInDirectory);
4363 test.Next(_L("Check the files are arranged in increasing file size\n"));
4364 for (TInt n = 0; n<aDirList->Count(); n++)
4366 entry = (*aDirList)[n];
4367 if (entry.iName.MatchF(KFile2GBMinusOne()) == 0)
4369 test(entry.FileSize() == K2GBMinusOne);
4372 else if (entry.iName.MatchF(KFile2GB()) == 0)
4374 test(entry.FileSize() == K2GB);
4377 else if (entry.iName.MatchF(KFile3GB()) == 0)
4379 test(entry.FileSize() == K3GB);
4382 else if (entry.iName.MatchF(KFile4GBMinusOne()) == 0)
4384 test(entry.FileSize() == K4GBMinusOne);
4395 @SYMTestCaseID PBASE-T_FILE64BIT-0787
4396 @SYMTestPriority High
4397 @SYMTestRequirement REQ9530
4399 @SYMTestCaseDesc Test cases for validating CDir::AddL()
4401 1) Fill the directory entry with details of large files contained in them
4402 2) Get the directory entry,using RFs::GetDir()
4403 3) Compare with entry added
4404 @SYMTestExpectedResults
4407 3) Added entry == retrieved entry
4408 @SYMTestStatus Implemented
4410 void TestAddLDirectory()
4416 testDir.Append(gDriveToTest);
4417 testDir.Append(KTestPath);
4419 test.Next(_L("Get the directory entry,using RFs::GetDir()\n"));
4420 TestRFs.GetDir(testDir, KEntryAttMaskSupported, ESortBySize, aDirList);
4421 test(aDirList->Count() == gFilesInDirectory);
4423 test.Next(_L("Compare with entry added\n"));
4424 for (TInt n = 0; n<aDirList->Count(); n++)
4426 entry = (*aDirList)[n];
4427 if (entry.iName.MatchF(KFile2GBMinusOne()) ==0 )
4429 test(entry.FileSize() == K2GBMinusOne);
4432 else if (entry.iName.MatchF(KFile2GB) == 0)
4434 test(entry.FileSize() == K2GB);
4437 else if (entry.iName.MatchF(KFile3GB()) == 0)
4439 test(entry.FileSize() == K3GB);
4442 else if (entry.iName.MatchF(KFile4GBMinusOne()) == 0)
4444 test(entry.FileSize() == K4GBMinusOne);
4453 TFileName file4GBMinusOne;
4454 file4GBMinusOne.Append(gDriveToTest);
4455 file4GBMinusOne.Append(KTestPath);
4456 file4GBMinusOne.Append(_L("File4GBMinusOne.txt"));
4457 TFileName file2GBMinusOne;
4458 file2GBMinusOne.Append(gDriveToTest);
4459 file2GBMinusOne.Append(KTestPath);
4460 file2GBMinusOne.Append(_L("File2GBMinusOne.txt"));
4462 file2GB.Append(gDriveToTest);
4463 file2GB.Append(KTestPath);
4464 file2GB.Append(_L("File2GB.txt"));
4466 file3GB.Append(gDriveToTest);
4467 file3GB.Append(KTestPath);
4468 file3GB.Append(_L("File3GB.txt"));
4470 TInt r = TheFs.Delete(file4GBMinusOne);
4471 test(r == KErrNone);
4472 r = TheFs.Delete(file2GBMinusOne);
4473 test(r == KErrNone);
4474 r = TheFs.Delete(file2GB);
4475 test(r == KErrNone);
4476 r = TheFs.Delete(file3GB);
4477 test(r == KErrNone);
4481 @SYMTestCaseID PBASE-T_FILE64BIT-0788
4482 @SYMTestPriority High
4483 @SYMTestRequirement REQXXXX
4485 @SYMTestCaseDesc Test cases for validating TFileText changes.
4487 1) Open test file and get the file size using RFile64::Size() and set the file handle to TFileText object
4488 2) Seek to the file end using TFileText::Seek()
4489 3) Get current file position using RFile64::Seek() and verify it is at file end.
4490 4) Seek to location greater than 2GB-1 using RFile64::Seek
4491 5) Write data to the file using RFile64::Write
4492 6) Read data using TFileText::Read
4493 7) Compare the data read in steps 6 to the data written in step 5.
4494 8) Seek to the file end using TFileText::Seek(ESeekEnd).
4495 9) Write known data using TFileText::Write
4496 10) Read the data using RFile64::Read
4497 11) Compare the source data with read data.
4498 @SYMTestExpectedResults
4501 3) Current file position is file end.
4505 7) Read data == Written data
4509 11) Read data == Source data
4510 @SYMTestStatus Implemented
4512 void TestTFileText()
4515 fileName.Append(gDriveToTest);
4516 fileName.Append(KTestPath);
4517 fileName.Append(_L("test.txt"));
4520 TInt64 sizeK3GB = K3GB;
4522 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);
4524 test(r == KErrNone);
4525 r = file64.SetSize(sizeK3GB);
4526 test(r == KErrNone);
4528 fileText.Set(file64);
4530 test.Next(_L("Seek to the file end using TFileText::Seek()\n"));
4531 r = fileText.Seek(ESeekEnd);
4532 test(r == KErrNone);
4534 test.Next(_L("Get current file position using RFile64::Seek() and verify it is at file end.\n"));
4536 r = file64.Seek(ESeekCurrent, pos);
4537 test(r == KErrNone);
4538 test(pos == sizeK3GB);
4540 test.Next(_L("Write data to the file using RFile64::Write\n"));
4541 HBufC* record = HBufC::NewL(10);
4542 record->Des().SetLength(10);
4543 record->Des().Fill('A');
4545 bufPtr.Set((TUint8*)record->Ptr(),record->Size()); // Size() returns length in bytes
4546 r = file64.Write(pos,bufPtr);
4547 test(r == KErrNone);
4549 test.Next(_L("Read data using TFileText::Read\n"));
4550 TBuf<20> fileTextReadBuf;
4551 file64.Seek(ESeekStart,pos);//seek to the position where the data has been written
4552 r = fileText.Read(fileTextReadBuf);
4553 test(fileTextReadBuf == _L("AAAAAAAAAA"));
4555 test.Next(_L("Seek to the file end using TFileText::Seek(ESeekEnd)\n"));
4556 r = fileText.Seek(ESeekEnd);
4557 test(r == KErrNone);
4559 test.Next(_L("Write known data using TFileText::Write\n"));
4560 TBuf<20> fileTextWriteBuf(_L("AAAAAAAAAA"));
4562 r = file64.Seek(ESeekCurrent,pos);
4563 r = fileText.Write(fileTextWriteBuf);
4564 test(r == KErrNone);
4566 test.Next(_L("Read the data using RFile64::Read\n"));
4567 TBuf8<20> file64ReadBuf;
4568 file64ReadBuf.Zero();
4569 r = file64.Read(pos,file64ReadBuf);
4570 r = bufPtr.Compare(file64ReadBuf);
4571 test (r == KErrNone);
4575 r = TheFs.Delete(fileName);
4576 test(r == KErrNone);
4582 @SYMTestCaseID PBASE-T_FILE64BIT-0789
4583 @SYMTestPriority High
4584 @SYMTestRequirement REQ9526
4586 @SYMTestCaseDesc Test the file read and write with locking a specified region of the file.
4588 1) Set the File Size to 2GB-1
4589 2) Lock a section of large file, position =0, aLength = 2GB-1
4590 3) Read from position = 2GB-100 and length = 99
4591 4) Write to the File, position = 2GB-100 and length = 99
4592 5) Use RFs::ReadFileSection () and with position = 2GB -100 and length = 99
4593 6) Set the file size to 4GB-1
4594 7) Lock a section of large file, position =2GB, aLength = 4GB-1
4595 8) Write to the File, position = 4GB-100 and length = 99
4596 @SYMTestExpectedResults
4598 2) KErrNone, file lock successful
4599 3) KErrNone, read is successful
4600 4) KErrLocked, write is unsuccessful
4601 5) KErrNone, read is successful
4603 7) KErrNone, lock is successful
4604 8) KErrLocked, write is unsuccessful
4605 @SYMTestStatus Implemented
4607 void TestReadWriteLock()
4609 TBuf8<0x63> readBuf;
4612 fileName.Append(gDriveToTest);
4613 fileName.Append(KTestPath);
4614 fileName.Append(_L("File4GBMinusOne.txt"));
4616 test.Start(_L("Test Lock Functionality\n"));
4617 TestRFile1.Replace(fileName, EFileWrite|EFileShareAny);
4618 TestRFile2.Open(fileName);
4620 test.Next(_L("Creating test pattern"));
4621 pattern.SetLength(pattern.MaxLength());
4622 for (TInt i = 0;i<pattern.MaxLength();i++)
4623 pattern[i] = (TText8)(i + 10);
4626 test.Next(_L("Multi file tests"));
4628 test.Next(_L("Set the File Size to 2GB-1\n"));
4629 TestRFile1.SetSize(K2GBMinusOne);
4630 TestRFile1.Size(size);
4631 test(size == K2GBMinusOne);
4633 test.Next(_L("Lock a section of large file, position =0, aLength = 2GB-1\n"));
4634 TestRFile1.Lock(0,K2GBMinusOne);
4635 TestRFile1.LockE(0,K2GBMinusOne);
4637 test.Next(_L("Read from position = 2GB-100 and length = 99\n"));
4638 TestRFile1.Read(K2GBMinus100,buf,99);
4640 test.Next(_L("Write to the File, position = 2GB-100 and length = 99\n"));
4641 TestRFile2.WriteE(K2GBMinus100,pattern,99);
4642 TestRFile1.UnLock(0,K2GBMinusOne);
4643 TestRFile2.Write(K2GBMinus100,pattern,99);
4645 test.Next(_L("Use RFs::ReadFileSection () and with position = 2GB -100 and length = 99\n"));
4646 TestRFs.ReadFileSection(fileName,K2GBMinus100,readBuf,99);
4648 test.Next(_L("Set the file size to 4GB-1\n"));
4649 TestRFile1.SetSize(K4GBMinusOne);
4650 TestRFile1.Size(size);
4651 test(size == K4GBMinusOne);
4653 if(KFileSizeMaxLargerThan4GBMinusOne)
4656 test.Next(_L("Lock a section of large file, position =2GB, aLength = 4GB-1\n"));
4657 TestRFile1.Lock(K2GB,K4GBMinusOne);
4658 TestRFile1.LockE(K2GB,K4GBMinusOne);
4660 test.Next(_L("Write to the File, position = 4GB-100 and length = 99\n"));
4661 TestRFile2.WriteE(K4GBMinus100,pattern,99);
4662 TestRFile1.UnLock(K2GB,K4GBMinusOne);
4668 TInt r = TheFs.Delete(fileName);
4669 test(r == KErrNone);
4674 @SYMTestCaseID PBASE-T_FILE64BIT-0790
4675 @SYMTestPriority High
4676 @SYMTestRequirement REQ9526
4678 @SYMTestCaseDesc Test the files unlock functionality and performs file read and write.
4680 1) Set the File Size to 2GB-1
4681 2) Lock a section of file, position =0, aLength = 2GB-1
4682 3) UnLock a section of large file, position = 0, aLength = 2GB-1
4683 4) Read a file with position = 2GB-100 and length = 99
4684 5) Write to a file with position = 2GB-100 and length = 99
4685 6) Use RFs::ReadFileSection() to read from a file, position = 0 and length = 100(Open mode = EFileShareAny)
4686 7) Set the File Size to 4GB-1
4687 8) Lock a section of large file, position =2GB, aLength = 4GB-1
4688 9) UnLock a section of large file, position =2GB, aLength = 4GB-1
4689 10)Write to the File, position = 4GB-100 and length = 99
4690 @SYMTestExpectedResults returns
4692 2) KErrNone, file locked successfully
4693 3) KErrNone, File unlocked successfully
4694 4) KErrNone, read is successful
4695 5) KErrNone, write is successful
4696 6) KErrNone, read is successful
4698 8) KErrNone, lock is successful
4699 9) KErrNone, unlock is successful
4700 10)KErrNone, write is successful
4701 @SYMTestStatus Implemented
4706 TBuf8<0x64> readBuf;
4709 fileName.Append(gDriveToTest);
4710 fileName.Append(KTestPath);
4711 fileName.Append(_L("File4GBMinusOne.txt"));
4713 test.Start(_L("Test Unlock Functionality\n"));
4714 TestRFile1.Replace(fileName,EFileWrite|EFileShareAny);
4715 TestRFile2.Open(fileName);
4717 test.Next(_L("Creating test pattern"));
4718 pattern.SetLength(pattern.MaxLength());
4719 for (TInt i = 0;i < pattern.MaxLength();i++)
4720 pattern[i] = (TText8)(i+10);
4722 test.Next(_L("Set the File Size to 2GB-1\n"));
4723 TestRFile1.SetSize(K2GBMinusOne);
4724 TestRFile1.Size(size);
4725 test(size == K2GBMinusOne);
4727 test.Next(_L("Lock a section of file, position =0, aLength = 2GB-1\n"));
4728 TestRFile1.Lock(0,K2GBMinusOne);
4729 TestRFile1.LockE(0,K2GBMinusOne);
4731 test.Next(_L("UnLock a section of large file, position = 0, aLength = 2GB-1\n"));
4732 TestRFile1.UnLock(0,K2GBMinusOne);
4734 test.Next(_L("Read a file with position = 2GB-100 and length = 99\n"));
4735 TestRFile1.Read(K2GBMinus100,buf,99);
4737 test.Next(_L("Write to a file with position = 2GB-100 and length = 99\n"));
4738 TestRFile2.Write(K2GBMinus100,pattern,99);
4739 TestRFile1.Read(K2GBMinus100,buf,99);
4740 test(pattern == buf); // Written data == Read data
4742 test.Next(_L("Use RFs::ReadFileSection() to read from a file, position = 0 and length = 100(Open mode = EFileShareAny)\n"));
4743 TFileName fileName1;
4744 fileName1.Append(gDriveToTest);
4745 fileName1.Append(KTestPath);
4746 fileName1.Append(_L("File2GB.txt"));
4748 TInt r = file.Replace(TheFs, fileName1, EFileWrite);
4749 test (r == KErrNone);
4751 test (r == KErrNone);
4753 TestRFs.ReadFileSection(fileName1,0,readBuf,100);
4754 r = TheFs.Delete(fileName1);
4755 test (r == KErrNone);
4756 test.Next(_L("Creating test pattern"));
4758 TBuf8<0x63> writeBuf63;
4759 TBuf8<0x63> readBuf63;
4760 for (TInt count = 0; count < 0x63; count++)
4762 writeBuf63.Append((TChar)count);
4765 test.Next(_L("Set the File Size to 4GB-1\n"));
4766 TestRFile1.SetSize(K4GBMinusOne);
4767 TestRFile1.Size(size);
4768 test(size == K4GBMinusOne);
4770 if(KFileSizeMaxLargerThan4GBMinusOne)
4772 test.Next(_L("Lock a section of large file, position =2GB, aLength = 4GB-1\n"));
4773 TestRFile1.Lock(K2GB,K4GBMinusOne);
4776 test.Next(_L("UnLock a section of large file, position =2GB, aLength = 4GB-1\n"));
4777 TestRFile1.UnLock(K2GB,K4GBMinusOne);
4779 test.Next(_L("Write to the File, position = 4GB-100 and length = 99\n"));
4780 TestRFile2.Write(K4GBMinus100,writeBuf63,99);
4781 TestRFile2.Read(K4GBMinus100,readBuf63,99);
4782 test(writeBuf63 == readBuf63); // Written data == Read data
4788 r = TheFs.Delete(fileName);
4789 test(r == KErrNone);
4794 @SYMTestCaseID PBASE-T_FILE64BIT-2349
4795 @SYMTestPriority High
4796 @SYMTestRequirement REQ9529
4798 @SYMTestCaseDesc Test RFile64::Seek(), Read() & Write() functionality for synchronous calls
4800 IMPORT_C TInt Read(TDes8 &aDes) const;
4801 IMPORT_C TInt Write(const TDesC8 &aDes);
4803 1) Open the large file, Set the File Size to 2GB-1
4804 2) File Seek with: Mode= ESeekCurrent, position = 2GB-100
4805 3) Write to a file with current position and length = 99
4806 4) Seek the file: Mode= ESeekStart, position = 2GB-100
4807 5) Read a file with current position and length =99
4808 6) Compare the read data with written data
4809 7) Seek the file: Mode = ESeekEnd
4810 8) Write to a file with current position and length =99
4811 9) Set the file size to 4GB-1
4812 10)Check for FAT32 File system. Seek the file: Mode = ESeekEnd
4813 11)Write to a file with current position and length =99
4814 12)If NGFS is supported, Set the file size to 4GB+10
4815 13)Seek the file: Mode = ESeekEnd
4816 14)Write to a file with current position and length =99
4817 @SYMTestExpectedResults
4818 1) KErrNone, open is successful
4819 2) KErrNone, Seek Position = 2GB-100
4820 3) KErrNone, write is successful
4821 4) KErrNone, Seek Position = 2GB-100
4822 5) KErrNone, read is successful
4823 6) Read data == written data
4825 8) KErrNone, write is successful
4832 @SYMTestStatus Implemented
4834 void TestSeekReadWrite()
4836 TBuf8<0x63> readBuf;
4837 TBuf8<0x63> writeBuf;
4841 fileName.Append(gDriveToTest);
4842 fileName.Append(KTestPath);
4843 fileName.Append(_L("File4GBMinusOne.txt"));
4845 test.Start(_L("Test RFile64::Seek(), RFile64::Read() & RFile64::Write() for synchronous calls\n"));
4847 test.Next(_L("Open the large file, Set the File Size to 2GB-1\n"));
4848 TestRFile1.Replace(fileName,EFileWrite|EFileShareAny);
4850 for (count = 0; count < 0x63; count++)
4852 writeBuf.Append(count);
4855 test.Next(_L("Single file tests"));
4856 TInt64 size2GBMinusOne = 1;
4857 size2GBMinusOne <<= 31;
4858 size2GBMinusOne -= 1;
4859 TestRFile1.SetSize(size2GBMinusOne);
4861 test.Next(_L("File Seek with: Mode= ESeekCurrent, position = 2GB-100\n"));
4862 seekPos = K2GBMinus100;
4863 TestRFile1.Seek(ESeekCurrent,seekPos);
4865 TestRFile1.Seek(ESeekCurrent,seekPos);
4866 test(seekPos == K2GBMinus100);
4868 test.Next(_L("Write to a file with current position and length = 99\n"));
4869 TestRFile1.Write(writeBuf); // Write 99 bytes of data to a file
4871 test.Next(_L("Seek the file: Mode= ESeekStart, position = 2GB-100\n"));
4873 TestRFile1.Seek(ESeekCurrent,seekPos);
4874 test(seekPos == K2GBMinusOne);
4876 test.Next(_L("Read a file with current position and length =99\n"));
4877 seekPos = K2GBMinus100;
4878 TestRFile1.Seek(ESeekStart,seekPos);
4879 TestRFile1.Read(readBuf);
4881 test.Next(_L("Compare the read data with written data\n"));
4882 test(writeBuf == readBuf); // Written data == Read data
4884 TBuf8<0x63> writeBuf99;
4885 TBuf8<0x63> readBuf99;
4888 test.Next(_L("Seek the file: Mode = ESeekEnd\n"));
4889 TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
4890 test(seekPos == K2GBMinusOne);
4892 test.Next(_L("Write to a file with current position and length =99\n"));
4893 for (count = 0; count < 0x63; count++)
4895 writeBuf99.Append(count+1);
4897 TestRFile1.Write(writeBuf99);
4898 seekPos = K2GBMinusOne;
4899 TestRFile1.Seek(ESeekStart,seekPos);
4900 TestRFile1.Read(readBuf99);
4901 test(writeBuf99 == readBuf99); // Written data == Read data
4903 TestRFile1.Size(size);
4904 test(size == K2GBPlus98); // Validate the file size
4906 TBuf8<0x63> readBufx63;
4907 TBuf8<0x63> writeBufx63;
4909 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) //File Systems supporting size of upto 4GB-1
4911 TestRFile1.SetSize(K4GBMinusOne);
4912 TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
4913 test(seekPos == K4GBMinusOne);
4914 for (TInt count = 0; count < 0x63; count++)
4916 writeBufx63.Append(count+2);
4918 TestRFile1.Write(writeBufx63);
4919 TestRFile1.Size(size);
4920 test(size == K4GBMinusOne);
4923 { //-- the currenc file system supports files larger than 4G-1
4924 TestRFile1.SetSize(K4GB+10);
4925 TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
4926 test(seekPos == K4GB+10);
4927 for (TInt count = 0; count < 0x63; count++)
4929 writeBufx63.Append(count+2);
4931 TestRFile1.Write(writeBufx63);
4932 TestRFile1.Size(size);
4933 test(size == K4GB+109);
4934 TestRFile1.Read(readBufx63); // validating the content
4939 TInt r = TheFs.Delete(fileName);
4940 test(r == KErrNone);
4945 @SYMTestCaseID PBASE-T_FILE64BIT-2350
4946 @SYMTestPriority High
4947 @SYMTestRequirement REQ9529
4949 @SYMTestCaseDesc Test RFile64::Seek(), Read() & Write() functionality for asynchronous calls
4951 IMPORT_C void Read(TDes8 &aDes, TRequestStatus &aStatus) const;
4952 IMPORT_C void Write(const TDesC8 &aDes, TRequestStatus &aStatus);
4954 1) Open the large file, Set the File Size to 2GB-1
4955 2) File Seek with: Mode= ESeekCurrent, position = 2GB-100
4956 3) Write to a file with current position and length = 99
4957 4) Seek the file: Mode= ESeekStart, position = 2GB-100
4958 5) Read a file with current position and length =99
4959 6) Compare the read data with written data
4960 7) Seek the file: Mode = ESeekEnd
4961 8) Write to a file with current position and length =99
4962 9) Set the file size to 4GB-1
4963 10)Check for FAT32 File system. Seek the file: Mode = ESeekEnd
4964 11)Write to a file with current position and length =99
4965 12)If NGFS is supported, Set the file size to 4GB+10
4966 13)Seek the file: Mode = ESeekEnd
4967 14)Write to a file with current position and length =99
4968 @SYMTestExpectedResults
4969 1) KErrNone, open is successful
4970 2) KErrNone, Seek Position = 2GB-100
4971 3) KErrNone, write is successful
4972 4) KErrNone, Seek Position = 2GB-100
4973 5) KErrNone, read is successful
4974 6) Read data == written data
4976 8) KErrNone, write is successful
4983 @SYMTestStatus Implemented
4985 void TestSeekAsyncReadWrite()
4987 TBuf8<0x63> readBuf;
4988 TBuf8<0x63> writeBuf;
4991 fileName.Append(gDriveToTest);
4992 fileName.Append(KTestPath);
4993 fileName.Append(_L("File4GBMinusOne.txt"));
4995 test.Start(_L("Test RFile64::Seek(), RFile64::Read() & RFile64::Write() for Asynchronous calls\n"));
4997 TestRFile1.Replace(fileName,EFileWrite|EFileShareAny);
4999 for (count = 0; count < 0x63; count++)
5001 writeBuf.Append(count);
5004 test.Next(_L("Single file tests"));
5005 TestRFile1.SetSize(K2GBMinusOne);
5006 TInt64 seekPos = K2GBMinus100;
5007 TestRFile1.Seek(ESeekCurrent,seekPos);
5009 TestRFile1.Seek(ESeekCurrent,seekPos);
5010 test(seekPos == K2GBMinus100);
5012 TRequestStatus status1 = KRequestPending;
5013 TestRFile1.Write(writeBuf,status1); // Write 99 bytes of data to a file
5015 TestRFile1.Seek(ESeekCurrent,seekPos);
5016 test(seekPos == K2GBMinusOne);
5017 seekPos = K2GBMinus100;
5018 TestRFile1.Seek(ESeekStart,seekPos);
5019 TRequestStatus status2 = KRequestPending;
5020 TestRFile1.Read(readBuf, status2);
5021 test(writeBuf == readBuf); // Written data == Read data
5023 TBuf8<0x63> writeBuf99;
5024 TBuf8<0x63> readBuf99;
5026 TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
5027 test(seekPos == K2GBMinusOne);
5028 for (count = 0; count < 0x63; count++)
5030 writeBuf99.Append(count+1);
5032 TRequestStatus status3 = KRequestPending;
5033 TestRFile1.Write(writeBuf99, status3);
5034 seekPos = K2GBMinusOne;
5035 TestRFile1.Seek(ESeekStart,seekPos);
5036 TRequestStatus status4 = KRequestPending;
5037 TestRFile1.Read(readBuf99, status4);
5038 test(writeBuf99 == readBuf99); // Written data == Read data
5040 TestRFile1.Size(size);
5041 test(size == K2GBPlus98); // Validate the file size
5043 TBuf8<0x63> readBufx63;
5044 TBuf8<0x63> writeBufx63;
5046 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)//File Systems supporting size of upto 4GB-1
5048 TestRFile1.SetSize(K4GBMinusOne);
5049 TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
5050 test(seekPos == K4GBMinusOne);
5051 for (TInt count = 0; count < 0x63; count++)
5053 writeBufx63.Append(count+2);
5055 TRequestStatus status5 = KRequestPending;
5056 TestRFile1.Write(writeBufx63, status5);
5057 TestRFile1.Size(size);
5058 test(size == K4GBMinusOne);
5062 TestRFile1.SetSize(K4GB+10);
5063 TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
5064 test(seekPos == K4GB+10);
5065 for (TInt count = 0; count < 0x63; count++)
5067 writeBufx63.Append(count+2);
5069 TRequestStatus status7 = KRequestPending;
5070 TestRFile1.Write(writeBufx63, status7);
5071 TestRFile1.Size(size);
5072 test(size == K4GB+109);
5073 TRequestStatus status8 = KRequestPending;;
5074 TestRFile1.Read(readBufx63, status8); // validating the content
5078 TInt r = TheFs.Delete(fileName);
5079 test(r == KErrNone);
5084 @SYMTestCaseID PBASE-T_FILE64BIT-2351
5085 @SYMTestPriority High
5086 @SYMTestRequirement REQ9529
5088 @SYMTestCaseDesc Test RFile64::Seek(), Read() & Write() functionality for synchronous calls with length
5090 IMPORT_C TInt Read(TDes8 &aDes, TInt aLength) const;
5091 IMPORT_C TInt Write(const TDesC8 &aDes, TInt aLength);
5093 1) Open the large file, Set the File Size to 2GB-1
5094 2) File Seek with: Mode= ESeekCurrent, position = 2GB-100
5095 3) Write to a file with current position and length = 99
5096 4) Seek the file: Mode= ESeekStart, position = 2GB-100
5097 5) Read a file with current position and length =99
5098 6) Compare the read data with written data
5099 7) Seek the file: Mode = ESeekEnd
5100 8) Write to a file with current position and length =99
5101 9) Set the file size to 4GB-1
5102 10)Check for FAT32 File system. Seek the file: Mode = ESeekEnd
5103 11)Write to a file with current position and length =99
5104 12)If NGFS is supported, Set the file size to 4GB+10
5105 13)Seek the file: Mode = ESeekEnd
5106 14)Write to a file with current position and length =99
5107 @SYMTestExpectedResults
5108 1) KErrNone, open is successful
5109 2) KErrNone, Seek Position = 2GB-100
5110 3) KErrNone, write is successful
5111 4) KErrNone, Seek Position = 2GB-100
5112 5) KErrNone, read is successful
5113 6) Read data == written data
5115 8) KErrNone, write is successful
5122 @SYMTestStatus Implemented
5124 void TestSeekReadWriteLen()
5126 TBuf8<0x63> readBuf;
5127 TBuf8<0x63> writeBuf;
5130 fileName.Append(gDriveToTest);
5131 fileName.Append(KTestPath);
5132 fileName.Append(_L("File4GBMinusOne.txt"));
5134 test.Start(_L("Test RFile64::Seek(), RFile64::Read() & RFile64::Write() with Length\n"));
5136 TestRFile1.Replace(fileName,EFileWrite|EFileShareAny);
5138 for (count = 0; count < 0x63; count++)
5140 writeBuf.Append(count);
5143 test.Next(_L("Single file tests"));
5145 test.Next(_L("Open the large file, Set the File Size to 2GB-1\n"));
5146 TestRFile1.SetSize(K2GBMinusOne);
5148 test.Next(_L("File Seek with: Mode= ESeekCurrent, position = 2GB-100\n"));
5149 TInt64 seekPos = K2GBMinus100;
5150 TestRFile1.Seek(ESeekCurrent,seekPos);
5152 TestRFile1.Seek(ESeekCurrent,seekPos);
5153 test(seekPos == K2GBMinus100);
5155 test.Next(_L("Write to a file with current position and length = 99\n"));
5156 TestRFile1.Write(writeBuf, 99); // Write 99 bytes of data to a file
5158 TestRFile1.Seek(ESeekCurrent,seekPos);
5159 test(seekPos == K2GBMinusOne);
5161 test.Next(_L("Seek the file: Mode= ESeekStart, position = 2GB-100\n"));
5162 seekPos = K2GBMinus100;
5163 TestRFile1.Seek(ESeekStart,seekPos);
5165 test.Next(_L("Read a file with current position and length =99\n"));
5166 TestRFile1.Read(readBuf, 99);
5168 test.Next(_L("Compare the read data with written data\n"));
5169 test(writeBuf == readBuf); // Written data == Read data
5171 test.Next(_L("Seek the file: Mode = ESeekEnd\n"));
5172 TBuf8<0x63> writeBuf99;
5173 TBuf8<0x63> readBuf99;
5175 TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
5176 test(seekPos == K2GBMinusOne);
5178 test.Next(_L("Write to a file with current position and length =99\n"));
5179 for (count = 0; count < 0x63; count++)
5181 writeBuf99.Append(count+1);
5183 TestRFile1.Write(writeBuf99, 99);
5184 seekPos = K2GBMinusOne;
5185 TestRFile1.Seek(ESeekStart,seekPos);
5186 TestRFile1.Read(readBuf99, 99);
5187 test(writeBuf99 == readBuf99); // Written data == Read data
5189 TestRFile1.Size(size);
5190 test(size == K2GBPlus98); // Validate the file size
5192 TBuf8<0x63> readBufx63;
5193 TBuf8<0x63> writeBufx63;
5195 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)//File Systems supporting size of upto 4GB-1
5197 TestRFile1.SetSize(K4GBMinusOne);
5198 TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
5199 test(seekPos == K4GBMinusOne);
5200 for (TInt count = 0; count < 0x63; count++)
5202 writeBufx63.Append(count+2);
5204 TestRFile1.Write(writeBufx63, 99);
5205 TestRFile1.Size(size);
5206 test(size == K4GBMinusOne);
5210 TestRFile1.SetSize(K4GB+10);
5211 TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
5212 test(seekPos == K4GB+10);
5213 for (TInt count = 0; count < 0x63; count++)
5215 writeBufx63.Append(count+2);
5217 TestRFile1.Write(writeBufx63, 99);
5218 TestRFile1.Size(size);
5219 test(size == K4GB+109);
5220 TestRFile1.Read(readBufx63, 99); // validating the content
5225 TInt r = TheFs.Delete(fileName);
5226 test(r == KErrNone);
5230 @SYMTestCaseID PBASE-T_FILE64BIT-2352
5231 @SYMTestPriority High
5232 @SYMTestRequirement REQ9529
5234 @SYMTestCaseDesc Test RFile64::Seek(), Read() & Write() functionality for asynchronous calls with length
5235 IMPORT_C void Read(TDes8 &aDes, TRequestStatus &aStatus) const;
5236 IMPORT_C void Write(const TDesC8 &aDes, TRequestStatus &aStatus);
5238 1) Open the large file, Set the File Size to 2GB-1
5239 2) File Seek with: Mode= ESeekCurrent, position = 2GB-100
5240 3) Write to a file with current position and length = 99
5241 4) Seek the file: Mode= ESeekStart, position = 2GB-100
5242 5) Read a file with current position and length =99
5243 6) Compare the read data with written data
5244 7) Seek the file: Mode = ESeekEnd
5245 8) Write to a file with current position and length =99
5246 9) Set the file size to 4GB-1
5247 10)Check for FAT32 File system. Seek the file: Mode = ESeekEnd
5248 11)Write to a file with current position and length =99
5249 12)If NGFS is supported, Set the file size to 4GB+10
5250 13)Seek the file: Mode = ESeekEnd
5251 14)Write to a file with current position and length =99
5252 @SYMTestExpectedResults
5253 1) KErrNone, open is successful
5254 2) KErrNone, Seek Position = 2GB-100
5255 3) KErrNone, write is successful
5256 4) KErrNone, Seek Position = 2GB-100
5257 5) KErrNone, read is successful
5258 6) Read data == written data
5260 8) KErrNone, write is successful
5267 @SYMTestStatus Implemented
5270 void TestSeekAsyncReadWriteLen()
5272 TBuf8<0x63> readBuf;
5273 TBuf8<0x63> writeBuf;
5276 fileName.Append(gDriveToTest);
5277 fileName.Append(KTestPath);
5278 fileName.Append(_L("File4GBMinusOne.txt"));
5281 test.Start(_L("Test RFile64::Seek, RFile64::Read & RFile64::Write\n"));
5283 test.Next(_L("Open the large file, Set the File Size to 2GB-1\n"));
5284 TestRFile1.Replace(fileName,EFileWrite|EFileShareAny);
5286 for (count = 0; count < 0x63; count++)
5288 writeBuf.Append(count);
5291 test.Next(_L("Single file tests"));
5292 TestRFile1.SetSize(K2GBMinusOne);
5294 test.Next(_L("File Seek with: Mode= ESeekCurrent, position = 2GB-100\n"));
5295 TInt64 seekPos = K2GBMinus100;
5296 TestRFile1.Seek(ESeekCurrent,seekPos);
5298 TestRFile1.Seek(ESeekCurrent,seekPos);
5299 test(seekPos == K2GBMinus100);
5301 test.Next(_L("Write to a file with current position and length = 99"));
5302 TRequestStatus status1 = KRequestPending;
5303 TestRFile1.Write(writeBuf,99,status1); // Write 99 bytes of data to a file
5305 test.Next(_L("Seek the file: Mode= ESeekStart, position = 2GB-100\n"));
5307 TestRFile1.Seek(ESeekCurrent,seekPos);
5308 test(seekPos == K2GBMinusOne);
5309 seekPos = K2GBMinus100;
5310 TestRFile1.Seek(ESeekStart,seekPos);
5312 test.Next(_L("Read a file with current position and length =99\n"));
5313 TRequestStatus status2 = KRequestPending;
5314 TestRFile1.Read(readBuf,99,status2);
5316 test.Next(_L("Compare the read data with written data\n"));
5317 test(writeBuf == readBuf); // Written data == Read data
5319 test.Next(_L("Seek the file: Mode = ESeekEnd\n"));
5320 TBuf8<0x63> writeBuf99;
5321 TBuf8<0x63> readBuf99;
5323 TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
5324 test(seekPos == K2GBMinusOne);
5325 for (count = 0; count < 0x63; count++)
5327 writeBuf99.Append(count+1);
5330 test.Next(_L("Write to a file with current position and length =99\n"));
5331 TRequestStatus status3 = KRequestPending;
5332 TestRFile1.Write(writeBuf99,99,status3);
5333 seekPos = K2GBMinusOne;
5334 TestRFile1.Seek(ESeekStart,seekPos);
5335 TRequestStatus status4 = KRequestPending;
5336 TestRFile1.Read(readBuf99,99,status4);
5337 test(writeBuf99 == readBuf99); // Written data == Read data
5339 TestRFile1.Size(size);
5340 test(size == K2GBPlus98); // Validate the file size
5342 TBuf8<0x63> readBufx63;
5343 TBuf8<0x63> writeBufx63;
5345 if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) //File Systems supporting size of upto 4GB-1
5347 test.Next(_L("Set the file size to 4GB-1\n"));
5348 TestRFile1.SetSize(K4GBMinusOne);
5349 TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
5350 test(seekPos == K4GBMinusOne);
5351 for (TInt count = 0; count < 0x63; count++)
5353 writeBufx63.Append(count+2);
5355 TRequestStatus status5 = KRequestPending;
5356 TestRFile1.Write(writeBufx63,99,status5);
5357 TestRFile1.Size(size);
5358 test(size == K4GBMinusOne);
5362 TestRFile1.SetSize(K4GB+10);
5363 TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
5364 test(seekPos == K4GB+10);
5365 for (TInt count = 0; count < 0x63; count++)
5367 writeBufx63.Append(count+2);
5369 TRequestStatus status7 = KRequestPending;
5370 TestRFile1.Write(writeBufx63,99,status7);
5371 TestRFile1.Size(size);
5372 test(size == K4GB+109);
5373 TRequestStatus status8 = KRequestPending;;
5374 TestRFile1.Read(readBufx63,99,status8);
5377 TInt r = TheFs.Delete(fileName);
5378 test(r == KErrNone);
5382 @SYMTestCaseID PBASE-T_FILE64BIT-2353
5383 @SYMTestPriority High
5384 @SYMTestRequirement REQ9529
5386 @SYMTestCaseDesc Tests File resizing functionality
5388 1) Create a file name "test" in write mode
5389 2) Generate a random file size
5390 3) Set the file size using RFile64::SetSize()
5391 4) Get the file size.
5392 5) Seek to the file position RFile64::Size() -100 & File position >0
5393 6) Write 99 bytes to the current file position
5394 7) Read from the current file position.
5395 8) Compare the file read with written data.
5396 9) Repeat step 2 to 8 for <10> times in a loop.
5398 @SYMTestExpectedResults
5399 1) File create successfully.
5400 2) Ramdom file size generated.
5401 3) File size set successfully.
5402 4) File size = Random file size set.
5403 5) File seek successful.
5404 6) File write successful with KErrNone.
5405 7) File read successful with KErrNone.
5406 8) Read data == Written data.
5407 9) Expect result same as step 2 to 8.
5408 10) File closed successfully.
5409 @SYMTestStatus Implemented
5411 void TestFileReSize()
5413 TInt64 seed = K4GBMinusOne;
5414 TBuf8<0x63> readBuf;
5415 TBuf8<0x63> writeBuf;
5417 fileName.Append(gDriveToTest);
5418 fileName.Append(KTestPath);
5419 fileName.Append(_L("test.txt"));
5420 for (TInt count = 0; count < 0x63; count++)
5422 writeBuf.Append(count);
5424 test.Next(_L("Create a file name test in write mode\n"));
5425 TestRFile1.Replace(fileName, EFileWrite);
5428 for (TInt i = 0; i<10; i++)
5430 test.Next(_L("Generate a random file size\n"));
5431 randSize = Math::Rand(seed);
5433 test.Next(_L("Set the file size using RFile64::SetSize()\n"));
5434 TestRFile1.SetSize(randSize);
5436 test.Next(_L("Get the file size.\n"));
5437 TestRFile1.Size(size);
5438 test(randSize == size);
5440 test.Next(_L("Seek to the file position RFile64::Size() -100 & File position >0\n"));
5441 TInt64 seekPos = size - 100;
5442 if(size>100) //carry out tests for file sizes greater than 100 bytes
5444 TestRFile1.Seek(ESeekStart,seekPos);
5445 TRequestStatus status1 = KRequestPending;
5447 test.Next(_L("Write 99 bytes to the current file position\n"));
5448 TestRFile1.Write(writeBuf,99,status1); // Write 99 bytes of data to a file
5449 TestRFile1.Seek(ESeekStart,seekPos);
5452 test.Next(_L("Read from the current file position.\n"));
5453 TRequestStatus status2 = KRequestPending;
5455 test.Next(_L("Compare the file read with written data.\n"));
5456 TestRFile1.Read(readBuf,99,status2);
5457 test(writeBuf == readBuf); // Written data == Read data
5461 TInt r = TheFs.Delete(fileName);
5462 test(r == KErrNone);
5465 @SYMTestCaseID PBASE-T_FILE64BIT-2354
5466 @SYMTestPriority High
5467 @SYMTestRequirement REQ9532
5469 @SYMTestCaseDesc Tests for copying a directory containing large files using CFileMan::Copy()
5471 1) Create one large file in the specified test path
5472 2) Set the file size to 3GB-4KB
5473 3) Seek to the end of the file
5474 4) Check the seek position
5475 5) Write to a file with position = 3GB-4KB and length = 4KB
5476 6) Get the file size
5477 7) Create 3 small files in the specified test path
5478 8) Write 10 bytes to the created files
5479 9) Copy the files from one folder to another using CFileMan::Copy()
5480 10)Get the directory entry and find how many files are copied
5481 11)Set file man observer
5482 12)Copy the files from one folder to another, source folder has 3 small files and a large file
5483 13)Check observer for number of successful copy and failed copy
5484 14)Get the directory entry and find how many files copied
5485 @SYMTestExpectedResults
5486 1) KErrNone, file created successfully
5489 4) Seek position = 3GB-4KB
5490 5) KErrNone, write is successful
5492 7) KErrNone, 3 small files created successfully
5493 8) KErrNone, write is successful
5494 9) KErrNone, copy is successful
5495 10)4 files copied successfully
5497 12)KErrNone, copy is successful
5498 13)Number of success file copy = 4, Failed = 0
5499 14)4 files copied successfully
5500 @SYMTestStatus Implemented
5503 void TestCopyDirectory()
5505 test.Next(_L("Copy a directory containing large files"));
5506 CFileMan* fileMan = CFileMan::NewL(TheFs);
5507 test(fileMan != NULL);
5509 CFileManObserver* observer = new CFileManObserver(fileMan);
5510 test(observer != NULL);
5513 filePathOld.Append(gDriveToTest);
5514 filePathOld.Append(KTestPath);
5518 filePathNew.Append(gDriveToTest);
5519 filePathNew.Append(_L(":\\TEST\\"));
5522 // create some small files in the source directory
5523 // so that there is a combination of small files and one large files
5525 TEntryArray entryArray;
5527 TFileName fileLarge1;
5528 fileLarge1.Append(gDriveToTest);
5529 fileLarge1.Append(KTestPath);
5530 fileLarge1.Append(_L("FileLargeOne.txt"));
5532 test.Next(_L(" Create one large file in the specified test path\n"));
5533 TestRFile1.Replace(fileLarge1, EFileWrite | EFileShareAny);
5536 test.Next(_L("Set the file size to 3GB-4KB\n"));
5537 TestRFile1.SetSize(K3GB-K4KB);
5539 TestRFile1.Size(size1);
5541 test.Next(_L("Seek to the end of the file\n"));
5543 TestRFile1.Seek(ESeekEnd,seekPos);
5544 test(seekPos == K3GB-K4KB);
5546 test.Next(_L("Write to a file with position = 3GB-4KB and length = 4KB\n"));
5547 TBuf8<4096> writeBufK4KB;
5548 for (TInt count = 0; count < 4096; count++)
5550 writeBufK4KB.Append(count+1);
5552 TestRFile1.Write(seekPos, writeBufK4KB, writeBufK4KB.Length());
5553 TestRFile1.Size(size1);
5554 test.Next(_L("Get the file size\n"));
5556 TestRFile1.Size(size);
5560 test.Next(_L("Create 3 small files in the specified test path and Write 10 bytes to the created files\n"));
5561 TFileName fileSmall1;
5562 fileSmall1.Append(gDriveToTest);
5563 fileSmall1.Append(KTestPath);
5564 fileSmall1.Append(_L("FileSmallOne.txt"));
5566 TFileName fileSmall2;
5567 fileSmall2.Append(gDriveToTest);
5568 fileSmall2.Append(KTestPath);
5569 fileSmall2.Append(_L("FileSmallTwo.txt"));
5571 TFileName fileSmall3;
5572 fileSmall3.Append(gDriveToTest);
5573 fileSmall3.Append(KTestPath);
5574 fileSmall3.Append(_L("FileSmallThree.txt"));
5576 TestRFile1.Create(fileSmall1, EFileWrite | EFileShareAny);
5577 TestRFile1.Write(_L8("1234567891"));
5580 TestRFile1.Create(fileSmall2, EFileWrite | EFileShareAny);
5581 TestRFile1.Write(_L8("1234567891"));
5584 TestRFile1.Create(fileSmall3, EFileWrite | EFileShareAny);
5585 TestRFile1.Write(_L8("1234567891"));
5588 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);
5590 test(r == KErrNone || r == KErrTooBig);
5592 test.Next(_L("Get the directory entry and find how many files are copied\n"));
5593 // check SMALL and LARGE files have been copied
5594 r = dir.Open(TheFs, filePathNew, KEntryAttNormal);
5595 test (r == KErrNone);
5596 r = dir.Read(entryArray);
5597 test (r == KErrEof);
5598 test(entryArray.Count() == gFilesInDirectory);
5601 // then delete the new directory
5602 r = fileMan->Delete(filePathNew);
5603 test(r == KErrNone);
5605 test.Next(_L("Set file man observer\n"));
5606 // attempt to copy to new directory again - this time with an observer
5607 fileMan->SetObserver(observer);
5609 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);
5611 test(r == KErrNone || r == KErrTooBig);
5613 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
5615 // (For 8 GB disk, the 4GB file is missing)
5616 test(observer->iNotifyEndedSuccesses == gFilesInDirectory);
5617 test(observer->iNotifyEndedFailures == 0);
5619 test.Next(_L("Get the directory entry and find how many files copied\n"));
5620 // check SMALL files have been copied
5621 r = dir.Open(TheFs, filePathNew, KEntryAttNormal);
5622 test (r == KErrNone);
5623 r = dir.Read(entryArray);
5624 test (r == KErrEof);
5626 test(entryArray.Count() == gFilesInDirectory);
5629 // then delete the new directory
5630 r = fileMan->Delete(filePathNew);
5631 test(r == KErrNone);
5636 r = TheFs.Delete(fileSmall1);
5637 test(r == KErrNone);
5638 r = TheFs.Delete(fileSmall2);
5639 test(r == KErrNone);
5640 r = TheFs.Delete(fileSmall3);
5641 test(r == KErrNone);
5642 r = TheFs.Delete(fileLarge1);
5643 test(r == KErrNone);
5646 @SYMTestCaseID PBASE-T_FILE64BIT-2355
5647 @SYMTestPriority High
5648 @SYMTestRequirement REQ9532
5650 @SYMTestCaseDesc Tests for moving a directory containing large files using CFileMan::Move()
5652 1) Create 3 small files and 1 large file
5653 2) Write 10 bytes to the created files
5654 3) Move the files from one folder to another using CFileMan Move
5655 4) Get the directory entry and find how many files moved in a directory
5656 5) Move the files back to the original folder
5657 @SYMTestExpectedResults
5658 1) KErrNone, files created successfully
5659 2) KErrNone, write is successful
5661 4) 4 files moved successfully
5663 @SYMTestStatus Implemented
5665 void TestMoveDirectory()
5667 test.Next(_L("Move a directory containing large files"));
5668 CFileMan* fileMan = CFileMan::NewL(TheFs);
5669 test(fileMan != NULL);
5672 filePathOld.Append(gDriveToTest);
5673 filePathOld.Append(KTestPath);
5677 filePathNew.Append(gDriveToTest);
5678 filePathNew.Append(_L(":\\TEST\\"));
5680 test.Next(_L("Create 3 small files and 1 large file\n"));
5682 TFileName fileLarge1;
5683 fileLarge1.Append(gDriveToTest);
5684 fileLarge1.Append(KTestPath);
5685 fileLarge1.Append(_L("FileLargeOne.txt"));
5686 TestRFile1.Replace(fileLarge1, EFileWrite | EFileShareAny);
5687 TestRFile1.SetSize(K4GB-1);
5691 TFileName fileSmall1;
5692 fileSmall1.Append(gDriveToTest);
5693 fileSmall1.Append(KTestPath);
5694 fileSmall1.Append(_L("FileSmallOne.txt"));
5696 TFileName fileSmall2;
5697 fileSmall2.Append(gDriveToTest);
5698 fileSmall2.Append(KTestPath);
5699 fileSmall2.Append(_L("FileSmallTwo.txt"));
5701 TFileName fileSmall3;
5702 fileSmall3.Append(gDriveToTest);
5703 fileSmall3.Append(KTestPath);
5704 fileSmall3.Append(_L("FileSmallThree.txt"));
5706 TestRFile1.Create(fileSmall1, EFileWrite | EFileShareAny);
5707 TestRFile1.Write(_L8("1234567891"));
5710 TestRFile1.Create(fileSmall2, EFileWrite | EFileShareAny);
5711 TestRFile1.Write(_L8("1234567891"));
5714 TestRFile1.Create(fileSmall3, EFileWrite | EFileShareAny);
5715 TestRFile1.Write(_L8("1234567891"));
5719 // move to new directory
5720 TInt r = fileMan->Move(filePathOld, filePathNew, CFileMan::ERecurse | CFileMan::EOverWrite);
5721 test(r == KErrNone || r == KErrTooBig);
5723 // check SMALL and LARGE files have been moved
5725 r = dir.Open(TheFs, filePathNew, KEntryAttNormal);
5726 test (r == KErrNone);
5727 TEntryArray entryArray;
5728 r = dir.Read(entryArray);
5729 test (r == KErrEof);
5730 test(entryArray.Count() == 4);
5733 // then delete the new directory
5734 r = fileMan->Delete(filePathNew);
5735 test(r == KErrNone);
5740 static void TestOpenFiles()
5744 TestOpen4GBMinusOne();
5746 TestOpenMoreThan2GB();
5747 TestOpenRFileRFile64();
5748 TestCreateTempFile();
5749 TestCreateRFile64();
5750 TestReplaceRFile64();
5751 TestReplaceRFile64RFs();
5754 static void TestAdoptFiles()
5759 test(r == KErrNone);
5760 r = fs.ShareProtected();
5761 test(r == KErrNone);
5763 fs.SessionPath(sessionp);
5764 r = fs.MkDirAll(sessionp);
5765 test(r == KErrNone || r == KErrAlreadyExists);
5767 TestRFile64AdoptFromCreator();
5768 TestRFile64AdoptFromClient();
5769 TestRFile64AdoptFromServer();
5773 static void TestReadFile()
5776 //The order of these tests need to be preserved, since the first test creates
5777 //a 4GB file, while the last one deletes it.
5779 TestOpenAndReadSyncLargeFile();
5780 TestOpenAndReadAsyncLargeFile();
5781 TestOpenAndReadSyncLargeFileWithLen();
5782 TestOpenAndReadAsyncLargeFileWithLen();
5785 static void TestWriteFile()
5787 TestOpenAndWriteSyncLargeFile();
5788 TestOpenAndWriteAsyncLargeFile();
5789 TestOpenAndWriteSyncLargeFileWithLen();
5790 TestOpenAndWriteAsyncLargeFileWithLen();
5793 static void TestFileAccess()
5798 TestFileSeekBigFile();
5801 static void TestLockUnLock()
5803 TestReadWriteLock();
5805 TestSeekReadWrite();
5806 TestSeekAsyncReadWrite();
5807 TestSeekReadWriteLen();
5808 TestSeekAsyncReadWriteLen();
5811 static void TestCopyMoveDirectory()
5813 TestCopyDirectory();
5814 TestMoveDirectory();
5817 TInt testLockPanic(TAny* aPtr)
5821 RFile64 * ptr = (RFile64 *)aPtr;
5822 TInt r=ptr->Lock(aPos, aLen);
5823 test (KErrNone == r);
5827 TInt testUnLockPanic(TAny* aPtr)
5831 RFile64 * ptr = (RFile64 *)aPtr;
5832 TInt r=ptr->UnLock(aPos, aLen);
5833 test (KErrNone == r);
5837 TInt testSetSizePanic(TAny* aPtr)
5840 RFile64 * ptr = (RFile64 *)aPtr;
5841 TInt r=ptr->SetSize(aSize);
5842 test (KErrNone == r);
5846 static void TestRFile64NegLen()
5848 test.Start(_L("Test RFile64::Lock, RFile64::Unlock, RFile64::SetSize and RFile::Write with Negative Length parameter"));
5850 test(TheFs.ShareProtected() == KErrNone);
5853 TInt r = aFile.Create(TheFs, _L("\\testRFile64NegLen.txt"), EFileWrite);
5854 test((KErrNone == r) || (KErrAlreadyExists == r));
5856 TRequestStatus status = KRequestPending;
5858 // launch call on separate thread as expected to panic
5859 // Test Lock with a negative length
5860 User::SetJustInTime(EFalse);
5862 test(t.Create(_L("testLockPanic"), testLockPanic, KDefaultStackSize, 0x2000, 0x2000, &aFile) == KErrNone);
5865 User::WaitForRequest(status);
5866 User::SetJustInTime(ETrue);
5867 test(t.ExitType() == EExitPanic);
5868 test(t.ExitReason() == 17);
5871 // Test Unlock with a negative length
5872 User::SetJustInTime(EFalse);
5873 status = KRequestPending;
5874 test(t.Create(_L("testUnLockPanic"), testUnLockPanic, KDefaultStackSize, 0x2000, 0x2000, &aFile) == KErrNone);
5877 User::WaitForRequest(status);
5878 test(t.ExitType() == EExitPanic);
5879 test(t.ExitReason() == 18);
5881 User::SetJustInTime(ETrue);
5883 // Test SetSize with a negative length
5884 User::SetJustInTime(EFalse);
5885 status = KRequestPending;
5886 test(t.Create(_L("testSetSizePanic"), testSetSizePanic, KDefaultStackSize, 0x2000, 0x2000, &aFile) == KErrNone);
5889 User::WaitForRequest(status);
5890 test(t.ExitType() == EExitPanic);
5891 test(t.ExitReason() == 20);
5893 User::SetJustInTime(ETrue);
5895 // Test RFile64::Write with a zero or negative length
5898 TBuf8<0x100> gBuf=_L8("1234567891");
5900 TRequestStatus status1=KRequestPending;
5901 TRequestStatus status2=KRequestPending;
5903 // If a zero length is passed into the Write function, KErrNone should be returned.
5904 r=aFile.Write(aPos,gBuf);
5907 // If the length is a negative, KErrArgument should be returned.
5908 r=aFile.Write(aPos,gBuf,aLen);
5909 test(r==KErrArgument);
5911 // Test the asynchronous requests
5912 aFile.Write(aPos,gBuf,aLen,status1);
5913 aFile.Write(aPos,gBuf,aLen,status2);
5914 User::WaitForRequest(status1);
5915 test(status1.Int()==KErrArgument);
5916 User::WaitForRequest(status2);
5917 test(status2.Int()==KErrArgument);
5920 r = TheFs.Delete(_L("\\testRFile64NegLen.txt"));
5921 test(r == KErrNone);
5924 //-------------------------------------------------------------------------------------------------------------------
5926 static TInt PrepareDisk(TInt aDrive)
5930 r = FormatDrive(TheFs, aDrive, ETrue);
5932 r = TheFs.Volume(gDriveVolumeInfo, aDrive);
5935 test.Printf(_L("\nError in getting drive volume information!! Error code is %d"),r);
5938 test.Printf(_L("\nDrive volume size is %LU\n"), gDriveVolumeInfo.iSize);
5940 // don't test if media size is less than 4 GB
5941 if (gDriveVolumeInfo.iFree <= K4GB)
5943 test.Printf(_L("\nSkipping test: test requires disk with capacity more than 4 GB"));
5944 return KErrNotSupported;
5948 fileName.Append(gDriveToTest);
5949 fileName.Append(KTestPath);
5954 //-- decide if we need to test files >= 4G. As soon as there is no appropriate API yet, this way is dodgy..
5955 if(Is_Fat(TheFs, aDrive))
5957 KFileSizeMaxLargerThan4GBMinusOne = EFalse; //-- FAT doesn't support >= 4G files
5959 else if(Is_Win32(TheFs, aDrive))
5960 {//-- this is the emulator's windows drive. The maximal file size depends on the Windows FS used for this drive.
5961 //-- if it is NTFS, files >= 4G are supported.
5962 r = CreateEmptyFile(TheFs, _L("\\test_file"), K4GB);
5964 KFileSizeMaxLargerThan4GBMinusOne = (r == KErrNone);
5965 r = TheFs.Delete(_L("\\test_file"));
5969 {//-- something else, exFAT for example
5970 if(Is_ExFat(TheFs, aDrive))
5971 KFileSizeMaxLargerThan4GBMinusOne = ETrue;
5982 r = RFs::CharToDrive(gDriveToTest, gDrive);
5983 test(r == KErrNone);
5985 //-- set up console output
5986 F32_Test_Utils::SetConsole(test.Console());
5988 PrintDrvInfo(TheFs, gDrive);
5990 r = PrepareDisk(gDrive);
5991 if(r == KErrNotSupported)
5995 TestRFile64NegLen();
6002 TestReadFilesection();
6008 // these tests require disk capacity of aaround 12GB.
6009 //order of these tests need to be preserved since the files are
6010 //created only in TestGetDirectory() and then deleted in TestAddLDirectory
6011 //but all the intermediate tests uses those files.
6013 if (gDriveVolumeInfo.iFree >= K12GB)
6017 TestReadDirectory();
6018 TestSortDirectory();
6019 TestAddLDirectory();
6021 // these tests require disk capacity of aaround 9GB.
6022 if (gDriveVolumeInfo.iFree >= K9GB)
6024 TestCopyMoveDirectory();
6027 // Delete the test directory
6029 dirName.Append(gDriveToTest);
6030 dirName.Append(KTestPath);
6031 r = TheFs.RmDir(dirName);
6032 test(r == KErrNone);