1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/server/t_file64bit.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,6040 @@
1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// //File Name: f32test/server/t_file64bit.cpp
1.18 +// //Description:This file contains implementation for checking the 64bit file
1.19 +// // server functionality. All the affected APIs are tested.
1.20 +// //While generating a file for reading, the contents are generated such that
1.21 +// //every four bytes of the file contains its location. So the file would be
1.22 +// //generated as:
1.23 +// // 0000: 00 00 00 00
1.24 +// // 0004: 04 00 00 00
1.25 +// // 0008: 08 00 00 00
1.26 +// // .. etc
1.27 +//
1.28 +//
1.29 +
1.30 +
1.31 +#include <f32file.h>
1.32 +#include <e32test.h>
1.33 +#include <e32svr.h>
1.34 +#include "t_server.h"
1.35 +#include "t_file64bit.h"
1.36 +#include "..\\fileshare\\handshare64bit.h"
1.37 +#include <f32pluginutils.h>
1.38 +#include <massstorage.h>
1.39 +#include <e32math.h>
1.40 +#include "f32_test_utils.h"
1.41 +
1.42 +using namespace F32_Test_Utils;
1.43 +
1.44 +RTest test(_L("T_FILE64BIT Tests"));
1.45 +
1.46 +_LIT(KTestPath, ":\\F32-TST\\TFILE64BIT\\");
1.47 +
1.48 +// to test any file system that supports file sizes of greater than 4GB -1,
1.49 +// this value shall be set.
1.50 +TBool KFileSizeMaxLargerThan4GBMinusOne = EFalse;
1.51 +
1.52 +
1.53 +
1.54 +TInt GenerateBigFileContents()
1.55 + {
1.56 + test.Printf(_L("GenerateBigFileContents()\n"));
1.57 +
1.58 + TInt r;
1.59 + const TUint KBufSize = 256*K1KiloByte;
1.60 + RBuf8 buf;
1.61 +
1.62 + r = buf.CreateMax(KBufSize);
1.63 + test(r == KErrNone);
1.64 +
1.65 + RFile64 file;
1.66 + TFileName fileName;
1.67 + fileName.Append(gDriveToTest);
1.68 + fileName.Append(KTestPath);
1.69 + fileName.Append(_L("File4GBMinusOne.txt"));
1.70 + r = file.Replace(TheFs,fileName, EFileWrite);
1.71 + test(r == KErrNone);
1.72 +
1.73 + r = file.SetSize(K4GBMinusOne);
1.74 + test(r == KErrNone);
1.75 +
1.76 + TInt64 nNumberOfBytesToWrite = 0;
1.77 + TInt64 nNumberOfBytesWritten = 0;
1.78 + for (TInt64 pos = 0; pos < K4GBMinusOne; pos += nNumberOfBytesWritten)
1.79 + {
1.80 + // Prepare the write buffer
1.81 + for (TUint n = 0; n<KBufSize; n += 4)
1.82 + {
1.83 + *((TUint*) &buf[n]) = I64LOW(pos + n);
1.84 + }
1.85 +
1.86 + nNumberOfBytesToWrite = Min(MAKE_TINT64(0,KBufSize), K4GBMinusOne - pos);
1.87 + TPtrC8 pText(buf.Ptr(), KBufSize);
1.88 +
1.89 + file.Write(pText, (TInt)nNumberOfBytesToWrite);
1.90 +
1.91 + nNumberOfBytesWritten = nNumberOfBytesToWrite;
1.92 + }
1.93 +
1.94 + r = file.Flush();
1.95 + test(r == KErrNone);
1.96 + test.Printf(_L("\nFile writing is completed!!"));
1.97 +
1.98 +
1.99 + file.Close();
1.100 +
1.101 + buf.Close();
1.102 +
1.103 + return KErrNone;
1.104 + }
1.105 +
1.106 +TInt RFileHandleSharer64Bit::Connect()
1.107 + {
1.108 + return CreateSession(KServerName, TVersion(1,0,0));
1.109 + }
1.110 +
1.111 +
1.112 +TInt RFileHandleSharer64Bit::Exit()
1.113 + {
1.114 + return SendReceive(EMsgExit, TIpcArgs(NULL));
1.115 + }
1.116 +
1.117 +TInt RFileHandleSharer64Bit::SetTestDrive(TInt aDrive)
1.118 + {
1.119 + return SendReceive(EMsgDrive, TIpcArgs(aDrive));
1.120 + }
1.121 +
1.122 +TInt RFileHandleSharer64Bit::PassFileHandleProcessLargeFileClient(TIpcArgs& aIpcArgs)
1.123 + {
1.124 + return SendReceive(EMsgPassFileHandleProcessLargeFileClient, aIpcArgs);
1.125 + }
1.126 +
1.127 +TInt RFileHandleSharer64Bit::PassFileHandleProcessLargeFileCreator()
1.128 + {
1.129 + return SendReceive(EMsgPassFileHandleProcessLargeFileCreator);
1.130 + }
1.131 +
1.132 +TInt RFileHandleSharer64Bit::GetFileHandleLargeFile2(TInt &aHandle, TFileMode aFileMode)
1.133 + {
1.134 + TPckgBuf<TInt> fh;
1.135 + TInt fsh = SendReceive(EMsgGetFileHandleLargeFile, TIpcArgs(&fh, aFileMode));
1.136 + aHandle = fh();
1.137 + return fsh;
1.138 + }
1.139 +
1.140 +void RFileHandleSharer64Bit::Sync()
1.141 + {
1.142 + SendReceive(EMsgSync, TIpcArgs());
1.143 + }
1.144 +
1.145 +
1.146 +CFileManObserver::CFileManObserver(CFileMan* aFileMan)
1.147 + {
1.148 + __DECLARE_NAME(_S("CFileManObserver"));
1.149 + iFileMan = aFileMan;
1.150 + }
1.151 +
1.152 +MFileManObserver::TControl CFileManObserver::NotifyFileManStarted()
1.153 + {
1.154 + return(MFileManObserver::EContinue);
1.155 + }
1.156 +
1.157 +MFileManObserver::TControl CFileManObserver::NotifyFileManOperation()
1.158 + {
1.159 + return(MFileManObserver::EContinue);
1.160 + }
1.161 +
1.162 +MFileManObserver::TControl CFileManObserver::NotifyFileManEnded()
1.163 + {
1.164 + TInt lastError = iFileMan->GetLastError();
1.165 + TFileName fileName = iFileMan->CurrentEntry().iName;
1.166 + test.Printf(_L("NotifyFileManEnded(): Error %d File %S\n"),lastError, &fileName);
1.167 + if (lastError == KErrNone)
1.168 + iNotifyEndedSuccesses++;
1.169 + else
1.170 + iNotifyEndedFailures++;
1.171 + return(MFileManObserver::EContinue);
1.172 + }
1.173 +
1.174 +
1.175 +
1.176 +RFsTest& RFsTest::Replace(const TDesC &anOldName, const TDesC &aNewName)
1.177 +//
1.178 +// Replaces a single file with another
1.179 +//
1.180 + {
1.181 + test.Printf(_L("%S File Replaced with %S\n"),&anOldName,&aNewName);\
1.182 + TInt r = TheFs.Replace(anOldName,aNewName);
1.183 + test(r == KErrNone);
1.184 + return(*this);
1.185 + }
1.186 +
1.187 +RFsTest& RFsTest::ReadFileSection(const TDesC& aName, TInt64 aPos,TDes8& aBuffer,TInt aLen)
1.188 +//
1.189 +// Reads data from the file without opening it. Expected not to fail.
1.190 +//
1.191 + {
1.192 + test.Printf(_L("Read File Section %S\n"),&aName);
1.193 + TInt r = TheFs.ReadFileSection(aName,aPos,aBuffer,aLen);
1.194 + TInt len = aBuffer.Length();
1.195 +
1.196 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.197 + {
1.198 + if(aPos < K4GB)
1.199 + test(r == KErrNone);
1.200 + else
1.201 + {
1.202 + test(r == KErrNone);
1.203 + test(len == 0);
1.204 + }
1.205 + }
1.206 + else
1.207 + {
1.208 + test (r == KErrNone);
1.209 + }
1.210 + return(*this);
1.211 + }
1.212 +
1.213 +
1.214 +RFsTest& RFsTest::GetDir(const TDesC &aName, TUint anEntryAttMask, TUint anEntrySortKey, CDir *&anEntryList)
1.215 +//
1.216 +// Gets a filtered list of a directory's contents.
1.217 +//
1.218 + {
1.219 + test.Printf(_L("Name of the directory for which listing is required %S\n"),&aName);
1.220 + TInt r = TheFs.GetDir(aName,anEntryAttMask,anEntrySortKey,anEntryList);
1.221 + test(r == KErrNone);
1.222 + return(*this);
1.223 + }
1.224 +
1.225 +RFsTest& RFsTest::GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,CDir*& aDirList)
1.226 +//
1.227 +// Gets a filtered list of the directory and the file entries contained in a directory and a
1.228 +// list of the directory entries only.
1.229 + {
1.230 + test.Printf(_L("Name of the directory for which directory and file listing is required %S\n"),&aName);
1.231 + TInt r = TheFs.GetDir(aName,anEntryAttMask,anEntrySortKey,anEntryList,aDirList);
1.232 + test(r == KErrNone);
1.233 + return(*this);
1.234 + }
1.235 +
1.236 +RFsTest& RFsTest::GetDir(const TDesC& aName,const TUidType& anEntryUid,TUint anEntrySortKey,CDir*& aFileList)
1.237 +//
1.238 +// Gets a filtered list of directory contents by UID type.
1.239 +//
1.240 + {
1.241 + test.Printf(_L("Name of the directory for which listing is required %S\n"),&aName);
1.242 + TInt r = TheFs.GetDir(aName,anEntryUid,anEntrySortKey,aFileList);
1.243 + test(r == KErrNone);
1.244 + return(*this);
1.245 + }
1.246 +
1.247 +
1.248 +RFileTest::RFileTest(const TDesC& aName)
1.249 +//
1.250 +// Constructor
1.251 +//
1.252 + : iName(aName)
1.253 + {}
1.254 +
1.255 +RFileTest& RFileTest::Create(const TDesC& aName, TUint aFileMode)
1.256 +//
1.257 +// Creates and opens a new file for writing, if the file already exists an error is returned
1.258 +//
1.259 + {
1.260 + test.Printf(_L("%S create %S in %d Mode\n"),&iName,&aName,aFileMode);
1.261 + TInt r = RFile64::Create(TheFs,aName,aFileMode);
1.262 + test(r == KErrNone || r == KErrAlreadyExists);
1.263 + return(*this);
1.264 + }
1.265 +
1.266 +RFileTest& RFileTest::Replace(const TDesC& aName)
1.267 +//
1.268 +// Opens a file for writing, replacing the content of any existing file of the same name
1.269 +// if it exists or cretaing a new file if it does not exist.
1.270 +//
1.271 + {
1.272 + test.Printf(_L("%S replace %S\n"),&iName,&aName);
1.273 + TInt r = RFile64::Replace(TheFs,aName,EFileStream|EFileWrite);
1.274 + test(r == KErrNone);
1.275 + return(*this);
1.276 + }
1.277 +
1.278 +RFileTest& RFileTest::Replace(const TDesC& aName, TUint aFileMode)
1.279 +//
1.280 +// Opens a file in aFileMode, replacing the content of any existing file of the same name
1.281 +// if it exists or cretaing a new file if it does not exist.
1.282 +//
1.283 + {
1.284 + test.Printf(_L("%S replace %S in %d Mode\n"),&iName,&aName, aFileMode);
1.285 + TInt r = RFile64::Replace(TheFs,aName,aFileMode);
1.286 + if (r == KErrNone)
1.287 + test(r == KErrNone);
1.288 + else
1.289 + test(r == KErrBadName);
1.290 + return(*this);
1.291 + }
1.292 +
1.293 +RFileTest& RFileTest::Open(const TDesC& aName)
1.294 +//
1.295 +// Open a existing file for reading and writing in shared access mode.
1.296 +//
1.297 + {
1.298 + test.Printf(_L("%S open %S\n"),&iName,&aName);
1.299 + TInt r = RFile64::Open(TheFs,aName,EFileWrite|EFileShareAny);
1.300 + test(r == KErrNone);
1.301 + return(*this);
1.302 + }
1.303 +
1.304 +RFileTest& RFileTest::Open(const TDesC& aName, TUint aFileMode)
1.305 +//
1.306 +// Opens an existing file using aFileMode.
1.307 +//
1.308 + {
1.309 + test.Printf(_L("%S open %S in %d Mode\n"),&iName,&aName, aFileMode);
1.310 + TInt r = RFile64::Open(TheFs,aName,aFileMode);
1.311 + test(r == KErrNone);
1.312 + return(*this);
1.313 + }
1.314 +
1.315 +RFileTest& RFileTest::Temp(const TDesC& aPath,TFileName& aName,TUint aFileMode)
1.316 +//
1.317 +// Creates and opens a temporary file with a unique name for writing and reading.
1.318 +//
1.319 + {
1.320 + test.Printf(_L("%S Temp file %S in %d Mode\n"),&iName,&aName, aFileMode);
1.321 + TInt r = RFile64::Temp(TheFs,aPath,aName,aFileMode);
1.322 + test(r == KErrNone);
1.323 + return(*this);
1.324 + }
1.325 +
1.326 +void RFileTest::Close()
1.327 +//
1.328 +// Closes the file.
1.329 +//
1.330 + {
1.331 + RFile::Close();
1.332 + }
1.333 +
1.334 +RFileTest& RFileTest::Lock(TInt64 aPos, TInt64 aLen)
1.335 +//
1.336 +// Set a lock on the file. Expected not to fail.
1.337 +//
1.338 + {
1.339 + test.Printf(_L("%S lock 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
1.340 + TInt r = RFile64::Lock(aPos,aLen);
1.341 + test(r == KErrNone);
1.342 + return(*this);
1.343 + }
1.344 +
1.345 +RFileTest& RFileTest::LockE(TInt64 aPos, TInt64 aLen)
1.346 +//
1.347 +// Set a lock on the file. Expected to fail.
1.348 +//
1.349 + {
1.350 + test.Printf(_L("%S lockE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
1.351 + TInt r = RFile64::Lock(aPos,aLen);
1.352 + test(r == KErrLocked);
1.353 + return(*this);
1.354 + }
1.355 +
1.356 +RFileTest& RFileTest::UnLock(TInt64 aPos, TInt64 aLen)
1.357 +//
1.358 +// Unlock the file. Expected not to fail.
1.359 +//
1.360 + {
1.361 + test.Printf(_L("%S ulock 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
1.362 + TInt r = RFile64::UnLock(aPos,aLen);
1.363 + test(r == KErrNone);
1.364 + return(*this);
1.365 + }
1.366 +
1.367 +RFileTest& RFileTest::UnLockE(TInt64 aPos, TInt64 aLen)
1.368 +//
1.369 +// Unlock the file. Expected to fail.
1.370 +//
1.371 + {
1.372 + test.Printf(_L("%S ulockE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
1.373 + TInt r = RFile64::UnLock(aPos,aLen);
1.374 + test(r == KErrNotFound);
1.375 + return(*this);
1.376 + }
1.377 +
1.378 +RFileTest& RFileTest::Write(const TDesC8& aDes)
1.379 +//
1.380 +// Write to the file.
1.381 +//
1.382 + {
1.383 + test.Printf(_L("%S write\n"),&iName);
1.384 +
1.385 + TInt64 seekPos = 0;
1.386 + TInt rr = RFile64::Seek(ESeekCurrent,seekPos);
1.387 + test(rr == KErrNone);
1.388 +
1.389 + TInt r = RFile64::Write(aDes);
1.390 + if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
1.391 + r = RFile64::Flush();
1.392 +
1.393 +
1.394 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.395 + {
1.396 + if((seekPos + aDes.Length()) < K4GB)
1.397 + test(r == KErrNone);
1.398 + else
1.399 + test(r == KErrNotSupported);
1.400 + }
1.401 + else
1.402 + {
1.403 + test (r == KErrNone);
1.404 + }
1.405 + return(*this);
1.406 + }
1.407 +
1.408 +RFileTest& RFileTest::Write(const TDesC8 &aDes, TRequestStatus &aStatus)
1.409 +//
1.410 +// Write to the file.
1.411 +//
1.412 + {
1.413 + test.Printf(_L("%S write\n"),&iName);
1.414 +
1.415 + TInt64 seekPos = 0;
1.416 + TInt rr = RFile64::Seek(ESeekCurrent,seekPos);
1.417 + test(rr == KErrNone);
1.418 +
1.419 + RFile64::Write(aDes, aStatus);
1.420 + User::WaitForRequest(aStatus);
1.421 + if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
1.422 + {
1.423 + RFile64::Flush(aStatus);
1.424 + User::WaitForRequest(aStatus);
1.425 + }
1.426 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.427 + {
1.428 + if((seekPos + aDes.Length()) < K4GB)
1.429 + test(aStatus.Int() == KErrNone);
1.430 + else
1.431 + test(aStatus.Int() == KErrNotSupported);
1.432 +
1.433 + }
1.434 + else
1.435 + {
1.436 + test(aStatus.Int() == KErrNone);
1.437 + }
1.438 + return(*this);
1.439 + }
1.440 +
1.441 +RFileTest& RFileTest::Write(const TDesC8& aDes, TInt aLength)
1.442 +//
1.443 +// Write aLength specified number of bytes to the file.
1.444 +//
1.445 + {
1.446 + test.Printf(_L("%S write\n"),&iName);
1.447 +
1.448 + TInt64 seekPos = 0;
1.449 + TInt rr = RFile64::Seek(ESeekCurrent,seekPos);
1.450 + test(rr == KErrNone);
1.451 +
1.452 + TInt r = RFile64::Write(aDes, aLength);
1.453 + if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
1.454 + r = RFile64::Flush();
1.455 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.456 + {
1.457 + if((seekPos + aLength) < K4GB)
1.458 + test(r == KErrNone);
1.459 + else
1.460 + test(r == KErrNotSupported);
1.461 + }
1.462 + else
1.463 + {
1.464 + test(r == KErrNone);
1.465 + }
1.466 + return(*this);
1.467 + }
1.468 +
1.469 +RFileTest& RFileTest::Write(const TDesC8& aDes, TInt aLength, TRequestStatus &aStatus)
1.470 +//
1.471 +// Write aLength specified number of bytes to the file. Expected not to fail (Asynchronous).
1.472 +//
1.473 + {
1.474 + test.Printf(_L("%S write\n"),&iName);
1.475 +
1.476 + TInt64 seekPos = 0;
1.477 + TInt rr = RFile64::Seek(ESeekCurrent,seekPos);
1.478 + test(rr == KErrNone);
1.479 +
1.480 + RFile64::Write(aDes,aLength,aStatus);
1.481 + User::WaitForRequest(aStatus);
1.482 + if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
1.483 + {
1.484 + RFile64::Flush(aStatus);
1.485 + User::WaitForRequest(aStatus);
1.486 + }
1.487 +
1.488 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.489 + {
1.490 + if((seekPos + aLength) < K4GB)
1.491 + test(aStatus.Int() == KErrNone);
1.492 + else
1.493 + test(aStatus.Int() == KErrNotSupported);
1.494 + }
1.495 + else
1.496 + {
1.497 + test(aStatus.Int() == KErrNone);
1.498 + }
1.499 + return(*this);
1.500 + }
1.501 +
1.502 +RFileTest& RFileTest::WriteP(TInt64 aPos, const TDesC8& aDes)
1.503 +//
1.504 +// Write to the file. Expected not to fail.
1.505 +//
1.506 + {
1.507 + test.Printf(_L("%S write 0x%lx\n"),&iName,aPos);
1.508 + TInt r = RFile64::Write(aPos,aDes);
1.509 + if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
1.510 + r = RFile64::Flush();
1.511 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.512 + {
1.513 + if ((aPos + aDes.Length()) < K4GB)
1.514 + test(r == KErrNone);
1.515 + else
1.516 + test(r == KErrNotSupported);
1.517 + }
1.518 + else
1.519 + {
1.520 + test(r == KErrNone);
1.521 + }
1.522 + return(*this);
1.523 + }
1.524 +
1.525 +RFileTest& RFileTest::WriteU(TUint aPos, const TDesC8& aDes)
1.526 +//
1.527 +// Write to the file. Expected not to fail.
1.528 +// Position is a TUint value
1.529 +//
1.530 + {
1.531 + test.Printf(_L("%S write %08x\n"),&iName,aPos);
1.532 + TInt r = RFile64::Write(aPos,aDes);
1.533 + if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
1.534 + r = RFile64::Flush();
1.535 + test(r == KErrNone);
1.536 + return(*this);
1.537 + }
1.538 +
1.539 +
1.540 +RFileTest& RFileTest::Write(TInt64 aPos, const TDesC8& aDes, TInt aLen)
1.541 +//
1.542 +// Write to the file. Synchronous Expected not to fail.
1.543 +//
1.544 + {
1.545 + test.Printf(_L("%S write 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
1.546 + TInt r = RFile64::Write(aPos,aDes,aLen);
1.547 + if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
1.548 + r = RFile64::Flush();
1.549 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.550 + {
1.551 + if ((aPos + aLen) < K4GB)
1.552 + {
1.553 + if (aLen < 0)
1.554 + test(r == KErrArgument);
1.555 + else
1.556 + test(r == KErrNone);
1.557 + }
1.558 + else
1.559 + test(r == KErrNotSupported);
1.560 + }
1.561 + else
1.562 + {
1.563 + if (aLen < 0)
1.564 + test(r == KErrArgument);
1.565 + else
1.566 + test(r == KErrNone);
1.567 + }
1.568 + return(*this);
1.569 + }
1.570 +
1.571 +RFileTest& RFileTest::WriteU(TUint aPos, const TDesC8& aDes, TInt aLen)
1.572 +//
1.573 +// Write to the file. Synchronous Expected not to fail.
1.574 +// Position is a TUint value
1.575 +//
1.576 + {
1.577 + test.Printf(_L("%S write %08x-%08x\n"),&iName,aPos,aPos+aLen-1);
1.578 + TInt r = RFile64::Write(aPos,aDes,aLen);
1.579 + if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
1.580 + r = RFile64::Flush();
1.581 + test(r == KErrNone);
1.582 + return(*this);
1.583 + }
1.584 +
1.585 +
1.586 +RFileTest& RFileTest::WriteE(TInt64 aPos, const TDesC8& aDes, TInt aLen)
1.587 +//
1.588 +// Write to the file. Expected to fail.
1.589 +//
1.590 + {
1.591 + test.Printf(_L("%S writeE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
1.592 + TInt r = RFile64::Write(aPos,aDes,aLen);
1.593 + if (aLen < 0)
1.594 + test(r == KErrArgument);
1.595 + else
1.596 + test(r == KErrLocked);
1.597 + return(*this);
1.598 + }
1.599 +
1.600 +RFileTest& RFileTest::Write(TInt64 aPos, const TDesC8& aDes, TInt aLen, TRequestStatus &aStatus)
1.601 +//
1.602 +// Write to the file. Asynchronous
1.603 + {
1.604 + test.Printf(_L("%S write 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
1.605 + RFile64::Write(aPos,aDes,aLen,aStatus);
1.606 + User::WaitForRequest(aStatus);
1.607 + if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
1.608 + {
1.609 + RFile64::Flush(aStatus);
1.610 + User::WaitForRequest(aStatus);
1.611 + }
1.612 +
1.613 + if(aLen < 0)
1.614 + test(aStatus.Int() == KErrArgument);
1.615 + else
1.616 + {
1.617 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.618 + {
1.619 + if((aPos + aLen) < K4GB)
1.620 + test(aStatus.Int() == KErrNone);
1.621 + else
1.622 + test(aStatus.Int() == KErrNotSupported);
1.623 + }
1.624 + else
1.625 + test(aStatus.Int() == KErrNone);
1.626 + }
1.627 + return(*this);
1.628 + }
1.629 +
1.630 +RFileTest& RFileTest::Write(TInt64 aPos, const TDesC8& aDes, TRequestStatus &aStatus)
1.631 +//
1.632 +// Write to the file (Asynchronous).
1.633 + {
1.634 + test.Printf(_L("%S write 0x%lx\n"),&iName,aPos);
1.635 + RFile64::Write(aPos,aDes,aStatus);
1.636 + User::WaitForRequest(aStatus);
1.637 + if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
1.638 + {
1.639 + RFile64::Flush(aStatus);
1.640 + User::WaitForRequest(aStatus);
1.641 + }
1.642 +
1.643 +
1.644 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.645 + {
1.646 + if((aPos + aDes.Length()) < K4GB)
1.647 + test(aStatus.Int() == KErrNone);
1.648 + else
1.649 + test(aStatus.Int() == KErrNotSupported);
1.650 + }
1.651 + else
1.652 + {
1.653 + test(aStatus.Int() == KErrNone);
1.654 + }
1.655 + return(*this);
1.656 + }
1.657 +
1.658 +RFileTest& RFileTest::WriteU(TUint aPos, const TDesC8& aDes, TRequestStatus &aStatus)
1.659 +//
1.660 +// Write to the file (Asynchronous).
1.661 +// Position is a TUint value
1.662 +//
1.663 + {
1.664 + test.Printf(_L("%S write %08x\n"),&iName,aPos);
1.665 + RFile64::Write(aPos,aDes,aStatus);
1.666 + User::WaitForRequest(aStatus);
1.667 + if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
1.668 + {
1.669 + RFile64::Flush(aStatus);
1.670 + User::WaitForRequest(aStatus);
1.671 + }
1.672 + test(aStatus.Int() == KErrNone);
1.673 + return(*this);
1.674 + }
1.675 +
1.676 +RFileTest& RFileTest::WriteU(TUint aPos, const TDesC8& aDes, TInt aLen, TRequestStatus &aStatus)
1.677 +//
1.678 +// Write to the file. Asynchronous
1.679 +// Position is a TUint value
1.680 +//
1.681 + {
1.682 + test.Printf(_L("%S write %08x-%08x\n"),&iName,aPos,aPos+aLen-1);
1.683 + RFile64::Write(aPos,aDes,aLen,aStatus);
1.684 + User::WaitForRequest(aStatus);
1.685 + if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
1.686 + {
1.687 + RFile64::Flush(aStatus);
1.688 + User::WaitForRequest(aStatus);
1.689 + }
1.690 +
1.691 + if(aLen < 0)
1.692 + test(aStatus.Int() == KErrArgument);
1.693 + else
1.694 + test(aStatus.Int() == KErrNone);
1.695 + return(*this);
1.696 + }
1.697 +
1.698 +
1.699 +
1.700 +RFileTest& RFileTest::Read(TDes8& aDes)
1.701 +//
1.702 +// Read from the file. Expected not to fail (Synchronous).
1.703 +//
1.704 + {
1.705 + test.Printf(_L("%S read \n"),&iName);
1.706 + TInt r = RFile64::Read(aDes);
1.707 + test(r == KErrNone);
1.708 + return(*this);
1.709 + }
1.710 +
1.711 +RFileTest& RFileTest::Read(TDes8& aDes, TRequestStatus& aStatus)
1.712 +//
1.713 +// Read from the file. Expected not to fail (Asynchronous).
1.714 +//
1.715 + {
1.716 + TInt64 size = 0;
1.717 + test.Printf(_L("%S read \n"),&iName);
1.718 + RFile64::Read(aDes, aStatus);
1.719 + User::WaitForRequest(aStatus);
1.720 + TInt len = aDes.Length();
1.721 + TInt rr = RFile64::Size(size);
1.722 + test(rr == KErrNone);
1.723 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.724 + {
1.725 + if(size < K4GB)
1.726 + test(aStatus.Int() == KErrNone);
1.727 + else
1.728 + {
1.729 + test(aStatus.Int() == KErrNone);
1.730 + test(len == 0);
1.731 + }
1.732 + }
1.733 + else
1.734 + {
1.735 + test(aStatus.Int() == KErrNone);
1.736 + }
1.737 + return(*this);
1.738 + }
1.739 +
1.740 +RFileTest& RFileTest::Read(TDes8& aDes,TInt aLen,TRequestStatus& aStatus)
1.741 +//
1.742 +// Read from the file. Expected not to fail (Asynchronous).
1.743 +//
1.744 + {
1.745 + TInt64 size = 0;
1.746 + test.Printf(_L("%S read \n"),&iName);
1.747 + RFile64::Read(aDes,aLen,aStatus);
1.748 + User::WaitForRequest(aStatus);
1.749 + TInt len = aDes.Length();
1.750 + TInt rr = RFile64::Size(size);
1.751 + test(rr == KErrNone);
1.752 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.753 + {
1.754 + if(size < K4GB)
1.755 + test(aStatus.Int() == KErrNone);
1.756 + else
1.757 + {
1.758 + test(aStatus.Int() == KErrNone);
1.759 + test(len == 0);
1.760 + }
1.761 + }
1.762 + else
1.763 + {
1.764 + test(aStatus.Int() == KErrNone);
1.765 + }
1.766 + return(*this);
1.767 + }
1.768 +
1.769 +RFileTest& RFileTest::Read(TDes8 &aDes, TInt aLen)
1.770 +//
1.771 +// Read from the file. Expected not to fail (Synchronous).
1.772 +//
1.773 + {
1.774 + test.Printf(_L("%S read 0x%08x bytes\n"),&iName,aLen);
1.775 + TInt r = RFile64::Read(aDes,aLen);
1.776 + if(aLen < 0)
1.777 + test(r == KErrArgument);
1.778 + else
1.779 + test(r == KErrNone);
1.780 + return(*this);
1.781 + }
1.782 +
1.783 +RFileTest& RFileTest::Read(TInt64 aPos, TDes8& aDes, TInt aLen)
1.784 +//
1.785 +// Read from the file. Expected not to fail (Synchronous).
1.786 +//
1.787 + {
1.788 + test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
1.789 + TInt r = RFile64::Read(aPos,aDes,aLen);
1.790 + TInt len = aDes.Length();
1.791 + if(aLen < 0)
1.792 + test(r == KErrArgument);
1.793 + else
1.794 + test(r == KErrNone);
1.795 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.796 + {
1.797 + if(aPos >= K4GB)
1.798 + test(len == 0);
1.799 + }
1.800 + return(*this);
1.801 + }
1.802 +
1.803 +RFileTest& RFileTest::ReadE(TInt64 aPos, TDes8& aDes, TInt aLen)
1.804 +//
1.805 +// Reads the specified number of bytes from the file at a specified offset. Expected to fail.
1.806 +//
1.807 + {
1.808 + test.Printf(_L("%S readE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
1.809 + TInt r = RFile64::Read(aPos,aDes,aLen);
1.810 + test(r == KErrLocked);
1.811 + return(*this);
1.812 + }
1.813 +
1.814 +RFileTest& RFileTest::Read(TInt64 aPos, TDes8& aDes, TInt aLen, TRequestStatus& aStatus)
1.815 +//
1.816 +// Reads the specified number of bytes from the file at a specified offset, Expected not to fail (Asynchronous).
1.817 +//
1.818 + {
1.819 + test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
1.820 + RFile64::Read(aPos,aDes,aLen,aStatus);
1.821 + User::WaitForRequest(aStatus);
1.822 + TInt len = aDes.Length();
1.823 + if(aLen < 0)
1.824 + test(aStatus.Int() == KErrArgument);
1.825 + else
1.826 + test(aStatus.Int() == KErrNone);
1.827 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.828 + {
1.829 + if(aPos >= K4GB)
1.830 + test(len == 0);
1.831 + }
1.832 + return(*this);
1.833 + }
1.834 +
1.835 +RFileTest& RFileTest::ReadP(TInt64 aPos, TDes8& aDes)
1.836 +//
1.837 +// Reads from the file at the specfied offset with in the file (Synchronous).
1.838 +//
1.839 + {
1.840 + test.Printf(_L("%S read 0x%lx\n"),&iName,aPos);
1.841 + TInt r = RFile64::Read(aPos,aDes);
1.842 + test(r == KErrNone);
1.843 + return(*this);
1.844 + }
1.845 +
1.846 +RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes)
1.847 +//
1.848 +// Reads from the file at the specfied offset with in the file (Synchronous).
1.849 +// Offset is specified as a TUint value.
1.850 +//
1.851 + {
1.852 + test.Printf(_L("%S read 0x%lx\n"),&iName,aPos);
1.853 + TInt r = RFile64::Read(aPos,aDes);
1.854 + test(r == KErrNone);
1.855 + return(*this);
1.856 + }
1.857 +
1.858 +RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes,TRequestStatus& aStatus)
1.859 +//
1.860 +// Reads from the file at the specfied offset with in the file (Asynchronous).
1.861 +// Offset is specified as a TUint value.
1.862 +//
1.863 + {
1.864 + test.Printf(_L("%S read 0x%lx\n"),&iName,aPos);
1.865 + RFile64::Read(aPos,aDes,aStatus);
1.866 + User::WaitForRequest(aStatus);
1.867 + test(aStatus.Int() == KErrNone);
1.868 + return(*this);
1.869 + }
1.870 +
1.871 +RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes, TInt aLen)
1.872 +//
1.873 +// Read from the file. Expected not to fail (Synchronous).
1.874 +// Offset is specified as a TUint value.
1.875 +//
1.876 + {
1.877 + test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
1.878 + TInt r = RFile64::Read(aPos,aDes,aLen);
1.879 + if(aLen < 0)
1.880 + test(r == KErrArgument);
1.881 + else
1.882 + test(r == KErrNone);
1.883 + return(*this);
1.884 + }
1.885 +
1.886 +RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes, TInt aLen, TRequestStatus& aStatus)
1.887 +//
1.888 +// Reads the specified number of bytes from the file at a specified offset, Expected not to fail (Asynchronous).
1.889 +// Offset is specified as a TUint value.
1.890 +//
1.891 + {
1.892 + test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
1.893 + RFile64::Read(aPos,aDes,aLen,aStatus);
1.894 + User::WaitForRequest(aStatus);
1.895 + if(aLen < 0)
1.896 + test(aStatus.Int() == KErrArgument);
1.897 + else
1.898 + test(aStatus.Int() == KErrNone);
1.899 + return(*this);
1.900 + }
1.901 +
1.902 +
1.903 +RFileTest& RFileTest::Read(TInt64 aPos, TDes8& aDes, TRequestStatus& aStatus)
1.904 +//
1.905 +// Reads from the file at the specfied offset with in the file (Asynchronous).
1.906 +//
1.907 + {
1.908 + test.Printf(_L("%S read 0x%lx\n"),&iName,aPos);
1.909 + RFile64::Read(aPos,aDes,aStatus);
1.910 + User::WaitForRequest(aStatus);
1.911 + test(aStatus.Int() == KErrNone);
1.912 + return(*this);
1.913 + }
1.914 +
1.915 +RFileTest& RFileTest::SetSize(TInt64 aSize)
1.916 +//
1.917 +// Set the size of the file. Expected not to fail.
1.918 +//
1.919 + {
1.920 + test.Printf(_L("%S size: 0x%lx\n"),&iName,aSize);
1.921 + TInt r = RFile64::SetSize(aSize);
1.922 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.923 + {
1.924 + if(aSize < K4GB)
1.925 + test(r == KErrNone);
1.926 + else
1.927 + test(r == KErrNotSupported);
1.928 + }
1.929 + else
1.930 + {
1.931 + test(r == KErrNone);
1.932 + }
1.933 + return(*this);
1.934 + }
1.935 +
1.936 +RFileTest& RFileTest::SetSizeE(TInt64 aSize)
1.937 +//
1.938 +// Set the size of the file. Expected to fail.
1.939 +//
1.940 + {
1.941 + test.Printf(_L("%S sizeE: 0x%lx\n"),&iName,aSize);
1.942 + TInt r = RFile64::SetSize(aSize);
1.943 + test(r == KErrLocked);
1.944 + return(*this);
1.945 + }
1.946 +
1.947 +RFileTest& RFileTest::Size(TInt64& aSize)
1.948 +//
1.949 +// Gets the current file size. Expected not to fail.
1.950 +//
1.951 + {
1.952 + TInt r = RFile64::Size(aSize);
1.953 + test.Printf(_L("%S size: 0x%lx\n"),&iName,aSize);
1.954 +
1.955 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.956 + {
1.957 + if(aSize < K4GB)
1.958 + test(r == KErrNone);
1.959 + else
1.960 + test(r == KErrTooBig);
1.961 + }
1.962 + else
1.963 + {
1.964 + test(r == KErrNone);
1.965 + }
1.966 + return(*this);
1.967 +
1.968 + }
1.969 +RFileTest& RFileTest::Seek(TSeek aMode, TInt64& aPos)
1.970 +//
1.971 +// Sets the current file position. Expected not to fail.
1.972 +//
1.973 + {
1.974 + test.Printf(_L("Seek to pos %LD in %d Mode\n"),aPos, aMode);
1.975 + TInt r = RFile64::Seek(aMode, aPos);
1.976 + if(aPos < 0)
1.977 + test(r == KErrArgument);
1.978 + else
1.979 + test(r == KErrNone);
1.980 + return(*this);
1.981 + }
1.982 +
1.983 +/**
1.984 +@SYMTestCaseID PBASE-T_FILE64BIT-0756
1.985 +@SYMTestPriority High
1.986 +@SYMTestRequirement REQ9531
1.987 +@SYMTestType CIT
1.988 +@SYMTestCaseDesc Test opening a large file = 2GB in size
1.989 +@SYMTestActions
1.990 +1) Gets the entry details for a file using RFs::Entry(). The original file size=2GB
1.991 +2) Open a large file whose size = 2GB, with File Mode = EFileRead
1.992 +3) Close the file
1.993 +@SYMTestExpectedResults
1.994 +1) File size = 2GB
1.995 +2) KErrNone, File open successful
1.996 +3) File closed successfully
1.997 +@SYMTestStatus Implemented
1.998 +*/
1.999 +void TestOpen2GB()
1.1000 + {
1.1001 + TEntry entry;
1.1002 + TInt64 testSize, size = 0;
1.1003 + TFileName fileName;
1.1004 + fileName.Append(gDriveToTest);
1.1005 + fileName.Append(KTestPath);
1.1006 + fileName.Append(_L("File2GB.txt"));
1.1007 +
1.1008 + testSize = K2GB;
1.1009 +
1.1010 + test.Next(_L("Create the file using RFile64::Replace and set the size and close"));
1.1011 + TestRFile1.Replace(fileName);
1.1012 + TestRFile1.SetSize(testSize);
1.1013 + TestRFile1.Close();
1.1014 +
1.1015 +
1.1016 + test.Next(_L("2GB File: Open"));
1.1017 + TInt r = TheFs.Entry(fileName, entry);
1.1018 + test(r == KErrNone);
1.1019 + test((TUint) entry.iSize == testSize);
1.1020 +
1.1021 + TestRFile1.Open(fileName, EFileRead);
1.1022 +
1.1023 +
1.1024 + TestRFile1.Size(size);
1.1025 + test(size == testSize);
1.1026 +
1.1027 + TestRFile1.Close();
1.1028 + r = TheFs.Delete(fileName);
1.1029 + test(r == KErrNone);
1.1030 + }
1.1031 +
1.1032 +/**
1.1033 +@SYMTestCaseID PBASE-T_FILE64BIT-0757
1.1034 +@SYMTestPriority High
1.1035 +@SYMTestRequirement REQ9531
1.1036 +@SYMTestType CIT
1.1037 +@SYMTestCaseDesc Test opening a large file = 3GB in size
1.1038 +@SYMTestActions
1.1039 +1) Gets the entry details for a file using RFs::GetEntry(). The original file size=3GB
1.1040 +2) Open a large file whose size = 3GB, with File Mode = EFileRead
1.1041 +3) Close the file
1.1042 +@SYMTestExpectedResults
1.1043 +1) File size = 3GB
1.1044 +2) KErrNone, File open successful
1.1045 +3) File closed successfully
1.1046 +@SYMTestStatus Implemented
1.1047 +*/
1.1048 +void TestOpen3GB()
1.1049 + {
1.1050 + TInt r;
1.1051 + TEntry entry;
1.1052 + TInt64 testSize, size = 0;
1.1053 + TFileName fileName;
1.1054 + fileName.Append(gDriveToTest);
1.1055 + fileName.Append(KTestPath);
1.1056 + fileName.Append(_L("File3GB.txt"));
1.1057 + testSize = K3GB;
1.1058 +
1.1059 + test.Next(_L("Create the file using RFile64::Replace and set the size and close"));
1.1060 + TestRFile1.Replace(fileName);
1.1061 + TestRFile1.SetSize(testSize);
1.1062 + TestRFile1.Close();
1.1063 +
1.1064 + test.Next(_L("3GB File: Open"));
1.1065 + r = TheFs.Entry(fileName, entry);
1.1066 + test(r == KErrNone);
1.1067 + test((TUint) entry.iSize == testSize);
1.1068 +
1.1069 + TestRFile1.Open(fileName,EFileRead);
1.1070 +
1.1071 + TestRFile1.Size(size);
1.1072 + test(size == testSize);
1.1073 + TestRFile1.Close();
1.1074 +
1.1075 + r = TheFs.Delete(fileName);
1.1076 + test(r == KErrNone);
1.1077 + }
1.1078 +
1.1079 +/**
1.1080 +@SYMTestCaseID PBASE-T_FILE64BIT-0758
1.1081 +@SYMTestPriority High
1.1082 +@SYMTestRequirement REQ9531
1.1083 +@SYMTestType CIT
1.1084 +@SYMTestCaseDesc Test opening a large file < 4GB in size
1.1085 +@SYMTestActions
1.1086 +1) Gets the entry details for a file using RFs::GetEntry(). The original file size=4GB-1
1.1087 +2) Open a large file whose size = 4GB-1, with File Mode = EFileRead
1.1088 +3) Close the file
1.1089 +@SYMTestExpectedResults
1.1090 +1) File size = 4GB-1
1.1091 +2) KErrNone, File open successful
1.1092 +3) File closed successfully
1.1093 +@SYMTestStatus Implemented
1.1094 +*/
1.1095 +void TestOpen4GBMinusOne()
1.1096 + {
1.1097 + TInt r;
1.1098 + TEntry entry;
1.1099 + TInt64 testSize, size = 0;
1.1100 + TFileName fileName;
1.1101 + fileName.Append(gDriveToTest);
1.1102 + fileName.Append(KTestPath);
1.1103 + fileName.Append(_L("File4GBMinusOne.txt"));
1.1104 + testSize = K4GB-1;
1.1105 +
1.1106 + test.Next(_L("Create the file using RFile64::Replace and set the size and close"));
1.1107 + TestRFile1.Replace(fileName);
1.1108 + TestRFile1.SetSize(testSize);
1.1109 + TestRFile1.Close();
1.1110 +
1.1111 + test.Next(_L("4GB-1 File: Open"));
1.1112 + r = TheFs.Entry(fileName, entry);
1.1113 + test(r == KErrNone);
1.1114 +
1.1115 + test((TUint) entry.iSize == testSize);
1.1116 +
1.1117 + TestRFile1.Open(fileName, EFileRead);
1.1118 +
1.1119 + TestRFile1.Size(size);
1.1120 +
1.1121 + test(size == testSize);
1.1122 + TestRFile1.Close();
1.1123 +
1.1124 + r = TheFs.Delete(fileName);
1.1125 + test(r == KErrNone);
1.1126 + }
1.1127 +
1.1128 +/**
1.1129 +@SYMTestCaseID PBASE-T_FILE64BIT-0759
1.1130 +@SYMTestPriority High
1.1131 +@SYMTestRequirement REQ9531
1.1132 +@SYMTestType CIT
1.1133 +@SYMTestCaseDesc Test opening a large file 4GB in size
1.1134 +@SYMTestActions
1.1135 +1) Gets the entry details for a file using RFs::GetEntry(). The original file size=4GB
1.1136 +2) Open a large file whose size = 4GB, with File Mode = EFileRead
1.1137 +3) Close the file
1.1138 +@SYMTestExpectedResults
1.1139 +1) File size = 4GB
1.1140 +2) KErrNone, File open successful
1.1141 +3) File closed successfully
1.1142 +@SYMTestStatus Implemented
1.1143 +*/
1.1144 +void TestOpen4GB()
1.1145 + {
1.1146 + TInt r;
1.1147 + TEntry entry;
1.1148 + TInt64 testSize, size = 0;
1.1149 + TFileName fileName;
1.1150 + fileName.Append(gDriveToTest);
1.1151 + fileName.Append(KTestPath);
1.1152 + fileName.Append(_L("File4GB.txt"));
1.1153 + testSize = K4GB;
1.1154 +
1.1155 + test.Next(_L("Create the file using RFile64::Replace and set the size and close"));
1.1156 + TestRFile1.Replace(fileName);
1.1157 + TestRFile1.SetSize(testSize);
1.1158 + TestRFile1.Close();
1.1159 +
1.1160 + test.Next(_L("4GB File: Open"));
1.1161 + r = TheFs.Entry(fileName, entry);
1.1162 + test(r == KErrNone);
1.1163 +
1.1164 + if ((TUint) entry.iSize == testSize)
1.1165 + {
1.1166 + TestRFile1.Open(fileName, EFileRead);
1.1167 + TestRFile1.Size(size);
1.1168 + test(size == testSize);
1.1169 + TestRFile1.Close();
1.1170 + }
1.1171 +
1.1172 + r = TheFs.Delete(fileName);
1.1173 + test(r == KErrNone);
1.1174 +
1.1175 + }
1.1176 +
1.1177 +/**
1.1178 +@SYMTestCaseID PBASE-T_FILE64BIT-0760
1.1179 +@SYMTestPriority High
1.1180 +@SYMTestRequirement REQ9531
1.1181 +@SYMTestType CIT
1.1182 +@SYMTestCaseDesc Tests opening a large file > 2GB in size
1.1183 +@SYMTestActions
1.1184 +1) Create a new file named "File4GBMinusOne.txt"
1.1185 +2) Open the file with file mode = EFileWrite
1.1186 +3) Set the file size to 4GB-1
1.1187 +4) Write few bytes to the file and close
1.1188 +5) Close the file
1.1189 +6) Open the file "File4GBMinusOne.txt"
1.1190 +7) If FAT32 file system, set the file size to 4GB
1.1191 +8) Close the file
1.1192 +9) Open the file with file mode = EDeleteOnClose
1.1193 +@SYMTestExpectedResults
1.1194 +1) File creation successful with KErrNone
1.1195 +2) File open successful with KErrNone
1.1196 +3) KErrNone, Sets the file size to 4GB-1
1.1197 +4) KErrNone, write is successful and file closed successfully
1.1198 +5) File closed successfully
1.1199 +6) KErrNone, file open successful
1.1200 +7) KErrNotSupported. For next generation file system KErrNone is expected
1.1201 +8) File closed successfully
1.1202 +9) File open failed with KErrArgument
1.1203 +@SYMTestStatus Implemented
1.1204 +*/
1.1205 +void TestOpenMoreThan2GB()
1.1206 + {
1.1207 + // constants and literals
1.1208 + test.Next(_L("\nTest Files of size more than 2GB\n"));
1.1209 +
1.1210 + TInt64 size;
1.1211 + TBuf8<KBUFSIZE> readBuf;
1.1212 + TFileName fileName;
1.1213 + fileName.Append(gDriveToTest);
1.1214 + fileName.Append(KTestPath);
1.1215 + fileName.Append(_L("File4GBMinusOne.txt"));
1.1216 +
1.1217 + test.Start(_L("Test to create a large file > 2GB\n"));
1.1218 +
1.1219 + TestRFile1.Replace(fileName);
1.1220 + test.Next(_L("Set the file size to 4GB-1\n"));
1.1221 +
1.1222 + size = K4GBMinusOne;
1.1223 + TestRFile1.SetSize(size);
1.1224 +
1.1225 + TBuf8<10> writeBuf;
1.1226 + writeBuf.Zero();
1.1227 + for(TInt count = 0; count < 10; count++)
1.1228 + {
1.1229 + writeBuf.Append(count);
1.1230 + }
1.1231 +
1.1232 + test.Next(_L("Write 10 bytes to the file\n"));
1.1233 + TestRFile1.Write(0, writeBuf, 10);
1.1234 + test.Next(_L("Read 10 bytes from position 0\n"));
1.1235 + TestRFile1.Read(0, readBuf, 10);
1.1236 + test(writeBuf == readBuf);
1.1237 +
1.1238 + TInt64 s;
1.1239 + TestRFile1.Size(s);
1.1240 + if(s < K4GB)
1.1241 + {
1.1242 + test.Printf(_L("\nFile size is less than 4 GB !!!!\n"));
1.1243 + }
1.1244 +
1.1245 + TestRFile1.Close();
1.1246 +
1.1247 + test.Next(_L("Open the file File4GBMinusOne.txt\n"));
1.1248 + TestRFile1.Open(fileName);
1.1249 +
1.1250 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.1251 + {
1.1252 + test.Next (_L("Set the file size to 4GB\n"));
1.1253 + size = K4GB;
1.1254 + TestRFile1.SetSize(size);
1.1255 + }
1.1256 + TestRFile1.Close();
1.1257 +
1.1258 + RFile64 file64;
1.1259 + TInt r = file64.Open(TheFs,fileName,EDeleteOnClose);
1.1260 + test (r == KErrArgument);
1.1261 +
1.1262 + r = TheFs.Delete(fileName);
1.1263 + test(r == KErrNone);
1.1264 +
1.1265 + }
1.1266 +
1.1267 +/**
1.1268 +@SYMTestCaseID PBASE-T_FILE64BIT-0761
1.1269 +@SYMTestPriority High
1.1270 +@SYMTestRequirement REQ9531
1.1271 +@SYMTestType CIT
1.1272 +@SYMTestCaseDesc Tests opening a file using RFile and RFile64 in file sharing mode
1.1273 +@SYMTestActions
1.1274 +1) Create a file using RFile::Replace()
1.1275 +2) Open the file using RFile::Open() and file mode = EFileShareAny
1.1276 +3) Write 100 bytes to the file and close the file
1.1277 +4) Open the same file using RFile64::Open() and file mode = EFileShareAny
1.1278 +5) Set the file size to 4GB-1 using RFile64::SetSize().
1.1279 +6) Get the file size using RFile::Size()
1.1280 +7) Seek to the file position 2GB+5 using RFile::Seek()
1.1281 +8) Get the file size using RFile64::Size()
1.1282 +9) Seek to the file position 4GB-10 using RFile64::Seek()
1.1283 +10) Read from the file position 4GB-10 using RFile::Read() of length 5 bytes
1.1284 +11) Close the file.
1.1285 +12) Open the file using RFile::Open().
1.1286 +13) Open the file using RFile64::Open() and close the file.
1.1287 +@SYMTestExpectedResults
1.1288 +1) File created successful with KErrNone.
1.1289 +2) File opened successfully with KErrNone.
1.1290 +3) Write successful with KErrNone.
1.1291 +4) File opened successfully with KErrNone.
1.1292 +5) File size set successfully with KErrNone.
1.1293 +6) Fail with KErrNotSupported.
1.1294 +7) Seek operation fail with KErrArgument.
1.1295 +8) FileSize == 4GB-1.
1.1296 +9) KErrNone.
1.1297 +10) Read fail with KErrNotSupported.
1.1298 +11) File closed successfully.
1.1299 +12) File Open failed with KErrTooBig.
1.1300 +13) File open successfully with KErrNone and file closed successfully.
1.1301 +@SYMTestStatus Implemented
1.1302 +*/
1.1303 +void TestOpenRFileRFile64()
1.1304 + {
1.1305 + RFile file;
1.1306 + TInt size;
1.1307 + TInt64 size64;
1.1308 + TInt count;
1.1309 + TFileName fileName;
1.1310 + fileName.Append(gDriveToTest);
1.1311 + fileName.Append(KTestPath);
1.1312 + fileName.Append(_L("File4GBMinusOne.txt"));
1.1313 +
1.1314 + test.Start(_L("Test opening a file using RFile and RFile64 in file sharing mode\n"));
1.1315 + TInt r = file.Replace(TheFs,fileName,EFileShareAny|EFileWrite);
1.1316 + test(r == KErrNone);
1.1317 +
1.1318 + TBuf8<100> writeBuf;
1.1319 + TBuf8<100> readBuf;
1.1320 + writeBuf.Zero();
1.1321 + for(count = 0; count < 100; count++)
1.1322 + {
1.1323 + writeBuf.Append(count);
1.1324 + }
1.1325 +
1.1326 + test.Next(_L("Write 100 bytes to the file\n"));
1.1327 + r = file.Write(0, writeBuf, 100);
1.1328 + test(r == KErrNone);
1.1329 +
1.1330 + test.Next(_L("Read 100 bytes from position 0"));
1.1331 + r = file.Read(0, readBuf, 100);
1.1332 + test(r == KErrNone);
1.1333 +
1.1334 + test.Next(_L("Compare the read data to the written data"));
1.1335 + test(readBuf == writeBuf);
1.1336 +
1.1337 +
1.1338 + test.Next(_L("Open the same file using RFile64::Open"));
1.1339 + TestRFile1.Open(fileName,EFileShareAny|EFileWrite);
1.1340 +
1.1341 + test.Next(_L("Set the file size to 4GB-1\n"));
1.1342 + TestRFile1.SetSize(K4GBMinusOne);
1.1343 +
1.1344 + test.Next(_L("Query the file size using Rfile::Size()\n"));
1.1345 + r = file.Size(size);
1.1346 + test (r == KErrTooBig);
1.1347 +
1.1348 + test.Next(_L("Seek to the file position using 2GB+5 using RFile::Seek()\n"));
1.1349 + TUint seekPos1 = K2GB + 5;
1.1350 + TInt seekPos = (TInt)seekPos1;
1.1351 + r = file.Seek(ESeekStart,seekPos);
1.1352 + test(r == KErrArgument);
1.1353 +
1.1354 + test.Next(_L("Get the file size using RFile64::Size()\n"));
1.1355 + TestRFile1.Size(size64);
1.1356 +
1.1357 + test.Next(_L("Seek to the file position 4GB-10 using RFile64::Seek()\n"));
1.1358 + TInt64 seekPos64 = K4GB - 10;
1.1359 + TestRFile1.Seek(ESeekStart,seekPos64);
1.1360 +
1.1361 + TBuf8<5> writeBuf64;
1.1362 + TBuf8<5> readBuf64;
1.1363 + writeBuf64.Zero();
1.1364 + for(count = 0; count < 5; count++)
1.1365 + {
1.1366 + writeBuf64.Append(count);
1.1367 + }
1.1368 +
1.1369 + test.Next(_L("Read from the file position 4GB-10 using RFile::Read() of length 5 bytes\n"));
1.1370 + TestRFile1.Write(seekPos64,writeBuf64,5);
1.1371 + TestRFile1.Seek(ESeekStart,seekPos64);
1.1372 + TestRFile1.Read(seekPos64,readBuf64,5);
1.1373 + test(readBuf64 == writeBuf64);
1.1374 +
1.1375 + TestRFile1.Close();
1.1376 + file.Close();
1.1377 +
1.1378 + test.Next(_L("Open the file using Rfile::Open()\n"));
1.1379 + r = file.Open(TheFs,fileName,EFileShareAny|EFileWrite);
1.1380 + test(r == KErrTooBig);
1.1381 +
1.1382 + test.Next(_L("Open the file using Rfile64::Open() and close\n"));
1.1383 + TestRFile1.Open(fileName,EFileShareAny|EFileWrite);
1.1384 + TestRFile1.Close();
1.1385 +
1.1386 + r = TheFs.Delete(fileName);
1.1387 + test(r == KErrNone);
1.1388 + }
1.1389 +
1.1390 +/**
1.1391 +@SYMTestCaseID PBASE-T_FILE64BIT-0762
1.1392 +@SYMTestPriority High
1.1393 +@SYMTestRequirement REQ9531
1.1394 +@SYMTestType CIT
1.1395 +@SYMTestCaseDesc Tests the temporary file creation using RFile64::Temp()
1.1396 +@SYMTestActions
1.1397 +1) Create a Temporary file using RFile64::Temp() in write mode and DeleteOnClose
1.1398 +2) Set the file size to 4GB-1
1.1399 +3) Write 100 bytes to the file at position 2GB+1
1.1400 +4) Write 1 byte to file position 4GB-2
1.1401 +5) Write 10 bytes to file position 0.
1.1402 +6) Write 1 byte to file position 4GB+1
1.1403 +7) Read and compare the data at position 2GB+1,4GB-2,0 and close the file
1.1404 +8) Delete the temporary file.
1.1405 +9) Create a temporary file using RFile64::Temp() in write mode and without DeleteOnClose flag
1.1406 +10) Close the File
1.1407 +11) Delete the temporary file
1.1408 +@SYMTestExpectedResults
1.1409 +1) Temporary file created successfully
1.1410 +2) File size = 4GB-1
1.1411 +3) Write successful with KErrNone
1.1412 +4) Write successful with KErrNone
1.1413 +5) Write successful with KErrNone
1.1414 +6) Write fail with KErrNotSupported
1.1415 +7) Read data == written data
1.1416 +8) KErrNotFound, since the file is already deleted on close
1.1417 +9) File created successfully
1.1418 +10) File closed
1.1419 +11) File deleted successfully
1.1420 +
1.1421 +@SYMTestStatus Implemented
1.1422 +*/
1.1423 +void TestCreateTempFile()
1.1424 + {
1.1425 + TInt count;
1.1426 + TFileName testDir;
1.1427 + testDir.Append(gDriveToTest);
1.1428 + testDir.Append(KTestPath);
1.1429 +
1.1430 + TInt r = TheFs.MkDir(testDir);
1.1431 + test(r == KErrNone || r == KErrAlreadyExists);
1.1432 +
1.1433 + TFileName fileName;
1.1434 + TestRFile1.Temp(testDir, fileName, EFileWrite|EDeleteOnClose);
1.1435 +
1.1436 + test.Next(_L("Set the file size to 4GB-1\n"));
1.1437 + TestRFile1.SetSize(K4GBMinusOne);
1.1438 +
1.1439 + TInt64 size = 0;
1.1440 + TestRFile1.Size(size);
1.1441 + test (size == K4GBMinusOne);
1.1442 +
1.1443 + TBuf8<0x64> writeBuf;
1.1444 + TBuf8<0x64> readBuf;
1.1445 + writeBuf.Zero();
1.1446 + for(count = 0; count < 100; count++)
1.1447 + {
1.1448 + writeBuf.Append(count);
1.1449 + }
1.1450 + TInt64 seekPos = K2GB + 1;
1.1451 + test.Next(_L("Write 100 bytes to the file at position 2GB+1\n"));
1.1452 + TestRFile1.Write(seekPos, writeBuf, 100);
1.1453 + test.Next(_L("Read 100 bytes from position 2GB+1"));
1.1454 + TestRFile1.Read(seekPos, readBuf, 100);
1.1455 + test(writeBuf == readBuf);
1.1456 +
1.1457 + test.Next(_L("Write 1 byte to the file at position 4GB-2\n"));
1.1458 + TBuf8<01> writeBuf1Byte;
1.1459 + TBuf8<01> readBuf1Byte;
1.1460 + writeBuf1Byte.Zero();
1.1461 + writeBuf1Byte.Append(0);
1.1462 + seekPos = K4GBMinusTwo;
1.1463 + TestRFile1.Write(seekPos, writeBuf1Byte, 1);
1.1464 +
1.1465 + test.Next(_L("Read 1 byte from position 4GB-2"));
1.1466 + seekPos = K4GBMinusTwo;
1.1467 + TestRFile1.Read(seekPos, readBuf1Byte, 1);
1.1468 + test(writeBuf1Byte == readBuf1Byte);
1.1469 +
1.1470 + test.Next(_L("Write 10 bytes to the file at position 0\n"));
1.1471 + TBuf8<10> writeBuf10Byte;
1.1472 + TBuf8<10> readBuf10Byte;
1.1473 + writeBuf10Byte.Zero();
1.1474 + for(count = 0; count < 10; count++)
1.1475 + {
1.1476 + writeBuf10Byte.Append(count);
1.1477 + }
1.1478 + TestRFile1.Write(0, writeBuf10Byte, 10);
1.1479 +
1.1480 + test.Next(_L("Read 10 byte from position 0"));
1.1481 + TestRFile1.Read(0, readBuf10Byte, 10);
1.1482 + test(writeBuf10Byte == readBuf10Byte);
1.1483 +
1.1484 + test.Next(_L("Write 1 byte to the file at position 4GB+1\n"));
1.1485 + seekPos = K4GB + 1;
1.1486 + TestRFile1.Write(seekPos, writeBuf1Byte, 1);
1.1487 +
1.1488 + TestRFile1.Close();
1.1489 +
1.1490 + test.Next(_L("Delete the temporary file\n"));
1.1491 + r = TheFs.Delete(fileName);
1.1492 + test(r == KErrNotFound);
1.1493 +
1.1494 + test.Next(_L("Create a temporary file using RFile64::Temp without EDeleteOnClose flag\n"));
1.1495 + TestRFile1.Temp(testDir, fileName, EFileWrite);
1.1496 +
1.1497 + test.Next(_L("Close the file\n"));
1.1498 + TestRFile1.Close();
1.1499 +
1.1500 + test.Next(_L("Delete the temporary the file\n"));
1.1501 + r = TheFs.Delete(fileName);
1.1502 + test(r == KErrNone);
1.1503 +
1.1504 + }
1.1505 +
1.1506 +/**
1.1507 +@SYMTestCaseID PBASE-T_FILE64BIT-0763
1.1508 +@SYMTestPriority High
1.1509 +@SYMTestRequirement REQ9531
1.1510 +@SYMTestType CIT
1.1511 +@SYMTestCaseDesc Tests the file creation using RFile64::Create()
1.1512 +@SYMTestActions
1.1513 +1) Create a file FileLargeOne.txt in write mode.
1.1514 +2) Set the file size to 3GB-4KB
1.1515 +3) Seek the file: Mode = ESeekEnd
1.1516 +4) Write to a file with current position and length =4KB
1.1517 +5) Get the file size.
1.1518 +6) Write to a file at position 0 and length = 100 bytes.
1.1519 +7) Write to a file at position 4GB -2 and length = 1 byte
1.1520 +8) Write to a file at position 4GB -2 and length = 3 byte
1.1521 +9) Read and compare the data written at position 0, 4GB-1
1.1522 +10) Close the File.
1.1523 +11) Create the file FileLargeOne.txt in write mode.
1.1524 +12) Create a file with invalid path and file name.
1.1525 +@SYMTestExpectedResults
1.1526 +1) File created successfully with KErrNone
1.1527 +2) File size = 3GB-4KB
1.1528 +3) KErrNone
1.1529 +4) Write successful with KErrNone
1.1530 +5) File size == 3GB
1.1531 +6) Write successful with KErrNone
1.1532 +7) Write successful with KErrNone
1.1533 +8) Write fails with KErrNotSupported.
1.1534 +9) Read data == written data.
1.1535 +10) File closed successfully.
1.1536 +11) File creation failed with KErrAlreadyExists
1.1537 +12) File Creation failed with KErrPathNotFound.
1.1538 +@SYMTestStatus Implemented
1.1539 +*/
1.1540 +void TestCreateRFile64()
1.1541 + {
1.1542 + TInt count;
1.1543 + TFileName fileName;
1.1544 + fileName.Append(gDriveToTest);
1.1545 + fileName.Append(KTestPath);
1.1546 + fileName.Append(_L("FileLargeOne.txt"));
1.1547 +
1.1548 + test.Next(_L("create a file named FileLargeOne.txt\n"));
1.1549 + TestRFile1.Create(fileName, EFileWrite);
1.1550 +
1.1551 + test.Next(_L("set the file size to 3GB - 4KB\n"));
1.1552 + TestRFile1.SetSize(K3GB-K4KB);
1.1553 +
1.1554 + TInt64 size = 0;
1.1555 + TestRFile1.Size(size);
1.1556 + test (size == K3GB-K4KB);
1.1557 +
1.1558 + test.Next(_L("seek to the end of the file\n"));
1.1559 + TInt64 seekPos = 0;
1.1560 + TestRFile1.Seek(ESeekEnd,seekPos);
1.1561 + test(seekPos == K3GB-K4KB);
1.1562 +
1.1563 + test.Next(_L("write to the file current position and length = 4KB\n"));
1.1564 + TBuf8<4096> writeBufK4KB;
1.1565 + TBuf8<4096> readBufK4KB;
1.1566 + for (count = 0; count < 4096; count++)
1.1567 + {
1.1568 + writeBufK4KB.Append(count+1);
1.1569 + }
1.1570 +
1.1571 + TestRFile1.Write(writeBufK4KB,K4KB);
1.1572 +
1.1573 + test.Next(_L("read from the file from position K3GB-K4KB and length = 4KB\n"));
1.1574 + seekPos = K3GB - K4KB;
1.1575 + TestRFile1.Read(seekPos,readBufK4KB,K4KB);
1.1576 + test(writeBufK4KB == readBufK4KB);
1.1577 +
1.1578 + test.Next(_L("get the size of the file\n"));
1.1579 + size = 0;
1.1580 + TestRFile1.Size(size);
1.1581 + test(size == K3GB);
1.1582 +
1.1583 + test.Next(_L("write to the file at position 0 and length = 100bytes\n"));
1.1584 + TBuf8<0x64> writeBuf100B;
1.1585 + TBuf8<0x64> readBuf100B;
1.1586 + writeBuf100B.Zero();
1.1587 + for(count = 0; count < 100; count++)
1.1588 + {
1.1589 + writeBuf100B.Append(count);
1.1590 + }
1.1591 + seekPos = 0;
1.1592 + TestRFile1.Write(seekPos, writeBuf100B, 100);
1.1593 +
1.1594 + test.Next(_L("Read 100 bytes from position 0"));
1.1595 + TestRFile1.Read(seekPos, readBuf100B, 100);
1.1596 + test(writeBuf100B == readBuf100B);
1.1597 +
1.1598 + test.Next(_L("Write 1 byte to the file at position 4GB-2\n"));
1.1599 + TBuf8<01> writeBuf1Byte;
1.1600 + TBuf8<01> readBuf1Byte;
1.1601 + writeBuf1Byte.Zero();
1.1602 + writeBuf1Byte.Append(0);
1.1603 + seekPos = K4GBMinusTwo;
1.1604 + TestRFile1.SetSize(K4GB-1);
1.1605 + TestRFile1.Write(seekPos, writeBuf1Byte, 1);
1.1606 +
1.1607 + test.Next(_L("Read 1 byte from position 4GB-2"));
1.1608 + seekPos = K4GBMinusTwo;
1.1609 + TestRFile1.Read(seekPos, readBuf1Byte, 1);
1.1610 + test(writeBuf1Byte == readBuf1Byte);
1.1611 +
1.1612 + test.Next(_L("Write 3 bytes to the file at position 4GB-1\n"));
1.1613 + TBuf8<3> writeBuf3Byte;
1.1614 +
1.1615 + writeBuf3Byte.Zero();
1.1616 + for(count = 0; count < 3; count++)
1.1617 + {
1.1618 + writeBuf3Byte.Append(count);
1.1619 + }
1.1620 + seekPos = K4GBMinusTwo;
1.1621 + TestRFile1.Write(seekPos, writeBuf1Byte, 3);
1.1622 +
1.1623 + TestRFile1.Close();
1.1624 +
1.1625 + test.Next(_L("create a file named FileLargeOne.txt(KErrAlreadyExists)\n"));
1.1626 + TestRFile1.Create(fileName,EFileWrite);
1.1627 +
1.1628 + test.Next(_L("create a file with InvalidPath and fileName\n"));
1.1629 + RFile64 file64;
1.1630 + TInt r = file64.Create(TheFs, _L("C:\\InvalidPathName\\FileName"),EFileWrite);
1.1631 + test(r == KErrPathNotFound);
1.1632 +
1.1633 + r = TheFs.Delete(fileName);
1.1634 + test(r == KErrNone);
1.1635 + }
1.1636 +
1.1637 +/**
1.1638 +@SYMTestCaseID PBASE-T_FILE64BIT-0764
1.1639 +@SYMTestPriority High
1.1640 +@SYMTestRequirement REQ9531
1.1641 +@SYMTestType CIT
1.1642 +@SYMTestCaseDesc Tests the file creation using RFile64::Replace()
1.1643 +@SYMTestActions
1.1644 +1) Replace a file FileLargeOne.txt in write mode using RFile64::Replace.
1.1645 +2) Set the file size to 4GB-1
1.1646 +3) Write to a file with position = 4GB-4KB-2 and length = 4KB
1.1647 +4) Get the file size
1.1648 +5) Seek the file: Mode = ESeekEnd,pos = 0.
1.1649 +6) Write to a file with current position, length = 1 byte
1.1650 +7) Seek the file: Mode = ESeekStart
1.1651 +8) Write to a file with current position and length = 4KB
1.1652 +9) Seek the file: Mode = ESeekEnd
1.1653 +10)Read from the current position and length = 1 byte and compare with written data
1.1654 +11)Seek the file: Mode = ESeekStart
1.1655 +12)Read the data from the current position and length = 4KB and compare with written data
1.1656 +13)Close the file
1.1657 +14)Replace a file FileLargeOne.txt in write mode
1.1658 +15)Get the file size
1.1659 +16)Close the file.
1.1660 +17)Replace a file FileLargeOne.txt with invalid path
1.1661 +@SYMTestExpectedResults
1.1662 +1) File created successfully with KErrNone
1.1663 +2) File size = 4GB-1
1.1664 +3) Write successful with KErrNone
1.1665 +4) File size = 4GB-1
1.1666 +5) KErrNone
1.1667 +6) Write successful with KErrNone
1.1668 +7) KErrNone
1.1669 +8) Write successful with KErrNone
1.1670 +9) KErrNone
1.1671 +10)Written data == Read data
1.1672 +11)KErrNone
1.1673 +12)Written data == Read data
1.1674 +13)File Closed
1.1675 +14)File creatd successfully with KErrNone
1.1676 +15)File size = 0
1.1677 +16)File Closed
1.1678 +17)File creation failed with KErrPathNotFound.
1.1679 +@SYMTestStatus Implemented
1.1680 +*/
1.1681 +void TestReplaceRFile64()
1.1682 + {
1.1683 + TFileName fileName;
1.1684 + fileName.Append(gDriveToTest);
1.1685 + fileName.Append(KTestPath);
1.1686 + fileName.Append(_L("FileLargeOne.txt"));
1.1687 +
1.1688 + test.Next(_L("Replace a file named FileLargeOne.txt\n"));
1.1689 + TestRFile1.Replace(fileName, EFileWrite);
1.1690 +
1.1691 + test.Next(_L("Set the size of the file to 4GB-1\n"));
1.1692 + TestRFile1.SetSize(K4GB-1);
1.1693 +
1.1694 + TBuf8<4096> writeBufK4KB;
1.1695 + TBuf8<4096> readBufK4KB;
1.1696 + for (TInt count = 0; count < 4096; count++)
1.1697 + {
1.1698 + writeBufK4KB.Append(count+1);
1.1699 + }
1.1700 +
1.1701 + test.Next(_L("Write to a file with position = 4GB-4KB-2 and length = 4KB\n"));
1.1702 + TInt64 pos = K4GB-K4KB-2;
1.1703 + TestRFile1.Write(pos,writeBufK4KB,K4KB);
1.1704 +
1.1705 + test.Next(_L("Read from 4GB-4KB-1 and compare data\n"));
1.1706 + TestRFile1.Read(pos,readBufK4KB,K4KB);
1.1707 + test(writeBufK4KB == readBufK4KB);
1.1708 +
1.1709 + test.Next(_L("Get the file size\n"));
1.1710 + TInt64 size = 0;
1.1711 + TestRFile1.Size(size);
1.1712 + test (size == K4GB-1);
1.1713 +
1.1714 + test.Next(_L("Seek the file: Mode = ESeekEnd,pos = 0.\n"));
1.1715 + TInt64 seekPos = 0;
1.1716 + TestRFile1.Seek(ESeekEnd,seekPos);
1.1717 + test(seekPos == K4GB-1);
1.1718 +
1.1719 + test.Next(_L("Write to a file with current position, length = 1 byte\n"));
1.1720 + TBuf8<1> writeBuf1B(_L8("0"));
1.1721 + TBuf8<1> readBuf1B;
1.1722 +
1.1723 + if(!KFileSizeMaxLargerThan4GBMinusOne)
1.1724 + seekPos--;
1.1725 +
1.1726 + TestRFile1.Write(seekPos,writeBuf1B,1); //-- now seek pos is K4GB
1.1727 +
1.1728 +
1.1729 + test.Next(_L("Seek the file: Mode = ESeekStart\n"));
1.1730 + seekPos = 0;
1.1731 + TestRFile1.Seek(ESeekStart,seekPos);
1.1732 +
1.1733 + test.Next(_L("Write to a file with current position and length = 4KB\n"));
1.1734 + TestRFile1.Write(seekPos,writeBufK4KB,K4KB);
1.1735 +
1.1736 + test.Next(_L("Seek the file: Mode = ESeekEnd\n"));
1.1737 + seekPos = 0;
1.1738 + TestRFile1.Seek(ESeekEnd,seekPos);
1.1739 +
1.1740 + if(KFileSizeMaxLargerThan4GBMinusOne)
1.1741 + {//-- file is larger than 4G-1
1.1742 + test(seekPos == K4GB);
1.1743 + }
1.1744 + else
1.1745 + {
1.1746 + test(seekPos == K4GB-1);
1.1747 + }
1.1748 +
1.1749 + seekPos--;
1.1750 +
1.1751 +
1.1752 + test.Next(_L("Read from pos = 4GB-1 and compare data\n"));
1.1753 + TestRFile1.Read(seekPos,readBuf1B,1);
1.1754 + test(writeBuf1B == readBuf1B);
1.1755 +
1.1756 + test.Next(_L("Seek the file: Mode = ESeekStart\n"));
1.1757 + seekPos = 0;
1.1758 + TestRFile1.Seek(ESeekStart,seekPos);
1.1759 +
1.1760 + test.Next(_L("Read from the file and compare written data\n"));
1.1761 + TestRFile1.Read(seekPos,readBufK4KB,K4KB);
1.1762 + test (writeBufK4KB == readBufK4KB);
1.1763 +
1.1764 + test.Next(_L("Close the file\n"));
1.1765 + TestRFile1.Close();
1.1766 +
1.1767 + test.Next(_L("Replace a file FileLargeOne.txt in write mode\n"));
1.1768 + TestRFile1.Replace(fileName, EFileWrite);
1.1769 +
1.1770 + test.Next(_L("Get the file size\n"));
1.1771 + size = 0;
1.1772 + TestRFile1.Size(size);
1.1773 + test (size == 0);
1.1774 +
1.1775 + test.Next(_L("Close the file\n"));
1.1776 + TestRFile1.Close();
1.1777 +
1.1778 + test.Next(_L("Replace a file FileLargeOne.txt with invalid path\n"));
1.1779 + RFile64 file64;
1.1780 + TInt r = file64.Replace(TheFs,_L("C:\\InvalidPath\\FileLargeOne.Txt"),EFileWrite);
1.1781 + test (r == KErrPathNotFound);
1.1782 +
1.1783 + r = TheFs.Delete(fileName);
1.1784 + test(r == KErrNone);
1.1785 + }
1.1786 +
1.1787 +/**
1.1788 +@SYMTestCaseID PBASE-T_FILE64BIT-0765
1.1789 +@SYMTestPriority High
1.1790 +@SYMTestRequirement REQXXXX
1.1791 +@SYMTestType CIT
1.1792 +@SYMTestCaseDesc Tests the file replace using RFs::Replace()
1.1793 +@SYMTestActions
1.1794 +1) Create a file named FileLargeOne.txt using RFile64::Replace()
1.1795 +2) Set the file size to 3GB and get the file size
1.1796 +3) Write 10 bytes to location 2GB+10 and close the file
1.1797 +4) Replace the file named ReNameFileLargeOne.txt using RFs::Replace()
1.1798 +5) Open the file ReNameFileLargeOne.txt
1.1799 +6) Set the file size to 4GB-1
1.1800 +7) Write 10 bytes to the location 3GB+10
1.1801 +8) Read the above file from the location 3GB+10
1.1802 +9) Compare the read and the written data
1.1803 +10)Close the file
1.1804 +@SYMTestExpectedResults
1.1805 +1) File created successfully with KErrNone
1.1806 +2) File size = 3GB
1.1807 +3) Write successful with KErrNone and file closed
1.1808 +4) FileLargeOne.txt is replaced with ReNameFileLargeOne.txt successfully
1.1809 +5) File ReNameFileLargeOne.txt is opened successfully
1.1810 +6) KErrNone
1.1811 +7) Write successful with KErrNone
1.1812 +8) Read is successful with KErrNone
1.1813 +9) Written data == Read data
1.1814 +10)File Closed
1.1815 +@SYMTestStatus Implemented
1.1816 +*/
1.1817 +void TestReplaceRFile64RFs()
1.1818 + {
1.1819 +
1.1820 + TFileName fileName;
1.1821 + fileName.Append(gDriveToTest);
1.1822 + fileName.Append(KTestPath);
1.1823 + fileName.Append(_L("FileLargeOne.txt"));
1.1824 +
1.1825 + test.Next(_L("Replace a file named FileLargeOne.txt\n"));
1.1826 + TestRFile1.Replace(fileName, EFileWrite);
1.1827 +
1.1828 + test.Next(_L("Set the file size to 3GB and get the file size\n"));
1.1829 + TestRFile1.SetSize(K3GB);
1.1830 + TInt64 size = 0;
1.1831 + TestRFile1.Size(size);
1.1832 + test (size == K3GB);
1.1833 +
1.1834 +
1.1835 + test.Next(_L("Write 10 bytes to location 2GB+10 and close the file\n"));
1.1836 + TBuf8<10> writeBuf;
1.1837 + TBuf8<10> readBuf;
1.1838 + for (TInt count = 0; count < 10; count++)
1.1839 + {
1.1840 + writeBuf.Append(count+1);
1.1841 + }
1.1842 + TInt64 pos = K2GB+10;
1.1843 + TestRFile1.Write(pos,writeBuf,10);
1.1844 + TestRFile1.Read(pos,readBuf,10);
1.1845 + test(readBuf == writeBuf);
1.1846 + TestRFile1.Close();
1.1847 +
1.1848 + test.Next(_L("Replace the file named ReNameFileLargeOne.txt using RFs::Replace()\n"));
1.1849 + TFileName fileNameReplace;
1.1850 + fileNameReplace.Append(gDriveToTest);
1.1851 + fileNameReplace.Append(KTestPath);
1.1852 + fileNameReplace.Append(_L("ReNameFileLargeOne.txt\n"));
1.1853 + TestRFs.Replace(fileName,fileNameReplace);
1.1854 +
1.1855 + test.Next(_L("Open the file ReNameFileLargeOne.txt\n"));
1.1856 + TestRFile1.Open(fileNameReplace,EFileWrite);
1.1857 +
1.1858 + test.Next(_L("Set the file size to 4GB-1\n"));
1.1859 + TestRFile1.SetSize(K4GB-1);
1.1860 + size = 0;
1.1861 + TestRFile1.Size(size);
1.1862 + test (size == K4GB-1);
1.1863 +
1.1864 + test.Next(_L("Write 10 bytes to the location 3GB+10\n"));
1.1865 + pos = K3GB+10;
1.1866 + TestRFile1.Write(pos,_L8("ABCDEFGHIJ"),10);
1.1867 +
1.1868 + test.Next(_L("Read the above file from the location 3GB+10 and compare\n"));
1.1869 + TBuf8<10> readBuffer;
1.1870 + TestRFile1.Read(pos,readBuffer,10);
1.1871 + test(readBuffer == _L8("ABCDEFGHIJ"));
1.1872 +
1.1873 + test.Next(_L("Close the file and delete\n"));
1.1874 + TestRFile1.Close();
1.1875 + TInt r = TheFs.Delete(fileNameReplace);
1.1876 + test(r == KErrNone);
1.1877 + }
1.1878 +
1.1879 +/**
1.1880 +@SYMTestCaseID PBASE-T_FILE64BIT-0766
1.1881 +@SYMTestPriority High
1.1882 +@SYMTestRequirement REQXXXX
1.1883 +@SYMTestType CIT
1.1884 +@SYMTestCaseDesc Test the file creation using RFile64::AdoptFromClient()
1.1885 +@SYMTestActions
1.1886 +1) Connect to the File server
1.1887 +2) Create a file and set the file size to 4GB-1
1.1888 +3) Write few bytes to the location 4GB-10, length = 9bytes
1.1889 +4) Transfer the file handle using TransferToServer() close the file
1.1890 +5) Adopt the already open file from a client using RFile64::Adopt::AdoptFromClient()
1.1891 +6) Read the file from position 4GB-10 and compare the data
1.1892 +@SYMTestExpectedResults
1.1893 +1) Connection successful
1.1894 +2) File created successfully
1.1895 +3) Write successful with KErrNone
1.1896 +4) KErrNone, Transfer to server is successful
1.1897 +5) successfully Allows the server to adopt an already open file from a client process
1.1898 +6) File read should be successful and Read Data = Test Data
1.1899 +@SYMTestStatus Implemented
1.1900 +*/
1.1901 +void TestRFile64AdoptFromClient()
1.1902 + {
1.1903 + test.Next(_L("Tests for checking RFile64::AdoptFromClient()"));
1.1904 +
1.1905 + RProcess p;
1.1906 + TInt r = p.Create(_L("FHServer64Bit.exe"), KNullDesC);
1.1907 + test(r == KErrNone);
1.1908 +
1.1909 +
1.1910 + test.Next(_L("Connect to the File server \n"));
1.1911 + RFs fs;
1.1912 + r = fs.Connect();
1.1913 + test(r == KErrNone);
1.1914 +
1.1915 + // Check the number of open file handles
1.1916 + TInt resCount = fs.ResourceCount();
1.1917 + test(resCount == 0);
1.1918 +
1.1919 + r = fs.ShareProtected();
1.1920 + test(r == KErrNone);
1.1921 +
1.1922 + r = fs.CreatePrivatePath(gDrive);
1.1923 + test(r == KErrNone);
1.1924 + r = fs.SetSessionToPrivate(gDrive);
1.1925 +
1.1926 + test.Next(_L("Create a file and set the file size to 4GB-1\n"));
1.1927 + RFile64 file1;
1.1928 + r = file1.Replace(fs,KClientFileName,EFileWrite);
1.1929 + test(r == KErrNone);
1.1930 + r = file1.SetSize(K4GB-1);
1.1931 + test(r == KErrNone);
1.1932 +
1.1933 + test.Next(_L("Write few bytes to the location 4GB-10, length = 9bytes\n"));
1.1934 + r = file1.Write(K4GB-10,KTestData3(),9);
1.1935 + test(r == KErrNone);
1.1936 + file1.Close();
1.1937 +
1.1938 + r = p.SetParameter(3, gDrive);
1.1939 + test(r == KErrNone);
1.1940 +
1.1941 + p.Resume();
1.1942 +
1.1943 +
1.1944 + test.Next(_L("Transfer the file handle using TransferToServer() close the file\n"));
1.1945 + RFileHandleSharer64Bit handsvr;
1.1946 + do
1.1947 + {
1.1948 + r = handsvr.Connect();
1.1949 + }
1.1950 + while(r == KErrNotFound);
1.1951 + test(r == KErrNone);
1.1952 +
1.1953 + r = handsvr.SetTestDrive(gDrive);
1.1954 + test(r == KErrNone);
1.1955 +
1.1956 + r = fs.SetSessionToPrivate(gDrive);
1.1957 + test(r == KErrNone);
1.1958 +
1.1959 + r = file1.Open(fs,KClientFileName,EFileRead);
1.1960 + test(r == KErrNone);
1.1961 +
1.1962 + // pass the file handle to FHServer
1.1963 + test.Next(_L("RFile::TransferToServer()"));
1.1964 +
1.1965 + TIpcArgs ipcArgs;
1.1966 + r = file1.TransferToServer(ipcArgs, 0, 1);
1.1967 + test(r == KErrNone);
1.1968 +
1.1969 + test.Next(_L("Adopt the already open file from a client using RFile64::AdoptFromClient()\n"));
1.1970 + r = handsvr.PassFileHandleProcessLargeFileClient(ipcArgs);
1.1971 + test(r == KErrNone);
1.1972 +
1.1973 + // verify that the original file handle's position is unchanged
1.1974 + TInt64 pos = 0;
1.1975 + r = file1.Seek(ESeekCurrent, pos);
1.1976 + test(r == KErrNone);
1.1977 + test(pos == 0);
1.1978 + // make sure we can still use it
1.1979 +
1.1980 + test.Next(_L("Read the file from position 4GB-10 and compare the data\n"));
1.1981 + TBuf8<9> rbuf;
1.1982 + r = file1.Read(K4GB-10,rbuf);
1.1983 + test(r == KErrNone);
1.1984 + test (rbuf == KTestData3);
1.1985 +
1.1986 + // Close the file
1.1987 + file1.Close();
1.1988 + handsvr.Exit();
1.1989 + handsvr.Close();
1.1990 + r = fs.MkDir(_L("C:\\mdir"));
1.1991 + test(r == KErrNone || r == KErrAlreadyExists);
1.1992 +
1.1993 + // Check the number of open file handles
1.1994 + resCount = fs.ResourceCount();
1.1995 + test(resCount == 0);
1.1996 +
1.1997 + r = fs.Delete(KClientFileName);
1.1998 + test(r == KErrNone);
1.1999 + fs.Close();
1.2000 + }
1.2001 +
1.2002 +/**
1.2003 +@SYMTestCaseID PBASE-T_FILE64BIT-0767
1.2004 +@SYMTestPriority High
1.2005 +@SYMTestRequirement REQXXXX
1.2006 +@SYMTestType CIT
1.2007 +@SYMTestCaseDesc Test the file creation using RFile64::AdoptFromCreator()
1.2008 +@SYMTestActions
1.2009 +1) Create a process named "FHServer64Bit.exe"
1.2010 +2) Connect to the File server
1.2011 +3) Create a file and set the file size to 4GB-1
1.2012 +4) Write few bytes to the location 4GB-10, length = 3 bytes
1.2013 +5) Transfer the file handle using TransferToProcess() close the file
1.2014 +6) Resume the process "FHServer64bit.exe"
1.2015 +7) Adopts the already open file from a client using RFile64::AdoptFromCreator()
1.2016 +8) Read the file from position 4GB-10 and compare the data
1.2017 +@SYMTestExpectedResults
1.2018 +1) Process is created successfully with KErrnone
1.2019 +2) Connection successful
1.2020 +3) File created successfully
1.2021 +4) Write successful with KErrNone
1.2022 +5) KErrNone, Transfer to other process is successful
1.2023 +6) Server process should be resumed
1.2024 +7) successfully Allows the server to adopt an already open file from a client process
1.2025 +8) File read should be successful and Read Data = Test Data
1.2026 +@SYMTestStatus Implemented
1.2027 +*/
1.2028 +
1.2029 +void TestRFile64AdoptFromCreator()
1.2030 + {
1.2031 + TInt r;
1.2032 + test.Next(_L("Tests for checking RFile64::AdoptFromCreator()"));
1.2033 + //create test server
1.2034 + test.Next(_L("Create a process named FHServer64Bit.exe\n"));
1.2035 + RProcess p;
1.2036 + r = p.Create(_L("FHServer64Bit.exe"), KNullDesC);
1.2037 + test(r == KErrNone);
1.2038 +
1.2039 + test.Next(_L("Connect to the file server\n"));
1.2040 + RFs fs;
1.2041 + r = fs.Connect();
1.2042 + test(r == KErrNone);
1.2043 +
1.2044 + // Check the number of open file handles
1.2045 + TInt resCount = fs.ResourceCount();
1.2046 + test(resCount == 0);
1.2047 +
1.2048 + r = fs.ShareProtected();
1.2049 + test(r == KErrNone);
1.2050 +
1.2051 + r = fs.CreatePrivatePath(gDrive);
1.2052 + test(r == KErrNone);
1.2053 + r = fs.SetSessionToPrivate(gDrive);
1.2054 +
1.2055 + test.Next(_L("Create a file and set the file size to 4GB-1\n"));
1.2056 + RFile64 file1;
1.2057 + r = file1.Replace(fs,KClientFileName,EFileWrite);
1.2058 + test(r == KErrNone);
1.2059 + r = file1.SetSize(K4GB-1);
1.2060 + test(r == KErrNone);
1.2061 +
1.2062 + test.Next(_L("Write few bytes to the location 4GB-10, length = 3bytes\n"));
1.2063 + r = file1.Write(K4GB-10,KTestData2(),3);
1.2064 + test(r == KErrNone);
1.2065 + file1.Close();
1.2066 +
1.2067 + r = file1.Open(fs, KClientFileName, EFileWrite);
1.2068 +
1.2069 + test(r == KErrNone);
1.2070 +
1.2071 + // NB slot 0 is reserved for the command line
1.2072 +
1.2073 + test.Next(_L("Transfer the file handle using TransferToProcess() close the file"));
1.2074 +
1.2075 + r = file1.TransferToProcess(p, 1, 2);
1.2076 +
1.2077 + r = p.SetParameter(3, gDrive);
1.2078 + test(r == KErrNone);
1.2079 +
1.2080 + r = fs.SetSessionToPrivate(gDrive);
1.2081 + test(r == KErrNone);
1.2082 +
1.2083 + // make sure we can still read from the file
1.2084 + TBuf8<3> rbuf;
1.2085 + r = file1.Read(K4GB-10,rbuf,3);
1.2086 + test(r == KErrNone);
1.2087 + r = rbuf.CompareF(KTestData2());
1.2088 + test(r == KErrNone);
1.2089 + file1.Close();
1.2090 +
1.2091 + r = fs.MkDir(_L("C:\\mdir"));
1.2092 + test(r == KErrNone || r == KErrAlreadyExists);
1.2093 +
1.2094 + // Check the number of open file handles -
1.2095 + // should be 1 (the one duplicated for the other process)
1.2096 + resCount = fs.ResourceCount();
1.2097 + test(resCount == 1);
1.2098 +
1.2099 + fs.Close();
1.2100 +
1.2101 + test.Next(_L("Resume the process FHServer64bit.exe "));
1.2102 +// Start the server thread
1.2103 + p.Resume();
1.2104 +
1.2105 +// connect to the server
1.2106 + RFileHandleSharer64Bit handsvr;
1.2107 + do
1.2108 + {
1.2109 + r = handsvr.Connect();
1.2110 + }
1.2111 + while(r == KErrNotFound);
1.2112 + test(r == KErrNone);
1.2113 + r = handsvr.SetTestDrive(gDrive);
1.2114 + test(r == KErrNone);
1.2115 +
1.2116 + // wait for server to read the file
1.2117 + r = handsvr.PassFileHandleProcessLargeFileCreator();
1.2118 + test (r == KErrNone);
1.2119 +
1.2120 +
1.2121 + // cleanup
1.2122 + handsvr.Exit();
1.2123 + handsvr.Close();
1.2124 + p.Close();
1.2125 + }
1.2126 +
1.2127 +/**
1.2128 +@SYMTestCaseID PBASE-T_FILE64BIT-0768
1.2129 +@SYMTestPriority High
1.2130 +@SYMTestRequirement REQXXXX
1.2131 +@SYMTestType CIT
1.2132 +@SYMTestCaseDesc Test the file creation using RFile64::AdoptFromServer()
1.2133 +@SYMTestActions
1.2134 +1) Connect to the File server
1.2135 +2) Create a file and set the file size to 4GB-1
1.2136 +3) Write few bytes to the location 4GB-10, length = 9bytes
1.2137 +4) Adopt an already open file from a server using RFile64::AdoptFromServer()
1.2138 +5) Read the file from position 4GB-10 and compare the data
1.2139 +@SYMTestExpectedResults
1.2140 +1) Connection successful
1.2141 +2) File created successfully
1.2142 +3) Write successful with KErrNone
1.2143 +4) successfully Allows the client to adopt an already open file from a server process
1.2144 +5) File read should be successful and Read Data = Test Data
1.2145 +@SYMTestStatus Implemented
1.2146 +*/
1.2147 +
1.2148 +void TestRFile64AdoptFromServer()
1.2149 + {
1.2150 +
1.2151 + test.Next(_L("Tests for checking RFile64::AdoptFromServer()"));
1.2152 + TInt r;
1.2153 +
1.2154 + test.Next(_L("Connect to the file server\n"));
1.2155 + RFs fs;
1.2156 + r = fs.Connect();
1.2157 + test(r == KErrNone);
1.2158 +
1.2159 + // Check the number of open file handles
1.2160 + TInt resCount = fs.ResourceCount();
1.2161 + test(resCount == 0);
1.2162 +
1.2163 + r = fs.ShareProtected();
1.2164 + test(r == KErrNone);
1.2165 +
1.2166 + r = fs.CreatePrivatePath(gDrive);
1.2167 + test(r == KErrNone);
1.2168 + r = fs.SetSessionToPrivate(gDrive);
1.2169 +
1.2170 + test.Next(_L("Create a file and set the file size to 4GB-1\n"));
1.2171 + RFile64 file1;
1.2172 + r = file1.Replace(fs,KClientFileName,EFileWrite);
1.2173 + test(r == KErrNone);
1.2174 + r = file1.SetSize(K4GB-1);
1.2175 + test(r == KErrNone);
1.2176 +
1.2177 +
1.2178 + r = file1.Write(K4GB-10,KTestData3(),9);
1.2179 + test(r == KErrNone);
1.2180 +
1.2181 + file1.Close();
1.2182 + r = fs.Delete(KClientFileName);
1.2183 + test(r == KErrNone);
1.2184 +
1.2185 + RProcess p;
1.2186 + r = p.Create(_L("FHServer64Bit.exe"), KNullDesC);
1.2187 + test(r == KErrNone);
1.2188 + // Request an open file (write mode) from the server
1.2189 + // using RFile64::AdoptFromServer()
1.2190 +
1.2191 + test.Next(_L("Adopt an already open file from a server using RFile64::AdoptFromServer()\n"));
1.2192 + p.Resume();
1.2193 + RFileHandleSharer64Bit handsvr;
1.2194 + do
1.2195 + {
1.2196 + r = handsvr.Connect();
1.2197 + }
1.2198 + while(r == KErrNotFound);
1.2199 + test(r == KErrNone);
1.2200 +
1.2201 + r = handsvr.SetTestDrive(gDrive);
1.2202 + test(r == KErrNone);
1.2203 +
1.2204 + TInt ssh;
1.2205 + TInt fsh = handsvr.GetFileHandleLargeFile2(ssh, EFileWrite);
1.2206 + test (fsh >= 0);
1.2207 +
1.2208 + // Closing the handle to the server ensures the server has closed it's
1.2209 + // RFs and RFile handles - this provides a means of testing whether we
1.2210 + // can still adopt the RFile even if the server has closed it's one.
1.2211 +
1.2212 + handsvr.Sync(); // make sure server has finished doing what it's doing
1.2213 + handsvr.Exit();
1.2214 + handsvr.Close();
1.2215 +
1.2216 + // adopt the file handle from FHServer
1.2217 + test.Next(_L("RFile64::AdoptFromServer()"));
1.2218 +
1.2219 + RFile64 file;
1.2220 + r = file.AdoptFromServer(fsh, ssh);
1.2221 + test(r == KErrNone);
1.2222 +
1.2223 + test.Next(_L("Read the file from position 4GB-10 and compare the data\n"));
1.2224 + TBuf8<9> rbuf;
1.2225 + r = file.Read(K4GB-10,rbuf);
1.2226 + test(r == KErrNone);
1.2227 + // server should write KTestData1 ("Server!!!") to file
1.2228 + test (rbuf == KTestData4);
1.2229 +
1.2230 + TFileName fileName;
1.2231 + r = file.FullName(fileName);
1.2232 + test(r == KErrNone);
1.2233 +
1.2234 + file.Close();
1.2235 + //cleanup
1.2236 + r = fs.Delete(fileName);
1.2237 + test(r == KErrNone);
1.2238 +
1.2239 + TFileName sessionPath;
1.2240 + r = fs.SessionPath(sessionPath);
1.2241 + test(r == KErrNone);
1.2242 +
1.2243 + r = fs.RmDir(sessionPath);
1.2244 + test(r == KErrNone);
1.2245 +
1.2246 + fs.Close();
1.2247 +
1.2248 + }
1.2249 +
1.2250 +
1.2251 +/**
1.2252 +@SYMTestCaseID PBASE-T_FILE64BIT-0769
1.2253 +@SYMTestPriority High
1.2254 +@SYMTestRequirement REQ9526
1.2255 +@SYMTestType CIT
1.2256 +@SYMTestCaseDesc Tests for reading a big file synchronously with specified position
1.2257 +@SYMTestActions
1.2258 +1) Big file is read synchronously in a thread, with aPos = 0;
1.2259 +2) Big file is read synchronously in a thread, with aPos = 2GB-1;
1.2260 +3) Big file is read synchronously in a thread. With aPos = 4GB -2. File size= 4GB-1.
1.2261 +4) Check for FAT32 file system, Read from a big file synchronously in a thread with aPos = 4GB.
1.2262 +@SYMTestExpectedResults
1.2263 +1) KErrNone, file is read successfully
1.2264 +2) KErrNone, file is read successfully
1.2265 +3) KErrNone, file is read successfully
1.2266 +4) KErrNone and zero length descriptor, if NGFS is supported we should get the valid data
1.2267 +@SYMTestStatus Implemented
1.2268 +*/
1.2269 +void TestOpenAndReadSyncLargeFile()
1.2270 + {
1.2271 + const TUint KBufSize = KKB;
1.2272 + TUint pos;
1.2273 + TBuf8<KBufSize> readBuf1;
1.2274 + TBuf8<KBufSize> readBuf2;
1.2275 + TUint i;
1.2276 + TInt r = GenerateBigFileContents();
1.2277 + test(r == KErrNone);
1.2278 +
1.2279 + test.Next(_L("Open & Read Synchronously Large File From Diff Offset:"));
1.2280 +
1.2281 + TFileName fileName;
1.2282 + fileName.Append(gDriveToTest);
1.2283 + fileName.Append(KTestPath);
1.2284 + fileName.Append(_L("File4GBMinusOne.txt"));
1.2285 + TestRFile1.Open(fileName,EFileRead);
1.2286 +
1.2287 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 0\n"));
1.2288 + // Sync read from pos = 0
1.2289 + pos = 0;
1.2290 + readBuf1.Zero();
1.2291 + TestRFile1.ReadP(pos, readBuf1);
1.2292 +
1.2293 + test.Next(_L("Compare the data read to the expected data\n"));
1.2294 + for(i = pos; i< pos + (KBufSize / 4); i+=4)
1.2295 + {
1.2296 + TUint j = * ((TUint*) &readBuf1[i - pos]);
1.2297 + test(i == j);
1.2298 + }
1.2299 +
1.2300 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB-1\n"));
1.2301 + // Sync read from pos = 2GB-1
1.2302 + pos = K2GB;
1.2303 + readBuf2.Zero();
1.2304 + TestRFile1.ReadP(pos, readBuf2);
1.2305 +
1.2306 + test.Next(_L("Compare the data read to the expected data\n"));
1.2307 + for(i = pos; i< pos + (KBufSize / 4); i+=4)
1.2308 + {
1.2309 + TUint j = * ((TUint*) &readBuf2[i - pos]);
1.2310 + test(i == j);
1.2311 + }
1.2312 +
1.2313 +
1.2314 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB-2\n"));
1.2315 + TBuf8<1> readBuffer;
1.2316 + pos = K4GBMinusTwo;
1.2317 + TestRFile1.ReadP(pos, readBuffer);
1.2318 + test(readBuffer.Length() == 1);
1.2319 +
1.2320 + // tests need to be repeated for calling the TUint variant of RFile64::Read()
1.2321 + pos = 0;
1.2322 + TestRFile1.ReadU(pos, readBuf1);
1.2323 +
1.2324 + test.Next(_L("Compare the data read to the expected data\n"));
1.2325 + for(i = pos; i< pos + (KBufSize / 4); i+=4)
1.2326 + {
1.2327 + TUint j = * ((TUint*) &readBuf1[i - pos]);
1.2328 + test(i == j);
1.2329 + }
1.2330 +
1.2331 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB\n"));
1.2332 + // Sync read from pos = 2GB
1.2333 + pos = K2GB;
1.2334 + readBuf2.Zero();
1.2335 + TestRFile1.ReadU(pos, readBuf2);
1.2336 +
1.2337 + test.Next(_L("Compare the data read to the expected data\n"));
1.2338 + for(i = pos; i< pos + (KBufSize / 4); i+=4)
1.2339 + {
1.2340 + TUint j = * ((TUint*) &readBuf2[i - pos]);
1.2341 + test(i == j);
1.2342 + }
1.2343 +
1.2344 +
1.2345 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB-2\n"));
1.2346 + pos = K4GBMinusTwo;
1.2347 + TestRFile1.ReadU(pos, readBuffer);
1.2348 + test(readBuffer.Length() == 1);
1.2349 +
1.2350 + // tests need to be repeated for calling the current position variant of RFile64::Read()
1.2351 + TInt64 seekPos = 0;
1.2352 + TestRFile1.Seek(ESeekStart,seekPos);
1.2353 + TestRFile1.Read(readBuf1);
1.2354 +
1.2355 + test.Next(_L("Compare the data read to the expected data\n"));
1.2356 + for(i = (TUint)seekPos; i< seekPos + (KBufSize / 4); i+=4)
1.2357 + {
1.2358 + TUint j = * ((TUint*) &readBuf1[i - (TUint)seekPos]);
1.2359 + test(i == j);
1.2360 + }
1.2361 +
1.2362 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB\n"));
1.2363 + // Sync read from pos = 2GB
1.2364 + seekPos = K2GB;
1.2365 + TestRFile1.Seek(ESeekStart,seekPos);
1.2366 + readBuf2.Zero();
1.2367 + TestRFile1.Read(readBuf2);
1.2368 +
1.2369 + test.Next(_L("Compare the data read to the expected data\n"));
1.2370 + for(i = (TUint)seekPos; i< seekPos + (KBufSize / 4); i+=4)
1.2371 + {
1.2372 + TUint j = * ((TUint*) &readBuf2[i - (TUint)seekPos]);
1.2373 + test(i == j);
1.2374 + }
1.2375 +
1.2376 +
1.2377 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB-2\n"));
1.2378 + seekPos = K4GBMinusTwo;
1.2379 + TestRFile1.Seek(ESeekStart,seekPos);
1.2380 + TestRFile1.Read(readBuffer);
1.2381 + test(readBuffer.Length() == 1);
1.2382 +
1.2383 +
1.2384 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.2385 + {
1.2386 + TInt64 pos64 = K4GB;
1.2387 + TestRFile1.ReadP(pos64, readBuf1);
1.2388 + test(readBuf1.Length() == 0);
1.2389 + }
1.2390 + TestRFile1.Close();
1.2391 + }
1.2392 +
1.2393 +/**
1.2394 +@SYMTestCaseID PBASE-T_FILE64BIT-0770
1.2395 +@SYMTestPriority High
1.2396 +@SYMTestRequirement REQ9526
1.2397 +@SYMTestType CIT
1.2398 +@SYMTestCaseDesc Tests for reading a big file asynchronously with specified position
1.2399 +@SYMTestActions
1.2400 +1) Big file is read asynchronously in a thread, with aPos = 0;
1.2401 +2) Big file is read asynchronously in a thread, with aPos = 2GB-1;
1.2402 +3) Big file is read asynchronously in a thread. With aPos = 4GB -1.
1.2403 +4) Check for FAT32 file system, Read from a big file asynchronously in a thread with aPos = 4GB.
1.2404 +@SYMTestExpectedResults
1.2405 +1) KErrNone, file is read successfully
1.2406 +2) KErrNone, file is read successfully
1.2407 +3) KErrNone, file is read successfully
1.2408 +4) KErrNone and zero length descriptor. If NGFS is supported we should get the valid data.
1.2409 +@SYMTestStatus Implemented
1.2410 +*/
1.2411 +void TestOpenAndReadAsyncLargeFile()
1.2412 + {
1.2413 + const TUint KBufSize = KKB;
1.2414 + TInt64 fileSize, size = 0;
1.2415 + TUint pos;
1.2416 + TUint i;
1.2417 + TBuf8<KBufSize> readBuf;
1.2418 + readBuf.SetLength(KBufSize);
1.2419 +
1.2420 +
1.2421 + test.Next(_L("Open & Read Asynchronously Large File From Diff Offset:"));
1.2422 +
1.2423 + TFileName fileName;
1.2424 + fileName.Append(gDriveToTest);
1.2425 + fileName.Append(KTestPath);
1.2426 + fileName.Append(_L("File4GBMinusOne.txt"));
1.2427 + TestRFile1.Open(fileName,EFileRead);
1.2428 +
1.2429 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0\n"));
1.2430 + // Async read from pos = 0
1.2431 + TRequestStatus status1 = KRequestPending;
1.2432 + pos = 0;
1.2433 + TestRFile1.Read(pos, readBuf, status1);
1.2434 +
1.2435 + test.Next(_L("Compare the data read to the expected data\n"));
1.2436 + for(i = pos; i< pos + (KBufSize / 4); i+=4)
1.2437 + {
1.2438 + TUint j = * ((TUint*) &readBuf[i - pos]);
1.2439 + test(i == j);
1.2440 + }
1.2441 +
1.2442 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB-1\n"));
1.2443 + // Async read from pos = 2GB-1
1.2444 + TRequestStatus status2 = KRequestPending;
1.2445 + pos = K2GB;
1.2446 + TestRFile1.Read(pos, readBuf, status2);
1.2447 +
1.2448 + test.Next(_L("Compare the data read to the expected data\n"));
1.2449 + for(i = pos; i< pos + (KBufSize / 4); i+=4)
1.2450 + {
1.2451 + TUint j = * ((TUint*) &readBuf[i - pos]);
1.2452 + test(i == j);
1.2453 + }
1.2454 +
1.2455 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1\n"));
1.2456 + TBuf8<0x1> readBuf1;
1.2457 + // Async read from pos = 4GB-1
1.2458 + TRequestStatus status3 = KRequestPending;
1.2459 + pos = K4GBMinusTwo;
1.2460 + TestRFile1.Read(pos, readBuf1, status3);
1.2461 + test(readBuf1.Length() == 1);
1.2462 +
1.2463 + fileSize = K4GBMinusOne;
1.2464 + TestRFile1.Size(size);
1.2465 + test(size == fileSize);
1.2466 +
1.2467 + //tests need to be repeated for calling the TUint variant of RFile64::Read()
1.2468 + pos = 0;
1.2469 + TestRFile1.ReadU(pos, readBuf, status1);
1.2470 +
1.2471 + test.Next(_L("Compare the data read to the expected data\n"));
1.2472 + for(i = pos; i< pos + (KBufSize / 4); i+=4)
1.2473 + {
1.2474 + TUint j = * ((TUint*) &readBuf[i - pos]);
1.2475 + test(i == j);
1.2476 + }
1.2477 +
1.2478 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB-1\n"));
1.2479 + // Async read from pos = 2GB-1
1.2480 + status2 = KRequestPending;
1.2481 + pos = K2GB;
1.2482 + TestRFile1.ReadU(pos, readBuf, status2);
1.2483 +
1.2484 + test.Next(_L("Compare the data read to the expected data\n"));
1.2485 + for(i = pos; i< pos + (KBufSize / 4); i+=4)
1.2486 + {
1.2487 + TUint j = * ((TUint*) &readBuf[i - pos]);
1.2488 + test(i == j);
1.2489 + }
1.2490 +
1.2491 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1\n"));
1.2492 + // Async read from pos = 4GB-1
1.2493 + status3 = KRequestPending;
1.2494 + pos = K4GBMinusTwo;
1.2495 + TestRFile1.ReadU(pos, readBuf1, status3);
1.2496 + test(readBuf1.Length() == 1);
1.2497 +
1.2498 + // tests need to be repeated for calling the current position variant of RFile64::Read()
1.2499 + TInt64 seekPos = 0;
1.2500 + TestRFile1.Seek(ESeekStart,seekPos);
1.2501 + TestRFile1.Read(readBuf, status1);
1.2502 +
1.2503 + test.Next(_L("Compare the data read to the expected data\n"));
1.2504 + for(i = (TUint)seekPos; i< seekPos + (KBufSize / 4); i+=4)
1.2505 + {
1.2506 + TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
1.2507 + test(i == j);
1.2508 + }
1.2509 +
1.2510 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB-1\n"));
1.2511 + // Async read from pos = 2GB-1
1.2512 + status2 = KRequestPending;
1.2513 + seekPos = K2GB;
1.2514 + TestRFile1.Seek(ESeekStart,seekPos);
1.2515 + TestRFile1.Read(readBuf, status2);
1.2516 +
1.2517 + test.Next(_L("Compare the data read to the expected data\n"));
1.2518 + for(i = (TUint)seekPos; i< seekPos + (KBufSize / 4); i+=4)
1.2519 + {
1.2520 + TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
1.2521 + test(i == j);
1.2522 + }
1.2523 +
1.2524 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1\n"));
1.2525 + // Async read from pos = 4GB-1
1.2526 + status3 = KRequestPending;
1.2527 + seekPos = K4GBMinusTwo;
1.2528 + TestRFile1.Seek(ESeekStart,seekPos);
1.2529 + TestRFile1.Read(readBuf1, status3);
1.2530 + test(readBuf1.Length() == 1);
1.2531 +
1.2532 +
1.2533 + // Async read from pos = 4GB
1.2534 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.2535 + {
1.2536 + TRequestStatus status5 = KRequestPending;
1.2537 + TInt64 pos64;
1.2538 + pos64 = K4GB;
1.2539 + TestRFile1.Read(pos64, readBuf, status5);
1.2540 + test(readBuf.Length() == 0);
1.2541 + }
1.2542 + // Close the file
1.2543 + TestRFile1.Close();
1.2544 + }
1.2545 +
1.2546 +/**
1.2547 +@SYMTestCaseID PBASE-T_FILE64BIT-0771
1.2548 +@SYMTestPriority High
1.2549 +@SYMTestRequirement REQ9526
1.2550 +@SYMTestType CIT
1.2551 +@SYMTestCaseDesc Tests for reading a big file synchronously with specified position and length
1.2552 +@SYMTestActions
1.2553 +1) Big file is read synchronously in a thread, with aPos = 0 and length = 256bytes
1.2554 +2) Big file is read synchronously in a thread, with aPos = 2GB-1 and length = 2KB
1.2555 +3) Big file is read synchronously in a thread, with aPos = 4GB -1 and length = 10 bytes
1.2556 +4) Check for FAT32 file system. Read from a big file, synchronously in a thread with aPos = 4GB and length = 1KB
1.2557 +5) Big file is read synchronously in a thread, with aPos = 0 and length = -1
1.2558 +6) Big file is read synchronously in a thread, with aPos = 0 and length = 0 bytes
1.2559 +@SYMTestExpectedResults
1.2560 +1) KErrNone, file is read successfully
1.2561 +2) KErrNone, file is read successfully
1.2562 +3) KErrNone, file is read successfully
1.2563 +4) KErrNone, with zero length descriptor. If NGFS is supported we should get the valid data
1.2564 +5) KErrArgument
1.2565 +6) KErrNone
1.2566 +@SYMTestStatus Implemented
1.2567 +*/
1.2568 +
1.2569 +void TestOpenAndReadSyncLargeFileWithLen()
1.2570 + {
1.2571 + TInt64 pos;
1.2572 + TUint i;
1.2573 + TBuf8<KMAXBUFSIZE> readBuf;
1.2574 + readBuf.SetLength(KMAXBUFSIZE);
1.2575 +
1.2576 + test.Next(_L("Open & Read Synchronously Large File From Different Offset and Length:"));
1.2577 +
1.2578 + TFileName fileName;
1.2579 + fileName.Append(gDriveToTest);
1.2580 + fileName.Append(KTestPath);
1.2581 + fileName.Append(_L("File4GBMinusOne.txt"));
1.2582 + TestRFile1.Open(fileName,EFileRead);
1.2583 +
1.2584 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = 256bytes:"));
1.2585 + // Sync read from pos = 0 and length = 256
1.2586 + pos = 0;
1.2587 + TestRFile1.Read(pos, readBuf, 256);
1.2588 + test(readBuf.Length() == 256);
1.2589 +
1.2590 + test.Next(_L("Compare the data read to the expected data\n"));
1.2591 + for(i = (TUint)pos; i< pos + (256 / 4); i+=4)
1.2592 + {
1.2593 + TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
1.2594 + test(i == j);
1.2595 + }
1.2596 +
1.2597 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB and length = K2KB:"));
1.2598 + // Sync read from pos = 2GB and length = K2KB
1.2599 + pos = K2GB;
1.2600 + TestRFile1.Read(pos, readBuf, K2KB);
1.2601 + test(readBuf.Length() == K2KB);
1.2602 +
1.2603 + test.Next(_L("Compare the data read to the expected data\n"));
1.2604 + for(i = (TUint)pos; i< pos + (K2KB / 4); i+=4)
1.2605 + {
1.2606 + TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
1.2607 + test(i == j);
1.2608 + }
1.2609 +
1.2610 +
1.2611 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB -1 and length = 10:"));
1.2612 + // Sync read from pos = 4GB-1 and length = 10
1.2613 + pos = K4GBMinusTwo;
1.2614 + TestRFile1.Read(pos, readBuf, 10);
1.2615 + test(readBuf.Length() == 1);
1.2616 +
1.2617 +
1.2618 + // Sync read from pos = 4GB and length = KKB
1.2619 +
1.2620 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.2621 + {
1.2622 + pos = K4GB;
1.2623 + TestRFile1.Read(pos, readBuf, KKB);
1.2624 + test(readBuf.Length() == 0);
1.2625 + }
1.2626 +
1.2627 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = -1"));
1.2628 + // Sync read from pos = 0 and length = -1
1.2629 + pos = 0;
1.2630 + TestRFile1.Read(pos, readBuf, -1);
1.2631 +
1.2632 + //tests need to repeated for TUint variant of RFile64::Read()
1.2633 +
1.2634 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = 256bytes:"));
1.2635 + // Sync read from pos = 0 and length = 256
1.2636 + pos = 0;
1.2637 + TestRFile1.ReadU((TUint)pos, readBuf, 256);
1.2638 + test(readBuf.Length() == 256);
1.2639 +
1.2640 + test.Next(_L("Compare the data read to the expected data\n"));
1.2641 + for(i = (TUint)pos; i< pos + (256 / 4); i+=4)
1.2642 + {
1.2643 + TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
1.2644 + test(i == j);
1.2645 + }
1.2646 +
1.2647 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB and length = K2KB:"));
1.2648 + // Sync read from pos = 2GB and length = K2KB
1.2649 + pos = K2GB;
1.2650 + TestRFile1.ReadU((TUint)pos, readBuf, K2KB);
1.2651 + test(readBuf.Length() == K2KB);
1.2652 +
1.2653 + test.Next(_L("Compare the data read to the expected data\n"));
1.2654 + for(i = (TUint)pos; i< pos + (K2KB / 4); i+=4)
1.2655 + {
1.2656 + TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
1.2657 + test(i == j);
1.2658 + }
1.2659 +
1.2660 +
1.2661 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB -1 and length = 10:"));
1.2662 + // Sync read from pos = 4GB-1 and length = 10
1.2663 + pos = K4GBMinusTwo;
1.2664 + TestRFile1.ReadU((TUint)pos, readBuf, 10);
1.2665 + test(readBuf.Length() == 1);
1.2666 +
1.2667 + //tests need to repeated for current position variant of RFile64::Read()
1.2668 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = 256bytes:"));
1.2669 + // Sync read from pos = 0 and length = 256
1.2670 + TInt64 seekPos = 0;
1.2671 + TestRFile1.Seek(ESeekStart,seekPos);
1.2672 + TestRFile1.Read(readBuf, 256);
1.2673 + test(readBuf.Length() == 256);
1.2674 +
1.2675 + test.Next(_L("Compare the data read to the expected data\n"));
1.2676 + for(i = (TUint)seekPos; i< seekPos + (256 / 4); i+=4)
1.2677 + {
1.2678 + TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
1.2679 + test(i == j);
1.2680 + }
1.2681 +
1.2682 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB and length = K2KB:"));
1.2683 + // Sync read from pos = 2GB and length = K2KB
1.2684 + seekPos = K2GB;
1.2685 + TestRFile1.Seek(ESeekStart,seekPos);
1.2686 + TestRFile1.Read(readBuf, K2KB);
1.2687 + test(readBuf.Length() == K2KB);
1.2688 +
1.2689 + test.Next(_L("Compare the data read to the expected data\n"));
1.2690 + for(i = (TUint)seekPos; i< seekPos + (K2KB / 4); i+=4)
1.2691 + {
1.2692 + TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
1.2693 + test(i == j);
1.2694 + }
1.2695 +
1.2696 +
1.2697 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB -1 and length = 10:"));
1.2698 + // Sync read from pos = 4GB-1 and length = 10
1.2699 + seekPos = K4GBMinusTwo;
1.2700 + TestRFile1.Seek(ESeekStart,seekPos);
1.2701 + TestRFile1.Read(readBuf, 10);
1.2702 + test(readBuf.Length() == 1);
1.2703 +
1.2704 +
1.2705 + // Sync read from pos = 4GB and length = KKB
1.2706 +
1.2707 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.2708 + {
1.2709 + pos = K4GB;
1.2710 + TestRFile1.Read(pos, readBuf, KKB);
1.2711 + test(readBuf.Length() == 0);
1.2712 + }
1.2713 +
1.2714 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = -1"));
1.2715 + // Sync read from pos = 0 and length = -1
1.2716 + pos = 0;
1.2717 + TestRFile1.Read(pos, readBuf, -1);
1.2718 +
1.2719 +
1.2720 +
1.2721 + test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = 0 bytes"));
1.2722 + // Sync read from pos = 0 and length = 0
1.2723 + pos = 0;
1.2724 + TestRFile1.Read(pos, readBuf, 0);
1.2725 + test(readBuf.Length() == 0);
1.2726 +
1.2727 + TestRFile1.Close();
1.2728 + }
1.2729 +/**
1.2730 +@SYMTestCaseID PBASE-T_FILE64BIT-0772
1.2731 +@SYMTestPriority High
1.2732 +@SYMTestRequirement REQ9526
1.2733 +@SYMTestType CIT
1.2734 +@SYMTestCaseDesc Tests for reading a big file asynchronously with specified position and length
1.2735 +@SYMTestActions
1.2736 +1) Big file is read asynchronously in a thread, with aPos = 0 and length = 256 bytes
1.2737 +2) Big file is read asynchronously in a thread, with aPos = 2GB-1 and length = 1KB
1.2738 +3) Big file is read asynchronously in a thread, with aPos = 4GB-1 and length = 1KB
1.2739 +4) Big file is read asynchronously in a thread, with aPos = 4GB and length = 256 bytes
1.2740 +5) Big file is read asynchronously in a thread, with aPos = 0 and length = -1
1.2741 +6) Big file is read asynchronously in a thread, with aPos = 0 and length = 0 bytes
1.2742 +@SYMTestExpectedResults
1.2743 +1) KErrNone, file is read successfully
1.2744 +2) KErrNone, file is read successfully
1.2745 +3) KErrNone, file is read successfully
1.2746 +4) KErrNone, with zero length descriptor. If NGFS is supported KErrNone with valid data
1.2747 +5) KErrArgument
1.2748 +6) KErrNone
1.2749 +@SYMTestStatus Implemented
1.2750 +*/
1.2751 +void TestOpenAndReadAsyncLargeFileWithLen()
1.2752 + {
1.2753 + TInt64 pos;
1.2754 + TUint i ;
1.2755 + TBuf8<KMAXBUFSIZE> readBuf;
1.2756 + readBuf.SetLength(KMAXBUFSIZE);
1.2757 +
1.2758 + test.Next(_L("Open & Read Asynchronously Large File From Different Offset & Length:"));
1.2759 +
1.2760 + TFileName fileName;
1.2761 + fileName.Append(gDriveToTest);
1.2762 + fileName.Append(KTestPath);
1.2763 + fileName.Append(_L("File4GBMinusOne.txt"));
1.2764 + TestRFile1.Open(fileName,EFileRead);
1.2765 +
1.2766 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0 and length = 256 bytes\n"));
1.2767 + // Async read from pos = 0 and length = 256
1.2768 + TRequestStatus status1 = KRequestPending;
1.2769 + pos = 0;
1.2770 + TestRFile1.Read(pos, readBuf, 256, status1);
1.2771 + test(readBuf.Length() == 256);
1.2772 +
1.2773 + test.Next(_L("Compare the data read to the expected data\n"));
1.2774 + for(i = (TUint)pos; i< pos + (256 / 4); i+=4)
1.2775 + {
1.2776 + TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
1.2777 + test(i == j);
1.2778 + }
1.2779 +
1.2780 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB and length = KKB bytes\n"));
1.2781 + // Async read from pos = 2GB and length = KKb
1.2782 + TRequestStatus status2 = KRequestPending;
1.2783 + pos = K2GB;
1.2784 + TestRFile1.Read(pos, readBuf, KKB, status2);
1.2785 + test(readBuf.Length() == KKB);
1.2786 +
1.2787 + test.Next(_L("Compare the data read to the expected data\n"));
1.2788 + for(i = (TUint)pos; i< pos + (KKB / 4); i+=4)
1.2789 + {
1.2790 + TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
1.2791 + test(i == j);
1.2792 + }
1.2793 +
1.2794 +
1.2795 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1 and length = KKb bytes\n"));
1.2796 + // Async read from pos = 4GB-1 and length = KKb
1.2797 + TRequestStatus status3 = KRequestPending;
1.2798 + pos = K4GBMinusTwo;
1.2799 + TestRFile1.Read(pos, readBuf, KKB, status3);
1.2800 + test(readBuf.Length() == 1);
1.2801 +
1.2802 + // tests need to be repeated for TUint variant of RFile64::Read()
1.2803 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0 and length = 256 bytes\n"));
1.2804 + // Async read from pos = 0 and length = 256
1.2805 + status1 = KRequestPending;
1.2806 + pos = 0;
1.2807 + TestRFile1.ReadU((TUint)pos, readBuf, 256, status1);
1.2808 + test(readBuf.Length() == 256);
1.2809 +
1.2810 + test.Next(_L("Compare the data read to the expected data\n"));
1.2811 + for(i = (TUint)pos; i< pos + (256 / 4); i+=4)
1.2812 + {
1.2813 + TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
1.2814 + test(i == j);
1.2815 + }
1.2816 +
1.2817 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB and length = KKB bytes\n"));
1.2818 + // Async read from pos = 2GB and length = KKb
1.2819 + status2 = KRequestPending;
1.2820 + pos = K2GB;
1.2821 + TestRFile1.ReadU((TUint)pos, readBuf, KKB, status2);
1.2822 + test(readBuf.Length() == KKB);
1.2823 +
1.2824 + test.Next(_L("Compare the data read to the expected data\n"));
1.2825 + for(i = (TUint)pos; i< pos + (KKB / 4); i+=4)
1.2826 + {
1.2827 + TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
1.2828 + test(i == j);
1.2829 + }
1.2830 +
1.2831 +
1.2832 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1 and length = KKb bytes\n"));
1.2833 + // Async read from pos = 4GB-1 and length = KKb
1.2834 + status3 = KRequestPending;
1.2835 + pos = K4GBMinusTwo;
1.2836 + TestRFile1.ReadU((TUint)pos, readBuf, KKB, status3);
1.2837 + test(readBuf.Length() == 1);
1.2838 +
1.2839 + // tests need to be repeated for current position variant of RFile64::Read()
1.2840 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0 and length = 256 bytes\n"));
1.2841 + // Async read from pos = 0 and length = 256
1.2842 + status1 = KRequestPending;
1.2843 + TInt64 seekPos = 0;
1.2844 + TestRFile1.Seek(ESeekStart,seekPos);
1.2845 + TestRFile1.Read(readBuf, 256, status1);
1.2846 + test(readBuf.Length() == 256);
1.2847 +
1.2848 + test.Next(_L("Compare the data read to the expected data\n"));
1.2849 + for(i = (TUint)seekPos; i< seekPos + (256 / 4); i+=4)
1.2850 + {
1.2851 + TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
1.2852 + test(i == j);
1.2853 + }
1.2854 +
1.2855 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB and length = KKB bytes\n"));
1.2856 + // Async read from pos = 2GB and length = KKb
1.2857 + status2 = KRequestPending;
1.2858 + seekPos = K2GB;
1.2859 + TestRFile1.Seek(ESeekStart,seekPos);
1.2860 + TestRFile1.Read(readBuf, KKB, status2);
1.2861 + test(readBuf.Length() == KKB);
1.2862 +
1.2863 + test.Next(_L("Compare the data read to the expected data\n"));
1.2864 + for(i = (TUint)seekPos; i< seekPos + (KKB / 4); i+=4)
1.2865 + {
1.2866 + TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
1.2867 + test(i == j);
1.2868 + }
1.2869 +
1.2870 +
1.2871 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1 and length = KKb bytes\n"));
1.2872 + // Async read from pos = 4GB-1 and length = KKb
1.2873 + status3 = KRequestPending;
1.2874 + seekPos = K4GBMinusTwo;
1.2875 + TestRFile1.Seek(ESeekStart,seekPos);
1.2876 + TestRFile1.Read(readBuf, KKB, status3);
1.2877 + test(readBuf.Length() == 1);
1.2878 +
1.2879 +
1.2880 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB and length = 256 bytes\n"));
1.2881 + // Async read from pos = 4GB and length = 256
1.2882 +
1.2883 +
1.2884 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.2885 + {
1.2886 + TRequestStatus status5 = KRequestPending;
1.2887 + pos = K4GB;
1.2888 + TestRFile1.Read(pos, readBuf, 256, status5);
1.2889 + test(readBuf.Length() == 0);
1.2890 + }
1.2891 +
1.2892 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0 and length = -1 bytes\n"));
1.2893 + // Async read from pos = 0 and length = -1
1.2894 + TRequestStatus status6 = KRequestPending;
1.2895 + pos = 0;
1.2896 + TestRFile1.Read(pos, readBuf, -1, status6);
1.2897 +
1.2898 + test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0 and length = 0 bytes\n"));
1.2899 + // Async read from pos = 0 and length = 0
1.2900 + TRequestStatus status7 = KRequestPending;
1.2901 + pos = 0;
1.2902 + TestRFile1.Read(pos, readBuf, 0, status7);
1.2903 +
1.2904 + TestRFile1.Close();
1.2905 +
1.2906 + TInt r = TheFs.Delete(fileName);
1.2907 + test(r == KErrNone);
1.2908 + }
1.2909 +
1.2910 +/**
1.2911 +@SYMTestCaseID PBASE-T_FILE64BIT-0773
1.2912 +@SYMTestPriority High
1.2913 +@SYMTestRequirement REQ9526
1.2914 +@SYMTestType CIT
1.2915 +@SYMTestCaseDesc Tests for writing to a big file synchronously with specified position
1.2916 +@SYMTestActions
1.2917 +1) Write to a big file synchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1
1.2918 +2) Write to a big file synchronously in a thread, with aPos = 2GB-1 and data = 1KB
1.2919 +3) Write to a big file synchronously in a thread, with aPos = 4GB-1 and data = 1 byte
1.2920 +4) Write a big file synchronously in a thread, with aPos = 4GB and data = 256 bytes
1.2921 +@SYMTestExpectedResults
1.2922 +1) KErrNone, write is successful
1.2923 +2) KErrNone, write is successful
1.2924 +3) KErrNone, write is successful
1.2925 +4) KErrNotSupported, if NGFS is supported KErrNone and write is successful
1.2926 +@SYMTestStatus Implemented
1.2927 +*/
1.2928 +
1.2929 +void TestOpenAndWriteSyncLargeFile()
1.2930 + {
1.2931 + test.Next(_L("Open & Write Synchronously Large File From Different Offset:"));
1.2932 +
1.2933 + TInt count;
1.2934 + TFileName fileName;
1.2935 + fileName.Append(gDriveToTest);
1.2936 + fileName.Append(KTestPath);
1.2937 + fileName.Append(_L("File4GBMinusOne.txt"));
1.2938 + TestRFile1.Replace(fileName, EFileWrite);
1.2939 + TestRFile1.SetSize(K4GBMinusOne);
1.2940 +
1.2941 + TInt64 size;
1.2942 + TestRFile1.Size(size);
1.2943 + test(size == K4GBMinusOne);
1.2944 +
1.2945 +
1.2946 + test.Next(_L("Write to a big file synchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1\n"));
1.2947 + TBuf8<0x100> writeBuf100;
1.2948 + TBuf8<0x100> readBuf100;
1.2949 + writeBuf100.Zero();
1.2950 + writeBuf100.FillZ();
1.2951 + for (count = 0; count < 0x100; count++)
1.2952 + {
1.2953 + writeBuf100.Append((TChar)count);
1.2954 + }
1.2955 + TestRFile1.WriteP(0,writeBuf100);
1.2956 + TestRFile1.Size(size);
1.2957 + TestRFile1.ReadP(0,readBuf100);
1.2958 + test(writeBuf100 == readBuf100);
1.2959 +
1.2960 + test.Next(_L("Write to a big file synchronously in a thread, with aPos = 2GB-1 and data = 1KB\n"));
1.2961 + TBuf8<0x400> writeBuf400;
1.2962 + TBuf8<0x400> readBuf400;
1.2963 + writeBuf400.Zero();
1.2964 + writeBuf400.FillZ();
1.2965 + for (count = 0; count < 0x400; count++)
1.2966 + {
1.2967 + writeBuf400.Append(count+20);
1.2968 + }
1.2969 + TestRFile1.WriteP(K2GBMinusOne,writeBuf400);
1.2970 + TestRFile1.ReadP(K2GBMinusOne,readBuf400); // just for validation
1.2971 + test(writeBuf400 == readBuf400);
1.2972 +
1.2973 + test.Next(_L("Write to a big file synchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
1.2974 + TBuf8<1> testReadBuf;
1.2975 + TestRFile1.WriteP(K4GBMinusTwo,_L8("1"));
1.2976 + TestRFile1.ReadP(K4GBMinusTwo, testReadBuf);
1.2977 + test(testReadBuf.Length() == 1);
1.2978 +
1.2979 + //tests need to be repeated for TUint variant of RFile64::Write()
1.2980 + readBuf100.Zero(); //to ensure that the previous data is removed
1.2981 + test.Next(_L("Write to a big file synchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1\n"));
1.2982 + TUint pos = 0;
1.2983 + TestRFile1.WriteU(pos,writeBuf100);
1.2984 + TestRFile1.ReadU(pos,readBuf100);
1.2985 + test(writeBuf100 == readBuf100);
1.2986 +
1.2987 + test.Next(_L("Write to a big file synchronously in a thread, with aPos = 2GB-1 and data = 1KB\n"));
1.2988 + readBuf400.Zero();//to ensure that the previous data is removed
1.2989 + pos = K2GBMinusOne;
1.2990 + TestRFile1.WriteU(pos,writeBuf400);
1.2991 + TestRFile1.ReadU(pos,readBuf400); // just for validation
1.2992 + test(writeBuf400 == readBuf400);
1.2993 +
1.2994 +
1.2995 + test.Next(_L("Write to a big file synchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
1.2996 + pos = K4GBMinusTwo;
1.2997 + testReadBuf.Zero();//to ensure that the previous data is removed
1.2998 + TestRFile1.WriteU(pos,_L8("1"));
1.2999 + TestRFile1.ReadU(pos, testReadBuf);
1.3000 + test(testReadBuf.Length() == 1);
1.3001 +
1.3002 + //
1.3003 + //tests need to be repeated for current position variant of RFile64::Write()
1.3004 + //testing with only current position as 4GB-2(boundary condition)
1.3005 + //
1.3006 + test.Next(_L("Write to a big file synchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
1.3007 + TInt64 seekPos = K4GBMinusTwo;
1.3008 + testReadBuf.Zero();//to ensure that the previous data is removed
1.3009 + TestRFile1.Seek(ESeekStart,seekPos);
1.3010 + TestRFile1.Write(_L8("1"));
1.3011 + TestRFile1.Seek(ESeekStart,seekPos);
1.3012 + TestRFile1.Read(testReadBuf);
1.3013 + test(testReadBuf.Length() == 1);
1.3014 +
1.3015 +
1.3016 +
1.3017 + test.Next(_L("Write a big file synchronously in a thread, with aPos = 4GB and data = 256 bytes\n"));
1.3018 +
1.3019 +
1.3020 + TBuf8<0x100> writeBuffer256;
1.3021 + TBuf8<0x100> readBuffer256;
1.3022 + writeBuffer256.Zero();
1.3023 + writeBuffer256.FillZ();
1.3024 + readBuffer256.Zero();
1.3025 + readBuffer256.FillZ();
1.3026 +
1.3027 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.3028 + {
1.3029 + for (TInt count = 0; count < 256; count++)
1.3030 + {
1.3031 + writeBuffer256.Append((TChar)count);
1.3032 + }
1.3033 + TestRFile1.WriteP(K4GB,writeBuffer256);
1.3034 + User::After(100000);
1.3035 + // Validation for boundary condition 4GB
1.3036 + TestRFile1.ReadP(K4GB,readBuffer256);
1.3037 + TInt rr = readBuffer256.Length();
1.3038 + test(rr == KErrNone);
1.3039 + test(readBuffer256.Length() == 0);
1.3040 + }
1.3041 + TestRFile1.Close();
1.3042 +
1.3043 + TInt r = TheFs.Delete(fileName);
1.3044 + test(r == KErrNone);
1.3045 + }
1.3046 +
1.3047 +/**
1.3048 +@SYMTestCaseID PBASE-T_FILE64BIT-0774
1.3049 +@SYMTestPriority High
1.3050 +@SYMTestRequirement REQ9526
1.3051 +@SYMTestType CIT
1.3052 +@SYMTestCaseDesc Tests for writing to a big file asynchronously with specified position
1.3053 +@SYMTestActions
1.3054 +1) Write to a big file asynchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1
1.3055 +2) Write to a big file asynchronously in a thread, with aPos = 2GB-1 and data = 1KB
1.3056 +3) Write to a big file asynchronously in a thread, with aPos = 4GB-1 and data = 1 byte
1.3057 +4) Check for FAT32 file system. Write to a big file asynchronously in a thread with aPos = 4GB and data length = 256 bytes
1.3058 +@SYMTestExpectedResults
1.3059 +1) KErrNone, write is successful
1.3060 +2) KErrNone, write is successful
1.3061 +3) KErrNone, write is successful
1.3062 +4) KErrNotSupported, if NGFS is available KErrNone and write is successful.
1.3063 +@SYMTestStatus Implemented
1.3064 +*/
1.3065 +
1.3066 +void TestOpenAndWriteAsyncLargeFile()
1.3067 + {
1.3068 + test.Next(_L("Open & Write Asynchronously Large File From Different Offset:"));
1.3069 +
1.3070 + TInt count;
1.3071 + TFileName fileName;
1.3072 + fileName.Append(gDriveToTest);
1.3073 + fileName.Append(KTestPath);
1.3074 + fileName.Append(_L("File4GBMinusOne.txt"));
1.3075 + TestRFile1.Replace(fileName, EFileWrite);
1.3076 +
1.3077 + TestRFile1.SetSize(K4GBMinusOne);
1.3078 + TInt64 size;
1.3079 + TestRFile1.Size(size);
1.3080 +
1.3081 + test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1\n"));
1.3082 + TBuf8<0x100> writeBuf100;
1.3083 + TBuf8<0x100> readBuf100;
1.3084 + writeBuf100.Zero();
1.3085 + writeBuf100.FillZ();
1.3086 + for (count = 0; count < 0x100; count++)
1.3087 + {
1.3088 + writeBuf100.Append((TChar)count);
1.3089 + }
1.3090 + TRequestStatus status1 = KRequestPending;
1.3091 + TestRFile1.Write(0,writeBuf100,status1);
1.3092 + TestRFile1.ReadP(0,readBuf100);
1.3093 + test (writeBuf100 == readBuf100);
1.3094 +
1.3095 + test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 2GB-1 and data = 1KB\n"));
1.3096 + TBuf8<0x400> writeBuf400;
1.3097 + TBuf8<0x400> readBuf400;
1.3098 + writeBuf400.Zero();
1.3099 + writeBuf400.FillZ();
1.3100 + for (count = 0; count < 0x400; count++)
1.3101 + {
1.3102 + writeBuf400.Append(count+20);
1.3103 + }
1.3104 + TRequestStatus status2 = KRequestPending;
1.3105 + TestRFile1.Write(K2GBMinusOne,writeBuf400,status2);
1.3106 + TestRFile1.ReadP(K2GBMinusOne,readBuf400); // just for validation
1.3107 + test(writeBuf400 == readBuf400);
1.3108 +
1.3109 + test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
1.3110 + TBuf8<0x1> writeBuf;
1.3111 + TBuf8<0x1> readBuf;
1.3112 + writeBuf.Zero();
1.3113 + writeBuf.FillZ();
1.3114 + for (count = 0; count < 0x1; count++)
1.3115 + {
1.3116 + writeBuf.Append((TChar)(count+17));
1.3117 + }
1.3118 + TRequestStatus status3 = KRequestPending;
1.3119 + TestRFile1.Write(K4GBMinusTwo,writeBuf,status3);
1.3120 + TestRFile1.ReadP(K4GBMinusTwo,readBuf);
1.3121 + test(readBuf.Length() == 1);
1.3122 +
1.3123 + //tests need to be repeated for TUint variant of RFile64::Write()
1.3124 + test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1\n"));
1.3125 + readBuf100.Zero();//to ensure that the previous data is removed
1.3126 + status1 = KRequestPending;
1.3127 + TUint pos = 0;
1.3128 + TestRFile1.WriteU(pos,writeBuf100,status1);
1.3129 + TestRFile1.ReadU(pos,readBuf100);
1.3130 + test (writeBuf100 == readBuf100);
1.3131 +
1.3132 + test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 2GB-1 and data = 1KB\n"));
1.3133 + readBuf400.Zero();//to ensure that the previous data is removed
1.3134 + status2 = KRequestPending;
1.3135 + pos = K2GBMinusOne;
1.3136 + TestRFile1.WriteU(pos,writeBuf400,status2);
1.3137 + TestRFile1.ReadU(pos,readBuf400); // just for validation
1.3138 + test(writeBuf400 == readBuf400);
1.3139 +
1.3140 + test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
1.3141 + readBuf.Zero();//to ensure that the previous data is removed
1.3142 + status3 = KRequestPending;
1.3143 + pos = K4GBMinusTwo;
1.3144 + TestRFile1.WriteU(pos,writeBuf,status3);
1.3145 + TestRFile1.ReadU(pos,readBuf);
1.3146 + test(readBuf.Length() == 1);
1.3147 +
1.3148 + //
1.3149 + //tests need to be repeated for current position variant of RFile64::Write()
1.3150 + //testing with only current position as 4GB-2(boundary condition)
1.3151 + //
1.3152 + test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
1.3153 + readBuf.Zero();//to ensure that the previous data is removed
1.3154 + status3 = KRequestPending;
1.3155 + TInt64 seekPos = K4GBMinusTwo;
1.3156 + TestRFile1.Seek(ESeekStart,seekPos);
1.3157 + TestRFile1.Write(writeBuf,status3);
1.3158 + TestRFile1.Seek(ESeekStart,seekPos);
1.3159 + TestRFile1.Read(readBuf);
1.3160 + test(readBuf.Length() == 1);
1.3161 +
1.3162 +
1.3163 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.3164 + {
1.3165 + TBuf8<0x100> writeBuf256;
1.3166 + TBuf8<0x100> readBuf256;
1.3167 + writeBuf256.Zero();
1.3168 + writeBuf256.FillZ();
1.3169 + for (TInt count = 0; count < 0x100; count++)
1.3170 + {
1.3171 + writeBuf256.Append((TChar)(count+7));
1.3172 + }
1.3173 + TRequestStatus status4 = KRequestPending;
1.3174 + TestRFile1.Write(K4GB,writeBuf256,status4);
1.3175 + User::After(100000);
1.3176 + // Validation for boundary condition 4GB
1.3177 + TestRFile1.ReadP(K4GB,readBuf256);
1.3178 + test(readBuf256.Length() == 0);
1.3179 + }
1.3180 + TestRFile1.Close();
1.3181 +
1.3182 + TInt r = TheFs.Delete(fileName);
1.3183 + test(r == KErrNone);
1.3184 + }
1.3185 +
1.3186 +/**
1.3187 +@SYMTestCaseID PBASE-T_FILE64BIT-0775
1.3188 +@SYMTestPriority High
1.3189 +@SYMTestRequirement REQ9526
1.3190 +@SYMTestType CIT
1.3191 +@SYMTestCaseDesc Tests for writing to a big file synchronously with specified position and length
1.3192 +@SYMTestActions
1.3193 +1) Write to a big file synchronously in a thread with aPos = 0, data = 256 bytes and length = 255 bytes
1.3194 +2) Write to a big file synchronously in a thread with aPos = 2GB -1, data = 1KB and length = 200 bytes
1.3195 +3) Write to a big file synchronously in a thread with aPos = 4GB-10 and data = 1KB and length = 10 bytes
1.3196 +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
1.3197 +5) Write to a big file synchronously in a thread with aPos = 0 , data = 256 bytes and length =0 bytes
1.3198 +6) Write to a big file synchronously in a thread with aPos = 0 , data = 256 bytes and length = -1
1.3199 +@SYMTestExpectedResults
1.3200 +1) KErrNone, write is successful
1.3201 +2) KErrNone, write is successful
1.3202 +3) KErrNone, write is successful
1.3203 +4) KErrNotSupported. If NGFS is supported and write is successful
1.3204 +5) KErrNone
1.3205 +6) KErrArgument
1.3206 +@SYMTestStatus Implemented
1.3207 +*/
1.3208 +
1.3209 +void TestOpenAndWriteSyncLargeFileWithLen()
1.3210 + {
1.3211 + test.Next(_L("Open & Write Synchronously Large File From Different Offset and length:"));
1.3212 +
1.3213 + TInt count;
1.3214 + TFileName fileName;
1.3215 + fileName.Append(gDriveToTest);
1.3216 + fileName.Append(KTestPath);
1.3217 + fileName.Append(_L("File4GBMinusOne.txt"));
1.3218 + TestRFile1.Replace(fileName, EFileWrite);
1.3219 +
1.3220 + TestRFile1.SetSize(K4GBMinusOne);
1.3221 +
1.3222 + test.Next(_L("Write to a big file synchronously in a thread with aPos = 0, data = 256 bytes and length = 255 bytes\n"));
1.3223 + TBuf8<0x100> writeBuf100;
1.3224 + TBuf8<0x100> readBuf100;
1.3225 + TBuf8<0x100> validateBuf100;
1.3226 + writeBuf100.Zero();
1.3227 + writeBuf100.FillZ();
1.3228 + validateBuf100.Zero();
1.3229 + for (count = 0; count < 0x100; count++)
1.3230 + {
1.3231 + writeBuf100.Append((TChar)count);
1.3232 + if(count < 0xFF)
1.3233 + validateBuf100.Append((TChar)count);
1.3234 + }
1.3235 + TestRFile1.Write(0,writeBuf100,255);
1.3236 + TestRFile1.Read(0,readBuf100,255);
1.3237 + test(validateBuf100 == readBuf100);
1.3238 +
1.3239 + test.Next(_L("Write to a big file synchronously in a thread with aPos = 2GB -1, data = 1KB and length = 200 bytes\n"));
1.3240 + TBuf8<0x400> writeBuf400;
1.3241 + TBuf8<0x400> readBuf400;
1.3242 + TBuf8<0x400> validateBuf400;
1.3243 + writeBuf400.Zero();
1.3244 + writeBuf400.FillZ();
1.3245 + for (count = 0; count < 0x400; count++)
1.3246 + {
1.3247 + writeBuf400.Append(count+20);
1.3248 + if(count<200)
1.3249 + validateBuf400.Append(count+20);
1.3250 + }
1.3251 + TestRFile1.Write(K2GBMinusOne,writeBuf400,200);
1.3252 + TestRFile1.Read(K2GBMinusOne,readBuf400,200);
1.3253 + test(validateBuf400 == readBuf400);
1.3254 +
1.3255 + test.Next(_L("Write to a big file synchronously in a thread with aPos = 4GB-10 and data = 1KB and length = 10 bytes\n"));
1.3256 + TBuf8<0x400> writeBuf1024;
1.3257 + TBuf8<0x400> readBuf1024;
1.3258 + TBuf8<0x400> validateBuf1024;
1.3259 + writeBuf1024.Zero();
1.3260 + writeBuf1024.FillZ();
1.3261 + for (count = 0; count < 0x400; count++)
1.3262 + {
1.3263 + writeBuf1024.Append(count+3);
1.3264 + if(count < 9)
1.3265 + validateBuf1024.Append(count+3);
1.3266 + }
1.3267 + TestRFile1.Write(K4GBMinusTen,writeBuf1024,9);
1.3268 + TestRFile1.Read(K4GBMinusTen,readBuf1024,9);
1.3269 + test(validateBuf1024 == readBuf1024);
1.3270 +
1.3271 + //tests need to be repeated for TUint variant of RFile64::Write()
1.3272 + test.Next(_L("Write to a big file synchronously in a thread with aPos = 0, data = 256 bytes and length = 255 bytes\n"));
1.3273 + readBuf100.Zero();//to ensure that the previous data is removed
1.3274 + TUint pos = 0;
1.3275 + TestRFile1.WriteU(pos,writeBuf100,255);
1.3276 + TestRFile1.ReadU(pos,readBuf100,255);
1.3277 + test(validateBuf100 == readBuf100);
1.3278 +
1.3279 + test.Next(_L("Write to a big file synchronously in a thread with aPos = 2GB -1, data = 1KB and length = 200 bytes\n"));
1.3280 + readBuf400.Zero();//to ensure that the previous data is removed
1.3281 + pos = K2GBMinusOne;
1.3282 + TestRFile1.WriteU(pos,writeBuf400,200);
1.3283 + TestRFile1.ReadU(pos,readBuf400,200);
1.3284 + test(validateBuf400 == readBuf400);
1.3285 +
1.3286 + test.Next(_L("Write to a big file synchronously in a thread with aPos = 4GB-10 and data = 1KB and length = 10 bytes\n"));
1.3287 + readBuf1024.Zero();//to ensure that the previous data is removed
1.3288 + pos = K4GBMinusTen;
1.3289 + TestRFile1.WriteU(pos,writeBuf1024,9);
1.3290 + TestRFile1.ReadU(pos,readBuf1024,9);
1.3291 + test(validateBuf1024 == readBuf1024);
1.3292 +
1.3293 + //
1.3294 + //tests need to be repeated for current position variant of RFile64::Write()
1.3295 + //testing with only current position as 4GB-2(boundary condition)
1.3296 + //
1.3297 + test.Next(_L("Write to a big file synchronously in a thread with aPos = 4GB-10 and data = 1KB and length = 10 bytes\n"));
1.3298 + readBuf1024.Zero();//to ensure that the previous data is removed
1.3299 + TInt64 seekPos = K4GBMinusTen;
1.3300 + TestRFile1.Seek(ESeekStart,seekPos);
1.3301 + TestRFile1.Write(writeBuf1024,9);
1.3302 + TestRFile1.Seek(ESeekStart,seekPos);
1.3303 + TestRFile1.Read(readBuf1024,9);
1.3304 + test(validateBuf1024 == readBuf1024);
1.3305 +
1.3306 +
1.3307 +
1.3308 + 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"));
1.3309 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.3310 + {
1.3311 + TBuf8<0x100> writeBuf256;
1.3312 + TBuf8<0x100> readBuf256;
1.3313 + writeBuf256.Zero();
1.3314 + writeBuf256.FillZ();
1.3315 + for (TInt count = 0; count < 0x100; count++)
1.3316 + {
1.3317 + writeBuf256.Append(count+6);
1.3318 + }
1.3319 + TestRFile1.Write(K4GB,writeBuf256,10);
1.3320 + TestRFile1.Read(K4GB,readBuf256,10);
1.3321 + test(readBuf256.Length() == 0);
1.3322 + }
1.3323 + test.Next(_L(" Write to a big file synchronously in a thread with aPos = 0 , data = 256 bytes and length =0 bytes\n"));
1.3324 + TBuf8<0x100> wrBuf256;
1.3325 + TBuf8<0x100> reBuf256;
1.3326 + wrBuf256.Zero();
1.3327 + wrBuf256.FillZ();
1.3328 + for (count = 0; count < 0x100; count++)
1.3329 + {
1.3330 + wrBuf256.Append(count+6);
1.3331 + }
1.3332 + TestRFile1.Write(0,wrBuf256,0);
1.3333 + TestRFile1.Read(0,reBuf256,0);
1.3334 + test(reBuf256.Length() == 0);
1.3335 +
1.3336 + test.Next(_L("Write to a big file synchronously in a thread with aPos = 0 , data = 256 bytes and length = -1\n"));
1.3337 + TBuf8<0x100> wBuf256;
1.3338 + wBuf256.Zero();
1.3339 + wBuf256.FillZ();
1.3340 + for (count = 0; count < 0x100; count++)
1.3341 + {
1.3342 + wBuf256.Append(count+3);
1.3343 + }
1.3344 + TestRFile1.Write(0,wrBuf256,-1);
1.3345 + TestRFile1.Close();
1.3346 +
1.3347 + TInt r = TheFs.Delete(fileName);
1.3348 + test(r == KErrNone);
1.3349 + }
1.3350 +
1.3351 +/**
1.3352 +@SYMTestCaseID PBASE-T_FILE64BIT-0776
1.3353 +@SYMTestPriority High
1.3354 +@SYMTestRequirement REQ9526
1.3355 +@SYMTestType CIT
1.3356 +@SYMTestCaseDesc Tests for writing to a big file asynchronously with specified position and length
1.3357 +@SYMTestActions
1.3358 +1) Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = 255 bytes
1.3359 +2) Write to a big file asynchronously in a thread, with aPos = 2GB-1, data = 1KB and length = 200 bytes
1.3360 +3) Write to a big file asynchronously in a thread, with aPos = 4GB-10, data = 10 bytes and length = 10 bytes
1.3361 +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
1.3362 +5) Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = 0 bytes
1.3363 +6) Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = -1bytes
1.3364 +@SYMTestExpectedResults
1.3365 +1) KErrNone, write is successful
1.3366 +2) KErrNone, write is successful
1.3367 +3) KErrNone, write is successful
1.3368 +4) KErrNotSupported. If NGFS is supported KErrNone and write is successful
1.3369 +5) KErrNone
1.3370 +6) KErrArgument
1.3371 +@SYMTestStatus Implemented
1.3372 +*/
1.3373 +
1.3374 +void TestOpenAndWriteAsyncLargeFileWithLen()
1.3375 + {
1.3376 + test.Next(_L("Open & Write Asynchronously Large File From Different Offset and length:"));
1.3377 +
1.3378 + TInt count;
1.3379 + TFileName fileName;
1.3380 + fileName.Append(gDriveToTest);
1.3381 + fileName.Append(KTestPath);
1.3382 + fileName.Append(_L("File4GBMinusOne.txt"));
1.3383 + TestRFile1.Replace(fileName, EFileWrite);
1.3384 +
1.3385 + TestRFile1.SetSize(K4GBMinusOne);
1.3386 +
1.3387 + test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = 255 bytes \n"));
1.3388 + TBuf8<0x100> writeBuf100;
1.3389 + TBuf8<0x100> readBuf100;
1.3390 + TBuf8<0x100> validateBuf100;
1.3391 + writeBuf100.Zero();
1.3392 + writeBuf100.FillZ();
1.3393 + validateBuf100.Zero();
1.3394 + for (count = 0; count < 0x100; count++)
1.3395 + {
1.3396 + writeBuf100.Append((TChar)count);
1.3397 + if(count < 0xFF)
1.3398 + validateBuf100.Append((TChar)count);
1.3399 + }
1.3400 + TRequestStatus status1 = KRequestPending;
1.3401 + TestRFile1.Write(0,writeBuf100,255,status1);
1.3402 + TestRFile1.Read(0,readBuf100,255);
1.3403 + test(validateBuf100 == readBuf100);
1.3404 +
1.3405 + test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 2GB-1, data = 1KB and length = 200 bytes\n"));
1.3406 + TBuf8<0x400> writeBuf400;
1.3407 + TBuf8<0x400> readBuf400;
1.3408 + TBuf8<0x400> validateBuf400;
1.3409 + writeBuf400.Zero();
1.3410 + writeBuf400.FillZ();
1.3411 + validateBuf400.Zero();
1.3412 + for (count = 0; count < 0x400; count++)
1.3413 + {
1.3414 + writeBuf400.Append(count+20);
1.3415 + if(count < 200)
1.3416 + validateBuf400.Append(count+20);
1.3417 + }
1.3418 + TRequestStatus status2 = KRequestPending;
1.3419 + TestRFile1.Write(K2GBMinusOne,writeBuf400,200,status2);
1.3420 + TestRFile1.Read(K2GBMinusOne,readBuf400,200);
1.3421 + test(validateBuf400 == readBuf400);
1.3422 +
1.3423 + test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-10, data = 10 bytes and length = 10 bytes\n"));
1.3424 + TBuf8<0x0A> writeBuf0A;
1.3425 + TBuf8<0x0A> readBuf0A;
1.3426 + TBuf8<0x0A> validateBuf0A;
1.3427 + writeBuf0A.Zero();
1.3428 + readBuf0A.FillZ();
1.3429 + validateBuf0A.Zero();
1.3430 + for (count = 0; count < 0x0A; count++)
1.3431 + {
1.3432 + writeBuf0A.Append(count+3);
1.3433 + if(count<9)
1.3434 + validateBuf0A.Append(count+3);
1.3435 + }
1.3436 + TRequestStatus status3 = KRequestPending;
1.3437 + TestRFile1.Write(K4GBMinusTen,writeBuf0A,9,status3);
1.3438 + TestRFile1.Read(K4GBMinusTen,readBuf0A,9);
1.3439 + test(validateBuf0A == readBuf0A);
1.3440 +
1.3441 + //tests need to be repeated for TUint variant of RFile64::Write()
1.3442 +
1.3443 + test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = 255 bytes \n"));
1.3444 + readBuf100.Zero();//to ensure that the previous data is removed
1.3445 + status1 = KRequestPending;
1.3446 + TUint pos = 0;
1.3447 + TestRFile1.WriteU(pos,writeBuf100,255,status1);
1.3448 + TestRFile1.ReadU(pos,readBuf100,255);
1.3449 + test(validateBuf100 == readBuf100);
1.3450 +
1.3451 + test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 2GB-1, data = 1KB and length = 200 bytes\n"));
1.3452 + readBuf400.Zero();//to ensure that the previous data is removed
1.3453 + status2 = KRequestPending;
1.3454 + pos = K2GBMinusOne;
1.3455 + TestRFile1.Write(pos,writeBuf400,200,status2);
1.3456 + TestRFile1.Read(pos,readBuf400,200);
1.3457 + test(validateBuf400 == readBuf400);
1.3458 +
1.3459 + test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-10, data = 10 bytes and length = 10 bytes\n"));
1.3460 + readBuf0A.Zero();//to ensure that the previous data is removed
1.3461 + status3 = KRequestPending;
1.3462 + pos = K4GBMinusTen;
1.3463 + TestRFile1.Write(pos,writeBuf0A,9,status3);
1.3464 + TestRFile1.Read(pos,readBuf0A,9);
1.3465 + test(validateBuf0A == readBuf0A);
1.3466 +
1.3467 + //
1.3468 + //tests need to be repeated for current position variant of RFile64::Write()
1.3469 + //testing with only current position as 4GB-2(boundary condition)
1.3470 + //
1.3471 + test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-10, data = 10 bytes and length = 10 bytes\n"));
1.3472 + readBuf0A.Zero();//to ensure that the previous data is removed
1.3473 + status3 = KRequestPending;
1.3474 + TInt64 seekPos = K4GBMinusTen;
1.3475 + TestRFile1.Seek(ESeekStart,seekPos);
1.3476 + TestRFile1.Write(writeBuf0A,9,status3);
1.3477 + TestRFile1.Seek(ESeekStart,seekPos);
1.3478 + TestRFile1.Read(readBuf0A,9);
1.3479 + test(validateBuf0A == readBuf0A);
1.3480 +
1.3481 +
1.3482 +
1.3483 + 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"));
1.3484 +
1.3485 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.3486 + {
1.3487 + TBuf8<0x100> writeBuf256;
1.3488 + TBuf8<0x100> readBuf256;
1.3489 + writeBuf256.Zero();
1.3490 + writeBuf256.FillZ();
1.3491 + for (TInt count = 0; count < 0x100; count++)
1.3492 + {
1.3493 + writeBuf256.Append(count+6);
1.3494 + }
1.3495 + TRequestStatus status5 = KRequestPending;
1.3496 + TestRFile1.Write(K4GBPlusOne,writeBuf256,10,status5);
1.3497 + TestRFile1.Read(K4GBPlusOne,readBuf256,10);
1.3498 + test(readBuf256.Length() == 0);
1.3499 + }
1.3500 +
1.3501 + test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = 0 bytes\n"));
1.3502 + TBuf8<0x100> wrBuf256;
1.3503 + TBuf8<0x100> reBuf256;
1.3504 + wrBuf256.Zero();
1.3505 + wrBuf256.FillZ();
1.3506 + for (count = 0; count < 0x100; count++)
1.3507 + {
1.3508 + wrBuf256.Append(count+6);
1.3509 + }
1.3510 + TRequestStatus status6 = KRequestPending;
1.3511 + TestRFile1.Write(0,wrBuf256,0,status6);
1.3512 + TestRFile1.Read(0,reBuf256,0);
1.3513 + test(reBuf256.Length() == 0);
1.3514 +
1.3515 + test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = -1bytes \n"));
1.3516 + TBuf8<0x100> wBuf256;
1.3517 + wBuf256.Zero();
1.3518 + wBuf256.FillZ();
1.3519 + for (count = 0; count < 0x100; count++)
1.3520 + {
1.3521 + wBuf256.Append(count+3);
1.3522 + }
1.3523 + TRequestStatus status7 = KRequestPending;
1.3524 + TestRFile1.Write(0,wrBuf256,-1,status7);
1.3525 + TestRFile1.Close();
1.3526 +
1.3527 + TInt r = TheFs.Delete(fileName);
1.3528 + test(r == KErrNone);
1.3529 + }
1.3530 +
1.3531 +/**
1.3532 +@SYMTestCaseID PBASE-T_FILE64BIT-0777
1.3533 +@SYMTestPriority High
1.3534 +@SYMTestRequirement REQ9526
1.3535 +@SYMTestType CIT
1.3536 +@SYMTestCaseDesc Tests for locking a large file using RFile64::Lock()
1.3537 +@SYMTestActions
1.3538 +1) Lock a big file with aPos = 0, aLength = 2GB-1
1.3539 +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.
1.3540 +3) Extend the Lock with aPos = 0, aLength = 2GB+10.This tests overlapped locks.
1.3541 +4) Extend the Lock with aPos = 2GB-100, aLength = 200. This also tests overlapped locks.
1.3542 +5) Lock with aPos = 100, aLength = 2GB-100.This tries to lock sub region of a Lock
1.3543 +6) Lock same file with aPos = 2GB-1 and aLength = 200. Lock same file with aPos = 2GB + 300 and aLength =200.
1.3544 +7) Lock a big file with aPos = 0, aLength = 4GB-1.Tests boundary condition.
1.3545 +8) Lock a file with aPos =4GB and aLength=10
1.3546 +@SYMTestExpectedResults
1.3547 +1) KErrNone, lock is successful
1.3548 +2) KErrLocked, lock is unsuccessful
1.3549 +3) KErrLocked, lock is unsuccessful
1.3550 +4) KErrLocked, lock is unsuccessful
1.3551 +5) KErrLocked, lock is unsuccessful
1.3552 +6) KErrNone, lock is successful
1.3553 +7) KErrLocked, lock is successful
1.3554 +8) KErrNone
1.3555 +@SYMTestStatus Implemented
1.3556 +*/
1.3557 +
1.3558 +void TestFileLock()
1.3559 + {
1.3560 + test.Next(_L("Tests for locking a big file:"));
1.3561 +
1.3562 + TFileName fileName;
1.3563 + fileName.Append(gDriveToTest);
1.3564 + fileName.Append(KTestPath);
1.3565 + fileName.Append(_L("File4GBMinusOne.txt"));
1.3566 + TestRFile1.Replace(fileName, EFileRead);
1.3567 +
1.3568 + test.Next(_L("Lock a big file with aPos = 0, aLength = 2GB-1\n"));
1.3569 + TestRFile1.Lock(0, K2GBMinusOne);
1.3570 +
1.3571 +
1.3572 + test.Next(_L(" Attempt to lock the same region again\n"));
1.3573 + TestRFile1.LockE(0, K2GBMinusOne);
1.3574 +
1.3575 + test.Next(_L("Extend the Lock with aPos = 0, aLength = 2GB+10\n"));
1.3576 + TestRFile1.LockE(0, K2GBPlusTen);
1.3577 +
1.3578 + test.Next(_L("Extend the Lock with aPos = 2GB-100, aLength = 200\n"));
1.3579 + TestRFile1.LockE(K2GBMinus100, 200);
1.3580 +
1.3581 + test.Next(_L("Lock with aPos = 100, aLength = 2GB-100.\n"));
1.3582 + TestRFile1.LockE(100, K2GBMinus100);
1.3583 +
1.3584 + test.Next(_L("Lock same file with aPos = 2GB-1 and aLength = 200\n"));
1.3585 + TestRFile1.Lock(K2GBMinusOne, 200);
1.3586 +
1.3587 + test.Next(_L("Lock a big file with aPos = 0, aLength = 4GB-1\n"));
1.3588 + TestRFile1.LockE(0, K4GBMinusOne);
1.3589 +
1.3590 +
1.3591 + if(KFileSizeMaxLargerThan4GBMinusOne)
1.3592 + {
1.3593 + test.Next(_L("Lock a file with aPos =4GB and aLength=10\n"));
1.3594 + TestRFile1.Lock(K4GB + 2, 10);
1.3595 + }
1.3596 +
1.3597 + TestRFile1.Close();
1.3598 +
1.3599 + TInt r = TheFs.Delete(fileName);
1.3600 + test(r == KErrNone);
1.3601 + }
1.3602 +
1.3603 +
1.3604 +/**
1.3605 +@SYMTestCaseID PBASE-T_FILE64BIT-0778
1.3606 +@SYMTestPriority High
1.3607 +@SYMTestRequirement REQ9526
1.3608 +@SYMTestType CIT
1.3609 +@SYMTestCaseDesc Tests the File unlock functionality using RFile64::UnLock()
1.3610 +@SYMTestActions
1.3611 +1) UnLock a big file, same region which is locked with aPos = 0, aLength = 2GB-1.
1.3612 +2) UnLock a big file, which is not locked with aPos = 0, aLength = 2GB-1.
1.3613 +3) UnLock a big file twice, same region which is locked with aPos = 0, aLength = 2GB-1.
1.3614 +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.
1.3615 +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.
1.3616 +6) UnLock a big file to test boundary condition, with aPos = 0, aLength = 4GB-1.The file should have been locked with same arguments.
1.3617 +7) UnLock different regions of a file which were locked in same order with aPos = 0, aLength = 2GB+200.
1.3618 + Second Unlock aPos = 2GB+300 and aLength =200.
1.3619 + Third UnLock aPos = 2GB+600 and aLength = 200.
1.3620 +8) UnLock different regions of a file which were locked in different order with aPos = 0, aLength = 2GB+100.
1.3621 + Second Unlock aPos = 2GB+300 and aLength =200.
1.3622 + Third UnLock aPos = 2GB+600 and aLength = 200.
1.3623 +9) UnLock multiple locked regions with aPos = 0, aLength = 2GB-1.The file should have been locked in same region but with different locks
1.3624 +10)Unlock a locked file with aPos = 4GB and aLength = 10bytes
1.3625 +
1.3626 +@SYMTestExpectedResults
1.3627 +1) KErrNone
1.3628 +2) KErrNotFound
1.3629 +3) KErrNotFound
1.3630 +4) KErrNotFound
1.3631 +5) KErrNotFound
1.3632 +6) KErrNone
1.3633 +7) KErrNone
1.3634 +8) KErrNone
1.3635 +9) KErrNotFound
1.3636 +10)KErrNone
1.3637 +@SYMTestStatus Implemented
1.3638 +*/
1.3639 +
1.3640 +void TestFileUnlock()
1.3641 + {
1.3642 + test.Next(_L("Tests for Unlocking a big file:\n"));
1.3643 +
1.3644 + TFileName fileName;
1.3645 + fileName.Append(gDriveToTest);
1.3646 + fileName.Append(KTestPath);
1.3647 + fileName.Append(_L("File4GBMinusOne.txt"));
1.3648 + TestRFile2.Replace(fileName, EFileRead);
1.3649 +
1.3650 + test.Next(_L("UnLock a big file, same region which is locked with aPos = 0, aLength = 2GB-1.\n"));
1.3651 + TestRFile2.Lock(0, K2GBMinusOne);
1.3652 + TestRFile2.UnLock(0, K2GBMinusOne);
1.3653 + TestRFile2.UnLockE(0, K2GBMinusOne);
1.3654 +
1.3655 + test.Next(_L("UnLock a big file, which is not locked with aPos = 0, aLength = 2GB-1\n"));
1.3656 + TestRFile2.UnLockE(0, K2GBMinusOne);
1.3657 +
1.3658 + test.Next(_L("UnLock a big file twice, same region which is locked with aPos = 0, aLength = 2GB-1\n"));
1.3659 + TestRFile2.Lock(0, K2GBMinusOne);
1.3660 + TestRFile2.UnLockE(10, K2GBMinus100);
1.3661 + TestRFile2.UnLock(0, K2GBMinusOne);
1.3662 +
1.3663 + 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"));
1.3664 + TestRFile2.Lock(0, K2GBMinusOne);
1.3665 + TestRFile2.UnLockE(10, K2GBMinus100);
1.3666 + TestRFile2.UnLock(0, K2GBMinusOne);
1.3667 +
1.3668 + 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"));
1.3669 + TestRFile2.Lock(0, K2GBMinusOne);
1.3670 + TestRFile2.UnLockE(10, K2GBPlus100);
1.3671 + TestRFile2.UnLock(0, K2GBMinusOne);
1.3672 +
1.3673 + 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"));
1.3674 + TestRFile2.Lock(0, K4GBMinusOne);
1.3675 + TestRFile2.UnLock(0, K4GBMinusOne);
1.3676 +
1.3677 + test.Next(_L("UnLock different regions of a file which were locked in same order with aPos = 0, aLength = 2GB+200\n"));
1.3678 + TestRFile2.Lock(0, K2GBPlus200);
1.3679 + TestRFile2.Lock(K2GBPlus300, 200);
1.3680 + TestRFile2.Lock(K2GBPlus600, 200);
1.3681 + TestRFile2.UnLock(0, K2GBPlus200);
1.3682 + TestRFile2.UnLock(K2GBPlus300, 200);
1.3683 + TestRFile2.UnLock(K2GBPlus600, 200);
1.3684 +
1.3685 + test.Next(_L("UnLock different regions of a file which were locked in different order with aPos = 0, aLength = 2GB+100\n"));
1.3686 + TestRFile2.Lock(0, K2GBPlus100);
1.3687 + TestRFile2.Lock(K2GBPlus600, 200);
1.3688 + TestRFile2.Lock(K2GBPlus300, 200);
1.3689 + TestRFile2.UnLock(K2GBPlus600, 200);
1.3690 + TestRFile2.UnLock(K2GBPlus300, 200);
1.3691 + TestRFile2.UnLock(0, K2GBPlus100);
1.3692 +
1.3693 + 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"));
1.3694 + TestRFile2.Lock(0, 100);
1.3695 + TestRFile2.Lock(100, K2GBMinusOne);
1.3696 + TestRFile2.UnLockE(0, K2GBMinusOne);
1.3697 +
1.3698 +
1.3699 + if(KFileSizeMaxLargerThan4GBMinusOne)
1.3700 + {
1.3701 +
1.3702 + test.Next(_L("Unlock a locked file with aPos = 4GB and aLength = 10bytes\n"));
1.3703 + TestRFile2.Lock(K4GB, 10);
1.3704 + TestRFile2.UnLock(K4GB, 10);
1.3705 + }
1.3706 +
1.3707 + TestRFile2.Close();
1.3708 + TInt r = TheFs.Delete(fileName);
1.3709 + test(r == KErrNone);
1.3710 + }
1.3711 +
1.3712 +/**
1.3713 +@SYMTestCaseID PBASE-T_FILE64BIT-0779
1.3714 +@SYMTestPriority High
1.3715 +@SYMTestRequirement REQ9526
1.3716 +@SYMTestType CIT
1.3717 +@SYMTestCaseDesc Tests for file seek operation using RFile64::Seek()
1.3718 +@SYMTestActions
1.3719 +1) Set the file size as 20
1.3720 +2) Seek mode = ESeekEnd, seek position = 80, call RFile64::Seek()
1.3721 +3) Check Seek position
1.3722 +4) Set file size = 512
1.3723 +5) Seek mode =ESeekStart, assign seek position =513, get the seek position using RFile64::Seek()
1.3724 +6) Check the seek position
1.3725 +7) Seek mode = ESeekEnd, get the seek position using RFile64::Seek()
1.3726 +8) Check the seek position
1.3727 +9) Seek position =-530, seek mode = ESeekEnd, Get the seek position using RFile64::Seek()
1.3728 +10)Check the seek position
1.3729 +11)Seek position =-10, seek mode = ESeekEnd, get the seek position using RFile64::Seek()
1.3730 +12)Seek position =-10, seek mode = ESeekStart, get the seek position using RFile64::Seek()
1.3731 +13)Seek position =0, seek mode = ESeekEnd, get the seek position using RFile64::Seek()
1.3732 +@SYMTestExpectedResults
1.3733 +1) KErrNone
1.3734 +2) KErrNone
1.3735 +3) Seek position = 20
1.3736 +4) KErrNone
1.3737 +5) KErrNone
1.3738 +6) Seek position = 513
1.3739 +7) KErrNone
1.3740 +8) Seek position = 512
1.3741 +9) KErrNone
1.3742 +10)Seekposition = 0
1.3743 +11)Seek position =502
1.3744 +12)KErrArgument, seek position unchanged
1.3745 +13)Seek position =512
1.3746 +@SYMTestStatus Implemented
1.3747 +*/
1.3748 +
1.3749 +void TestFileSeek()
1.3750 + {
1.3751 + TInt64 seekPos;
1.3752 +
1.3753 + TFileName fileName;
1.3754 + fileName.Append(gDriveToTest);
1.3755 + fileName.Append(KTestPath);
1.3756 + fileName.Append(_L("seektest.txt"));
1.3757 + TestRFile1.Replace(fileName);
1.3758 +
1.3759 +
1.3760 + test.Next(_L("Set the file size as 20\n"));
1.3761 + TestRFile1.SetSize(20);
1.3762 +
1.3763 + test.Next(_L("Seek mode = ESeekEnd, seek position = 80, call RFile64::Seek() "));
1.3764 + seekPos = 80;
1.3765 + TestRFile1.Seek(ESeekEnd, seekPos);
1.3766 + test(seekPos == 20);
1.3767 +
1.3768 + test.Next(_L("Set the file size as 512\n"));
1.3769 + TestRFile1.SetSize(512);
1.3770 +
1.3771 + test.Next(_L("Seek mode =ESeekStart, assign seek position =513, get the seek position using RFile64::Seek()\n"));
1.3772 + seekPos = 513;
1.3773 + TestRFile1.Seek(ESeekStart, seekPos);
1.3774 + test(seekPos == 513);
1.3775 +
1.3776 + test.Next(_L("Seek mode = ESeekEnd, get the seek position using RFile64::Seek()\n"));
1.3777 + TestRFile1.Seek(ESeekEnd, seekPos);
1.3778 + test(seekPos == 512);
1.3779 +
1.3780 + test.Next(_L("Seek position =-530, seek mode = ESeekEnd, Get the seek position using RFile64::Seek()\n"));
1.3781 + seekPos = -530;
1.3782 + TestRFile1.Seek(ESeekEnd, seekPos);
1.3783 + test(seekPos == 0);
1.3784 +
1.3785 + test.Next(_L("Seek position =-10, seek mode = ESeekEnd, get the seek position using RFile64::Seek()\n"));
1.3786 + seekPos = -10;
1.3787 + TestRFile1.Seek(ESeekEnd, seekPos);
1.3788 + test(seekPos == 502);
1.3789 +
1.3790 + test.Next(_L("Seek position =-10, seek mode = ESeekStart, get the seek position using RFile64::Seek()\n"));
1.3791 + seekPos = -10;
1.3792 + TestRFile1.Seek(ESeekStart,seekPos);
1.3793 + test(seekPos == -10);
1.3794 +
1.3795 + test.Next(_L("Seek position =0, seek mode = ESeekEnd, get the seek position using RFile64::Seek()\n"));
1.3796 + seekPos = 0;
1.3797 + TestRFile1.Seek(ESeekEnd,seekPos);
1.3798 + test(seekPos == 512);
1.3799 +
1.3800 + TestRFile1.Close();
1.3801 +
1.3802 + TInt r = TheFs.Delete(fileName);
1.3803 + test(r == KErrNone);
1.3804 + }
1.3805 +
1.3806 +/**
1.3807 +@SYMTestCaseID PBASE-T_FILE64BIT-0780
1.3808 +@SYMTestPriority High
1.3809 +@SYMTestRequirement REQ9526
1.3810 +@SYMTestType CIT
1.3811 +@SYMTestCaseDesc Test file seek operation for large file
1.3812 +@SYMTestActions
1.3813 +1) Set the file size as 2GB-1
1.3814 +2) Seek mode = ESeekEnd, seek position = 2GB+80, call RFile64::Seek()
1.3815 +3) Check Seek position
1.3816 +4) Set file size = 4GB -1
1.3817 +5) Seek mode = ESeekStart, assign seek position = 4GB-1, get the seek position using RFile64::Seek()
1.3818 +6) Check the seek position
1.3819 +7) Seek mode = ESeekEnd, get the seek position using RFile64::Seek()
1.3820 +8) Check the seek position
1.3821 +9) Seek position = (4GB), seek mode = ESeekEnd, Get the seek position using RFile64::Seek()
1.3822 +10)Check the seek position
1.3823 +11)Seek position =-10, seek mode = ESeekEnd, get the seek position using RFile64::Seek()
1.3824 +12)Seek position =-10, seek mode = ESeekStart, get the seek position using RFile64::Seek()
1.3825 +13)Seek position =0, seek mode = ESeekEnd, get the seek position using RFile64::Seek()
1.3826 +@SYMTestExpectedResults
1.3827 +1) KErrNone
1.3828 +2) KErrNone
1.3829 +3) Seek position = 2GB-1
1.3830 +4) KErrNone
1.3831 +5) KErrNone
1.3832 +6) Seek position = 4GB-1
1.3833 +7) KErrNone
1.3834 +8) Seek position = 4GB-1
1.3835 +9) KErrNone
1.3836 +10)Seekposition = 0
1.3837 +11)Seek position =4GB-10
1.3838 +12)KErrArgument, seek position unchanged
1.3839 +13)Seek position =4GB - 1
1.3840 +@SYMTestStatus Implemented
1.3841 +*/
1.3842 +
1.3843 +void TestFileSeekBigFile()
1.3844 +
1.3845 + {
1.3846 + TInt64 seekPos;
1.3847 +
1.3848 +
1.3849 + TFileName fileName;
1.3850 + fileName.Append(gDriveToTest);
1.3851 + fileName.Append(KTestPath);
1.3852 + fileName.Append(_L("File4GBMinusOne.txt"));
1.3853 + TestRFile1.Replace(fileName, EFileRead|EFileWrite);
1.3854 +
1.3855 + test.Next(_L("Set the file size as 2GB-1\n"));
1.3856 + TestRFile1.SetSize(K2GBMinusOne);
1.3857 +
1.3858 + test.Next(_L("Seek mode = ESeekEnd, seek position = 2GB+80, call RFile64::Seek()\n"));
1.3859 + seekPos = K2GBPlus80;
1.3860 + TestRFile1.Seek(ESeekEnd, seekPos);
1.3861 + test(seekPos == K2GBMinusOne);
1.3862 +
1.3863 + test.Next(_L("Set the file size to 4GB-1\n"));
1.3864 + TestRFile1.SetSize(K4GBMinusOne);
1.3865 +
1.3866 + test.Next(_L("Seek mode = ESeekStart, assign seek position = 4GB-1, get the seek position using RFile64::Seek()\n"));
1.3867 + seekPos = K4GBMinusOne;
1.3868 + TestRFile1.Seek(ESeekStart, seekPos);
1.3869 + test(seekPos == K4GBMinusOne);
1.3870 +
1.3871 + test.Next(_L("Seek mode = ESeekEnd, get the seek position using RFile64::Seek()\n"));
1.3872 + TestRFile1.Seek(ESeekEnd, seekPos);
1.3873 + test(seekPos == K4GBMinusOne);
1.3874 +
1.3875 + if(KFileSizeMaxLargerThan4GBMinusOne)
1.3876 + {
1.3877 + TestRFile1.SetSize(K4GB);
1.3878 + TestRFile1.Seek(ESeekEnd, seekPos);
1.3879 + test(seekPos == K4GB);
1.3880 + seekPos = -10;
1.3881 + TestRFile1.Seek(ESeekEnd, seekPos);
1.3882 + test(seekPos == K4GB-10);
1.3883 + seekPos = -10;
1.3884 + TestRFile1.Seek(ESeekStart,seekPos);
1.3885 + test(seekPos == -10);
1.3886 + seekPos = 0;
1.3887 + TestRFile1.Seek(ESeekEnd,seekPos);
1.3888 + test(seekPos == K4GB);
1.3889 + }
1.3890 + else
1.3891 + {
1.3892 + TestRFile1.SetSize(K4GB);
1.3893 + TestRFile1.Seek(ESeekEnd, seekPos);
1.3894 + test(seekPos == K4GBMinusOne);
1.3895 + seekPos = -10;
1.3896 + TestRFile1.Seek(ESeekEnd, seekPos);
1.3897 + test(seekPos == K4GBMinusOne-10);
1.3898 + seekPos = -10;
1.3899 + TestRFile1.Seek(ESeekStart,seekPos);
1.3900 + test(seekPos == -10);
1.3901 + seekPos = 0;
1.3902 + TestRFile1.Seek(ESeekEnd,seekPos);
1.3903 + test(seekPos == K4GBMinusOne);
1.3904 + }
1.3905 +
1.3906 +
1.3907 + TestRFile1.Close();
1.3908 +
1.3909 + TInt r = TheFs.Delete(fileName);
1.3910 + test(r == KErrNone);
1.3911 +}
1.3912 +
1.3913 +/**
1.3914 +@SYMTestCaseID PBASE-T_FILE64BIT-0781
1.3915 +@SYMTestPriority High
1.3916 +@SYMTestRequirement REQ9527
1.3917 +@SYMTestType CIT
1.3918 +@SYMTestCaseDesc Test RFile64::SetSize() and RFile64::Size() functionality
1.3919 +@SYMTestActions
1.3920 +1) Set the file size =128KB
1.3921 +2) Write a test data = "ABCDEFGH", at position = 0
1.3922 +3) Get the file size
1.3923 +4) Read the data from position = 0
1.3924 +5) Compare the read data with written data
1.3925 +6) Set the file size to = 2GB-1
1.3926 +7) Write test data = "IJKLMnOPxY IJKLMnOPx", length=20 bytes, at position 2GB-10
1.3927 +8) Get the file size
1.3928 +9) Read the data from the position 2GB-10
1.3929 +10)Compare the read data
1.3930 +11)Set the file size = 4GB-1
1.3931 +12)Write test data = "IJKLMnOPxY IJKLMnOPx", length=10 bytes, at position 4GB-10
1.3932 +13)Get the file size
1.3933 +14)Read the data from the position 4GB-10
1.3934 +15)Compare the read data
1.3935 +@SYMTestExpectedResults
1.3936 +1) KErrNone
1.3937 +2) KErrNone, write is successful
1.3938 +3) KErrNone, File Size = 128KB
1.3939 +4) KErrNone, read is successful
1.3940 +5) Read data == Written data
1.3941 +6) KErrNone
1.3942 +7) KErrNone, write is successful
1.3943 +8) KErrNone File Size = 2GB+10
1.3944 +9) KErrNone, read is successful
1.3945 +10)Read data == Written data
1.3946 +11)KErrNone
1.3947 +12)KErrNone, write is successful for 10 bytes
1.3948 +13)KErrNone File Size == 4GB-1
1.3949 +14)KErrNone, read is successful
1.3950 +15)Read data == Written data
1.3951 +@SYMTestStatus Implemented
1.3952 +*/
1.3953 +
1.3954 +void TestSetsize()
1.3955 + {
1.3956 + test.Next(_L("Create a large file"));
1.3957 +
1.3958 + TFileName fileName;
1.3959 + fileName.Append(gDriveToTest);
1.3960 + fileName.Append(KTestPath);
1.3961 + fileName.Append(_L("File4GBMinusOne.txt"));
1.3962 + TestRFile1.Replace(fileName, EFileRead|EFileWrite);
1.3963 +
1.3964 + CheckDisk();
1.3965 +
1.3966 + test.Next(_L("Set the file size =128KB\n"));
1.3967 + TestRFile1.SetSize(131072); // 128KB
1.3968 +
1.3969 + test.Next(_L("Write a test data = ABCDEFGH, at position = 0\n"));
1.3970 + TBuf8<16> testData = _L8("ABCDEFGH");
1.3971 + TestRFile1.WriteP(0,testData);
1.3972 + TInt64 size = 0;
1.3973 +
1.3974 + test.Next(_L("Get the file size\n"));
1.3975 + TestRFile1.Size(size);
1.3976 + test(size == 131072) ;
1.3977 +
1.3978 + test.Next(_L("Read and compare the data from position = 0\n"));
1.3979 + TBuf8<16> testData2;
1.3980 + TestRFile1.Read(0,testData2,8);
1.3981 + test(testData == testData2);
1.3982 +
1.3983 + test.Next(_L("Set the file size =2GB - 1 \n"));
1.3984 + TestRFile1.SetSize(K2GBMinusOne); // 2GB-1
1.3985 +
1.3986 + test.Next(_L("Write test data = IJKLMnOPxY IJKLMnOPx ,length=20 bytes, at position 2GB-10\n"));
1.3987 + TBuf8<20> testData3 = _L8("IJKLMnOPxY IJKLMnOPx");
1.3988 + TestRFile1.Write(K2GBMinusTen,testData3, 20);
1.3989 +
1.3990 + test.Next(_L("Get the file size\n"));
1.3991 + TestRFile1.Size(size);
1.3992 + test(size == K2GBPlusTen);
1.3993 +
1.3994 + test.Next(_L("Read and compare the data from position = 2GB-10\n"));
1.3995 + TBuf8<10> testData4;
1.3996 + TestRFile1.Read(K2GBMinusTen,testData4,10);
1.3997 + test(testData4 == _L8("IJKLMnOPxY"));
1.3998 +
1.3999 + test.Next(_L("Set the file size =2GB - 1 \n"));
1.4000 + TestRFile1.SetSize(K4GBMinusOne); // 4GB-1
1.4001 +
1.4002 + test.Next(_L("Write test data = IJKLMnOPxY IJKLMnOPx, length=10 bytes, at position 4GB-10\n"));
1.4003 + TBuf8<20> testData5 = _L8("IJKLMnOPxY IJKLMnOPx");
1.4004 + TestRFile1.Write(K4GBMinusTen,testData5,9);
1.4005 +
1.4006 + test.Next(_L("Get the file size\n"));
1.4007 + TestRFile1.Size(size);
1.4008 + test(size == K4GBMinusOne);
1.4009 +
1.4010 + test.Next(_L("Read the data from the position 4GB-10\n"));
1.4011 + TBuf8<10> testData6;
1.4012 + TestRFile1.Read(K4GBMinusTen,testData6,9);
1.4013 + test(testData6 == _L8("IJKLMnOPx"));
1.4014 + TestRFile1.Close();
1.4015 +
1.4016 + TInt r = TheFs.Delete(fileName);
1.4017 + test(r == KErrNone);
1.4018 + }
1.4019 +
1.4020 +/**
1.4021 +@SYMTestCaseID PBASE-T_FILE64BIT-0782
1.4022 +@SYMTestPriority High
1.4023 +@SYMTestRequirement REQ9528
1.4024 +@SYMTestType CIT
1.4025 +@SYMTestCaseDesc Tests for reading a data from a big file without opening it
1.4026 +@SYMTestActions
1.4027 +1) Read from a big file using RFs::ReadFileSection() from position 3GB-1,52byte lengths of data
1.4028 +2) Open a big file in EFileShareAny | EFileRead mode and read from it using RFs::ReadFileSection() from position 3GB-1, 52byte lengths of data
1.4029 +3) Open a big file in EFileShareExclusive | EFileRead mode and read from it using RFs::ReadFileSection( ) from position 3GB-1, 52byte lengths of data
1.4030 +4) Open a big file in EFileShareExclusive | EFileWrite mode and read from it using RFs::ReadFileSection( ) from position 3GB-1, 52byte lengths of data
1.4031 +5) Check for FAT32 file system. Read from a big file using RFs::ReadFileSection( ) from position equal to 4GB, 52byte lengths of data
1.4032 +@SYMTestExpectedResults
1.4033 +1) KErrNone, read is successful
1.4034 +2) KErrNone, open and read both are successful
1.4035 +3) KErrNone, open and read both are successful
1.4036 +4) KErrNone, open and read both are successful
1.4037 +5) KErrNone with zero length descriptor,if NGFS is supported we should get the valid data
1.4038 +@SYMTestStatus Implemented
1.4039 +*/
1.4040 +void TestReadFilesection()
1.4041 + {
1.4042 + test.Next(_L("Read data from a large file using RFs::ReadFileSection\n"));
1.4043 + TBuf8<52> testDes;
1.4044 + TBuf8<52> readBuf;
1.4045 +
1.4046 + RFile64 file;
1.4047 +
1.4048 + TFileName fileName;
1.4049 + fileName.Append(gDriveToTest);
1.4050 + fileName.Append(KTestPath);
1.4051 + fileName.Append(_L("File4GBMinusOne.txt"));
1.4052 +
1.4053 + TInt r = file.Replace(TheFs,fileName,EFileWrite);
1.4054 + test(r == KErrNone);
1.4055 + r = file.SetSize(K4GBMinusOne);
1.4056 + test(r == KErrNone);
1.4057 + file.Close();
1.4058 +
1.4059 + test.Next(_L("Read from a big file using RFs::ReadFileSection() from position 3GB-1,52byte lengths of data\n"));
1.4060 + TestRFs.ReadFileSection(fileName,K3GBMinusOne,testDes,52);
1.4061 +
1.4062 + 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"));
1.4063 + TestRFile1.Open(fileName,EFileShareAny|EFileRead);
1.4064 + TestRFs.ReadFileSection(fileName,0,testDes,52);
1.4065 + test(testDes.Length() == 52);
1.4066 + TestRFile1.Close();
1.4067 +
1.4068 + 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"));
1.4069 + TestRFile1.Open(fileName,EFileShareExclusive|EFileRead);
1.4070 + TestRFs.ReadFileSection(fileName,K3GBMinusOne,testDes,52);
1.4071 + TestRFile1.Close();
1.4072 +
1.4073 + 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"));
1.4074 + TestRFile1.Open(fileName,EFileShareExclusive|EFileWrite);
1.4075 + TestRFs.ReadFileSection(fileName,K3GBMinusOne,testDes,52);
1.4076 + TestRFile1.Close();
1.4077 +
1.4078 +
1.4079 + 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"));
1.4080 +
1.4081 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.4082 + {
1.4083 + TestRFs.ReadFileSection(fileName,K4GB,readBuf,52);
1.4084 + }
1.4085 +
1.4086 + r = TheFs.Delete(fileName);
1.4087 + test(r == KErrNone);
1.4088 + }
1.4089 +
1.4090 +/**
1.4091 +@SYMTestCaseID PBASE-T_FILE64BIT-0783
1.4092 +@SYMTestPriority High
1.4093 +@SYMTestRequirement REQ9530
1.4094 +@SYMTestType CIT
1.4095 +@SYMTestCaseDesc Check that we can get a valid directory listing of a directory containing large files using RDir and then CDir
1.4096 + TInt RFs::GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList) const;
1.4097 +@SYMTestActions
1.4098 +1) Get the directory listing, sort by size
1.4099 +2) Check the files count in the directory. Number of files in a directory is 4
1.4100 +3) Get the entry list & Check the files are listed in order of file sizes
1.4101 +@SYMTestExpectedResults
1.4102 +1) KErrNone
1.4103 +2) 4 Files in the directory
1.4104 +3) File size should match and arranged in ascending order
1.4105 +@SYMTestStatus Implemented
1.4106 +*/
1.4107 +void TestGetDirectory()
1.4108 + {
1.4109 + test.Next(_L("Read a directory containing large files using RDir"));
1.4110 +
1.4111 + TFileName dirName;
1.4112 + dirName.Append(gDriveToTest);
1.4113 + dirName.Append(KTestPath);
1.4114 +
1.4115 + TFileName file4GBMinusOne;
1.4116 + file4GBMinusOne.Append(gDriveToTest);
1.4117 + file4GBMinusOne.Append(KTestPath);
1.4118 + file4GBMinusOne.Append(_L("File4GBMinusOne.txt"));
1.4119 + TFileName file2GBMinusOne;
1.4120 + file2GBMinusOne.Append(gDriveToTest);
1.4121 + file2GBMinusOne.Append(KTestPath);
1.4122 + file2GBMinusOne.Append(_L("File2GBMinusOne.txt"));
1.4123 + TFileName file2GB;
1.4124 + file2GB.Append(gDriveToTest);
1.4125 + file2GB.Append(KTestPath);
1.4126 + file2GB.Append(_L("File2GB.txt"));
1.4127 + TFileName file3GB;
1.4128 + file3GB.Append(gDriveToTest);
1.4129 + file3GB.Append(KTestPath);
1.4130 + file3GB.Append(_L("File3GB.txt"));
1.4131 +
1.4132 + TestRFile1.Replace(file4GBMinusOne);
1.4133 + TestRFile1.SetSize(K4GBMinusOne);
1.4134 + TestRFile1.Close();
1.4135 +
1.4136 + TestRFile1.Replace(file2GBMinusOne);
1.4137 + TestRFile1.SetSize(K2GBMinusOne);
1.4138 + TestRFile1.Close();
1.4139 +
1.4140 + TestRFile1.Replace(file2GB);
1.4141 + TestRFile1.SetSize(K2GB);
1.4142 + TestRFile1.Close();
1.4143 +
1.4144 + TestRFile1.Replace(file3GB);
1.4145 + TestRFile1.SetSize(K3GB);
1.4146 + TestRFile1.Close();
1.4147 +
1.4148 + test.Next(_L("Get the directory listing, sort by size\n"));
1.4149 + RDir dir;
1.4150 + TInt r = dir.Open(TheFs, dirName, KEntryAttNormal);
1.4151 + test (r == KErrNone);
1.4152 +
1.4153 + TEntryArray entryArray;
1.4154 + r = dir.Read(entryArray);
1.4155 + test (r == KErrEof);
1.4156 +
1.4157 + test.Next(_L("Check the files count in the directory. Number of files in a directory is 4\n"));
1.4158 + test(entryArray.Count() == gFilesInDirectory);
1.4159 +
1.4160 + test.Next(_L("Get the entry list & Check the files are listed in order of file sizes\n"));
1.4161 + TInt n;
1.4162 + for (n = 0; n<entryArray.Count(); n++)
1.4163 + {
1.4164 + const TEntry& entry = entryArray[n];
1.4165 + if (entry.iName.MatchF(KFile2GBMinusOne()) == 0)
1.4166 + test(entry.FileSize() == K2GBMinusOne);
1.4167 + else if (entry.iName.MatchF(KFile2GB()) == 0)
1.4168 + test(entry.FileSize() == K2GB);
1.4169 + else if (entry.iName.MatchF(KFile3GB()) == 0)
1.4170 + test(entry.FileSize() == K3GB);
1.4171 + else if (entry.iName.MatchF(KFile4GBMinusOne()) == 0)
1.4172 + test(entry.FileSize() == K4GBMinusOne);
1.4173 + else
1.4174 + test(EFalse);
1.4175 + }
1.4176 +
1.4177 + dir.Close();
1.4178 +
1.4179 + test.Next(_L("Read a directory containing large files using CDir & sort by size"));
1.4180 + CDir* dirList = NULL;
1.4181 + TestRFs.GetDir(dirName, KEntryAttMaskSupported, ESortBySize, dirList);
1.4182 + test(dirList->Count() == gFilesInDirectory);
1.4183 + for (n = 0; n<dirList->Count(); n++)
1.4184 + {
1.4185 + TEntry entry;
1.4186 + entry = (*dirList)[n];
1.4187 + if (entry.iName.MatchF(KFile2GBMinusOne()) == 0)
1.4188 + test(entry.FileSize() == K2GBMinusOne);
1.4189 + else if (entry.iName.MatchF(KFile2GB()) == 0)
1.4190 + test(entry.FileSize() == K2GB);
1.4191 + else if (entry.iName.MatchF(KFile3GB()) == 0)
1.4192 + test(entry.FileSize() == K3GB);
1.4193 + else if (entry.iName.MatchF(KFile4GBMinusOne()) == 0)
1.4194 + test(entry.FileSize() == K4GBMinusOne);
1.4195 + else
1.4196 + test(EFalse);
1.4197 + }
1.4198 + delete dirList;
1.4199 + dirList = NULL;
1.4200 + }
1.4201 +
1.4202 +
1.4203 +/**
1.4204 +@SYMTestCaseID PBASE-T_FILE64BIT-0784
1.4205 +@SYMTestPriority High
1.4206 +@SYMTestRequirement REQ9533
1.4207 +@SYMTestType CIT
1.4208 +@SYMTestCaseDesc Tests functionality of TEntry
1.4209 +@SYMTestActions
1.4210 +1) Set the File Size to 4GB-1 using RFile64::SetSize()
1.4211 +2) Get the entry
1.4212 +3) Get the file size, using TEntry::FileSize()
1.4213 +4) Get the file size using iSize (i.e. without type cast to TUint)
1.4214 +5) Check for FAT32 file system. Set the file size to 4GB
1.4215 +6) Get the file size, using TEntry::FileSize()
1.4216 +7) Compare the File size with expected size
1.4217 +@SYMTestExpectedResults
1.4218 +1) KErrNone
1.4219 +2) KErrNone
1.4220 +3) File size = 4GB-1
1.4221 +4) File size = -1
1.4222 +5) KErrNotSupported for FAT32 and KErrNone for NGFS
1.4223 +6) FAT32 file size = 4GB-1 and NGFS file size = 4GB
1.4224 +7) File size = 4GB-1
1.4225 +@SYMTestStatus Implemented
1.4226 +*/
1.4227 +void TestTEntry()
1.4228 + {
1.4229 + test.Next(_L("Tests functionality for TEntry"));
1.4230 +
1.4231 + TFileName fileName;
1.4232 + fileName.Append(gDriveToTest);
1.4233 + fileName.Append(KTestPath);
1.4234 + fileName.Append(_L("File4GBMinusOne.txt"));
1.4235 + TestRFile1.Replace(fileName, EFileRead|EFileWrite);
1.4236 +
1.4237 + CDir* anEntryList;
1.4238 + TEntry entry;
1.4239 + TInt64 size = 0;
1.4240 +
1.4241 + test.Next(_L("Set the File Size to 4GB-1 using RFile64::SetSize()\n"));
1.4242 + TestRFile1.SetSize(K4GBMinusOne);
1.4243 +
1.4244 + test.Next(_L("Get the entry\n"));
1.4245 + TestRFs.GetDir(fileName, KEntryAttMaskSupported, ESortBySize, anEntryList);
1.4246 + for (TInt n = 0; n<anEntryList->Count(); n++)
1.4247 + {
1.4248 + entry = (*anEntryList)[n];
1.4249 + if (entry.iName.MatchF(KFile4GBMinusOne()) == 0)
1.4250 + {
1.4251 + test(entry.FileSize() == K4GBMinusOne);
1.4252 + }
1.4253 + }
1.4254 +
1.4255 + test.Next(_L("Get the file size, using TEntry::FileSize()\n"));
1.4256 + size = entry.FileSize();
1.4257 + test(size == K4GBMinusOne);
1.4258 + test(entry.iSize == -1);
1.4259 +
1.4260 +
1.4261 +
1.4262 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
1.4263 + {
1.4264 + TestRFile1.SetSize(K4GB);
1.4265 + size = entry.FileSize();
1.4266 + test(size == K4GBMinusOne);
1.4267 + }
1.4268 + TestRFile1.Close();
1.4269 + delete anEntryList;
1.4270 + anEntryList = NULL;
1.4271 + }
1.4272 +
1.4273 +/**
1.4274 +@SYMTestCaseID PBASE-T_FILE64BIT-0785
1.4275 +@SYMTestPriority High
1.4276 +@SYMTestRequirement REQ9530
1.4277 +@SYMTestType CIT
1.4278 +@SYMTestCaseDesc Test the RDir read functionality with large file
1.4279 +@SYMTestActions
1.4280 +1) Open the directory containing large file, using RDir open()
1.4281 +2) Read the directory entry using TEntryArray as parameter
1.4282 +3) Check the count
1.4283 +4) Close using RDir
1.4284 +@SYMTestExpectedResults
1.4285 +1) KErrNone, open is successful
1.4286 +2) KErrEof
1.4287 +3) count = 4 files
1.4288 +4) Closes the directory
1.4289 +@SYMTestStatus Implemented
1.4290 +*/
1.4291 +
1.4292 +void TestReadDirectory()
1.4293 + {
1.4294 + test.Next(_L("RDir::Read()"));
1.4295 +
1.4296 + TFileName dirName;
1.4297 + dirName.Append(gDriveToTest);
1.4298 + dirName.Append(KTestPath);
1.4299 +
1.4300 + test.Next(_L("Open the directory containing large file, using RDir open()\n"));
1.4301 + RDir dir;
1.4302 + TInt r = dir.Open(TheFs, dirName, KEntryAttNormal);
1.4303 + test (r == KErrNone);
1.4304 +
1.4305 + test.Next(_L("Read the directory entry using TEntryArray as parameter\n"));
1.4306 + TEntryArray entryArray;
1.4307 + r = dir.Read(entryArray);
1.4308 + test (r == KErrEof);
1.4309 +
1.4310 + test.Next(_L("Check the count\n"));
1.4311 + test(entryArray.Count() == gFilesInDirectory);
1.4312 +
1.4313 + test.Next(_L("Close using RDir\n"));
1.4314 + dir.Close();
1.4315 + }
1.4316 +
1.4317 +/**
1.4318 +@SYMTestCaseID PBASE-T_FILE64BIT-0786
1.4319 +@SYMTestPriority High
1.4320 +@SYMTestRequirement REQ9530
1.4321 +@SYMTestType CIT
1.4322 +@SYMTestCaseDesc Test the sorting of directory entries using CDir::Sort()
1.4323 +@SYMTestActions
1.4324 +1) Sort with number of entries =0
1.4325 +2) Sort the directory entries with large files, sort key = ESortBySize
1.4326 +3) Get the entries count
1.4327 +4) Check the files are arranged in increasing file size
1.4328 +@SYMTestExpectedResults
1.4329 +1) KErrNone
1.4330 +2) KErrNone, sort is successful
1.4331 +3) count = 4
1.4332 +4) sequence should be in increasing order
1.4333 +@SYMTestStatus Implemented
1.4334 +*/
1.4335 +
1.4336 +void TestSortDirectory()
1.4337 + {
1.4338 + CDir* anEntryList;
1.4339 + TEntry entry;
1.4340 +
1.4341 +
1.4342 + TFileName testDir0;
1.4343 + testDir0.Append(gDriveToTest);
1.4344 + testDir0.Append(_L("F32-TEST"));
1.4345 +
1.4346 + TInt r = TheFs.MkDir(testDir0);
1.4347 + test(r == KErrNone || r == KErrAlreadyExists);
1.4348 +
1.4349 + test.Next(_L("Sort with number of entries =0\n"));
1.4350 + TestRFs.GetDir(testDir0, KEntryAttMaskSupported, ESortBySize, anEntryList);
1.4351 + test(anEntryList->Count() == 0);
1.4352 + delete anEntryList;
1.4353 + anEntryList = NULL;
1.4354 +
1.4355 + test.Next(_L(" Sort the directory entries with large files, sort key = ESortBySize\n"));
1.4356 + TFileName testDir;
1.4357 + testDir.Append(gDriveToTest);
1.4358 + testDir.Append(KTestPath);
1.4359 + CDir* aDirList;
1.4360 + TestRFs.GetDir(testDir, KEntryAttMaskSupported, ESortBySize, aDirList);
1.4361 +
1.4362 + test.Next(_L("Get the entries count\n"));
1.4363 + test(aDirList->Count() == gFilesInDirectory);
1.4364 +
1.4365 +
1.4366 + test.Next(_L("Check the files are arranged in increasing file size\n"));
1.4367 + for (TInt n = 0; n<aDirList->Count(); n++)
1.4368 + {
1.4369 + entry = (*aDirList)[n];
1.4370 + if (entry.iName.MatchF(KFile2GBMinusOne()) == 0)
1.4371 + {
1.4372 + test(entry.FileSize() == K2GBMinusOne);
1.4373 + test(n == 0);
1.4374 + }
1.4375 + else if (entry.iName.MatchF(KFile2GB()) == 0)
1.4376 + {
1.4377 + test(entry.FileSize() == K2GB);
1.4378 + test(n == 1);
1.4379 + }
1.4380 + else if (entry.iName.MatchF(KFile3GB()) == 0)
1.4381 + {
1.4382 + test(entry.FileSize() == K3GB);
1.4383 + test(n == 2);
1.4384 + }
1.4385 + else if (entry.iName.MatchF(KFile4GBMinusOne()) == 0)
1.4386 + {
1.4387 + test(entry.FileSize() == K4GBMinusOne);
1.4388 + test(n == 3);
1.4389 + }
1.4390 + else
1.4391 + test(EFalse);
1.4392 + }
1.4393 + delete aDirList;
1.4394 + aDirList = NULL;
1.4395 + }
1.4396 +
1.4397 +/**
1.4398 +@SYMTestCaseID PBASE-T_FILE64BIT-0787
1.4399 +@SYMTestPriority High
1.4400 +@SYMTestRequirement REQ9530
1.4401 +@SYMTestType CIT
1.4402 +@SYMTestCaseDesc Test cases for validating CDir::AddL()
1.4403 +@SYMTestActions
1.4404 +1) Fill the directory entry with details of large files contained in them
1.4405 +2) Get the directory entry,using RFs::GetDir()
1.4406 +3) Compare with entry added
1.4407 +@SYMTestExpectedResults
1.4408 +1) KErrNone
1.4409 +2) KErrNone
1.4410 +3) Added entry == retrieved entry
1.4411 +@SYMTestStatus Implemented
1.4412 +*/
1.4413 +void TestAddLDirectory()
1.4414 + {
1.4415 + CDir* aDirList;
1.4416 + TEntry entry;
1.4417 +
1.4418 + TFileName testDir;
1.4419 + testDir.Append(gDriveToTest);
1.4420 + testDir.Append(KTestPath);
1.4421 +
1.4422 + test.Next(_L("Get the directory entry,using RFs::GetDir()\n"));
1.4423 + TestRFs.GetDir(testDir, KEntryAttMaskSupported, ESortBySize, aDirList);
1.4424 + test(aDirList->Count() == gFilesInDirectory);
1.4425 +
1.4426 + test.Next(_L("Compare with entry added\n"));
1.4427 + for (TInt n = 0; n<aDirList->Count(); n++)
1.4428 + {
1.4429 + entry = (*aDirList)[n];
1.4430 + if (entry.iName.MatchF(KFile2GBMinusOne()) ==0 )
1.4431 + {
1.4432 + test(entry.FileSize() == K2GBMinusOne);
1.4433 + test(n == 0);
1.4434 + }
1.4435 + else if (entry.iName.MatchF(KFile2GB) == 0)
1.4436 + {
1.4437 + test(entry.FileSize() == K2GB);
1.4438 + test(n == 1);
1.4439 + }
1.4440 + else if (entry.iName.MatchF(KFile3GB()) == 0)
1.4441 + {
1.4442 + test(entry.FileSize() == K3GB);
1.4443 + test(n == 2);
1.4444 + }
1.4445 + else if (entry.iName.MatchF(KFile4GBMinusOne()) == 0)
1.4446 + {
1.4447 + test(entry.FileSize() == K4GBMinusOne);
1.4448 + test(n == 3);
1.4449 + }
1.4450 + else
1.4451 + test(EFalse);
1.4452 + }
1.4453 + delete aDirList;
1.4454 + aDirList = NULL;
1.4455 +
1.4456 + TFileName file4GBMinusOne;
1.4457 + file4GBMinusOne.Append(gDriveToTest);
1.4458 + file4GBMinusOne.Append(KTestPath);
1.4459 + file4GBMinusOne.Append(_L("File4GBMinusOne.txt"));
1.4460 + TFileName file2GBMinusOne;
1.4461 + file2GBMinusOne.Append(gDriveToTest);
1.4462 + file2GBMinusOne.Append(KTestPath);
1.4463 + file2GBMinusOne.Append(_L("File2GBMinusOne.txt"));
1.4464 + TFileName file2GB;
1.4465 + file2GB.Append(gDriveToTest);
1.4466 + file2GB.Append(KTestPath);
1.4467 + file2GB.Append(_L("File2GB.txt"));
1.4468 + TFileName file3GB;
1.4469 + file3GB.Append(gDriveToTest);
1.4470 + file3GB.Append(KTestPath);
1.4471 + file3GB.Append(_L("File3GB.txt"));
1.4472 +
1.4473 + TInt r = TheFs.Delete(file4GBMinusOne);
1.4474 + test(r == KErrNone);
1.4475 + r = TheFs.Delete(file2GBMinusOne);
1.4476 + test(r == KErrNone);
1.4477 + r = TheFs.Delete(file2GB);
1.4478 + test(r == KErrNone);
1.4479 + r = TheFs.Delete(file3GB);
1.4480 + test(r == KErrNone);
1.4481 + }
1.4482 +
1.4483 +/**
1.4484 +@SYMTestCaseID PBASE-T_FILE64BIT-0788
1.4485 +@SYMTestPriority High
1.4486 +@SYMTestRequirement REQXXXX
1.4487 +@SYMTestType CIT
1.4488 +@SYMTestCaseDesc Test cases for validating TFileText changes.
1.4489 +@SYMTestActions
1.4490 +1) Open test file and get the file size using RFile64::Size() and set the file handle to TFileText object
1.4491 +2) Seek to the file end using TFileText::Seek()
1.4492 +3) Get current file position using RFile64::Seek() and verify it is at file end.
1.4493 +4) Seek to location greater than 2GB-1 using RFile64::Seek
1.4494 +5) Write data to the file using RFile64::Write
1.4495 +6) Read data using TFileText::Read
1.4496 +7) Compare the data read in steps 6 to the data written in step 5.
1.4497 +8) Seek to the file end using TFileText::Seek(ESeekEnd).
1.4498 +9) Write known data using TFileText::Write
1.4499 +10) Read the data using RFile64::Read
1.4500 +11) Compare the source data with read data.
1.4501 +@SYMTestExpectedResults
1.4502 +1) KErrNone
1.4503 +2) KErrNone
1.4504 +3) Current file position is file end.
1.4505 +4) KErrNone
1.4506 +5) KErrNone
1.4507 +6) KErrNone
1.4508 +7) Read data == Written data
1.4509 +8) KErrNone
1.4510 +9) KErrNone
1.4511 +10) KErrNone
1.4512 +11) Read data == Source data
1.4513 +@SYMTestStatus Implemented
1.4514 +*/
1.4515 +void TestTFileText()
1.4516 + {
1.4517 + TFileName fileName;
1.4518 + fileName.Append(gDriveToTest);
1.4519 + fileName.Append(KTestPath);
1.4520 + fileName.Append(_L("test.txt"));
1.4521 + TInt r;
1.4522 + RFile64 file64;
1.4523 + TInt64 sizeK3GB = K3GB;
1.4524 +
1.4525 + test.Next(_L("Open test file and get the file size using RFile64::Size() and set the file handle to TFileText object\n"));
1.4526 + r = file64.Replace(TheFs,fileName,EFileRead|EFileWrite);
1.4527 + test(r == KErrNone);
1.4528 + r = file64.SetSize(sizeK3GB);
1.4529 + test(r == KErrNone);
1.4530 + TFileText fileText;
1.4531 + fileText.Set(file64);
1.4532 +
1.4533 + test.Next(_L("Seek to the file end using TFileText::Seek()\n"));
1.4534 + r = fileText.Seek(ESeekEnd);
1.4535 + test(r == KErrNone);
1.4536 +
1.4537 + test.Next(_L("Get current file position using RFile64::Seek() and verify it is at file end.\n"));
1.4538 + TInt64 pos = 0;
1.4539 + r = file64.Seek(ESeekCurrent, pos);
1.4540 + test(r == KErrNone);
1.4541 + test(pos == sizeK3GB);
1.4542 +
1.4543 + test.Next(_L("Write data to the file using RFile64::Write\n"));
1.4544 + HBufC* record = HBufC::NewL(10);
1.4545 + record->Des().SetLength(10);
1.4546 + record->Des().Fill('A');
1.4547 + TPtrC8 bufPtr;
1.4548 + bufPtr.Set((TUint8*)record->Ptr(),record->Size()); // Size() returns length in bytes
1.4549 + r = file64.Write(pos,bufPtr);
1.4550 + test(r == KErrNone);
1.4551 +
1.4552 + test.Next(_L("Read data using TFileText::Read\n"));
1.4553 + TBuf<20> fileTextReadBuf;
1.4554 + file64.Seek(ESeekStart,pos);//seek to the position where the data has been written
1.4555 + r = fileText.Read(fileTextReadBuf);
1.4556 + test(fileTextReadBuf == _L("AAAAAAAAAA"));
1.4557 +
1.4558 + test.Next(_L("Seek to the file end using TFileText::Seek(ESeekEnd)\n"));
1.4559 + r = fileText.Seek(ESeekEnd);
1.4560 + test(r == KErrNone);
1.4561 +
1.4562 + test.Next(_L("Write known data using TFileText::Write\n"));
1.4563 + TBuf<20> fileTextWriteBuf(_L("AAAAAAAAAA"));
1.4564 + pos = 0;
1.4565 + r = file64.Seek(ESeekCurrent,pos);
1.4566 + r = fileText.Write(fileTextWriteBuf);
1.4567 + test(r == KErrNone);
1.4568 +
1.4569 + test.Next(_L("Read the data using RFile64::Read\n"));
1.4570 + TBuf8<20> file64ReadBuf;
1.4571 + file64ReadBuf.Zero();
1.4572 + r = file64.Read(pos,file64ReadBuf);
1.4573 + r = bufPtr.Compare(file64ReadBuf);
1.4574 + test (r == KErrNone);
1.4575 +
1.4576 + file64.Close();
1.4577 +
1.4578 + r = TheFs.Delete(fileName);
1.4579 + test(r == KErrNone);
1.4580 + User::Free(record);
1.4581 + }
1.4582 +
1.4583 +
1.4584 +/**
1.4585 +@SYMTestCaseID PBASE-T_FILE64BIT-0789
1.4586 +@SYMTestPriority High
1.4587 +@SYMTestRequirement REQ9526
1.4588 +@SYMTestType CIT
1.4589 +@SYMTestCaseDesc Test the file read and write with locking a specified region of the file.
1.4590 +@SYMTestActions
1.4591 +1) Set the File Size to 2GB-1
1.4592 +2) Lock a section of large file, position =0, aLength = 2GB-1
1.4593 +3) Read from position = 2GB-100 and length = 99
1.4594 +4) Write to the File, position = 2GB-100 and length = 99
1.4595 +5) Use RFs::ReadFileSection () and with position = 2GB -100 and length = 99
1.4596 +6) Set the file size to 4GB-1
1.4597 +7) Lock a section of large file, position =2GB, aLength = 4GB-1
1.4598 +8) Write to the File, position = 4GB-100 and length = 99
1.4599 +@SYMTestExpectedResults
1.4600 +1) KErrNone
1.4601 +2) KErrNone, file lock successful
1.4602 +3) KErrNone, read is successful
1.4603 +4) KErrLocked, write is unsuccessful
1.4604 +5) KErrNone, read is successful
1.4605 +6) KErrNone
1.4606 +7) KErrNone, lock is successful
1.4607 +8) KErrLocked, write is unsuccessful
1.4608 +@SYMTestStatus Implemented
1.4609 +*/
1.4610 +void TestReadWriteLock()
1.4611 + {
1.4612 + TBuf8<0x63> readBuf;
1.4613 + TBuf8<0x63> buf;
1.4614 + TFileName fileName;
1.4615 + fileName.Append(gDriveToTest);
1.4616 + fileName.Append(KTestPath);
1.4617 + fileName.Append(_L("File4GBMinusOne.txt"));
1.4618 +
1.4619 + test.Start(_L("Test Lock Functionality\n"));
1.4620 + TestRFile1.Replace(fileName, EFileWrite|EFileShareAny);
1.4621 + TestRFile2.Open(fileName);
1.4622 +
1.4623 + test.Next(_L("Creating test pattern"));
1.4624 + pattern.SetLength(pattern.MaxLength());
1.4625 + for (TInt i = 0;i<pattern.MaxLength();i++)
1.4626 + pattern[i] = (TText8)(i + 10);
1.4627 +
1.4628 + TInt64 size = 0;
1.4629 + test.Next(_L("Multi file tests"));
1.4630 +
1.4631 + test.Next(_L("Set the File Size to 2GB-1\n"));
1.4632 + TestRFile1.SetSize(K2GBMinusOne);
1.4633 + TestRFile1.Size(size);
1.4634 + test(size == K2GBMinusOne);
1.4635 +
1.4636 + test.Next(_L("Lock a section of large file, position =0, aLength = 2GB-1\n"));
1.4637 + TestRFile1.Lock(0,K2GBMinusOne);
1.4638 + TestRFile1.LockE(0,K2GBMinusOne);
1.4639 +
1.4640 + test.Next(_L("Read from position = 2GB-100 and length = 99\n"));
1.4641 + TestRFile1.Read(K2GBMinus100,buf,99);
1.4642 +
1.4643 + test.Next(_L("Write to the File, position = 2GB-100 and length = 99\n"));
1.4644 + TestRFile2.WriteE(K2GBMinus100,pattern,99);
1.4645 + TestRFile1.UnLock(0,K2GBMinusOne);
1.4646 + TestRFile2.Write(K2GBMinus100,pattern,99);
1.4647 +
1.4648 + test.Next(_L("Use RFs::ReadFileSection () and with position = 2GB -100 and length = 99\n"));
1.4649 + TestRFs.ReadFileSection(fileName,K2GBMinus100,readBuf,99);
1.4650 +
1.4651 + test.Next(_L("Set the file size to 4GB-1\n"));
1.4652 + TestRFile1.SetSize(K4GBMinusOne);
1.4653 + TestRFile1.Size(size);
1.4654 + test(size == K4GBMinusOne);
1.4655 +
1.4656 + if(KFileSizeMaxLargerThan4GBMinusOne)
1.4657 + {
1.4658 +
1.4659 + test.Next(_L("Lock a section of large file, position =2GB, aLength = 4GB-1\n"));
1.4660 + TestRFile1.Lock(K2GB,K4GBMinusOne);
1.4661 + TestRFile1.LockE(K2GB,K4GBMinusOne);
1.4662 +
1.4663 + test.Next(_L("Write to the File, position = 4GB-100 and length = 99\n"));
1.4664 + TestRFile2.WriteE(K4GBMinus100,pattern,99);
1.4665 + TestRFile1.UnLock(K2GB,K4GBMinusOne);
1.4666 + }
1.4667 +
1.4668 + TestRFile2.Close();
1.4669 + TestRFile1.Close();
1.4670 +
1.4671 + TInt r = TheFs.Delete(fileName);
1.4672 + test(r == KErrNone);
1.4673 + test.End();
1.4674 + }
1.4675 +
1.4676 +/**
1.4677 +@SYMTestCaseID PBASE-T_FILE64BIT-0790
1.4678 +@SYMTestPriority High
1.4679 +@SYMTestRequirement REQ9526
1.4680 +@SYMTestType CIT
1.4681 +@SYMTestCaseDesc Test the files unlock functionality and performs file read and write.
1.4682 +@SYMTestActions
1.4683 +1) Set the File Size to 2GB-1
1.4684 +2) Lock a section of file, position =0, aLength = 2GB-1
1.4685 +3) UnLock a section of large file, position = 0, aLength = 2GB-1
1.4686 +4) Read a file with position = 2GB-100 and length = 99
1.4687 +5) Write to a file with position = 2GB-100 and length = 99
1.4688 +6) Use RFs::ReadFileSection() to read from a file, position = 0 and length = 100(Open mode = EFileShareAny)
1.4689 +7) Set the File Size to 4GB-1
1.4690 +8) Lock a section of large file, position =2GB, aLength = 4GB-1
1.4691 +9) UnLock a section of large file, position =2GB, aLength = 4GB-1
1.4692 +10)Write to the File, position = 4GB-100 and length = 99
1.4693 +@SYMTestExpectedResults returns
1.4694 +1) KErrNone
1.4695 +2) KErrNone, file locked successfully
1.4696 +3) KErrNone, File unlocked successfully
1.4697 +4) KErrNone, read is successful
1.4698 +5) KErrNone, write is successful
1.4699 +6) KErrNone, read is successful
1.4700 +7) KErrNone
1.4701 +8) KErrNone, lock is successful
1.4702 +9) KErrNone, unlock is successful
1.4703 +10)KErrNone, write is successful
1.4704 +@SYMTestStatus Implemented
1.4705 +*/
1.4706 +void TestUnLock()
1.4707 + {
1.4708 + TBuf8<0x63> buf;
1.4709 + TBuf8<0x64> readBuf;
1.4710 + TInt64 size = 0;
1.4711 + TFileName fileName;
1.4712 + fileName.Append(gDriveToTest);
1.4713 + fileName.Append(KTestPath);
1.4714 + fileName.Append(_L("File4GBMinusOne.txt"));
1.4715 +
1.4716 + test.Start(_L("Test Unlock Functionality\n"));
1.4717 + TestRFile1.Replace(fileName,EFileWrite|EFileShareAny);
1.4718 + TestRFile2.Open(fileName);
1.4719 +
1.4720 + test.Next(_L("Creating test pattern"));
1.4721 + pattern.SetLength(pattern.MaxLength());
1.4722 + for (TInt i = 0;i < pattern.MaxLength();i++)
1.4723 + pattern[i] = (TText8)(i+10);
1.4724 +
1.4725 + test.Next(_L("Set the File Size to 2GB-1\n"));
1.4726 + TestRFile1.SetSize(K2GBMinusOne);
1.4727 + TestRFile1.Size(size);
1.4728 + test(size == K2GBMinusOne);
1.4729 +
1.4730 + test.Next(_L("Lock a section of file, position =0, aLength = 2GB-1\n"));
1.4731 + TestRFile1.Lock(0,K2GBMinusOne);
1.4732 + TestRFile1.LockE(0,K2GBMinusOne);
1.4733 +
1.4734 + test.Next(_L("UnLock a section of large file, position = 0, aLength = 2GB-1\n"));
1.4735 + TestRFile1.UnLock(0,K2GBMinusOne);
1.4736 +
1.4737 + test.Next(_L("Read a file with position = 2GB-100 and length = 99\n"));
1.4738 + TestRFile1.Read(K2GBMinus100,buf,99);
1.4739 +
1.4740 + test.Next(_L("Write to a file with position = 2GB-100 and length = 99\n"));
1.4741 + TestRFile2.Write(K2GBMinus100,pattern,99);
1.4742 + TestRFile1.Read(K2GBMinus100,buf,99);
1.4743 + test(pattern == buf); // Written data == Read data
1.4744 +
1.4745 + test.Next(_L("Use RFs::ReadFileSection() to read from a file, position = 0 and length = 100(Open mode = EFileShareAny)\n"));
1.4746 + TFileName fileName1;
1.4747 + fileName1.Append(gDriveToTest);
1.4748 + fileName1.Append(KTestPath);
1.4749 + fileName1.Append(_L("File2GB.txt"));
1.4750 + RFile64 file;
1.4751 + TInt r = file.Replace(TheFs, fileName1, EFileWrite);
1.4752 + test (r == KErrNone);
1.4753 + file.SetSize(K2GB);
1.4754 + test (r == KErrNone);
1.4755 + file.Close();
1.4756 + TestRFs.ReadFileSection(fileName1,0,readBuf,100);
1.4757 + r = TheFs.Delete(fileName1);
1.4758 + test (r == KErrNone);
1.4759 + test.Next(_L("Creating test pattern"));
1.4760 +
1.4761 + TBuf8<0x63> writeBuf63;
1.4762 + TBuf8<0x63> readBuf63;
1.4763 + for (TInt count = 0; count < 0x63; count++)
1.4764 + {
1.4765 + writeBuf63.Append((TChar)count);
1.4766 + }
1.4767 +
1.4768 + test.Next(_L("Set the File Size to 4GB-1\n"));
1.4769 + TestRFile1.SetSize(K4GBMinusOne);
1.4770 + TestRFile1.Size(size);
1.4771 + test(size == K4GBMinusOne);
1.4772 +
1.4773 + if(KFileSizeMaxLargerThan4GBMinusOne)
1.4774 + {
1.4775 + test.Next(_L("Lock a section of large file, position =2GB, aLength = 4GB-1\n"));
1.4776 + TestRFile1.Lock(K2GB,K4GBMinusOne);
1.4777 +
1.4778 +
1.4779 + test.Next(_L("UnLock a section of large file, position =2GB, aLength = 4GB-1\n"));
1.4780 + TestRFile1.UnLock(K2GB,K4GBMinusOne);
1.4781 +
1.4782 + test.Next(_L("Write to the File, position = 4GB-100 and length = 99\n"));
1.4783 + TestRFile2.Write(K4GBMinus100,writeBuf63,99);
1.4784 + TestRFile2.Read(K4GBMinus100,readBuf63,99);
1.4785 + test(writeBuf63 == readBuf63); // Written data == Read data
1.4786 + }
1.4787 +
1.4788 + TestRFile2.Close();
1.4789 + TestRFile1.Close();
1.4790 +
1.4791 + r = TheFs.Delete(fileName);
1.4792 + test(r == KErrNone);
1.4793 + test.End();
1.4794 + }
1.4795 +
1.4796 +/**
1.4797 +@SYMTestCaseID PBASE-T_FILE64BIT-2349
1.4798 +@SYMTestPriority High
1.4799 +@SYMTestRequirement REQ9529
1.4800 +@SYMTestType CIT
1.4801 +@SYMTestCaseDesc Test RFile64::Seek(), Read() & Write() functionality for synchronous calls
1.4802 +
1.4803 + IMPORT_C TInt Read(TDes8 &aDes) const;
1.4804 + IMPORT_C TInt Write(const TDesC8 &aDes);
1.4805 +@SYMTestActions
1.4806 +1) Open the large file, Set the File Size to 2GB-1
1.4807 +2) File Seek with: Mode= ESeekCurrent, position = 2GB-100
1.4808 +3) Write to a file with current position and length = 99
1.4809 +4) Seek the file: Mode= ESeekStart, position = 2GB-100
1.4810 +5) Read a file with current position and length =99
1.4811 +6) Compare the read data with written data
1.4812 +7) Seek the file: Mode = ESeekEnd
1.4813 +8) Write to a file with current position and length =99
1.4814 +9) Set the file size to 4GB-1
1.4815 +10)Check for FAT32 File system. Seek the file: Mode = ESeekEnd
1.4816 +11)Write to a file with current position and length =99
1.4817 +12)If NGFS is supported, Set the file size to 4GB+10
1.4818 +13)Seek the file: Mode = ESeekEnd
1.4819 +14)Write to a file with current position and length =99
1.4820 +@SYMTestExpectedResults
1.4821 +1) KErrNone, open is successful
1.4822 +2) KErrNone, Seek Position = 2GB-100
1.4823 +3) KErrNone, write is successful
1.4824 +4) KErrNone, Seek Position = 2GB-100
1.4825 +5) KErrNone, read is successful
1.4826 +6) Read data == written data
1.4827 +7) KErrNone
1.4828 +8) KErrNone, write is successful
1.4829 +9) KErrNone
1.4830 +10)KErrNone
1.4831 +11)
1.4832 +12)KErrNone
1.4833 +13)KErrNone
1.4834 +14)KErrNone
1.4835 +@SYMTestStatus Implemented
1.4836 +*/
1.4837 +void TestSeekReadWrite()
1.4838 + {
1.4839 + TBuf8<0x63> readBuf;
1.4840 + TBuf8<0x63> writeBuf;
1.4841 + TInt count;
1.4842 + TInt64 seekPos = 0;
1.4843 + TFileName fileName;
1.4844 + fileName.Append(gDriveToTest);
1.4845 + fileName.Append(KTestPath);
1.4846 + fileName.Append(_L("File4GBMinusOne.txt"));
1.4847 +
1.4848 + test.Start(_L("Test RFile64::Seek(), RFile64::Read() & RFile64::Write() for synchronous calls\n"));
1.4849 +
1.4850 + test.Next(_L("Open the large file, Set the File Size to 2GB-1\n"));
1.4851 + TestRFile1.Replace(fileName,EFileWrite|EFileShareAny);
1.4852 +
1.4853 + for (count = 0; count < 0x63; count++)
1.4854 + {
1.4855 + writeBuf.Append(count);
1.4856 + }
1.4857 +
1.4858 + test.Next(_L("Single file tests"));
1.4859 + TInt64 size2GBMinusOne = 1;
1.4860 + size2GBMinusOne <<= 31;
1.4861 + size2GBMinusOne -= 1;
1.4862 + TestRFile1.SetSize(size2GBMinusOne);
1.4863 +
1.4864 + test.Next(_L("File Seek with: Mode= ESeekCurrent, position = 2GB-100\n"));
1.4865 + seekPos = K2GBMinus100;
1.4866 + TestRFile1.Seek(ESeekCurrent,seekPos);
1.4867 + seekPos = 0;
1.4868 + TestRFile1.Seek(ESeekCurrent,seekPos);
1.4869 + test(seekPos == K2GBMinus100);
1.4870 +
1.4871 + test.Next(_L("Write to a file with current position and length = 99\n"));
1.4872 + TestRFile1.Write(writeBuf); // Write 99 bytes of data to a file
1.4873 +
1.4874 + test.Next(_L("Seek the file: Mode= ESeekStart, position = 2GB-100\n"));
1.4875 + seekPos = 0;
1.4876 + TestRFile1.Seek(ESeekCurrent,seekPos);
1.4877 + test(seekPos == K2GBMinusOne);
1.4878 +
1.4879 + test.Next(_L("Read a file with current position and length =99\n"));
1.4880 + seekPos = K2GBMinus100;
1.4881 + TestRFile1.Seek(ESeekStart,seekPos);
1.4882 + TestRFile1.Read(readBuf);
1.4883 +
1.4884 + test.Next(_L("Compare the read data with written data\n"));
1.4885 + test(writeBuf == readBuf); // Written data == Read data
1.4886 +
1.4887 + TBuf8<0x63> writeBuf99;
1.4888 + TBuf8<0x63> readBuf99;
1.4889 + TInt64 size = 0;
1.4890 +
1.4891 + test.Next(_L("Seek the file: Mode = ESeekEnd\n"));
1.4892 + TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
1.4893 + test(seekPos == K2GBMinusOne);
1.4894 +
1.4895 + test.Next(_L("Write to a file with current position and length =99\n"));
1.4896 + for (count = 0; count < 0x63; count++)
1.4897 + {
1.4898 + writeBuf99.Append(count+1);
1.4899 + }
1.4900 + TestRFile1.Write(writeBuf99);
1.4901 + seekPos = K2GBMinusOne;
1.4902 + TestRFile1.Seek(ESeekStart,seekPos);
1.4903 + TestRFile1.Read(readBuf99);
1.4904 + test(writeBuf99 == readBuf99); // Written data == Read data
1.4905 + // Query Size
1.4906 + TestRFile1.Size(size);
1.4907 + test(size == K2GBPlus98); // Validate the file size
1.4908 +
1.4909 + TBuf8<0x63> readBufx63;
1.4910 + TBuf8<0x63> writeBufx63;
1.4911 + size = 0;
1.4912 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) //File Systems supporting size of upto 4GB-1
1.4913 + {
1.4914 + TestRFile1.SetSize(K4GBMinusOne);
1.4915 + TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
1.4916 + test(seekPos == K4GBMinusOne);
1.4917 + for (TInt count = 0; count < 0x63; count++)
1.4918 + {
1.4919 + writeBufx63.Append(count+2);
1.4920 + }
1.4921 + TestRFile1.Write(writeBufx63);
1.4922 + TestRFile1.Size(size);
1.4923 + test(size == K4GBMinusOne);
1.4924 + }
1.4925 + else
1.4926 + { //-- the currenc file system supports files larger than 4G-1
1.4927 + TestRFile1.SetSize(K4GB+10);
1.4928 + TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
1.4929 + test(seekPos == K4GB+10);
1.4930 + for (TInt count = 0; count < 0x63; count++)
1.4931 + {
1.4932 + writeBufx63.Append(count+2);
1.4933 + }
1.4934 + TestRFile1.Write(writeBufx63);
1.4935 + TestRFile1.Size(size);
1.4936 + test(size == K4GB+109);
1.4937 + TestRFile1.Read(readBufx63); // validating the content
1.4938 + }
1.4939 +
1.4940 + TestRFile1.Close();
1.4941 +
1.4942 + TInt r = TheFs.Delete(fileName);
1.4943 + test(r == KErrNone);
1.4944 + test.End();
1.4945 + }
1.4946 +
1.4947 +/**
1.4948 +@SYMTestCaseID PBASE-T_FILE64BIT-2350
1.4949 +@SYMTestPriority High
1.4950 +@SYMTestRequirement REQ9529
1.4951 +@SYMTestType CIT
1.4952 +@SYMTestCaseDesc Test RFile64::Seek(), Read() & Write() functionality for asynchronous calls
1.4953 +
1.4954 + IMPORT_C void Read(TDes8 &aDes, TRequestStatus &aStatus) const;
1.4955 + IMPORT_C void Write(const TDesC8 &aDes, TRequestStatus &aStatus);
1.4956 +@SYMTestActions
1.4957 +1) Open the large file, Set the File Size to 2GB-1
1.4958 +2) File Seek with: Mode= ESeekCurrent, position = 2GB-100
1.4959 +3) Write to a file with current position and length = 99
1.4960 +4) Seek the file: Mode= ESeekStart, position = 2GB-100
1.4961 +5) Read a file with current position and length =99
1.4962 +6) Compare the read data with written data
1.4963 +7) Seek the file: Mode = ESeekEnd
1.4964 +8) Write to a file with current position and length =99
1.4965 +9) Set the file size to 4GB-1
1.4966 +10)Check for FAT32 File system. Seek the file: Mode = ESeekEnd
1.4967 +11)Write to a file with current position and length =99
1.4968 +12)If NGFS is supported, Set the file size to 4GB+10
1.4969 +13)Seek the file: Mode = ESeekEnd
1.4970 +14)Write to a file with current position and length =99
1.4971 +@SYMTestExpectedResults
1.4972 +1) KErrNone, open is successful
1.4973 +2) KErrNone, Seek Position = 2GB-100
1.4974 +3) KErrNone, write is successful
1.4975 +4) KErrNone, Seek Position = 2GB-100
1.4976 +5) KErrNone, read is successful
1.4977 +6) Read data == written data
1.4978 +7) KErrNone
1.4979 +8) KErrNone, write is successful
1.4980 +9) KErrNone
1.4981 +10)KErrNone
1.4982 +11)
1.4983 +12)KErrNone
1.4984 +13)KErrNone
1.4985 +14)KErrNone
1.4986 +@SYMTestStatus Implemented
1.4987 +*/
1.4988 +void TestSeekAsyncReadWrite()
1.4989 + {
1.4990 + TBuf8<0x63> readBuf;
1.4991 + TBuf8<0x63> writeBuf;
1.4992 + TInt count;
1.4993 + TFileName fileName;
1.4994 + fileName.Append(gDriveToTest);
1.4995 + fileName.Append(KTestPath);
1.4996 + fileName.Append(_L("File4GBMinusOne.txt"));
1.4997 +
1.4998 + test.Start(_L("Test RFile64::Seek(), RFile64::Read() & RFile64::Write() for Asynchronous calls\n"));
1.4999 +
1.5000 + TestRFile1.Replace(fileName,EFileWrite|EFileShareAny);
1.5001 +
1.5002 + for (count = 0; count < 0x63; count++)
1.5003 + {
1.5004 + writeBuf.Append(count);
1.5005 + }
1.5006 +
1.5007 + test.Next(_L("Single file tests"));
1.5008 + TestRFile1.SetSize(K2GBMinusOne);
1.5009 + TInt64 seekPos = K2GBMinus100;
1.5010 + TestRFile1.Seek(ESeekCurrent,seekPos);
1.5011 + seekPos = 0;
1.5012 + TestRFile1.Seek(ESeekCurrent,seekPos);
1.5013 + test(seekPos == K2GBMinus100);
1.5014 +
1.5015 + TRequestStatus status1 = KRequestPending;
1.5016 + TestRFile1.Write(writeBuf,status1); // Write 99 bytes of data to a file
1.5017 + seekPos = 0;
1.5018 + TestRFile1.Seek(ESeekCurrent,seekPos);
1.5019 + test(seekPos == K2GBMinusOne);
1.5020 + seekPos = K2GBMinus100;
1.5021 + TestRFile1.Seek(ESeekStart,seekPos);
1.5022 + TRequestStatus status2 = KRequestPending;
1.5023 + TestRFile1.Read(readBuf, status2);
1.5024 + test(writeBuf == readBuf); // Written data == Read data
1.5025 +
1.5026 + TBuf8<0x63> writeBuf99;
1.5027 + TBuf8<0x63> readBuf99;
1.5028 + TInt64 size = 0;
1.5029 + TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
1.5030 + test(seekPos == K2GBMinusOne);
1.5031 + for (count = 0; count < 0x63; count++)
1.5032 + {
1.5033 + writeBuf99.Append(count+1);
1.5034 + }
1.5035 + TRequestStatus status3 = KRequestPending;
1.5036 + TestRFile1.Write(writeBuf99, status3);
1.5037 + seekPos = K2GBMinusOne;
1.5038 + TestRFile1.Seek(ESeekStart,seekPos);
1.5039 + TRequestStatus status4 = KRequestPending;
1.5040 + TestRFile1.Read(readBuf99, status4);
1.5041 + test(writeBuf99 == readBuf99); // Written data == Read data
1.5042 + // Query Size
1.5043 + TestRFile1.Size(size);
1.5044 + test(size == K2GBPlus98); // Validate the file size
1.5045 +
1.5046 + TBuf8<0x63> readBufx63;
1.5047 + TBuf8<0x63> writeBufx63;
1.5048 + size = 0;
1.5049 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)//File Systems supporting size of upto 4GB-1
1.5050 + {
1.5051 + TestRFile1.SetSize(K4GBMinusOne);
1.5052 + TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
1.5053 + test(seekPos == K4GBMinusOne);
1.5054 + for (TInt count = 0; count < 0x63; count++)
1.5055 + {
1.5056 + writeBufx63.Append(count+2);
1.5057 + }
1.5058 + TRequestStatus status5 = KRequestPending;
1.5059 + TestRFile1.Write(writeBufx63, status5);
1.5060 + TestRFile1.Size(size);
1.5061 + test(size == K4GBMinusOne);
1.5062 + }
1.5063 + else
1.5064 + {
1.5065 + TestRFile1.SetSize(K4GB+10);
1.5066 + TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
1.5067 + test(seekPos == K4GB+10);
1.5068 + for (TInt count = 0; count < 0x63; count++)
1.5069 + {
1.5070 + writeBufx63.Append(count+2);
1.5071 + }
1.5072 + TRequestStatus status7 = KRequestPending;
1.5073 + TestRFile1.Write(writeBufx63, status7);
1.5074 + TestRFile1.Size(size);
1.5075 + test(size == K4GB+109);
1.5076 + TRequestStatus status8 = KRequestPending;;
1.5077 + TestRFile1.Read(readBufx63, status8); // validating the content
1.5078 + }
1.5079 + TestRFile1.Close();
1.5080 +
1.5081 + TInt r = TheFs.Delete(fileName);
1.5082 + test(r == KErrNone);
1.5083 + test.End();
1.5084 + }
1.5085 +
1.5086 +/**
1.5087 +@SYMTestCaseID PBASE-T_FILE64BIT-2351
1.5088 +@SYMTestPriority High
1.5089 +@SYMTestRequirement REQ9529
1.5090 +@SYMTestType CIT
1.5091 +@SYMTestCaseDesc Test RFile64::Seek(), Read() & Write() functionality for synchronous calls with length
1.5092 +
1.5093 + IMPORT_C TInt Read(TDes8 &aDes, TInt aLength) const;
1.5094 + IMPORT_C TInt Write(const TDesC8 &aDes, TInt aLength);
1.5095 +@SYMTestActions
1.5096 +1) Open the large file, Set the File Size to 2GB-1
1.5097 +2) File Seek with: Mode= ESeekCurrent, position = 2GB-100
1.5098 +3) Write to a file with current position and length = 99
1.5099 +4) Seek the file: Mode= ESeekStart, position = 2GB-100
1.5100 +5) Read a file with current position and length =99
1.5101 +6) Compare the read data with written data
1.5102 +7) Seek the file: Mode = ESeekEnd
1.5103 +8) Write to a file with current position and length =99
1.5104 +9) Set the file size to 4GB-1
1.5105 +10)Check for FAT32 File system. Seek the file: Mode = ESeekEnd
1.5106 +11)Write to a file with current position and length =99
1.5107 +12)If NGFS is supported, Set the file size to 4GB+10
1.5108 +13)Seek the file: Mode = ESeekEnd
1.5109 +14)Write to a file with current position and length =99
1.5110 +@SYMTestExpectedResults
1.5111 +1) KErrNone, open is successful
1.5112 +2) KErrNone, Seek Position = 2GB-100
1.5113 +3) KErrNone, write is successful
1.5114 +4) KErrNone, Seek Position = 2GB-100
1.5115 +5) KErrNone, read is successful
1.5116 +6) Read data == written data
1.5117 +7) KErrNone
1.5118 +8) KErrNone, write is successful
1.5119 +9) KErrNone
1.5120 +10)KErrNone
1.5121 +11)
1.5122 +12)KErrNone
1.5123 +13)KErrNone
1.5124 +14)KErrNone
1.5125 +@SYMTestStatus Implemented
1.5126 +*/
1.5127 +void TestSeekReadWriteLen()
1.5128 + {
1.5129 + TBuf8<0x63> readBuf;
1.5130 + TBuf8<0x63> writeBuf;
1.5131 + TInt count;
1.5132 + TFileName fileName;
1.5133 + fileName.Append(gDriveToTest);
1.5134 + fileName.Append(KTestPath);
1.5135 + fileName.Append(_L("File4GBMinusOne.txt"));
1.5136 +
1.5137 + test.Start(_L("Test RFile64::Seek(), RFile64::Read() & RFile64::Write() with Length\n"));
1.5138 +
1.5139 + TestRFile1.Replace(fileName,EFileWrite|EFileShareAny);
1.5140 +
1.5141 + for (count = 0; count < 0x63; count++)
1.5142 + {
1.5143 + writeBuf.Append(count);
1.5144 + }
1.5145 +
1.5146 + test.Next(_L("Single file tests"));
1.5147 +
1.5148 + test.Next(_L("Open the large file, Set the File Size to 2GB-1\n"));
1.5149 + TestRFile1.SetSize(K2GBMinusOne);
1.5150 +
1.5151 + test.Next(_L("File Seek with: Mode= ESeekCurrent, position = 2GB-100\n"));
1.5152 + TInt64 seekPos = K2GBMinus100;
1.5153 + TestRFile1.Seek(ESeekCurrent,seekPos);
1.5154 + seekPos = 0;
1.5155 + TestRFile1.Seek(ESeekCurrent,seekPos);
1.5156 + test(seekPos == K2GBMinus100);
1.5157 +
1.5158 + test.Next(_L("Write to a file with current position and length = 99\n"));
1.5159 + TestRFile1.Write(writeBuf, 99); // Write 99 bytes of data to a file
1.5160 + seekPos = 0;
1.5161 + TestRFile1.Seek(ESeekCurrent,seekPos);
1.5162 + test(seekPos == K2GBMinusOne);
1.5163 +
1.5164 + test.Next(_L("Seek the file: Mode= ESeekStart, position = 2GB-100\n"));
1.5165 + seekPos = K2GBMinus100;
1.5166 + TestRFile1.Seek(ESeekStart,seekPos);
1.5167 +
1.5168 + test.Next(_L("Read a file with current position and length =99\n"));
1.5169 + TestRFile1.Read(readBuf, 99);
1.5170 +
1.5171 + test.Next(_L("Compare the read data with written data\n"));
1.5172 + test(writeBuf == readBuf); // Written data == Read data
1.5173 +
1.5174 + test.Next(_L("Seek the file: Mode = ESeekEnd\n"));
1.5175 + TBuf8<0x63> writeBuf99;
1.5176 + TBuf8<0x63> readBuf99;
1.5177 + TInt64 size = 0;
1.5178 + TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
1.5179 + test(seekPos == K2GBMinusOne);
1.5180 +
1.5181 + test.Next(_L("Write to a file with current position and length =99\n"));
1.5182 + for (count = 0; count < 0x63; count++)
1.5183 + {
1.5184 + writeBuf99.Append(count+1);
1.5185 + }
1.5186 + TestRFile1.Write(writeBuf99, 99);
1.5187 + seekPos = K2GBMinusOne;
1.5188 + TestRFile1.Seek(ESeekStart,seekPos);
1.5189 + TestRFile1.Read(readBuf99, 99);
1.5190 + test(writeBuf99 == readBuf99); // Written data == Read data
1.5191 + // Query Size
1.5192 + TestRFile1.Size(size);
1.5193 + test(size == K2GBPlus98); // Validate the file size
1.5194 +
1.5195 + TBuf8<0x63> readBufx63;
1.5196 + TBuf8<0x63> writeBufx63;
1.5197 + size = 0;
1.5198 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)//File Systems supporting size of upto 4GB-1
1.5199 + {
1.5200 + TestRFile1.SetSize(K4GBMinusOne);
1.5201 + TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
1.5202 + test(seekPos == K4GBMinusOne);
1.5203 + for (TInt count = 0; count < 0x63; count++)
1.5204 + {
1.5205 + writeBufx63.Append(count+2);
1.5206 + }
1.5207 + TestRFile1.Write(writeBufx63, 99);
1.5208 + TestRFile1.Size(size);
1.5209 + test(size == K4GBMinusOne);
1.5210 + }
1.5211 + else
1.5212 + {
1.5213 + TestRFile1.SetSize(K4GB+10);
1.5214 + TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
1.5215 + test(seekPos == K4GB+10);
1.5216 + for (TInt count = 0; count < 0x63; count++)
1.5217 + {
1.5218 + writeBufx63.Append(count+2);
1.5219 + }
1.5220 + TestRFile1.Write(writeBufx63, 99);
1.5221 + TestRFile1.Size(size);
1.5222 + test(size == K4GB+109);
1.5223 + TestRFile1.Read(readBufx63, 99); // validating the content
1.5224 + }
1.5225 +
1.5226 + TestRFile1.Close();
1.5227 +
1.5228 + TInt r = TheFs.Delete(fileName);
1.5229 + test(r == KErrNone);
1.5230 + test.End();
1.5231 + }
1.5232 +/**
1.5233 +@SYMTestCaseID PBASE-T_FILE64BIT-2352
1.5234 +@SYMTestPriority High
1.5235 +@SYMTestRequirement REQ9529
1.5236 +@SYMTestType CIT
1.5237 +@SYMTestCaseDesc Test RFile64::Seek(), Read() & Write() functionality for asynchronous calls with length
1.5238 + IMPORT_C void Read(TDes8 &aDes, TRequestStatus &aStatus) const;
1.5239 + IMPORT_C void Write(const TDesC8 &aDes, TRequestStatus &aStatus);
1.5240 +@SYMTestActions
1.5241 +1) Open the large file, Set the File Size to 2GB-1
1.5242 +2) File Seek with: Mode= ESeekCurrent, position = 2GB-100
1.5243 +3) Write to a file with current position and length = 99
1.5244 +4) Seek the file: Mode= ESeekStart, position = 2GB-100
1.5245 +5) Read a file with current position and length =99
1.5246 +6) Compare the read data with written data
1.5247 +7) Seek the file: Mode = ESeekEnd
1.5248 +8) Write to a file with current position and length =99
1.5249 +9) Set the file size to 4GB-1
1.5250 +10)Check for FAT32 File system. Seek the file: Mode = ESeekEnd
1.5251 +11)Write to a file with current position and length =99
1.5252 +12)If NGFS is supported, Set the file size to 4GB+10
1.5253 +13)Seek the file: Mode = ESeekEnd
1.5254 +14)Write to a file with current position and length =99
1.5255 +@SYMTestExpectedResults
1.5256 +1) KErrNone, open is successful
1.5257 +2) KErrNone, Seek Position = 2GB-100
1.5258 +3) KErrNone, write is successful
1.5259 +4) KErrNone, Seek Position = 2GB-100
1.5260 +5) KErrNone, read is successful
1.5261 +6) Read data == written data
1.5262 +7) KErrNone
1.5263 +8) KErrNone, write is successful
1.5264 +9) KErrNone
1.5265 +10)KErrNone
1.5266 +11)
1.5267 +12)KErrNone
1.5268 +13)KErrNone
1.5269 +14)KErrNone
1.5270 +@SYMTestStatus Implemented
1.5271 +*/
1.5272 +
1.5273 +void TestSeekAsyncReadWriteLen()
1.5274 + {
1.5275 + TBuf8<0x63> readBuf;
1.5276 + TBuf8<0x63> writeBuf;
1.5277 + TInt count;
1.5278 + TFileName fileName;
1.5279 + fileName.Append(gDriveToTest);
1.5280 + fileName.Append(KTestPath);
1.5281 + fileName.Append(_L("File4GBMinusOne.txt"));
1.5282 +
1.5283 +
1.5284 + test.Start(_L("Test RFile64::Seek, RFile64::Read & RFile64::Write\n"));
1.5285 +
1.5286 + test.Next(_L("Open the large file, Set the File Size to 2GB-1\n"));
1.5287 + TestRFile1.Replace(fileName,EFileWrite|EFileShareAny);
1.5288 +
1.5289 + for (count = 0; count < 0x63; count++)
1.5290 + {
1.5291 + writeBuf.Append(count);
1.5292 + }
1.5293 +
1.5294 + test.Next(_L("Single file tests"));
1.5295 + TestRFile1.SetSize(K2GBMinusOne);
1.5296 +
1.5297 + test.Next(_L("File Seek with: Mode= ESeekCurrent, position = 2GB-100\n"));
1.5298 + TInt64 seekPos = K2GBMinus100;
1.5299 + TestRFile1.Seek(ESeekCurrent,seekPos);
1.5300 + seekPos = 0;
1.5301 + TestRFile1.Seek(ESeekCurrent,seekPos);
1.5302 + test(seekPos == K2GBMinus100);
1.5303 +
1.5304 + test.Next(_L("Write to a file with current position and length = 99"));
1.5305 + TRequestStatus status1 = KRequestPending;
1.5306 + TestRFile1.Write(writeBuf,99,status1); // Write 99 bytes of data to a file
1.5307 +
1.5308 + test.Next(_L("Seek the file: Mode= ESeekStart, position = 2GB-100\n"));
1.5309 + seekPos = 0;
1.5310 + TestRFile1.Seek(ESeekCurrent,seekPos);
1.5311 + test(seekPos == K2GBMinusOne);
1.5312 + seekPos = K2GBMinus100;
1.5313 + TestRFile1.Seek(ESeekStart,seekPos);
1.5314 +
1.5315 + test.Next(_L("Read a file with current position and length =99\n"));
1.5316 + TRequestStatus status2 = KRequestPending;
1.5317 + TestRFile1.Read(readBuf,99,status2);
1.5318 +
1.5319 + test.Next(_L("Compare the read data with written data\n"));
1.5320 + test(writeBuf == readBuf); // Written data == Read data
1.5321 +
1.5322 + test.Next(_L("Seek the file: Mode = ESeekEnd\n"));
1.5323 + TBuf8<0x63> writeBuf99;
1.5324 + TBuf8<0x63> readBuf99;
1.5325 + TInt64 size = 0;
1.5326 + TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
1.5327 + test(seekPos == K2GBMinusOne);
1.5328 + for (count = 0; count < 0x63; count++)
1.5329 + {
1.5330 + writeBuf99.Append(count+1);
1.5331 + }
1.5332 +
1.5333 + test.Next(_L("Write to a file with current position and length =99\n"));
1.5334 + TRequestStatus status3 = KRequestPending;
1.5335 + TestRFile1.Write(writeBuf99,99,status3);
1.5336 + seekPos = K2GBMinusOne;
1.5337 + TestRFile1.Seek(ESeekStart,seekPos);
1.5338 + TRequestStatus status4 = KRequestPending;
1.5339 + TestRFile1.Read(readBuf99,99,status4);
1.5340 + test(writeBuf99 == readBuf99); // Written data == Read data
1.5341 + // Query Size
1.5342 + TestRFile1.Size(size);
1.5343 + test(size == K2GBPlus98); // Validate the file size
1.5344 +
1.5345 + TBuf8<0x63> readBufx63;
1.5346 + TBuf8<0x63> writeBufx63;
1.5347 + size = 0;
1.5348 + if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) //File Systems supporting size of upto 4GB-1
1.5349 + {
1.5350 + test.Next(_L("Set the file size to 4GB-1\n"));
1.5351 + TestRFile1.SetSize(K4GBMinusOne);
1.5352 + TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
1.5353 + test(seekPos == K4GBMinusOne);
1.5354 + for (TInt count = 0; count < 0x63; count++)
1.5355 + {
1.5356 + writeBufx63.Append(count+2);
1.5357 + }
1.5358 + TRequestStatus status5 = KRequestPending;
1.5359 + TestRFile1.Write(writeBufx63,99,status5);
1.5360 + TestRFile1.Size(size);
1.5361 + test(size == K4GBMinusOne);
1.5362 + }
1.5363 + else
1.5364 + {
1.5365 + TestRFile1.SetSize(K4GB+10);
1.5366 + TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
1.5367 + test(seekPos == K4GB+10);
1.5368 + for (TInt count = 0; count < 0x63; count++)
1.5369 + {
1.5370 + writeBufx63.Append(count+2);
1.5371 + }
1.5372 + TRequestStatus status7 = KRequestPending;
1.5373 + TestRFile1.Write(writeBufx63,99,status7);
1.5374 + TestRFile1.Size(size);
1.5375 + test(size == K4GB+109);
1.5376 + TRequestStatus status8 = KRequestPending;;
1.5377 + TestRFile1.Read(readBufx63,99,status8);
1.5378 + }
1.5379 + TestRFile1.Close();
1.5380 + TInt r = TheFs.Delete(fileName);
1.5381 + test(r == KErrNone);
1.5382 + test.End();
1.5383 + }
1.5384 +/**
1.5385 +@SYMTestCaseID PBASE-T_FILE64BIT-2353
1.5386 +@SYMTestPriority High
1.5387 +@SYMTestRequirement REQ9529
1.5388 +@SYMTestType CIT
1.5389 +@SYMTestCaseDesc Tests File resizing functionality
1.5390 +@SYMTestActions
1.5391 +1) Create a file name "test" in write mode
1.5392 +2) Generate a random file size
1.5393 +3) Set the file size using RFile64::SetSize()
1.5394 +4) Get the file size.
1.5395 +5) Seek to the file position RFile64::Size() -100 & File position >0
1.5396 +6) Write 99 bytes to the current file position
1.5397 +7) Read from the current file position.
1.5398 +8) Compare the file read with written data.
1.5399 +9) Repeat step 2 to 8 for <10> times in a loop.
1.5400 +10) Close the file
1.5401 +@SYMTestExpectedResults
1.5402 +1) File create successfully.
1.5403 +2) Ramdom file size generated.
1.5404 +3) File size set successfully.
1.5405 +4) File size = Random file size set.
1.5406 +5) File seek successful.
1.5407 +6) File write successful with KErrNone.
1.5408 +7) File read successful with KErrNone.
1.5409 +8) Read data == Written data.
1.5410 +9) Expect result same as step 2 to 8.
1.5411 +10) File closed successfully.
1.5412 +@SYMTestStatus Implemented
1.5413 +*/
1.5414 +void TestFileReSize()
1.5415 + {
1.5416 + TInt64 seed = K4GBMinusOne;
1.5417 + TBuf8<0x63> readBuf;
1.5418 + TBuf8<0x63> writeBuf;
1.5419 + TFileName fileName;
1.5420 + fileName.Append(gDriveToTest);
1.5421 + fileName.Append(KTestPath);
1.5422 + fileName.Append(_L("test.txt"));
1.5423 + for (TInt count = 0; count < 0x63; count++)
1.5424 + {
1.5425 + writeBuf.Append(count);
1.5426 + }
1.5427 + test.Next(_L("Create a file name test in write mode\n"));
1.5428 + TestRFile1.Replace(fileName, EFileWrite);
1.5429 + TInt randSize;
1.5430 + TInt64 size;
1.5431 + for (TInt i = 0; i<10; i++)
1.5432 + {
1.5433 + test.Next(_L("Generate a random file size\n"));
1.5434 + randSize = Math::Rand(seed);
1.5435 +
1.5436 + test.Next(_L("Set the file size using RFile64::SetSize()\n"));
1.5437 + TestRFile1.SetSize(randSize);
1.5438 +
1.5439 + test.Next(_L("Get the file size.\n"));
1.5440 + TestRFile1.Size(size);
1.5441 + test(randSize == size);
1.5442 +
1.5443 + test.Next(_L("Seek to the file position RFile64::Size() -100 & File position >0\n"));
1.5444 + TInt64 seekPos = size - 100;
1.5445 + if(size>100) //carry out tests for file sizes greater than 100 bytes
1.5446 + {
1.5447 + TestRFile1.Seek(ESeekStart,seekPos);
1.5448 + TRequestStatus status1 = KRequestPending;
1.5449 +
1.5450 + test.Next(_L("Write 99 bytes to the current file position\n"));
1.5451 + TestRFile1.Write(writeBuf,99,status1); // Write 99 bytes of data to a file
1.5452 + TestRFile1.Seek(ESeekStart,seekPos);
1.5453 +
1.5454 +
1.5455 + test.Next(_L("Read from the current file position.\n"));
1.5456 + TRequestStatus status2 = KRequestPending;
1.5457 +
1.5458 + test.Next(_L("Compare the file read with written data.\n"));
1.5459 + TestRFile1.Read(readBuf,99,status2);
1.5460 + test(writeBuf == readBuf); // Written data == Read data
1.5461 + }
1.5462 + }
1.5463 + TestRFile1.Close();
1.5464 + TInt r = TheFs.Delete(fileName);
1.5465 + test(r == KErrNone);
1.5466 + }
1.5467 +/**
1.5468 +@SYMTestCaseID PBASE-T_FILE64BIT-2354
1.5469 +@SYMTestPriority High
1.5470 +@SYMTestRequirement REQ9532
1.5471 +@SYMTestType CIT
1.5472 +@SYMTestCaseDesc Tests for copying a directory containing large files using CFileMan::Copy()
1.5473 +@SYMTestActions
1.5474 +1) Create one large file in the specified test path
1.5475 +2) Set the file size to 3GB-4KB
1.5476 +3) Seek to the end of the file
1.5477 +4) Check the seek position
1.5478 +5) Write to a file with position = 3GB-4KB and length = 4KB
1.5479 +6) Get the file size
1.5480 +7) Create 3 small files in the specified test path
1.5481 +8) Write 10 bytes to the created files
1.5482 +9) Copy the files from one folder to another using CFileMan::Copy()
1.5483 +10)Get the directory entry and find how many files are copied
1.5484 +11)Set file man observer
1.5485 +12)Copy the files from one folder to another, source folder has 3 small files and a large file
1.5486 +13)Check observer for number of successful copy and failed copy
1.5487 +14)Get the directory entry and find how many files copied
1.5488 +@SYMTestExpectedResults
1.5489 +1) KErrNone, file created successfully
1.5490 +2) KErrNone
1.5491 +3) KErrNone
1.5492 +4) Seek position = 3GB-4KB
1.5493 +5) KErrNone, write is successful
1.5494 +6) File size = 3GB
1.5495 +7) KErrNone, 3 small files created successfully
1.5496 +8) KErrNone, write is successful
1.5497 +9) KErrNone, copy is successful
1.5498 +10)4 files copied successfully
1.5499 +11)KErrNone
1.5500 +12)KErrNone, copy is successful
1.5501 +13)Number of success file copy = 4, Failed = 0
1.5502 +14)4 files copied successfully
1.5503 +@SYMTestStatus Implemented
1.5504 +*/
1.5505 +
1.5506 +void TestCopyDirectory()
1.5507 + {
1.5508 + test.Next(_L("Copy a directory containing large files"));
1.5509 + CFileMan* fileMan = CFileMan::NewL(TheFs);
1.5510 + test(fileMan != NULL);
1.5511 +
1.5512 + CFileManObserver* observer = new CFileManObserver(fileMan);
1.5513 + test(observer != NULL);
1.5514 +
1.5515 + TPath filePathOld;
1.5516 + filePathOld.Append(gDriveToTest);
1.5517 + filePathOld.Append(KTestPath);
1.5518 +
1.5519 +
1.5520 + TPath filePathNew;
1.5521 + filePathNew.Append(gDriveToTest);
1.5522 + filePathNew.Append(_L(":\\TEST\\"));
1.5523 +
1.5524 +
1.5525 + // create some small files in the source directory
1.5526 + // so that there is a combination of small files and one large files
1.5527 + RDir dir;
1.5528 + TEntryArray entryArray;
1.5529 +
1.5530 + TFileName fileLarge1;
1.5531 + fileLarge1.Append(gDriveToTest);
1.5532 + fileLarge1.Append(KTestPath);
1.5533 + fileLarge1.Append(_L("FileLargeOne.txt"));
1.5534 +
1.5535 + test.Next(_L(" Create one large file in the specified test path\n"));
1.5536 + TestRFile1.Replace(fileLarge1, EFileWrite | EFileShareAny);
1.5537 +
1.5538 +
1.5539 + test.Next(_L("Set the file size to 3GB-4KB\n"));
1.5540 + TestRFile1.SetSize(K3GB-K4KB);
1.5541 + TInt64 size1 = 0;
1.5542 + TestRFile1.Size(size1);
1.5543 +
1.5544 + test.Next(_L("Seek to the end of the file\n"));
1.5545 + TInt64 seekPos = 0;
1.5546 + TestRFile1.Seek(ESeekEnd,seekPos);
1.5547 + test(seekPos == K3GB-K4KB);
1.5548 +
1.5549 + test.Next(_L("Write to a file with position = 3GB-4KB and length = 4KB\n"));
1.5550 + TBuf8<4096> writeBufK4KB;
1.5551 + for (TInt count = 0; count < 4096; count++)
1.5552 + {
1.5553 + writeBufK4KB.Append(count+1);
1.5554 + }
1.5555 + TestRFile1.Write(seekPos, writeBufK4KB, writeBufK4KB.Length());
1.5556 + TestRFile1.Size(size1);
1.5557 + test.Next(_L("Get the file size\n"));
1.5558 + TInt64 size = 0;
1.5559 + TestRFile1.Size(size);
1.5560 + test(size == K3GB);
1.5561 + TestRFile1.Close();
1.5562 +
1.5563 + test.Next(_L("Create 3 small files in the specified test path and Write 10 bytes to the created files\n"));
1.5564 + TFileName fileSmall1;
1.5565 + fileSmall1.Append(gDriveToTest);
1.5566 + fileSmall1.Append(KTestPath);
1.5567 + fileSmall1.Append(_L("FileSmallOne.txt"));
1.5568 +
1.5569 + TFileName fileSmall2;
1.5570 + fileSmall2.Append(gDriveToTest);
1.5571 + fileSmall2.Append(KTestPath);
1.5572 + fileSmall2.Append(_L("FileSmallTwo.txt"));
1.5573 +
1.5574 + TFileName fileSmall3;
1.5575 + fileSmall3.Append(gDriveToTest);
1.5576 + fileSmall3.Append(KTestPath);
1.5577 + fileSmall3.Append(_L("FileSmallThree.txt"));
1.5578 +
1.5579 + TestRFile1.Create(fileSmall1, EFileWrite | EFileShareAny);
1.5580 + TestRFile1.Write(_L8("1234567891"));
1.5581 + TestRFile1.Close();
1.5582 +
1.5583 + TestRFile1.Create(fileSmall2, EFileWrite | EFileShareAny);
1.5584 + TestRFile1.Write(_L8("1234567891"));
1.5585 + TestRFile1.Close();
1.5586 +
1.5587 + TestRFile1.Create(fileSmall3, EFileWrite | EFileShareAny);
1.5588 + TestRFile1.Write(_L8("1234567891"));
1.5589 + TestRFile1.Close();
1.5590 +
1.5591 + test.Next(_L("Copy the files from one folder to another using CFileMan::Copy()\n"));
1.5592 + TInt r = fileMan->Copy(filePathOld, filePathNew, CFileMan::ERecurse | CFileMan::EOverWrite);
1.5593 + test(r == KErrNone || r == KErrTooBig);
1.5594 +
1.5595 + test.Next(_L("Get the directory entry and find how many files are copied\n"));
1.5596 + // check SMALL and LARGE files have been copied
1.5597 + r = dir.Open(TheFs, filePathNew, KEntryAttNormal);
1.5598 + test (r == KErrNone);
1.5599 + r = dir.Read(entryArray);
1.5600 + test (r == KErrEof);
1.5601 + test(entryArray.Count() == gFilesInDirectory);
1.5602 + dir.Close();
1.5603 +
1.5604 + // then delete the new directory
1.5605 + r = fileMan->Delete(filePathNew);
1.5606 + test(r == KErrNone);
1.5607 +
1.5608 + test.Next(_L("Set file man observer\n"));
1.5609 + // attempt to copy to new directory again - this time with an observer
1.5610 + fileMan->SetObserver(observer);
1.5611 +
1.5612 + test.Next(_L("Copy the files from one folder to another, source folder has 3 small files and a large file\n"));
1.5613 + r = fileMan->Copy(filePathOld, filePathNew, CFileMan::ERecurse | CFileMan::EOverWrite);
1.5614 + test(r == KErrNone || r == KErrTooBig);
1.5615 +
1.5616 + test.Next(_L("Check observer for number of successful copy and failed copy\n"));
1.5617 + // test that 3 small files and 1 large file were copied
1.5618 + // (For 8 GB disk, the 4GB file is missing)
1.5619 + test(observer->iNotifyEndedSuccesses == gFilesInDirectory);
1.5620 + test(observer->iNotifyEndedFailures == 0);
1.5621 +
1.5622 + test.Next(_L("Get the directory entry and find how many files copied\n"));
1.5623 + // check SMALL files have been copied
1.5624 + r = dir.Open(TheFs, filePathNew, KEntryAttNormal);
1.5625 + test (r == KErrNone);
1.5626 + r = dir.Read(entryArray);
1.5627 + test (r == KErrEof);
1.5628 +
1.5629 + test(entryArray.Count() == gFilesInDirectory);
1.5630 + dir.Close();
1.5631 +
1.5632 + // then delete the new directory
1.5633 + r = fileMan->Delete(filePathNew);
1.5634 + test(r == KErrNone);
1.5635 +
1.5636 + delete observer;
1.5637 + delete fileMan;
1.5638 +
1.5639 + r = TheFs.Delete(fileSmall1);
1.5640 + test(r == KErrNone);
1.5641 + r = TheFs.Delete(fileSmall2);
1.5642 + test(r == KErrNone);
1.5643 + r = TheFs.Delete(fileSmall3);
1.5644 + test(r == KErrNone);
1.5645 + r = TheFs.Delete(fileLarge1);
1.5646 + test(r == KErrNone);
1.5647 + }
1.5648 +/**
1.5649 +@SYMTestCaseID PBASE-T_FILE64BIT-2355
1.5650 +@SYMTestPriority High
1.5651 +@SYMTestRequirement REQ9532
1.5652 +@SYMTestType CIT
1.5653 +@SYMTestCaseDesc Tests for moving a directory containing large files using CFileMan::Move()
1.5654 +@SYMTestActions
1.5655 +1) Create 3 small files and 1 large file
1.5656 +2) Write 10 bytes to the created files
1.5657 +3) Move the files from one folder to another using CFileMan Move
1.5658 +4) Get the directory entry and find how many files moved in a directory
1.5659 +5) Move the files back to the original folder
1.5660 +@SYMTestExpectedResults
1.5661 +1) KErrNone, files created successfully
1.5662 +2) KErrNone, write is successful
1.5663 +3) KErrNone
1.5664 +4) 4 files moved successfully
1.5665 +5) KErrNone
1.5666 +@SYMTestStatus Implemented
1.5667 +*/
1.5668 +void TestMoveDirectory()
1.5669 + {
1.5670 + test.Next(_L("Move a directory containing large files"));
1.5671 + CFileMan* fileMan = CFileMan::NewL(TheFs);
1.5672 + test(fileMan != NULL);
1.5673 +
1.5674 + TPath filePathOld;
1.5675 + filePathOld.Append(gDriveToTest);
1.5676 + filePathOld.Append(KTestPath);
1.5677 +
1.5678 +
1.5679 + TPath filePathNew;
1.5680 + filePathNew.Append(gDriveToTest);
1.5681 + filePathNew.Append(_L(":\\TEST\\"));
1.5682 +
1.5683 + test.Next(_L("Create 3 small files and 1 large file\n"));
1.5684 +
1.5685 + TFileName fileLarge1;
1.5686 + fileLarge1.Append(gDriveToTest);
1.5687 + fileLarge1.Append(KTestPath);
1.5688 + fileLarge1.Append(_L("FileLargeOne.txt"));
1.5689 + TestRFile1.Replace(fileLarge1, EFileWrite | EFileShareAny);
1.5690 + TestRFile1.SetSize(K4GB-1);
1.5691 + TestRFile1.Close();
1.5692 +
1.5693 +
1.5694 + TFileName fileSmall1;
1.5695 + fileSmall1.Append(gDriveToTest);
1.5696 + fileSmall1.Append(KTestPath);
1.5697 + fileSmall1.Append(_L("FileSmallOne.txt"));
1.5698 +
1.5699 + TFileName fileSmall2;
1.5700 + fileSmall2.Append(gDriveToTest);
1.5701 + fileSmall2.Append(KTestPath);
1.5702 + fileSmall2.Append(_L("FileSmallTwo.txt"));
1.5703 +
1.5704 + TFileName fileSmall3;
1.5705 + fileSmall3.Append(gDriveToTest);
1.5706 + fileSmall3.Append(KTestPath);
1.5707 + fileSmall3.Append(_L("FileSmallThree.txt"));
1.5708 +
1.5709 + TestRFile1.Create(fileSmall1, EFileWrite | EFileShareAny);
1.5710 + TestRFile1.Write(_L8("1234567891"));
1.5711 + TestRFile1.Close();
1.5712 +
1.5713 + TestRFile1.Create(fileSmall2, EFileWrite | EFileShareAny);
1.5714 + TestRFile1.Write(_L8("1234567891"));
1.5715 + TestRFile1.Close();
1.5716 +
1.5717 + TestRFile1.Create(fileSmall3, EFileWrite | EFileShareAny);
1.5718 + TestRFile1.Write(_L8("1234567891"));
1.5719 + TestRFile1.Close();
1.5720 +
1.5721 +
1.5722 + // move to new directory
1.5723 + TInt r = fileMan->Move(filePathOld, filePathNew, CFileMan::ERecurse | CFileMan::EOverWrite);
1.5724 + test(r == KErrNone || r == KErrTooBig);
1.5725 +
1.5726 + // check SMALL and LARGE files have been moved
1.5727 + RDir dir;
1.5728 + r = dir.Open(TheFs, filePathNew, KEntryAttNormal);
1.5729 + test (r == KErrNone);
1.5730 + TEntryArray entryArray;
1.5731 + r = dir.Read(entryArray);
1.5732 + test (r == KErrEof);
1.5733 + test(entryArray.Count() == 4);
1.5734 + dir.Close();
1.5735 +
1.5736 + // then delete the new directory
1.5737 + r = fileMan->Delete(filePathNew);
1.5738 + test(r == KErrNone);
1.5739 + delete fileMan;
1.5740 + }
1.5741 +
1.5742 +
1.5743 +static void TestOpenFiles()
1.5744 + {
1.5745 + TestOpen2GB();
1.5746 + TestOpen3GB();
1.5747 + TestOpen4GBMinusOne();
1.5748 + TestOpen4GB();
1.5749 + TestOpenMoreThan2GB();
1.5750 + TestOpenRFileRFile64();
1.5751 + TestCreateTempFile();
1.5752 + TestCreateRFile64();
1.5753 + TestReplaceRFile64();
1.5754 + TestReplaceRFile64RFs();
1.5755 + }
1.5756 +
1.5757 +static void TestAdoptFiles()
1.5758 + {
1.5759 + TInt r;
1.5760 + RFs fs;
1.5761 + r = fs.Connect();
1.5762 + test(r == KErrNone);
1.5763 + r = fs.ShareProtected();
1.5764 + test(r == KErrNone);
1.5765 + TFileName sessionp;
1.5766 + fs.SessionPath(sessionp);
1.5767 + r = fs.MkDirAll(sessionp);
1.5768 + test(r == KErrNone || r == KErrAlreadyExists);
1.5769 + fs.Close();
1.5770 + TestRFile64AdoptFromCreator();
1.5771 + TestRFile64AdoptFromClient();
1.5772 + TestRFile64AdoptFromServer();
1.5773 + }
1.5774 +
1.5775 +
1.5776 +static void TestReadFile()
1.5777 + {
1.5778 +//
1.5779 +//The order of these tests need to be preserved, since the first test creates
1.5780 +//a 4GB file, while the last one deletes it.
1.5781 +//
1.5782 + TestOpenAndReadSyncLargeFile();
1.5783 + TestOpenAndReadAsyncLargeFile();
1.5784 + TestOpenAndReadSyncLargeFileWithLen();
1.5785 + TestOpenAndReadAsyncLargeFileWithLen();
1.5786 + }
1.5787 +
1.5788 +static void TestWriteFile()
1.5789 + {
1.5790 + TestOpenAndWriteSyncLargeFile();
1.5791 + TestOpenAndWriteAsyncLargeFile();
1.5792 + TestOpenAndWriteSyncLargeFileWithLen();
1.5793 + TestOpenAndWriteAsyncLargeFileWithLen();
1.5794 + }
1.5795 +
1.5796 +static void TestFileAccess()
1.5797 + {
1.5798 + TestFileLock();
1.5799 + TestFileUnlock();
1.5800 + TestFileSeek();
1.5801 + TestFileSeekBigFile();
1.5802 + }
1.5803 +
1.5804 +static void TestLockUnLock()
1.5805 + {
1.5806 + TestReadWriteLock();
1.5807 + TestUnLock();
1.5808 + TestSeekReadWrite();
1.5809 + TestSeekAsyncReadWrite();
1.5810 + TestSeekReadWriteLen();
1.5811 + TestSeekAsyncReadWriteLen();
1.5812 + }
1.5813 +
1.5814 +static void TestCopyMoveDirectory()
1.5815 + {
1.5816 + TestCopyDirectory();
1.5817 + TestMoveDirectory();
1.5818 + }
1.5819 +
1.5820 +TInt testLockPanic(TAny* aPtr)
1.5821 + {
1.5822 + TInt aPos=128;
1.5823 + TInt aLen=-1;
1.5824 + RFile64 * ptr = (RFile64 *)aPtr;
1.5825 + TInt r=ptr->Lock(aPos, aLen);
1.5826 + test (KErrNone == r);
1.5827 + return KErrNone;
1.5828 + }
1.5829 +
1.5830 +TInt testUnLockPanic(TAny* aPtr)
1.5831 + {
1.5832 + TInt aPos=128;
1.5833 + TInt aLen=-1;
1.5834 + RFile64 * ptr = (RFile64 *)aPtr;
1.5835 + TInt r=ptr->UnLock(aPos, aLen);
1.5836 + test (KErrNone == r);
1.5837 + return KErrNone;
1.5838 + }
1.5839 +
1.5840 +TInt testSetSizePanic(TAny* aPtr)
1.5841 + {
1.5842 + TInt aSize=-1;
1.5843 + RFile64 * ptr = (RFile64 *)aPtr;
1.5844 + TInt r=ptr->SetSize(aSize);
1.5845 + test (KErrNone == r);
1.5846 + return KErrNone;
1.5847 + }
1.5848 +
1.5849 +static void TestRFile64NegLen()
1.5850 + {
1.5851 + test.Start(_L("Test RFile64::Lock, RFile64::Unlock, RFile64::SetSize and RFile::Write with Negative Length parameter"));
1.5852 +
1.5853 + test(TheFs.ShareProtected() == KErrNone);
1.5854 +
1.5855 + RFile64 aFile;
1.5856 + TInt r = aFile.Create(TheFs, _L("\\testRFile64NegLen.txt"), EFileWrite);
1.5857 + test((KErrNone == r) || (KErrAlreadyExists == r));
1.5858 +
1.5859 + TRequestStatus status = KRequestPending;
1.5860 +
1.5861 + // launch call on separate thread as expected to panic
1.5862 + // Test Lock with a negative length
1.5863 + User::SetJustInTime(EFalse);
1.5864 + RThread t;
1.5865 + test(t.Create(_L("testLockPanic"), testLockPanic, KDefaultStackSize, 0x2000, 0x2000, &aFile) == KErrNone);
1.5866 + t.Logon(status);
1.5867 + t.Resume();
1.5868 + User::WaitForRequest(status);
1.5869 + User::SetJustInTime(ETrue);
1.5870 + test(t.ExitType() == EExitPanic);
1.5871 + test(t.ExitReason() == 17);
1.5872 + t.Close();
1.5873 +
1.5874 + // Test Unlock with a negative length
1.5875 + User::SetJustInTime(EFalse);
1.5876 + status = KRequestPending;
1.5877 + test(t.Create(_L("testUnLockPanic"), testUnLockPanic, KDefaultStackSize, 0x2000, 0x2000, &aFile) == KErrNone);
1.5878 + t.Logon(status);
1.5879 + t.Resume();
1.5880 + User::WaitForRequest(status);
1.5881 + test(t.ExitType() == EExitPanic);
1.5882 + test(t.ExitReason() == 18);
1.5883 + t.Close();
1.5884 + User::SetJustInTime(ETrue);
1.5885 +
1.5886 + // Test SetSize with a negative length
1.5887 + User::SetJustInTime(EFalse);
1.5888 + status = KRequestPending;
1.5889 + test(t.Create(_L("testSetSizePanic"), testSetSizePanic, KDefaultStackSize, 0x2000, 0x2000, &aFile) == KErrNone);
1.5890 + t.Logon(status);
1.5891 + t.Resume();
1.5892 + User::WaitForRequest(status);
1.5893 + test(t.ExitType() == EExitPanic);
1.5894 + test(t.ExitReason() == 20);
1.5895 + t.Close();
1.5896 + User::SetJustInTime(ETrue);
1.5897 +
1.5898 + // Test RFile64::Write with a zero or negative length
1.5899 + TInt aPos=128;
1.5900 + TInt aLen=-1;
1.5901 + TBuf8<0x100> gBuf=_L8("1234567891");
1.5902 + gBuf.Zero();
1.5903 + TRequestStatus status1=KRequestPending;
1.5904 + TRequestStatus status2=KRequestPending;
1.5905 +
1.5906 + // If a zero length is passed into the Write function, KErrNone should be returned.
1.5907 + r=aFile.Write(aPos,gBuf);
1.5908 + test(r==KErrNone);
1.5909 +
1.5910 + // If the length is a negative, KErrArgument should be returned.
1.5911 + r=aFile.Write(aPos,gBuf,aLen);
1.5912 + test(r==KErrArgument);
1.5913 +
1.5914 + // Test the asynchronous requests
1.5915 + aFile.Write(aPos,gBuf,aLen,status1);
1.5916 + aFile.Write(aPos,gBuf,aLen,status2);
1.5917 + User::WaitForRequest(status1);
1.5918 + test(status1.Int()==KErrArgument);
1.5919 + User::WaitForRequest(status2);
1.5920 + test(status2.Int()==KErrArgument);
1.5921 +
1.5922 + aFile.Close();
1.5923 + r = TheFs.Delete(_L("\\testRFile64NegLen.txt"));
1.5924 + test(r == KErrNone);
1.5925 + test.End();
1.5926 + }
1.5927 +//-------------------------------------------------------------------------------------------------------------------
1.5928 +
1.5929 +static TInt PrepareDisk(TInt aDrive)
1.5930 + {
1.5931 + TInt r;
1.5932 +
1.5933 + r = FormatDrive(TheFs, aDrive, ETrue);
1.5934 +
1.5935 + r = TheFs.Volume(gDriveVolumeInfo, aDrive);
1.5936 + if(KErrNone != r)
1.5937 + {
1.5938 + test.Printf(_L("\nError in getting drive volume information!! Error code is %d"),r);
1.5939 + test(EFalse);
1.5940 + }
1.5941 + test.Printf(_L("\nDrive volume size is %LU\n"), gDriveVolumeInfo.iSize);
1.5942 +
1.5943 + // don't test if media size is less than 4 GB
1.5944 + if (gDriveVolumeInfo.iFree <= K4GB)
1.5945 + {
1.5946 + test.Printf(_L("\nSkipping test: test requires disk with capacity more than 4 GB"));
1.5947 + return KErrNotSupported;
1.5948 + }
1.5949 +
1.5950 + TFileName fileName;
1.5951 + fileName.Append(gDriveToTest);
1.5952 + fileName.Append(KTestPath);
1.5953 +
1.5954 + MakeDir(fileName);
1.5955 +
1.5956 +
1.5957 + //-- decide if we need to test files >= 4G. As soon as there is no appropriate API yet, this way is dodgy..
1.5958 + if(Is_Fat(TheFs, aDrive))
1.5959 + {
1.5960 + KFileSizeMaxLargerThan4GBMinusOne = EFalse; //-- FAT doesn't support >= 4G files
1.5961 + }
1.5962 + else if(Is_Win32(TheFs, aDrive))
1.5963 + {//-- this is the emulator's windows drive. The maximal file size depends on the Windows FS used for this drive.
1.5964 + //-- if it is NTFS, files >= 4G are supported.
1.5965 + r = CreateEmptyFile(TheFs, _L("\\test_file"), K4GB);
1.5966 +
1.5967 + KFileSizeMaxLargerThan4GBMinusOne = (r == KErrNone);
1.5968 + r = TheFs.Delete(_L("\\test_file"));
1.5969 +
1.5970 + }
1.5971 + else
1.5972 + {//-- something else, exFAT for example
1.5973 + if(Is_ExFat(TheFs, aDrive))
1.5974 + KFileSizeMaxLargerThan4GBMinusOne = ETrue;
1.5975 + }
1.5976 +
1.5977 +
1.5978 + return KErrNone;
1.5979 + }
1.5980 +
1.5981 +
1.5982 +void CallTestsL()
1.5983 + {
1.5984 + TInt r;
1.5985 + r = RFs::CharToDrive(gDriveToTest, gDrive);
1.5986 + test(r == KErrNone);
1.5987 +
1.5988 + //-- set up console output
1.5989 + F32_Test_Utils::SetConsole(test.Console());
1.5990 +
1.5991 + PrintDrvInfo(TheFs, gDrive);
1.5992 +
1.5993 + r = PrepareDisk(gDrive);
1.5994 + if(r == KErrNotSupported)
1.5995 + return;
1.5996 +
1.5997 +
1.5998 + TestRFile64NegLen();
1.5999 + TestOpenFiles();
1.6000 + TestAdoptFiles();
1.6001 + TestReadFile();
1.6002 + TestWriteFile();
1.6003 + TestFileAccess();
1.6004 + TestSetsize();
1.6005 + TestReadFilesection();
1.6006 + TestTFileText();
1.6007 +
1.6008 + TestLockUnLock();
1.6009 + TestFileReSize();
1.6010 + //
1.6011 + // these tests require disk capacity of aaround 12GB.
1.6012 + //order of these tests need to be preserved since the files are
1.6013 + //created only in TestGetDirectory() and then deleted in TestAddLDirectory
1.6014 + //but all the intermediate tests uses those files.
1.6015 + //
1.6016 + if (gDriveVolumeInfo.iFree >= K12GB)
1.6017 + {
1.6018 + TestGetDirectory();
1.6019 + TestTEntry();
1.6020 + TestReadDirectory();
1.6021 + TestSortDirectory();
1.6022 + TestAddLDirectory();
1.6023 + }
1.6024 + // these tests require disk capacity of aaround 9GB.
1.6025 + if (gDriveVolumeInfo.iFree >= K9GB)
1.6026 + {
1.6027 + TestCopyMoveDirectory();
1.6028 + }
1.6029 +
1.6030 + // Delete the test directory
1.6031 + TFileName dirName;
1.6032 + dirName.Append(gDriveToTest);
1.6033 + dirName.Append(KTestPath);
1.6034 + r = TheFs.RmDir(dirName);
1.6035 + test(r == KErrNone);
1.6036 + }
1.6037 +
1.6038 +
1.6039 +
1.6040 +
1.6041 +
1.6042 +
1.6043 +