sl@0
|
1 |
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// //File Name: f32test/server/t_file64bit.cpp
|
sl@0
|
15 |
// //Description:This file contains implementation for checking the 64bit file
|
sl@0
|
16 |
// // server functionality. All the affected APIs are tested.
|
sl@0
|
17 |
// //While generating a file for reading, the contents are generated such that
|
sl@0
|
18 |
// //every four bytes of the file contains its location. So the file would be
|
sl@0
|
19 |
// //generated as:
|
sl@0
|
20 |
// // 0000: 00 00 00 00
|
sl@0
|
21 |
// // 0004: 04 00 00 00
|
sl@0
|
22 |
// // 0008: 08 00 00 00
|
sl@0
|
23 |
// // .. etc
|
sl@0
|
24 |
//
|
sl@0
|
25 |
//
|
sl@0
|
26 |
|
sl@0
|
27 |
|
sl@0
|
28 |
#include <f32file.h>
|
sl@0
|
29 |
#include <e32test.h>
|
sl@0
|
30 |
#include <e32svr.h>
|
sl@0
|
31 |
#include "t_server.h"
|
sl@0
|
32 |
#include "t_file64bit.h"
|
sl@0
|
33 |
#include "..\\fileshare\\handshare64bit.h"
|
sl@0
|
34 |
#include <f32pluginutils.h>
|
sl@0
|
35 |
#include <massstorage.h>
|
sl@0
|
36 |
#include <e32math.h>
|
sl@0
|
37 |
#include "f32_test_utils.h"
|
sl@0
|
38 |
|
sl@0
|
39 |
using namespace F32_Test_Utils;
|
sl@0
|
40 |
|
sl@0
|
41 |
RTest test(_L("T_FILE64BIT Tests"));
|
sl@0
|
42 |
|
sl@0
|
43 |
_LIT(KTestPath, ":\\F32-TST\\TFILE64BIT\\");
|
sl@0
|
44 |
|
sl@0
|
45 |
// to test any file system that supports file sizes of greater than 4GB -1,
|
sl@0
|
46 |
// this value shall be set.
|
sl@0
|
47 |
TBool KFileSizeMaxLargerThan4GBMinusOne = EFalse;
|
sl@0
|
48 |
|
sl@0
|
49 |
|
sl@0
|
50 |
|
sl@0
|
51 |
TInt GenerateBigFileContents()
|
sl@0
|
52 |
{
|
sl@0
|
53 |
test.Printf(_L("GenerateBigFileContents()\n"));
|
sl@0
|
54 |
|
sl@0
|
55 |
TInt r;
|
sl@0
|
56 |
const TUint KBufSize = 256*K1KiloByte;
|
sl@0
|
57 |
RBuf8 buf;
|
sl@0
|
58 |
|
sl@0
|
59 |
r = buf.CreateMax(KBufSize);
|
sl@0
|
60 |
test(r == KErrNone);
|
sl@0
|
61 |
|
sl@0
|
62 |
RFile64 file;
|
sl@0
|
63 |
TFileName fileName;
|
sl@0
|
64 |
fileName.Append(gDriveToTest);
|
sl@0
|
65 |
fileName.Append(KTestPath);
|
sl@0
|
66 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
67 |
r = file.Replace(TheFs,fileName, EFileWrite);
|
sl@0
|
68 |
test(r == KErrNone);
|
sl@0
|
69 |
|
sl@0
|
70 |
r = file.SetSize(K4GBMinusOne);
|
sl@0
|
71 |
test(r == KErrNone);
|
sl@0
|
72 |
|
sl@0
|
73 |
TInt64 nNumberOfBytesToWrite = 0;
|
sl@0
|
74 |
TInt64 nNumberOfBytesWritten = 0;
|
sl@0
|
75 |
for (TInt64 pos = 0; pos < K4GBMinusOne; pos += nNumberOfBytesWritten)
|
sl@0
|
76 |
{
|
sl@0
|
77 |
// Prepare the write buffer
|
sl@0
|
78 |
for (TUint n = 0; n<KBufSize; n += 4)
|
sl@0
|
79 |
{
|
sl@0
|
80 |
*((TUint*) &buf[n]) = I64LOW(pos + n);
|
sl@0
|
81 |
}
|
sl@0
|
82 |
|
sl@0
|
83 |
nNumberOfBytesToWrite = Min(MAKE_TINT64(0,KBufSize), K4GBMinusOne - pos);
|
sl@0
|
84 |
TPtrC8 pText(buf.Ptr(), KBufSize);
|
sl@0
|
85 |
|
sl@0
|
86 |
file.Write(pText, (TInt)nNumberOfBytesToWrite);
|
sl@0
|
87 |
|
sl@0
|
88 |
nNumberOfBytesWritten = nNumberOfBytesToWrite;
|
sl@0
|
89 |
}
|
sl@0
|
90 |
|
sl@0
|
91 |
r = file.Flush();
|
sl@0
|
92 |
test(r == KErrNone);
|
sl@0
|
93 |
test.Printf(_L("\nFile writing is completed!!"));
|
sl@0
|
94 |
|
sl@0
|
95 |
|
sl@0
|
96 |
file.Close();
|
sl@0
|
97 |
|
sl@0
|
98 |
buf.Close();
|
sl@0
|
99 |
|
sl@0
|
100 |
return KErrNone;
|
sl@0
|
101 |
}
|
sl@0
|
102 |
|
sl@0
|
103 |
TInt RFileHandleSharer64Bit::Connect()
|
sl@0
|
104 |
{
|
sl@0
|
105 |
return CreateSession(KServerName, TVersion(1,0,0));
|
sl@0
|
106 |
}
|
sl@0
|
107 |
|
sl@0
|
108 |
|
sl@0
|
109 |
TInt RFileHandleSharer64Bit::Exit()
|
sl@0
|
110 |
{
|
sl@0
|
111 |
return SendReceive(EMsgExit, TIpcArgs(NULL));
|
sl@0
|
112 |
}
|
sl@0
|
113 |
|
sl@0
|
114 |
TInt RFileHandleSharer64Bit::SetTestDrive(TInt aDrive)
|
sl@0
|
115 |
{
|
sl@0
|
116 |
return SendReceive(EMsgDrive, TIpcArgs(aDrive));
|
sl@0
|
117 |
}
|
sl@0
|
118 |
|
sl@0
|
119 |
TInt RFileHandleSharer64Bit::PassFileHandleProcessLargeFileClient(TIpcArgs& aIpcArgs)
|
sl@0
|
120 |
{
|
sl@0
|
121 |
return SendReceive(EMsgPassFileHandleProcessLargeFileClient, aIpcArgs);
|
sl@0
|
122 |
}
|
sl@0
|
123 |
|
sl@0
|
124 |
TInt RFileHandleSharer64Bit::PassFileHandleProcessLargeFileCreator()
|
sl@0
|
125 |
{
|
sl@0
|
126 |
return SendReceive(EMsgPassFileHandleProcessLargeFileCreator);
|
sl@0
|
127 |
}
|
sl@0
|
128 |
|
sl@0
|
129 |
TInt RFileHandleSharer64Bit::GetFileHandleLargeFile2(TInt &aHandle, TFileMode aFileMode)
|
sl@0
|
130 |
{
|
sl@0
|
131 |
TPckgBuf<TInt> fh;
|
sl@0
|
132 |
TInt fsh = SendReceive(EMsgGetFileHandleLargeFile, TIpcArgs(&fh, aFileMode));
|
sl@0
|
133 |
aHandle = fh();
|
sl@0
|
134 |
return fsh;
|
sl@0
|
135 |
}
|
sl@0
|
136 |
|
sl@0
|
137 |
void RFileHandleSharer64Bit::Sync()
|
sl@0
|
138 |
{
|
sl@0
|
139 |
SendReceive(EMsgSync, TIpcArgs());
|
sl@0
|
140 |
}
|
sl@0
|
141 |
|
sl@0
|
142 |
|
sl@0
|
143 |
CFileManObserver::CFileManObserver(CFileMan* aFileMan)
|
sl@0
|
144 |
{
|
sl@0
|
145 |
__DECLARE_NAME(_S("CFileManObserver"));
|
sl@0
|
146 |
iFileMan = aFileMan;
|
sl@0
|
147 |
}
|
sl@0
|
148 |
|
sl@0
|
149 |
MFileManObserver::TControl CFileManObserver::NotifyFileManStarted()
|
sl@0
|
150 |
{
|
sl@0
|
151 |
return(MFileManObserver::EContinue);
|
sl@0
|
152 |
}
|
sl@0
|
153 |
|
sl@0
|
154 |
MFileManObserver::TControl CFileManObserver::NotifyFileManOperation()
|
sl@0
|
155 |
{
|
sl@0
|
156 |
return(MFileManObserver::EContinue);
|
sl@0
|
157 |
}
|
sl@0
|
158 |
|
sl@0
|
159 |
MFileManObserver::TControl CFileManObserver::NotifyFileManEnded()
|
sl@0
|
160 |
{
|
sl@0
|
161 |
TInt lastError = iFileMan->GetLastError();
|
sl@0
|
162 |
TFileName fileName = iFileMan->CurrentEntry().iName;
|
sl@0
|
163 |
test.Printf(_L("NotifyFileManEnded(): Error %d File %S\n"),lastError, &fileName);
|
sl@0
|
164 |
if (lastError == KErrNone)
|
sl@0
|
165 |
iNotifyEndedSuccesses++;
|
sl@0
|
166 |
else
|
sl@0
|
167 |
iNotifyEndedFailures++;
|
sl@0
|
168 |
return(MFileManObserver::EContinue);
|
sl@0
|
169 |
}
|
sl@0
|
170 |
|
sl@0
|
171 |
|
sl@0
|
172 |
|
sl@0
|
173 |
RFsTest& RFsTest::Replace(const TDesC &anOldName, const TDesC &aNewName)
|
sl@0
|
174 |
//
|
sl@0
|
175 |
// Replaces a single file with another
|
sl@0
|
176 |
//
|
sl@0
|
177 |
{
|
sl@0
|
178 |
test.Printf(_L("%S File Replaced with %S\n"),&anOldName,&aNewName);\
|
sl@0
|
179 |
TInt r = TheFs.Replace(anOldName,aNewName);
|
sl@0
|
180 |
test(r == KErrNone);
|
sl@0
|
181 |
return(*this);
|
sl@0
|
182 |
}
|
sl@0
|
183 |
|
sl@0
|
184 |
RFsTest& RFsTest::ReadFileSection(const TDesC& aName, TInt64 aPos,TDes8& aBuffer,TInt aLen)
|
sl@0
|
185 |
//
|
sl@0
|
186 |
// Reads data from the file without opening it. Expected not to fail.
|
sl@0
|
187 |
//
|
sl@0
|
188 |
{
|
sl@0
|
189 |
test.Printf(_L("Read File Section %S\n"),&aName);
|
sl@0
|
190 |
TInt r = TheFs.ReadFileSection(aName,aPos,aBuffer,aLen);
|
sl@0
|
191 |
TInt len = aBuffer.Length();
|
sl@0
|
192 |
|
sl@0
|
193 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
194 |
{
|
sl@0
|
195 |
if(aPos < K4GB)
|
sl@0
|
196 |
test(r == KErrNone);
|
sl@0
|
197 |
else
|
sl@0
|
198 |
{
|
sl@0
|
199 |
test(r == KErrNone);
|
sl@0
|
200 |
test(len == 0);
|
sl@0
|
201 |
}
|
sl@0
|
202 |
}
|
sl@0
|
203 |
else
|
sl@0
|
204 |
{
|
sl@0
|
205 |
test (r == KErrNone);
|
sl@0
|
206 |
}
|
sl@0
|
207 |
return(*this);
|
sl@0
|
208 |
}
|
sl@0
|
209 |
|
sl@0
|
210 |
|
sl@0
|
211 |
RFsTest& RFsTest::GetDir(const TDesC &aName, TUint anEntryAttMask, TUint anEntrySortKey, CDir *&anEntryList)
|
sl@0
|
212 |
//
|
sl@0
|
213 |
// Gets a filtered list of a directory's contents.
|
sl@0
|
214 |
//
|
sl@0
|
215 |
{
|
sl@0
|
216 |
test.Printf(_L("Name of the directory for which listing is required %S\n"),&aName);
|
sl@0
|
217 |
TInt r = TheFs.GetDir(aName,anEntryAttMask,anEntrySortKey,anEntryList);
|
sl@0
|
218 |
test(r == KErrNone);
|
sl@0
|
219 |
return(*this);
|
sl@0
|
220 |
}
|
sl@0
|
221 |
|
sl@0
|
222 |
RFsTest& RFsTest::GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,CDir*& aDirList)
|
sl@0
|
223 |
//
|
sl@0
|
224 |
// Gets a filtered list of the directory and the file entries contained in a directory and a
|
sl@0
|
225 |
// list of the directory entries only.
|
sl@0
|
226 |
{
|
sl@0
|
227 |
test.Printf(_L("Name of the directory for which directory and file listing is required %S\n"),&aName);
|
sl@0
|
228 |
TInt r = TheFs.GetDir(aName,anEntryAttMask,anEntrySortKey,anEntryList,aDirList);
|
sl@0
|
229 |
test(r == KErrNone);
|
sl@0
|
230 |
return(*this);
|
sl@0
|
231 |
}
|
sl@0
|
232 |
|
sl@0
|
233 |
RFsTest& RFsTest::GetDir(const TDesC& aName,const TUidType& anEntryUid,TUint anEntrySortKey,CDir*& aFileList)
|
sl@0
|
234 |
//
|
sl@0
|
235 |
// Gets a filtered list of directory contents by UID type.
|
sl@0
|
236 |
//
|
sl@0
|
237 |
{
|
sl@0
|
238 |
test.Printf(_L("Name of the directory for which listing is required %S\n"),&aName);
|
sl@0
|
239 |
TInt r = TheFs.GetDir(aName,anEntryUid,anEntrySortKey,aFileList);
|
sl@0
|
240 |
test(r == KErrNone);
|
sl@0
|
241 |
return(*this);
|
sl@0
|
242 |
}
|
sl@0
|
243 |
|
sl@0
|
244 |
|
sl@0
|
245 |
RFileTest::RFileTest(const TDesC& aName)
|
sl@0
|
246 |
//
|
sl@0
|
247 |
// Constructor
|
sl@0
|
248 |
//
|
sl@0
|
249 |
: iName(aName)
|
sl@0
|
250 |
{}
|
sl@0
|
251 |
|
sl@0
|
252 |
RFileTest& RFileTest::Create(const TDesC& aName, TUint aFileMode)
|
sl@0
|
253 |
//
|
sl@0
|
254 |
// Creates and opens a new file for writing, if the file already exists an error is returned
|
sl@0
|
255 |
//
|
sl@0
|
256 |
{
|
sl@0
|
257 |
test.Printf(_L("%S create %S in %d Mode\n"),&iName,&aName,aFileMode);
|
sl@0
|
258 |
TInt r = RFile64::Create(TheFs,aName,aFileMode);
|
sl@0
|
259 |
test(r == KErrNone || r == KErrAlreadyExists);
|
sl@0
|
260 |
return(*this);
|
sl@0
|
261 |
}
|
sl@0
|
262 |
|
sl@0
|
263 |
RFileTest& RFileTest::Replace(const TDesC& aName)
|
sl@0
|
264 |
//
|
sl@0
|
265 |
// Opens a file for writing, replacing the content of any existing file of the same name
|
sl@0
|
266 |
// if it exists or cretaing a new file if it does not exist.
|
sl@0
|
267 |
//
|
sl@0
|
268 |
{
|
sl@0
|
269 |
test.Printf(_L("%S replace %S\n"),&iName,&aName);
|
sl@0
|
270 |
TInt r = RFile64::Replace(TheFs,aName,EFileStream|EFileWrite);
|
sl@0
|
271 |
test(r == KErrNone);
|
sl@0
|
272 |
return(*this);
|
sl@0
|
273 |
}
|
sl@0
|
274 |
|
sl@0
|
275 |
RFileTest& RFileTest::Replace(const TDesC& aName, TUint aFileMode)
|
sl@0
|
276 |
//
|
sl@0
|
277 |
// Opens a file in aFileMode, replacing the content of any existing file of the same name
|
sl@0
|
278 |
// if it exists or cretaing a new file if it does not exist.
|
sl@0
|
279 |
//
|
sl@0
|
280 |
{
|
sl@0
|
281 |
test.Printf(_L("%S replace %S in %d Mode\n"),&iName,&aName, aFileMode);
|
sl@0
|
282 |
TInt r = RFile64::Replace(TheFs,aName,aFileMode);
|
sl@0
|
283 |
if (r == KErrNone)
|
sl@0
|
284 |
test(r == KErrNone);
|
sl@0
|
285 |
else
|
sl@0
|
286 |
test(r == KErrBadName);
|
sl@0
|
287 |
return(*this);
|
sl@0
|
288 |
}
|
sl@0
|
289 |
|
sl@0
|
290 |
RFileTest& RFileTest::Open(const TDesC& aName)
|
sl@0
|
291 |
//
|
sl@0
|
292 |
// Open a existing file for reading and writing in shared access mode.
|
sl@0
|
293 |
//
|
sl@0
|
294 |
{
|
sl@0
|
295 |
test.Printf(_L("%S open %S\n"),&iName,&aName);
|
sl@0
|
296 |
TInt r = RFile64::Open(TheFs,aName,EFileWrite|EFileShareAny);
|
sl@0
|
297 |
test(r == KErrNone);
|
sl@0
|
298 |
return(*this);
|
sl@0
|
299 |
}
|
sl@0
|
300 |
|
sl@0
|
301 |
RFileTest& RFileTest::Open(const TDesC& aName, TUint aFileMode)
|
sl@0
|
302 |
//
|
sl@0
|
303 |
// Opens an existing file using aFileMode.
|
sl@0
|
304 |
//
|
sl@0
|
305 |
{
|
sl@0
|
306 |
test.Printf(_L("%S open %S in %d Mode\n"),&iName,&aName, aFileMode);
|
sl@0
|
307 |
TInt r = RFile64::Open(TheFs,aName,aFileMode);
|
sl@0
|
308 |
test(r == KErrNone);
|
sl@0
|
309 |
return(*this);
|
sl@0
|
310 |
}
|
sl@0
|
311 |
|
sl@0
|
312 |
RFileTest& RFileTest::Temp(const TDesC& aPath,TFileName& aName,TUint aFileMode)
|
sl@0
|
313 |
//
|
sl@0
|
314 |
// Creates and opens a temporary file with a unique name for writing and reading.
|
sl@0
|
315 |
//
|
sl@0
|
316 |
{
|
sl@0
|
317 |
test.Printf(_L("%S Temp file %S in %d Mode\n"),&iName,&aName, aFileMode);
|
sl@0
|
318 |
TInt r = RFile64::Temp(TheFs,aPath,aName,aFileMode);
|
sl@0
|
319 |
test(r == KErrNone);
|
sl@0
|
320 |
return(*this);
|
sl@0
|
321 |
}
|
sl@0
|
322 |
|
sl@0
|
323 |
void RFileTest::Close()
|
sl@0
|
324 |
//
|
sl@0
|
325 |
// Closes the file.
|
sl@0
|
326 |
//
|
sl@0
|
327 |
{
|
sl@0
|
328 |
RFile::Close();
|
sl@0
|
329 |
}
|
sl@0
|
330 |
|
sl@0
|
331 |
RFileTest& RFileTest::Lock(TInt64 aPos, TInt64 aLen)
|
sl@0
|
332 |
//
|
sl@0
|
333 |
// Set a lock on the file. Expected not to fail.
|
sl@0
|
334 |
//
|
sl@0
|
335 |
{
|
sl@0
|
336 |
test.Printf(_L("%S lock 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
|
sl@0
|
337 |
TInt r = RFile64::Lock(aPos,aLen);
|
sl@0
|
338 |
test(r == KErrNone);
|
sl@0
|
339 |
return(*this);
|
sl@0
|
340 |
}
|
sl@0
|
341 |
|
sl@0
|
342 |
RFileTest& RFileTest::LockE(TInt64 aPos, TInt64 aLen)
|
sl@0
|
343 |
//
|
sl@0
|
344 |
// Set a lock on the file. Expected to fail.
|
sl@0
|
345 |
//
|
sl@0
|
346 |
{
|
sl@0
|
347 |
test.Printf(_L("%S lockE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
|
sl@0
|
348 |
TInt r = RFile64::Lock(aPos,aLen);
|
sl@0
|
349 |
test(r == KErrLocked);
|
sl@0
|
350 |
return(*this);
|
sl@0
|
351 |
}
|
sl@0
|
352 |
|
sl@0
|
353 |
RFileTest& RFileTest::UnLock(TInt64 aPos, TInt64 aLen)
|
sl@0
|
354 |
//
|
sl@0
|
355 |
// Unlock the file. Expected not to fail.
|
sl@0
|
356 |
//
|
sl@0
|
357 |
{
|
sl@0
|
358 |
test.Printf(_L("%S ulock 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
|
sl@0
|
359 |
TInt r = RFile64::UnLock(aPos,aLen);
|
sl@0
|
360 |
test(r == KErrNone);
|
sl@0
|
361 |
return(*this);
|
sl@0
|
362 |
}
|
sl@0
|
363 |
|
sl@0
|
364 |
RFileTest& RFileTest::UnLockE(TInt64 aPos, TInt64 aLen)
|
sl@0
|
365 |
//
|
sl@0
|
366 |
// Unlock the file. Expected to fail.
|
sl@0
|
367 |
//
|
sl@0
|
368 |
{
|
sl@0
|
369 |
test.Printf(_L("%S ulockE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
|
sl@0
|
370 |
TInt r = RFile64::UnLock(aPos,aLen);
|
sl@0
|
371 |
test(r == KErrNotFound);
|
sl@0
|
372 |
return(*this);
|
sl@0
|
373 |
}
|
sl@0
|
374 |
|
sl@0
|
375 |
RFileTest& RFileTest::Write(const TDesC8& aDes)
|
sl@0
|
376 |
//
|
sl@0
|
377 |
// Write to the file.
|
sl@0
|
378 |
//
|
sl@0
|
379 |
{
|
sl@0
|
380 |
test.Printf(_L("%S write\n"),&iName);
|
sl@0
|
381 |
|
sl@0
|
382 |
TInt64 seekPos = 0;
|
sl@0
|
383 |
TInt rr = RFile64::Seek(ESeekCurrent,seekPos);
|
sl@0
|
384 |
test(rr == KErrNone);
|
sl@0
|
385 |
|
sl@0
|
386 |
TInt r = RFile64::Write(aDes);
|
sl@0
|
387 |
if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
|
sl@0
|
388 |
r = RFile64::Flush();
|
sl@0
|
389 |
|
sl@0
|
390 |
|
sl@0
|
391 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
392 |
{
|
sl@0
|
393 |
if((seekPos + aDes.Length()) < K4GB)
|
sl@0
|
394 |
test(r == KErrNone);
|
sl@0
|
395 |
else
|
sl@0
|
396 |
test(r == KErrNotSupported);
|
sl@0
|
397 |
}
|
sl@0
|
398 |
else
|
sl@0
|
399 |
{
|
sl@0
|
400 |
test (r == KErrNone);
|
sl@0
|
401 |
}
|
sl@0
|
402 |
return(*this);
|
sl@0
|
403 |
}
|
sl@0
|
404 |
|
sl@0
|
405 |
RFileTest& RFileTest::Write(const TDesC8 &aDes, TRequestStatus &aStatus)
|
sl@0
|
406 |
//
|
sl@0
|
407 |
// Write to the file.
|
sl@0
|
408 |
//
|
sl@0
|
409 |
{
|
sl@0
|
410 |
test.Printf(_L("%S write\n"),&iName);
|
sl@0
|
411 |
|
sl@0
|
412 |
TInt64 seekPos = 0;
|
sl@0
|
413 |
TInt rr = RFile64::Seek(ESeekCurrent,seekPos);
|
sl@0
|
414 |
test(rr == KErrNone);
|
sl@0
|
415 |
|
sl@0
|
416 |
RFile64::Write(aDes, aStatus);
|
sl@0
|
417 |
User::WaitForRequest(aStatus);
|
sl@0
|
418 |
if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
|
sl@0
|
419 |
{
|
sl@0
|
420 |
RFile64::Flush(aStatus);
|
sl@0
|
421 |
User::WaitForRequest(aStatus);
|
sl@0
|
422 |
}
|
sl@0
|
423 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
424 |
{
|
sl@0
|
425 |
if((seekPos + aDes.Length()) < K4GB)
|
sl@0
|
426 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
427 |
else
|
sl@0
|
428 |
test(aStatus.Int() == KErrNotSupported);
|
sl@0
|
429 |
|
sl@0
|
430 |
}
|
sl@0
|
431 |
else
|
sl@0
|
432 |
{
|
sl@0
|
433 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
434 |
}
|
sl@0
|
435 |
return(*this);
|
sl@0
|
436 |
}
|
sl@0
|
437 |
|
sl@0
|
438 |
RFileTest& RFileTest::Write(const TDesC8& aDes, TInt aLength)
|
sl@0
|
439 |
//
|
sl@0
|
440 |
// Write aLength specified number of bytes to the file.
|
sl@0
|
441 |
//
|
sl@0
|
442 |
{
|
sl@0
|
443 |
test.Printf(_L("%S write\n"),&iName);
|
sl@0
|
444 |
|
sl@0
|
445 |
TInt64 seekPos = 0;
|
sl@0
|
446 |
TInt rr = RFile64::Seek(ESeekCurrent,seekPos);
|
sl@0
|
447 |
test(rr == KErrNone);
|
sl@0
|
448 |
|
sl@0
|
449 |
TInt r = RFile64::Write(aDes, aLength);
|
sl@0
|
450 |
if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
|
sl@0
|
451 |
r = RFile64::Flush();
|
sl@0
|
452 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
453 |
{
|
sl@0
|
454 |
if((seekPos + aLength) < K4GB)
|
sl@0
|
455 |
test(r == KErrNone);
|
sl@0
|
456 |
else
|
sl@0
|
457 |
test(r == KErrNotSupported);
|
sl@0
|
458 |
}
|
sl@0
|
459 |
else
|
sl@0
|
460 |
{
|
sl@0
|
461 |
test(r == KErrNone);
|
sl@0
|
462 |
}
|
sl@0
|
463 |
return(*this);
|
sl@0
|
464 |
}
|
sl@0
|
465 |
|
sl@0
|
466 |
RFileTest& RFileTest::Write(const TDesC8& aDes, TInt aLength, TRequestStatus &aStatus)
|
sl@0
|
467 |
//
|
sl@0
|
468 |
// Write aLength specified number of bytes to the file. Expected not to fail (Asynchronous).
|
sl@0
|
469 |
//
|
sl@0
|
470 |
{
|
sl@0
|
471 |
test.Printf(_L("%S write\n"),&iName);
|
sl@0
|
472 |
|
sl@0
|
473 |
TInt64 seekPos = 0;
|
sl@0
|
474 |
TInt rr = RFile64::Seek(ESeekCurrent,seekPos);
|
sl@0
|
475 |
test(rr == KErrNone);
|
sl@0
|
476 |
|
sl@0
|
477 |
RFile64::Write(aDes,aLength,aStatus);
|
sl@0
|
478 |
User::WaitForRequest(aStatus);
|
sl@0
|
479 |
if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
|
sl@0
|
480 |
{
|
sl@0
|
481 |
RFile64::Flush(aStatus);
|
sl@0
|
482 |
User::WaitForRequest(aStatus);
|
sl@0
|
483 |
}
|
sl@0
|
484 |
|
sl@0
|
485 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
486 |
{
|
sl@0
|
487 |
if((seekPos + aLength) < K4GB)
|
sl@0
|
488 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
489 |
else
|
sl@0
|
490 |
test(aStatus.Int() == KErrNotSupported);
|
sl@0
|
491 |
}
|
sl@0
|
492 |
else
|
sl@0
|
493 |
{
|
sl@0
|
494 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
495 |
}
|
sl@0
|
496 |
return(*this);
|
sl@0
|
497 |
}
|
sl@0
|
498 |
|
sl@0
|
499 |
RFileTest& RFileTest::WriteP(TInt64 aPos, const TDesC8& aDes)
|
sl@0
|
500 |
//
|
sl@0
|
501 |
// Write to the file. Expected not to fail.
|
sl@0
|
502 |
//
|
sl@0
|
503 |
{
|
sl@0
|
504 |
test.Printf(_L("%S write 0x%lx\n"),&iName,aPos);
|
sl@0
|
505 |
TInt r = RFile64::Write(aPos,aDes);
|
sl@0
|
506 |
if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
|
sl@0
|
507 |
r = RFile64::Flush();
|
sl@0
|
508 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
509 |
{
|
sl@0
|
510 |
if ((aPos + aDes.Length()) < K4GB)
|
sl@0
|
511 |
test(r == KErrNone);
|
sl@0
|
512 |
else
|
sl@0
|
513 |
test(r == KErrNotSupported);
|
sl@0
|
514 |
}
|
sl@0
|
515 |
else
|
sl@0
|
516 |
{
|
sl@0
|
517 |
test(r == KErrNone);
|
sl@0
|
518 |
}
|
sl@0
|
519 |
return(*this);
|
sl@0
|
520 |
}
|
sl@0
|
521 |
|
sl@0
|
522 |
RFileTest& RFileTest::WriteU(TUint aPos, const TDesC8& aDes)
|
sl@0
|
523 |
//
|
sl@0
|
524 |
// Write to the file. Expected not to fail.
|
sl@0
|
525 |
// Position is a TUint value
|
sl@0
|
526 |
//
|
sl@0
|
527 |
{
|
sl@0
|
528 |
test.Printf(_L("%S write %08x\n"),&iName,aPos);
|
sl@0
|
529 |
TInt r = RFile64::Write(aPos,aDes);
|
sl@0
|
530 |
if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
|
sl@0
|
531 |
r = RFile64::Flush();
|
sl@0
|
532 |
test(r == KErrNone);
|
sl@0
|
533 |
return(*this);
|
sl@0
|
534 |
}
|
sl@0
|
535 |
|
sl@0
|
536 |
|
sl@0
|
537 |
RFileTest& RFileTest::Write(TInt64 aPos, const TDesC8& aDes, TInt aLen)
|
sl@0
|
538 |
//
|
sl@0
|
539 |
// Write to the file. Synchronous Expected not to fail.
|
sl@0
|
540 |
//
|
sl@0
|
541 |
{
|
sl@0
|
542 |
test.Printf(_L("%S write 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
|
sl@0
|
543 |
TInt r = RFile64::Write(aPos,aDes,aLen);
|
sl@0
|
544 |
if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
|
sl@0
|
545 |
r = RFile64::Flush();
|
sl@0
|
546 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
547 |
{
|
sl@0
|
548 |
if ((aPos + aLen) < K4GB)
|
sl@0
|
549 |
{
|
sl@0
|
550 |
if (aLen < 0)
|
sl@0
|
551 |
test(r == KErrArgument);
|
sl@0
|
552 |
else
|
sl@0
|
553 |
test(r == KErrNone);
|
sl@0
|
554 |
}
|
sl@0
|
555 |
else
|
sl@0
|
556 |
test(r == KErrNotSupported);
|
sl@0
|
557 |
}
|
sl@0
|
558 |
else
|
sl@0
|
559 |
{
|
sl@0
|
560 |
if (aLen < 0)
|
sl@0
|
561 |
test(r == KErrArgument);
|
sl@0
|
562 |
else
|
sl@0
|
563 |
test(r == KErrNone);
|
sl@0
|
564 |
}
|
sl@0
|
565 |
return(*this);
|
sl@0
|
566 |
}
|
sl@0
|
567 |
|
sl@0
|
568 |
RFileTest& RFileTest::WriteU(TUint aPos, const TDesC8& aDes, TInt aLen)
|
sl@0
|
569 |
//
|
sl@0
|
570 |
// Write to the file. Synchronous Expected not to fail.
|
sl@0
|
571 |
// Position is a TUint value
|
sl@0
|
572 |
//
|
sl@0
|
573 |
{
|
sl@0
|
574 |
test.Printf(_L("%S write %08x-%08x\n"),&iName,aPos,aPos+aLen-1);
|
sl@0
|
575 |
TInt r = RFile64::Write(aPos,aDes,aLen);
|
sl@0
|
576 |
if( KErrNone == r) // this is to ensure that the written data is committed and not cached.
|
sl@0
|
577 |
r = RFile64::Flush();
|
sl@0
|
578 |
test(r == KErrNone);
|
sl@0
|
579 |
return(*this);
|
sl@0
|
580 |
}
|
sl@0
|
581 |
|
sl@0
|
582 |
|
sl@0
|
583 |
RFileTest& RFileTest::WriteE(TInt64 aPos, const TDesC8& aDes, TInt aLen)
|
sl@0
|
584 |
//
|
sl@0
|
585 |
// Write to the file. Expected to fail.
|
sl@0
|
586 |
//
|
sl@0
|
587 |
{
|
sl@0
|
588 |
test.Printf(_L("%S writeE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
|
sl@0
|
589 |
TInt r = RFile64::Write(aPos,aDes,aLen);
|
sl@0
|
590 |
if (aLen < 0)
|
sl@0
|
591 |
test(r == KErrArgument);
|
sl@0
|
592 |
else
|
sl@0
|
593 |
test(r == KErrLocked);
|
sl@0
|
594 |
return(*this);
|
sl@0
|
595 |
}
|
sl@0
|
596 |
|
sl@0
|
597 |
RFileTest& RFileTest::Write(TInt64 aPos, const TDesC8& aDes, TInt aLen, TRequestStatus &aStatus)
|
sl@0
|
598 |
//
|
sl@0
|
599 |
// Write to the file. Asynchronous
|
sl@0
|
600 |
{
|
sl@0
|
601 |
test.Printf(_L("%S write 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
|
sl@0
|
602 |
RFile64::Write(aPos,aDes,aLen,aStatus);
|
sl@0
|
603 |
User::WaitForRequest(aStatus);
|
sl@0
|
604 |
if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
|
sl@0
|
605 |
{
|
sl@0
|
606 |
RFile64::Flush(aStatus);
|
sl@0
|
607 |
User::WaitForRequest(aStatus);
|
sl@0
|
608 |
}
|
sl@0
|
609 |
|
sl@0
|
610 |
if(aLen < 0)
|
sl@0
|
611 |
test(aStatus.Int() == KErrArgument);
|
sl@0
|
612 |
else
|
sl@0
|
613 |
{
|
sl@0
|
614 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
615 |
{
|
sl@0
|
616 |
if((aPos + aLen) < K4GB)
|
sl@0
|
617 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
618 |
else
|
sl@0
|
619 |
test(aStatus.Int() == KErrNotSupported);
|
sl@0
|
620 |
}
|
sl@0
|
621 |
else
|
sl@0
|
622 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
623 |
}
|
sl@0
|
624 |
return(*this);
|
sl@0
|
625 |
}
|
sl@0
|
626 |
|
sl@0
|
627 |
RFileTest& RFileTest::Write(TInt64 aPos, const TDesC8& aDes, TRequestStatus &aStatus)
|
sl@0
|
628 |
//
|
sl@0
|
629 |
// Write to the file (Asynchronous).
|
sl@0
|
630 |
{
|
sl@0
|
631 |
test.Printf(_L("%S write 0x%lx\n"),&iName,aPos);
|
sl@0
|
632 |
RFile64::Write(aPos,aDes,aStatus);
|
sl@0
|
633 |
User::WaitForRequest(aStatus);
|
sl@0
|
634 |
if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
|
sl@0
|
635 |
{
|
sl@0
|
636 |
RFile64::Flush(aStatus);
|
sl@0
|
637 |
User::WaitForRequest(aStatus);
|
sl@0
|
638 |
}
|
sl@0
|
639 |
|
sl@0
|
640 |
|
sl@0
|
641 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
642 |
{
|
sl@0
|
643 |
if((aPos + aDes.Length()) < K4GB)
|
sl@0
|
644 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
645 |
else
|
sl@0
|
646 |
test(aStatus.Int() == KErrNotSupported);
|
sl@0
|
647 |
}
|
sl@0
|
648 |
else
|
sl@0
|
649 |
{
|
sl@0
|
650 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
651 |
}
|
sl@0
|
652 |
return(*this);
|
sl@0
|
653 |
}
|
sl@0
|
654 |
|
sl@0
|
655 |
RFileTest& RFileTest::WriteU(TUint aPos, const TDesC8& aDes, TRequestStatus &aStatus)
|
sl@0
|
656 |
//
|
sl@0
|
657 |
// Write to the file (Asynchronous).
|
sl@0
|
658 |
// Position is a TUint value
|
sl@0
|
659 |
//
|
sl@0
|
660 |
{
|
sl@0
|
661 |
test.Printf(_L("%S write %08x\n"),&iName,aPos);
|
sl@0
|
662 |
RFile64::Write(aPos,aDes,aStatus);
|
sl@0
|
663 |
User::WaitForRequest(aStatus);
|
sl@0
|
664 |
if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
|
sl@0
|
665 |
{
|
sl@0
|
666 |
RFile64::Flush(aStatus);
|
sl@0
|
667 |
User::WaitForRequest(aStatus);
|
sl@0
|
668 |
}
|
sl@0
|
669 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
670 |
return(*this);
|
sl@0
|
671 |
}
|
sl@0
|
672 |
|
sl@0
|
673 |
RFileTest& RFileTest::WriteU(TUint aPos, const TDesC8& aDes, TInt aLen, TRequestStatus &aStatus)
|
sl@0
|
674 |
//
|
sl@0
|
675 |
// Write to the file. Asynchronous
|
sl@0
|
676 |
// Position is a TUint value
|
sl@0
|
677 |
//
|
sl@0
|
678 |
{
|
sl@0
|
679 |
test.Printf(_L("%S write %08x-%08x\n"),&iName,aPos,aPos+aLen-1);
|
sl@0
|
680 |
RFile64::Write(aPos,aDes,aLen,aStatus);
|
sl@0
|
681 |
User::WaitForRequest(aStatus);
|
sl@0
|
682 |
if( KErrNone == aStatus.Int()) // this is to ensure that the written data is committed and not cached.
|
sl@0
|
683 |
{
|
sl@0
|
684 |
RFile64::Flush(aStatus);
|
sl@0
|
685 |
User::WaitForRequest(aStatus);
|
sl@0
|
686 |
}
|
sl@0
|
687 |
|
sl@0
|
688 |
if(aLen < 0)
|
sl@0
|
689 |
test(aStatus.Int() == KErrArgument);
|
sl@0
|
690 |
else
|
sl@0
|
691 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
692 |
return(*this);
|
sl@0
|
693 |
}
|
sl@0
|
694 |
|
sl@0
|
695 |
|
sl@0
|
696 |
|
sl@0
|
697 |
RFileTest& RFileTest::Read(TDes8& aDes)
|
sl@0
|
698 |
//
|
sl@0
|
699 |
// Read from the file. Expected not to fail (Synchronous).
|
sl@0
|
700 |
//
|
sl@0
|
701 |
{
|
sl@0
|
702 |
test.Printf(_L("%S read \n"),&iName);
|
sl@0
|
703 |
TInt r = RFile64::Read(aDes);
|
sl@0
|
704 |
test(r == KErrNone);
|
sl@0
|
705 |
return(*this);
|
sl@0
|
706 |
}
|
sl@0
|
707 |
|
sl@0
|
708 |
RFileTest& RFileTest::Read(TDes8& aDes, TRequestStatus& aStatus)
|
sl@0
|
709 |
//
|
sl@0
|
710 |
// Read from the file. Expected not to fail (Asynchronous).
|
sl@0
|
711 |
//
|
sl@0
|
712 |
{
|
sl@0
|
713 |
TInt64 size = 0;
|
sl@0
|
714 |
test.Printf(_L("%S read \n"),&iName);
|
sl@0
|
715 |
RFile64::Read(aDes, aStatus);
|
sl@0
|
716 |
User::WaitForRequest(aStatus);
|
sl@0
|
717 |
TInt len = aDes.Length();
|
sl@0
|
718 |
TInt rr = RFile64::Size(size);
|
sl@0
|
719 |
test(rr == KErrNone);
|
sl@0
|
720 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
721 |
{
|
sl@0
|
722 |
if(size < K4GB)
|
sl@0
|
723 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
724 |
else
|
sl@0
|
725 |
{
|
sl@0
|
726 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
727 |
test(len == 0);
|
sl@0
|
728 |
}
|
sl@0
|
729 |
}
|
sl@0
|
730 |
else
|
sl@0
|
731 |
{
|
sl@0
|
732 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
733 |
}
|
sl@0
|
734 |
return(*this);
|
sl@0
|
735 |
}
|
sl@0
|
736 |
|
sl@0
|
737 |
RFileTest& RFileTest::Read(TDes8& aDes,TInt aLen,TRequestStatus& aStatus)
|
sl@0
|
738 |
//
|
sl@0
|
739 |
// Read from the file. Expected not to fail (Asynchronous).
|
sl@0
|
740 |
//
|
sl@0
|
741 |
{
|
sl@0
|
742 |
TInt64 size = 0;
|
sl@0
|
743 |
test.Printf(_L("%S read \n"),&iName);
|
sl@0
|
744 |
RFile64::Read(aDes,aLen,aStatus);
|
sl@0
|
745 |
User::WaitForRequest(aStatus);
|
sl@0
|
746 |
TInt len = aDes.Length();
|
sl@0
|
747 |
TInt rr = RFile64::Size(size);
|
sl@0
|
748 |
test(rr == KErrNone);
|
sl@0
|
749 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
750 |
{
|
sl@0
|
751 |
if(size < K4GB)
|
sl@0
|
752 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
753 |
else
|
sl@0
|
754 |
{
|
sl@0
|
755 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
756 |
test(len == 0);
|
sl@0
|
757 |
}
|
sl@0
|
758 |
}
|
sl@0
|
759 |
else
|
sl@0
|
760 |
{
|
sl@0
|
761 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
762 |
}
|
sl@0
|
763 |
return(*this);
|
sl@0
|
764 |
}
|
sl@0
|
765 |
|
sl@0
|
766 |
RFileTest& RFileTest::Read(TDes8 &aDes, TInt aLen)
|
sl@0
|
767 |
//
|
sl@0
|
768 |
// Read from the file. Expected not to fail (Synchronous).
|
sl@0
|
769 |
//
|
sl@0
|
770 |
{
|
sl@0
|
771 |
test.Printf(_L("%S read 0x%08x bytes\n"),&iName,aLen);
|
sl@0
|
772 |
TInt r = RFile64::Read(aDes,aLen);
|
sl@0
|
773 |
if(aLen < 0)
|
sl@0
|
774 |
test(r == KErrArgument);
|
sl@0
|
775 |
else
|
sl@0
|
776 |
test(r == KErrNone);
|
sl@0
|
777 |
return(*this);
|
sl@0
|
778 |
}
|
sl@0
|
779 |
|
sl@0
|
780 |
RFileTest& RFileTest::Read(TInt64 aPos, TDes8& aDes, TInt aLen)
|
sl@0
|
781 |
//
|
sl@0
|
782 |
// Read from the file. Expected not to fail (Synchronous).
|
sl@0
|
783 |
//
|
sl@0
|
784 |
{
|
sl@0
|
785 |
test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
|
sl@0
|
786 |
TInt r = RFile64::Read(aPos,aDes,aLen);
|
sl@0
|
787 |
TInt len = aDes.Length();
|
sl@0
|
788 |
if(aLen < 0)
|
sl@0
|
789 |
test(r == KErrArgument);
|
sl@0
|
790 |
else
|
sl@0
|
791 |
test(r == KErrNone);
|
sl@0
|
792 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
793 |
{
|
sl@0
|
794 |
if(aPos >= K4GB)
|
sl@0
|
795 |
test(len == 0);
|
sl@0
|
796 |
}
|
sl@0
|
797 |
return(*this);
|
sl@0
|
798 |
}
|
sl@0
|
799 |
|
sl@0
|
800 |
RFileTest& RFileTest::ReadE(TInt64 aPos, TDes8& aDes, TInt aLen)
|
sl@0
|
801 |
//
|
sl@0
|
802 |
// Reads the specified number of bytes from the file at a specified offset. Expected to fail.
|
sl@0
|
803 |
//
|
sl@0
|
804 |
{
|
sl@0
|
805 |
test.Printf(_L("%S readE 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
|
sl@0
|
806 |
TInt r = RFile64::Read(aPos,aDes,aLen);
|
sl@0
|
807 |
test(r == KErrLocked);
|
sl@0
|
808 |
return(*this);
|
sl@0
|
809 |
}
|
sl@0
|
810 |
|
sl@0
|
811 |
RFileTest& RFileTest::Read(TInt64 aPos, TDes8& aDes, TInt aLen, TRequestStatus& aStatus)
|
sl@0
|
812 |
//
|
sl@0
|
813 |
// Reads the specified number of bytes from the file at a specified offset, Expected not to fail (Asynchronous).
|
sl@0
|
814 |
//
|
sl@0
|
815 |
{
|
sl@0
|
816 |
test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
|
sl@0
|
817 |
RFile64::Read(aPos,aDes,aLen,aStatus);
|
sl@0
|
818 |
User::WaitForRequest(aStatus);
|
sl@0
|
819 |
TInt len = aDes.Length();
|
sl@0
|
820 |
if(aLen < 0)
|
sl@0
|
821 |
test(aStatus.Int() == KErrArgument);
|
sl@0
|
822 |
else
|
sl@0
|
823 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
824 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
825 |
{
|
sl@0
|
826 |
if(aPos >= K4GB)
|
sl@0
|
827 |
test(len == 0);
|
sl@0
|
828 |
}
|
sl@0
|
829 |
return(*this);
|
sl@0
|
830 |
}
|
sl@0
|
831 |
|
sl@0
|
832 |
RFileTest& RFileTest::ReadP(TInt64 aPos, TDes8& aDes)
|
sl@0
|
833 |
//
|
sl@0
|
834 |
// Reads from the file at the specfied offset with in the file (Synchronous).
|
sl@0
|
835 |
//
|
sl@0
|
836 |
{
|
sl@0
|
837 |
test.Printf(_L("%S read 0x%lx\n"),&iName,aPos);
|
sl@0
|
838 |
TInt r = RFile64::Read(aPos,aDes);
|
sl@0
|
839 |
test(r == KErrNone);
|
sl@0
|
840 |
return(*this);
|
sl@0
|
841 |
}
|
sl@0
|
842 |
|
sl@0
|
843 |
RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes)
|
sl@0
|
844 |
//
|
sl@0
|
845 |
// Reads from the file at the specfied offset with in the file (Synchronous).
|
sl@0
|
846 |
// Offset is specified as a TUint value.
|
sl@0
|
847 |
//
|
sl@0
|
848 |
{
|
sl@0
|
849 |
test.Printf(_L("%S read 0x%lx\n"),&iName,aPos);
|
sl@0
|
850 |
TInt r = RFile64::Read(aPos,aDes);
|
sl@0
|
851 |
test(r == KErrNone);
|
sl@0
|
852 |
return(*this);
|
sl@0
|
853 |
}
|
sl@0
|
854 |
|
sl@0
|
855 |
RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes,TRequestStatus& aStatus)
|
sl@0
|
856 |
//
|
sl@0
|
857 |
// Reads from the file at the specfied offset with in the file (Asynchronous).
|
sl@0
|
858 |
// Offset is specified as a TUint value.
|
sl@0
|
859 |
//
|
sl@0
|
860 |
{
|
sl@0
|
861 |
test.Printf(_L("%S read 0x%lx\n"),&iName,aPos);
|
sl@0
|
862 |
RFile64::Read(aPos,aDes,aStatus);
|
sl@0
|
863 |
User::WaitForRequest(aStatus);
|
sl@0
|
864 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
865 |
return(*this);
|
sl@0
|
866 |
}
|
sl@0
|
867 |
|
sl@0
|
868 |
RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes, TInt aLen)
|
sl@0
|
869 |
//
|
sl@0
|
870 |
// Read from the file. Expected not to fail (Synchronous).
|
sl@0
|
871 |
// Offset is specified as a TUint value.
|
sl@0
|
872 |
//
|
sl@0
|
873 |
{
|
sl@0
|
874 |
test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
|
sl@0
|
875 |
TInt r = RFile64::Read(aPos,aDes,aLen);
|
sl@0
|
876 |
if(aLen < 0)
|
sl@0
|
877 |
test(r == KErrArgument);
|
sl@0
|
878 |
else
|
sl@0
|
879 |
test(r == KErrNone);
|
sl@0
|
880 |
return(*this);
|
sl@0
|
881 |
}
|
sl@0
|
882 |
|
sl@0
|
883 |
RFileTest& RFileTest::ReadU(TUint aPos, TDes8& aDes, TInt aLen, TRequestStatus& aStatus)
|
sl@0
|
884 |
//
|
sl@0
|
885 |
// Reads the specified number of bytes from the file at a specified offset, Expected not to fail (Asynchronous).
|
sl@0
|
886 |
// Offset is specified as a TUint value.
|
sl@0
|
887 |
//
|
sl@0
|
888 |
{
|
sl@0
|
889 |
test.Printf(_L("%S read 0x%lx-0x%lx\n"),&iName,aPos,aPos+aLen-1);
|
sl@0
|
890 |
RFile64::Read(aPos,aDes,aLen,aStatus);
|
sl@0
|
891 |
User::WaitForRequest(aStatus);
|
sl@0
|
892 |
if(aLen < 0)
|
sl@0
|
893 |
test(aStatus.Int() == KErrArgument);
|
sl@0
|
894 |
else
|
sl@0
|
895 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
896 |
return(*this);
|
sl@0
|
897 |
}
|
sl@0
|
898 |
|
sl@0
|
899 |
|
sl@0
|
900 |
RFileTest& RFileTest::Read(TInt64 aPos, TDes8& aDes, TRequestStatus& aStatus)
|
sl@0
|
901 |
//
|
sl@0
|
902 |
// Reads from the file at the specfied offset with in the file (Asynchronous).
|
sl@0
|
903 |
//
|
sl@0
|
904 |
{
|
sl@0
|
905 |
test.Printf(_L("%S read 0x%lx\n"),&iName,aPos);
|
sl@0
|
906 |
RFile64::Read(aPos,aDes,aStatus);
|
sl@0
|
907 |
User::WaitForRequest(aStatus);
|
sl@0
|
908 |
test(aStatus.Int() == KErrNone);
|
sl@0
|
909 |
return(*this);
|
sl@0
|
910 |
}
|
sl@0
|
911 |
|
sl@0
|
912 |
RFileTest& RFileTest::SetSize(TInt64 aSize)
|
sl@0
|
913 |
//
|
sl@0
|
914 |
// Set the size of the file. Expected not to fail.
|
sl@0
|
915 |
//
|
sl@0
|
916 |
{
|
sl@0
|
917 |
test.Printf(_L("%S size: 0x%lx\n"),&iName,aSize);
|
sl@0
|
918 |
TInt r = RFile64::SetSize(aSize);
|
sl@0
|
919 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
920 |
{
|
sl@0
|
921 |
if(aSize < K4GB)
|
sl@0
|
922 |
test(r == KErrNone);
|
sl@0
|
923 |
else
|
sl@0
|
924 |
test(r == KErrNotSupported);
|
sl@0
|
925 |
}
|
sl@0
|
926 |
else
|
sl@0
|
927 |
{
|
sl@0
|
928 |
test(r == KErrNone);
|
sl@0
|
929 |
}
|
sl@0
|
930 |
return(*this);
|
sl@0
|
931 |
}
|
sl@0
|
932 |
|
sl@0
|
933 |
RFileTest& RFileTest::SetSizeE(TInt64 aSize)
|
sl@0
|
934 |
//
|
sl@0
|
935 |
// Set the size of the file. Expected to fail.
|
sl@0
|
936 |
//
|
sl@0
|
937 |
{
|
sl@0
|
938 |
test.Printf(_L("%S sizeE: 0x%lx\n"),&iName,aSize);
|
sl@0
|
939 |
TInt r = RFile64::SetSize(aSize);
|
sl@0
|
940 |
test(r == KErrLocked);
|
sl@0
|
941 |
return(*this);
|
sl@0
|
942 |
}
|
sl@0
|
943 |
|
sl@0
|
944 |
RFileTest& RFileTest::Size(TInt64& aSize)
|
sl@0
|
945 |
//
|
sl@0
|
946 |
// Gets the current file size. Expected not to fail.
|
sl@0
|
947 |
//
|
sl@0
|
948 |
{
|
sl@0
|
949 |
TInt r = RFile64::Size(aSize);
|
sl@0
|
950 |
test.Printf(_L("%S size: 0x%lx\n"),&iName,aSize);
|
sl@0
|
951 |
|
sl@0
|
952 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
953 |
{
|
sl@0
|
954 |
if(aSize < K4GB)
|
sl@0
|
955 |
test(r == KErrNone);
|
sl@0
|
956 |
else
|
sl@0
|
957 |
test(r == KErrTooBig);
|
sl@0
|
958 |
}
|
sl@0
|
959 |
else
|
sl@0
|
960 |
{
|
sl@0
|
961 |
test(r == KErrNone);
|
sl@0
|
962 |
}
|
sl@0
|
963 |
return(*this);
|
sl@0
|
964 |
|
sl@0
|
965 |
}
|
sl@0
|
966 |
RFileTest& RFileTest::Seek(TSeek aMode, TInt64& aPos)
|
sl@0
|
967 |
//
|
sl@0
|
968 |
// Sets the current file position. Expected not to fail.
|
sl@0
|
969 |
//
|
sl@0
|
970 |
{
|
sl@0
|
971 |
test.Printf(_L("Seek to pos %LD in %d Mode\n"),aPos, aMode);
|
sl@0
|
972 |
TInt r = RFile64::Seek(aMode, aPos);
|
sl@0
|
973 |
if(aPos < 0)
|
sl@0
|
974 |
test(r == KErrArgument);
|
sl@0
|
975 |
else
|
sl@0
|
976 |
test(r == KErrNone);
|
sl@0
|
977 |
return(*this);
|
sl@0
|
978 |
}
|
sl@0
|
979 |
|
sl@0
|
980 |
/**
|
sl@0
|
981 |
@SYMTestCaseID PBASE-T_FILE64BIT-0756
|
sl@0
|
982 |
@SYMTestPriority High
|
sl@0
|
983 |
@SYMTestRequirement REQ9531
|
sl@0
|
984 |
@SYMTestType CIT
|
sl@0
|
985 |
@SYMTestCaseDesc Test opening a large file = 2GB in size
|
sl@0
|
986 |
@SYMTestActions
|
sl@0
|
987 |
1) Gets the entry details for a file using RFs::Entry(). The original file size=2GB
|
sl@0
|
988 |
2) Open a large file whose size = 2GB, with File Mode = EFileRead
|
sl@0
|
989 |
3) Close the file
|
sl@0
|
990 |
@SYMTestExpectedResults
|
sl@0
|
991 |
1) File size = 2GB
|
sl@0
|
992 |
2) KErrNone, File open successful
|
sl@0
|
993 |
3) File closed successfully
|
sl@0
|
994 |
@SYMTestStatus Implemented
|
sl@0
|
995 |
*/
|
sl@0
|
996 |
void TestOpen2GB()
|
sl@0
|
997 |
{
|
sl@0
|
998 |
TEntry entry;
|
sl@0
|
999 |
TInt64 testSize, size = 0;
|
sl@0
|
1000 |
TFileName fileName;
|
sl@0
|
1001 |
fileName.Append(gDriveToTest);
|
sl@0
|
1002 |
fileName.Append(KTestPath);
|
sl@0
|
1003 |
fileName.Append(_L("File2GB.txt"));
|
sl@0
|
1004 |
|
sl@0
|
1005 |
testSize = K2GB;
|
sl@0
|
1006 |
|
sl@0
|
1007 |
test.Next(_L("Create the file using RFile64::Replace and set the size and close"));
|
sl@0
|
1008 |
TestRFile1.Replace(fileName);
|
sl@0
|
1009 |
TestRFile1.SetSize(testSize);
|
sl@0
|
1010 |
TestRFile1.Close();
|
sl@0
|
1011 |
|
sl@0
|
1012 |
|
sl@0
|
1013 |
test.Next(_L("2GB File: Open"));
|
sl@0
|
1014 |
TInt r = TheFs.Entry(fileName, entry);
|
sl@0
|
1015 |
test(r == KErrNone);
|
sl@0
|
1016 |
test((TUint) entry.iSize == testSize);
|
sl@0
|
1017 |
|
sl@0
|
1018 |
TestRFile1.Open(fileName, EFileRead);
|
sl@0
|
1019 |
|
sl@0
|
1020 |
|
sl@0
|
1021 |
TestRFile1.Size(size);
|
sl@0
|
1022 |
test(size == testSize);
|
sl@0
|
1023 |
|
sl@0
|
1024 |
TestRFile1.Close();
|
sl@0
|
1025 |
r = TheFs.Delete(fileName);
|
sl@0
|
1026 |
test(r == KErrNone);
|
sl@0
|
1027 |
}
|
sl@0
|
1028 |
|
sl@0
|
1029 |
/**
|
sl@0
|
1030 |
@SYMTestCaseID PBASE-T_FILE64BIT-0757
|
sl@0
|
1031 |
@SYMTestPriority High
|
sl@0
|
1032 |
@SYMTestRequirement REQ9531
|
sl@0
|
1033 |
@SYMTestType CIT
|
sl@0
|
1034 |
@SYMTestCaseDesc Test opening a large file = 3GB in size
|
sl@0
|
1035 |
@SYMTestActions
|
sl@0
|
1036 |
1) Gets the entry details for a file using RFs::GetEntry(). The original file size=3GB
|
sl@0
|
1037 |
2) Open a large file whose size = 3GB, with File Mode = EFileRead
|
sl@0
|
1038 |
3) Close the file
|
sl@0
|
1039 |
@SYMTestExpectedResults
|
sl@0
|
1040 |
1) File size = 3GB
|
sl@0
|
1041 |
2) KErrNone, File open successful
|
sl@0
|
1042 |
3) File closed successfully
|
sl@0
|
1043 |
@SYMTestStatus Implemented
|
sl@0
|
1044 |
*/
|
sl@0
|
1045 |
void TestOpen3GB()
|
sl@0
|
1046 |
{
|
sl@0
|
1047 |
TInt r;
|
sl@0
|
1048 |
TEntry entry;
|
sl@0
|
1049 |
TInt64 testSize, size = 0;
|
sl@0
|
1050 |
TFileName fileName;
|
sl@0
|
1051 |
fileName.Append(gDriveToTest);
|
sl@0
|
1052 |
fileName.Append(KTestPath);
|
sl@0
|
1053 |
fileName.Append(_L("File3GB.txt"));
|
sl@0
|
1054 |
testSize = K3GB;
|
sl@0
|
1055 |
|
sl@0
|
1056 |
test.Next(_L("Create the file using RFile64::Replace and set the size and close"));
|
sl@0
|
1057 |
TestRFile1.Replace(fileName);
|
sl@0
|
1058 |
TestRFile1.SetSize(testSize);
|
sl@0
|
1059 |
TestRFile1.Close();
|
sl@0
|
1060 |
|
sl@0
|
1061 |
test.Next(_L("3GB File: Open"));
|
sl@0
|
1062 |
r = TheFs.Entry(fileName, entry);
|
sl@0
|
1063 |
test(r == KErrNone);
|
sl@0
|
1064 |
test((TUint) entry.iSize == testSize);
|
sl@0
|
1065 |
|
sl@0
|
1066 |
TestRFile1.Open(fileName,EFileRead);
|
sl@0
|
1067 |
|
sl@0
|
1068 |
TestRFile1.Size(size);
|
sl@0
|
1069 |
test(size == testSize);
|
sl@0
|
1070 |
TestRFile1.Close();
|
sl@0
|
1071 |
|
sl@0
|
1072 |
r = TheFs.Delete(fileName);
|
sl@0
|
1073 |
test(r == KErrNone);
|
sl@0
|
1074 |
}
|
sl@0
|
1075 |
|
sl@0
|
1076 |
/**
|
sl@0
|
1077 |
@SYMTestCaseID PBASE-T_FILE64BIT-0758
|
sl@0
|
1078 |
@SYMTestPriority High
|
sl@0
|
1079 |
@SYMTestRequirement REQ9531
|
sl@0
|
1080 |
@SYMTestType CIT
|
sl@0
|
1081 |
@SYMTestCaseDesc Test opening a large file < 4GB in size
|
sl@0
|
1082 |
@SYMTestActions
|
sl@0
|
1083 |
1) Gets the entry details for a file using RFs::GetEntry(). The original file size=4GB-1
|
sl@0
|
1084 |
2) Open a large file whose size = 4GB-1, with File Mode = EFileRead
|
sl@0
|
1085 |
3) Close the file
|
sl@0
|
1086 |
@SYMTestExpectedResults
|
sl@0
|
1087 |
1) File size = 4GB-1
|
sl@0
|
1088 |
2) KErrNone, File open successful
|
sl@0
|
1089 |
3) File closed successfully
|
sl@0
|
1090 |
@SYMTestStatus Implemented
|
sl@0
|
1091 |
*/
|
sl@0
|
1092 |
void TestOpen4GBMinusOne()
|
sl@0
|
1093 |
{
|
sl@0
|
1094 |
TInt r;
|
sl@0
|
1095 |
TEntry entry;
|
sl@0
|
1096 |
TInt64 testSize, size = 0;
|
sl@0
|
1097 |
TFileName fileName;
|
sl@0
|
1098 |
fileName.Append(gDriveToTest);
|
sl@0
|
1099 |
fileName.Append(KTestPath);
|
sl@0
|
1100 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
1101 |
testSize = K4GB-1;
|
sl@0
|
1102 |
|
sl@0
|
1103 |
test.Next(_L("Create the file using RFile64::Replace and set the size and close"));
|
sl@0
|
1104 |
TestRFile1.Replace(fileName);
|
sl@0
|
1105 |
TestRFile1.SetSize(testSize);
|
sl@0
|
1106 |
TestRFile1.Close();
|
sl@0
|
1107 |
|
sl@0
|
1108 |
test.Next(_L("4GB-1 File: Open"));
|
sl@0
|
1109 |
r = TheFs.Entry(fileName, entry);
|
sl@0
|
1110 |
test(r == KErrNone);
|
sl@0
|
1111 |
|
sl@0
|
1112 |
test((TUint) entry.iSize == testSize);
|
sl@0
|
1113 |
|
sl@0
|
1114 |
TestRFile1.Open(fileName, EFileRead);
|
sl@0
|
1115 |
|
sl@0
|
1116 |
TestRFile1.Size(size);
|
sl@0
|
1117 |
|
sl@0
|
1118 |
test(size == testSize);
|
sl@0
|
1119 |
TestRFile1.Close();
|
sl@0
|
1120 |
|
sl@0
|
1121 |
r = TheFs.Delete(fileName);
|
sl@0
|
1122 |
test(r == KErrNone);
|
sl@0
|
1123 |
}
|
sl@0
|
1124 |
|
sl@0
|
1125 |
/**
|
sl@0
|
1126 |
@SYMTestCaseID PBASE-T_FILE64BIT-0759
|
sl@0
|
1127 |
@SYMTestPriority High
|
sl@0
|
1128 |
@SYMTestRequirement REQ9531
|
sl@0
|
1129 |
@SYMTestType CIT
|
sl@0
|
1130 |
@SYMTestCaseDesc Test opening a large file 4GB in size
|
sl@0
|
1131 |
@SYMTestActions
|
sl@0
|
1132 |
1) Gets the entry details for a file using RFs::GetEntry(). The original file size=4GB
|
sl@0
|
1133 |
2) Open a large file whose size = 4GB, with File Mode = EFileRead
|
sl@0
|
1134 |
3) Close the file
|
sl@0
|
1135 |
@SYMTestExpectedResults
|
sl@0
|
1136 |
1) File size = 4GB
|
sl@0
|
1137 |
2) KErrNone, File open successful
|
sl@0
|
1138 |
3) File closed successfully
|
sl@0
|
1139 |
@SYMTestStatus Implemented
|
sl@0
|
1140 |
*/
|
sl@0
|
1141 |
void TestOpen4GB()
|
sl@0
|
1142 |
{
|
sl@0
|
1143 |
TInt r;
|
sl@0
|
1144 |
TEntry entry;
|
sl@0
|
1145 |
TInt64 testSize, size = 0;
|
sl@0
|
1146 |
TFileName fileName;
|
sl@0
|
1147 |
fileName.Append(gDriveToTest);
|
sl@0
|
1148 |
fileName.Append(KTestPath);
|
sl@0
|
1149 |
fileName.Append(_L("File4GB.txt"));
|
sl@0
|
1150 |
testSize = K4GB;
|
sl@0
|
1151 |
|
sl@0
|
1152 |
test.Next(_L("Create the file using RFile64::Replace and set the size and close"));
|
sl@0
|
1153 |
TestRFile1.Replace(fileName);
|
sl@0
|
1154 |
TestRFile1.SetSize(testSize);
|
sl@0
|
1155 |
TestRFile1.Close();
|
sl@0
|
1156 |
|
sl@0
|
1157 |
test.Next(_L("4GB File: Open"));
|
sl@0
|
1158 |
r = TheFs.Entry(fileName, entry);
|
sl@0
|
1159 |
test(r == KErrNone);
|
sl@0
|
1160 |
|
sl@0
|
1161 |
if ((TUint) entry.iSize == testSize)
|
sl@0
|
1162 |
{
|
sl@0
|
1163 |
TestRFile1.Open(fileName, EFileRead);
|
sl@0
|
1164 |
TestRFile1.Size(size);
|
sl@0
|
1165 |
test(size == testSize);
|
sl@0
|
1166 |
TestRFile1.Close();
|
sl@0
|
1167 |
}
|
sl@0
|
1168 |
|
sl@0
|
1169 |
r = TheFs.Delete(fileName);
|
sl@0
|
1170 |
test(r == KErrNone);
|
sl@0
|
1171 |
|
sl@0
|
1172 |
}
|
sl@0
|
1173 |
|
sl@0
|
1174 |
/**
|
sl@0
|
1175 |
@SYMTestCaseID PBASE-T_FILE64BIT-0760
|
sl@0
|
1176 |
@SYMTestPriority High
|
sl@0
|
1177 |
@SYMTestRequirement REQ9531
|
sl@0
|
1178 |
@SYMTestType CIT
|
sl@0
|
1179 |
@SYMTestCaseDesc Tests opening a large file > 2GB in size
|
sl@0
|
1180 |
@SYMTestActions
|
sl@0
|
1181 |
1) Create a new file named "File4GBMinusOne.txt"
|
sl@0
|
1182 |
2) Open the file with file mode = EFileWrite
|
sl@0
|
1183 |
3) Set the file size to 4GB-1
|
sl@0
|
1184 |
4) Write few bytes to the file and close
|
sl@0
|
1185 |
5) Close the file
|
sl@0
|
1186 |
6) Open the file "File4GBMinusOne.txt"
|
sl@0
|
1187 |
7) If FAT32 file system, set the file size to 4GB
|
sl@0
|
1188 |
8) Close the file
|
sl@0
|
1189 |
9) Open the file with file mode = EDeleteOnClose
|
sl@0
|
1190 |
@SYMTestExpectedResults
|
sl@0
|
1191 |
1) File creation successful with KErrNone
|
sl@0
|
1192 |
2) File open successful with KErrNone
|
sl@0
|
1193 |
3) KErrNone, Sets the file size to 4GB-1
|
sl@0
|
1194 |
4) KErrNone, write is successful and file closed successfully
|
sl@0
|
1195 |
5) File closed successfully
|
sl@0
|
1196 |
6) KErrNone, file open successful
|
sl@0
|
1197 |
7) KErrNotSupported. For next generation file system KErrNone is expected
|
sl@0
|
1198 |
8) File closed successfully
|
sl@0
|
1199 |
9) File open failed with KErrArgument
|
sl@0
|
1200 |
@SYMTestStatus Implemented
|
sl@0
|
1201 |
*/
|
sl@0
|
1202 |
void TestOpenMoreThan2GB()
|
sl@0
|
1203 |
{
|
sl@0
|
1204 |
// constants and literals
|
sl@0
|
1205 |
test.Next(_L("\nTest Files of size more than 2GB\n"));
|
sl@0
|
1206 |
|
sl@0
|
1207 |
TInt64 size;
|
sl@0
|
1208 |
TBuf8<KBUFSIZE> readBuf;
|
sl@0
|
1209 |
TFileName fileName;
|
sl@0
|
1210 |
fileName.Append(gDriveToTest);
|
sl@0
|
1211 |
fileName.Append(KTestPath);
|
sl@0
|
1212 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
1213 |
|
sl@0
|
1214 |
test.Start(_L("Test to create a large file > 2GB\n"));
|
sl@0
|
1215 |
|
sl@0
|
1216 |
TestRFile1.Replace(fileName);
|
sl@0
|
1217 |
test.Next(_L("Set the file size to 4GB-1\n"));
|
sl@0
|
1218 |
|
sl@0
|
1219 |
size = K4GBMinusOne;
|
sl@0
|
1220 |
TestRFile1.SetSize(size);
|
sl@0
|
1221 |
|
sl@0
|
1222 |
TBuf8<10> writeBuf;
|
sl@0
|
1223 |
writeBuf.Zero();
|
sl@0
|
1224 |
for(TInt count = 0; count < 10; count++)
|
sl@0
|
1225 |
{
|
sl@0
|
1226 |
writeBuf.Append(count);
|
sl@0
|
1227 |
}
|
sl@0
|
1228 |
|
sl@0
|
1229 |
test.Next(_L("Write 10 bytes to the file\n"));
|
sl@0
|
1230 |
TestRFile1.Write(0, writeBuf, 10);
|
sl@0
|
1231 |
test.Next(_L("Read 10 bytes from position 0\n"));
|
sl@0
|
1232 |
TestRFile1.Read(0, readBuf, 10);
|
sl@0
|
1233 |
test(writeBuf == readBuf);
|
sl@0
|
1234 |
|
sl@0
|
1235 |
TInt64 s;
|
sl@0
|
1236 |
TestRFile1.Size(s);
|
sl@0
|
1237 |
if(s < K4GB)
|
sl@0
|
1238 |
{
|
sl@0
|
1239 |
test.Printf(_L("\nFile size is less than 4 GB !!!!\n"));
|
sl@0
|
1240 |
}
|
sl@0
|
1241 |
|
sl@0
|
1242 |
TestRFile1.Close();
|
sl@0
|
1243 |
|
sl@0
|
1244 |
test.Next(_L("Open the file File4GBMinusOne.txt\n"));
|
sl@0
|
1245 |
TestRFile1.Open(fileName);
|
sl@0
|
1246 |
|
sl@0
|
1247 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
1248 |
{
|
sl@0
|
1249 |
test.Next (_L("Set the file size to 4GB\n"));
|
sl@0
|
1250 |
size = K4GB;
|
sl@0
|
1251 |
TestRFile1.SetSize(size);
|
sl@0
|
1252 |
}
|
sl@0
|
1253 |
TestRFile1.Close();
|
sl@0
|
1254 |
|
sl@0
|
1255 |
RFile64 file64;
|
sl@0
|
1256 |
TInt r = file64.Open(TheFs,fileName,EDeleteOnClose);
|
sl@0
|
1257 |
test (r == KErrArgument);
|
sl@0
|
1258 |
|
sl@0
|
1259 |
r = TheFs.Delete(fileName);
|
sl@0
|
1260 |
test(r == KErrNone);
|
sl@0
|
1261 |
|
sl@0
|
1262 |
}
|
sl@0
|
1263 |
|
sl@0
|
1264 |
/**
|
sl@0
|
1265 |
@SYMTestCaseID PBASE-T_FILE64BIT-0761
|
sl@0
|
1266 |
@SYMTestPriority High
|
sl@0
|
1267 |
@SYMTestRequirement REQ9531
|
sl@0
|
1268 |
@SYMTestType CIT
|
sl@0
|
1269 |
@SYMTestCaseDesc Tests opening a file using RFile and RFile64 in file sharing mode
|
sl@0
|
1270 |
@SYMTestActions
|
sl@0
|
1271 |
1) Create a file using RFile::Replace()
|
sl@0
|
1272 |
2) Open the file using RFile::Open() and file mode = EFileShareAny
|
sl@0
|
1273 |
3) Write 100 bytes to the file and close the file
|
sl@0
|
1274 |
4) Open the same file using RFile64::Open() and file mode = EFileShareAny
|
sl@0
|
1275 |
5) Set the file size to 4GB-1 using RFile64::SetSize().
|
sl@0
|
1276 |
6) Get the file size using RFile::Size()
|
sl@0
|
1277 |
7) Seek to the file position 2GB+5 using RFile::Seek()
|
sl@0
|
1278 |
8) Get the file size using RFile64::Size()
|
sl@0
|
1279 |
9) Seek to the file position 4GB-10 using RFile64::Seek()
|
sl@0
|
1280 |
10) Read from the file position 4GB-10 using RFile::Read() of length 5 bytes
|
sl@0
|
1281 |
11) Close the file.
|
sl@0
|
1282 |
12) Open the file using RFile::Open().
|
sl@0
|
1283 |
13) Open the file using RFile64::Open() and close the file.
|
sl@0
|
1284 |
@SYMTestExpectedResults
|
sl@0
|
1285 |
1) File created successful with KErrNone.
|
sl@0
|
1286 |
2) File opened successfully with KErrNone.
|
sl@0
|
1287 |
3) Write successful with KErrNone.
|
sl@0
|
1288 |
4) File opened successfully with KErrNone.
|
sl@0
|
1289 |
5) File size set successfully with KErrNone.
|
sl@0
|
1290 |
6) Fail with KErrNotSupported.
|
sl@0
|
1291 |
7) Seek operation fail with KErrArgument.
|
sl@0
|
1292 |
8) FileSize == 4GB-1.
|
sl@0
|
1293 |
9) KErrNone.
|
sl@0
|
1294 |
10) Read fail with KErrNotSupported.
|
sl@0
|
1295 |
11) File closed successfully.
|
sl@0
|
1296 |
12) File Open failed with KErrTooBig.
|
sl@0
|
1297 |
13) File open successfully with KErrNone and file closed successfully.
|
sl@0
|
1298 |
@SYMTestStatus Implemented
|
sl@0
|
1299 |
*/
|
sl@0
|
1300 |
void TestOpenRFileRFile64()
|
sl@0
|
1301 |
{
|
sl@0
|
1302 |
RFile file;
|
sl@0
|
1303 |
TInt size;
|
sl@0
|
1304 |
TInt64 size64;
|
sl@0
|
1305 |
TInt count;
|
sl@0
|
1306 |
TFileName fileName;
|
sl@0
|
1307 |
fileName.Append(gDriveToTest);
|
sl@0
|
1308 |
fileName.Append(KTestPath);
|
sl@0
|
1309 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
1310 |
|
sl@0
|
1311 |
test.Start(_L("Test opening a file using RFile and RFile64 in file sharing mode\n"));
|
sl@0
|
1312 |
TInt r = file.Replace(TheFs,fileName,EFileShareAny|EFileWrite);
|
sl@0
|
1313 |
test(r == KErrNone);
|
sl@0
|
1314 |
|
sl@0
|
1315 |
TBuf8<100> writeBuf;
|
sl@0
|
1316 |
TBuf8<100> readBuf;
|
sl@0
|
1317 |
writeBuf.Zero();
|
sl@0
|
1318 |
for(count = 0; count < 100; count++)
|
sl@0
|
1319 |
{
|
sl@0
|
1320 |
writeBuf.Append(count);
|
sl@0
|
1321 |
}
|
sl@0
|
1322 |
|
sl@0
|
1323 |
test.Next(_L("Write 100 bytes to the file\n"));
|
sl@0
|
1324 |
r = file.Write(0, writeBuf, 100);
|
sl@0
|
1325 |
test(r == KErrNone);
|
sl@0
|
1326 |
|
sl@0
|
1327 |
test.Next(_L("Read 100 bytes from position 0"));
|
sl@0
|
1328 |
r = file.Read(0, readBuf, 100);
|
sl@0
|
1329 |
test(r == KErrNone);
|
sl@0
|
1330 |
|
sl@0
|
1331 |
test.Next(_L("Compare the read data to the written data"));
|
sl@0
|
1332 |
test(readBuf == writeBuf);
|
sl@0
|
1333 |
|
sl@0
|
1334 |
|
sl@0
|
1335 |
test.Next(_L("Open the same file using RFile64::Open"));
|
sl@0
|
1336 |
TestRFile1.Open(fileName,EFileShareAny|EFileWrite);
|
sl@0
|
1337 |
|
sl@0
|
1338 |
test.Next(_L("Set the file size to 4GB-1\n"));
|
sl@0
|
1339 |
TestRFile1.SetSize(K4GBMinusOne);
|
sl@0
|
1340 |
|
sl@0
|
1341 |
test.Next(_L("Query the file size using Rfile::Size()\n"));
|
sl@0
|
1342 |
r = file.Size(size);
|
sl@0
|
1343 |
test (r == KErrTooBig);
|
sl@0
|
1344 |
|
sl@0
|
1345 |
test.Next(_L("Seek to the file position using 2GB+5 using RFile::Seek()\n"));
|
sl@0
|
1346 |
TUint seekPos1 = K2GB + 5;
|
sl@0
|
1347 |
TInt seekPos = (TInt)seekPos1;
|
sl@0
|
1348 |
r = file.Seek(ESeekStart,seekPos);
|
sl@0
|
1349 |
test(r == KErrArgument);
|
sl@0
|
1350 |
|
sl@0
|
1351 |
test.Next(_L("Get the file size using RFile64::Size()\n"));
|
sl@0
|
1352 |
TestRFile1.Size(size64);
|
sl@0
|
1353 |
|
sl@0
|
1354 |
test.Next(_L("Seek to the file position 4GB-10 using RFile64::Seek()\n"));
|
sl@0
|
1355 |
TInt64 seekPos64 = K4GB - 10;
|
sl@0
|
1356 |
TestRFile1.Seek(ESeekStart,seekPos64);
|
sl@0
|
1357 |
|
sl@0
|
1358 |
TBuf8<5> writeBuf64;
|
sl@0
|
1359 |
TBuf8<5> readBuf64;
|
sl@0
|
1360 |
writeBuf64.Zero();
|
sl@0
|
1361 |
for(count = 0; count < 5; count++)
|
sl@0
|
1362 |
{
|
sl@0
|
1363 |
writeBuf64.Append(count);
|
sl@0
|
1364 |
}
|
sl@0
|
1365 |
|
sl@0
|
1366 |
test.Next(_L("Read from the file position 4GB-10 using RFile::Read() of length 5 bytes\n"));
|
sl@0
|
1367 |
TestRFile1.Write(seekPos64,writeBuf64,5);
|
sl@0
|
1368 |
TestRFile1.Seek(ESeekStart,seekPos64);
|
sl@0
|
1369 |
TestRFile1.Read(seekPos64,readBuf64,5);
|
sl@0
|
1370 |
test(readBuf64 == writeBuf64);
|
sl@0
|
1371 |
|
sl@0
|
1372 |
TestRFile1.Close();
|
sl@0
|
1373 |
file.Close();
|
sl@0
|
1374 |
|
sl@0
|
1375 |
test.Next(_L("Open the file using Rfile::Open()\n"));
|
sl@0
|
1376 |
r = file.Open(TheFs,fileName,EFileShareAny|EFileWrite);
|
sl@0
|
1377 |
test(r == KErrTooBig);
|
sl@0
|
1378 |
|
sl@0
|
1379 |
test.Next(_L("Open the file using Rfile64::Open() and close\n"));
|
sl@0
|
1380 |
TestRFile1.Open(fileName,EFileShareAny|EFileWrite);
|
sl@0
|
1381 |
TestRFile1.Close();
|
sl@0
|
1382 |
|
sl@0
|
1383 |
r = TheFs.Delete(fileName);
|
sl@0
|
1384 |
test(r == KErrNone);
|
sl@0
|
1385 |
}
|
sl@0
|
1386 |
|
sl@0
|
1387 |
/**
|
sl@0
|
1388 |
@SYMTestCaseID PBASE-T_FILE64BIT-0762
|
sl@0
|
1389 |
@SYMTestPriority High
|
sl@0
|
1390 |
@SYMTestRequirement REQ9531
|
sl@0
|
1391 |
@SYMTestType CIT
|
sl@0
|
1392 |
@SYMTestCaseDesc Tests the temporary file creation using RFile64::Temp()
|
sl@0
|
1393 |
@SYMTestActions
|
sl@0
|
1394 |
1) Create a Temporary file using RFile64::Temp() in write mode and DeleteOnClose
|
sl@0
|
1395 |
2) Set the file size to 4GB-1
|
sl@0
|
1396 |
3) Write 100 bytes to the file at position 2GB+1
|
sl@0
|
1397 |
4) Write 1 byte to file position 4GB-2
|
sl@0
|
1398 |
5) Write 10 bytes to file position 0.
|
sl@0
|
1399 |
6) Write 1 byte to file position 4GB+1
|
sl@0
|
1400 |
7) Read and compare the data at position 2GB+1,4GB-2,0 and close the file
|
sl@0
|
1401 |
8) Delete the temporary file.
|
sl@0
|
1402 |
9) Create a temporary file using RFile64::Temp() in write mode and without DeleteOnClose flag
|
sl@0
|
1403 |
10) Close the File
|
sl@0
|
1404 |
11) Delete the temporary file
|
sl@0
|
1405 |
@SYMTestExpectedResults
|
sl@0
|
1406 |
1) Temporary file created successfully
|
sl@0
|
1407 |
2) File size = 4GB-1
|
sl@0
|
1408 |
3) Write successful with KErrNone
|
sl@0
|
1409 |
4) Write successful with KErrNone
|
sl@0
|
1410 |
5) Write successful with KErrNone
|
sl@0
|
1411 |
6) Write fail with KErrNotSupported
|
sl@0
|
1412 |
7) Read data == written data
|
sl@0
|
1413 |
8) KErrNotFound, since the file is already deleted on close
|
sl@0
|
1414 |
9) File created successfully
|
sl@0
|
1415 |
10) File closed
|
sl@0
|
1416 |
11) File deleted successfully
|
sl@0
|
1417 |
|
sl@0
|
1418 |
@SYMTestStatus Implemented
|
sl@0
|
1419 |
*/
|
sl@0
|
1420 |
void TestCreateTempFile()
|
sl@0
|
1421 |
{
|
sl@0
|
1422 |
TInt count;
|
sl@0
|
1423 |
TFileName testDir;
|
sl@0
|
1424 |
testDir.Append(gDriveToTest);
|
sl@0
|
1425 |
testDir.Append(KTestPath);
|
sl@0
|
1426 |
|
sl@0
|
1427 |
TInt r = TheFs.MkDir(testDir);
|
sl@0
|
1428 |
test(r == KErrNone || r == KErrAlreadyExists);
|
sl@0
|
1429 |
|
sl@0
|
1430 |
TFileName fileName;
|
sl@0
|
1431 |
TestRFile1.Temp(testDir, fileName, EFileWrite|EDeleteOnClose);
|
sl@0
|
1432 |
|
sl@0
|
1433 |
test.Next(_L("Set the file size to 4GB-1\n"));
|
sl@0
|
1434 |
TestRFile1.SetSize(K4GBMinusOne);
|
sl@0
|
1435 |
|
sl@0
|
1436 |
TInt64 size = 0;
|
sl@0
|
1437 |
TestRFile1.Size(size);
|
sl@0
|
1438 |
test (size == K4GBMinusOne);
|
sl@0
|
1439 |
|
sl@0
|
1440 |
TBuf8<0x64> writeBuf;
|
sl@0
|
1441 |
TBuf8<0x64> readBuf;
|
sl@0
|
1442 |
writeBuf.Zero();
|
sl@0
|
1443 |
for(count = 0; count < 100; count++)
|
sl@0
|
1444 |
{
|
sl@0
|
1445 |
writeBuf.Append(count);
|
sl@0
|
1446 |
}
|
sl@0
|
1447 |
TInt64 seekPos = K2GB + 1;
|
sl@0
|
1448 |
test.Next(_L("Write 100 bytes to the file at position 2GB+1\n"));
|
sl@0
|
1449 |
TestRFile1.Write(seekPos, writeBuf, 100);
|
sl@0
|
1450 |
test.Next(_L("Read 100 bytes from position 2GB+1"));
|
sl@0
|
1451 |
TestRFile1.Read(seekPos, readBuf, 100);
|
sl@0
|
1452 |
test(writeBuf == readBuf);
|
sl@0
|
1453 |
|
sl@0
|
1454 |
test.Next(_L("Write 1 byte to the file at position 4GB-2\n"));
|
sl@0
|
1455 |
TBuf8<01> writeBuf1Byte;
|
sl@0
|
1456 |
TBuf8<01> readBuf1Byte;
|
sl@0
|
1457 |
writeBuf1Byte.Zero();
|
sl@0
|
1458 |
writeBuf1Byte.Append(0);
|
sl@0
|
1459 |
seekPos = K4GBMinusTwo;
|
sl@0
|
1460 |
TestRFile1.Write(seekPos, writeBuf1Byte, 1);
|
sl@0
|
1461 |
|
sl@0
|
1462 |
test.Next(_L("Read 1 byte from position 4GB-2"));
|
sl@0
|
1463 |
seekPos = K4GBMinusTwo;
|
sl@0
|
1464 |
TestRFile1.Read(seekPos, readBuf1Byte, 1);
|
sl@0
|
1465 |
test(writeBuf1Byte == readBuf1Byte);
|
sl@0
|
1466 |
|
sl@0
|
1467 |
test.Next(_L("Write 10 bytes to the file at position 0\n"));
|
sl@0
|
1468 |
TBuf8<10> writeBuf10Byte;
|
sl@0
|
1469 |
TBuf8<10> readBuf10Byte;
|
sl@0
|
1470 |
writeBuf10Byte.Zero();
|
sl@0
|
1471 |
for(count = 0; count < 10; count++)
|
sl@0
|
1472 |
{
|
sl@0
|
1473 |
writeBuf10Byte.Append(count);
|
sl@0
|
1474 |
}
|
sl@0
|
1475 |
TestRFile1.Write(0, writeBuf10Byte, 10);
|
sl@0
|
1476 |
|
sl@0
|
1477 |
test.Next(_L("Read 10 byte from position 0"));
|
sl@0
|
1478 |
TestRFile1.Read(0, readBuf10Byte, 10);
|
sl@0
|
1479 |
test(writeBuf10Byte == readBuf10Byte);
|
sl@0
|
1480 |
|
sl@0
|
1481 |
test.Next(_L("Write 1 byte to the file at position 4GB+1\n"));
|
sl@0
|
1482 |
seekPos = K4GB + 1;
|
sl@0
|
1483 |
TestRFile1.Write(seekPos, writeBuf1Byte, 1);
|
sl@0
|
1484 |
|
sl@0
|
1485 |
TestRFile1.Close();
|
sl@0
|
1486 |
|
sl@0
|
1487 |
test.Next(_L("Delete the temporary file\n"));
|
sl@0
|
1488 |
r = TheFs.Delete(fileName);
|
sl@0
|
1489 |
test(r == KErrNotFound);
|
sl@0
|
1490 |
|
sl@0
|
1491 |
test.Next(_L("Create a temporary file using RFile64::Temp without EDeleteOnClose flag\n"));
|
sl@0
|
1492 |
TestRFile1.Temp(testDir, fileName, EFileWrite);
|
sl@0
|
1493 |
|
sl@0
|
1494 |
test.Next(_L("Close the file\n"));
|
sl@0
|
1495 |
TestRFile1.Close();
|
sl@0
|
1496 |
|
sl@0
|
1497 |
test.Next(_L("Delete the temporary the file\n"));
|
sl@0
|
1498 |
r = TheFs.Delete(fileName);
|
sl@0
|
1499 |
test(r == KErrNone);
|
sl@0
|
1500 |
|
sl@0
|
1501 |
}
|
sl@0
|
1502 |
|
sl@0
|
1503 |
/**
|
sl@0
|
1504 |
@SYMTestCaseID PBASE-T_FILE64BIT-0763
|
sl@0
|
1505 |
@SYMTestPriority High
|
sl@0
|
1506 |
@SYMTestRequirement REQ9531
|
sl@0
|
1507 |
@SYMTestType CIT
|
sl@0
|
1508 |
@SYMTestCaseDesc Tests the file creation using RFile64::Create()
|
sl@0
|
1509 |
@SYMTestActions
|
sl@0
|
1510 |
1) Create a file FileLargeOne.txt in write mode.
|
sl@0
|
1511 |
2) Set the file size to 3GB-4KB
|
sl@0
|
1512 |
3) Seek the file: Mode = ESeekEnd
|
sl@0
|
1513 |
4) Write to a file with current position and length =4KB
|
sl@0
|
1514 |
5) Get the file size.
|
sl@0
|
1515 |
6) Write to a file at position 0 and length = 100 bytes.
|
sl@0
|
1516 |
7) Write to a file at position 4GB -2 and length = 1 byte
|
sl@0
|
1517 |
8) Write to a file at position 4GB -2 and length = 3 byte
|
sl@0
|
1518 |
9) Read and compare the data written at position 0, 4GB-1
|
sl@0
|
1519 |
10) Close the File.
|
sl@0
|
1520 |
11) Create the file FileLargeOne.txt in write mode.
|
sl@0
|
1521 |
12) Create a file with invalid path and file name.
|
sl@0
|
1522 |
@SYMTestExpectedResults
|
sl@0
|
1523 |
1) File created successfully with KErrNone
|
sl@0
|
1524 |
2) File size = 3GB-4KB
|
sl@0
|
1525 |
3) KErrNone
|
sl@0
|
1526 |
4) Write successful with KErrNone
|
sl@0
|
1527 |
5) File size == 3GB
|
sl@0
|
1528 |
6) Write successful with KErrNone
|
sl@0
|
1529 |
7) Write successful with KErrNone
|
sl@0
|
1530 |
8) Write fails with KErrNotSupported.
|
sl@0
|
1531 |
9) Read data == written data.
|
sl@0
|
1532 |
10) File closed successfully.
|
sl@0
|
1533 |
11) File creation failed with KErrAlreadyExists
|
sl@0
|
1534 |
12) File Creation failed with KErrPathNotFound.
|
sl@0
|
1535 |
@SYMTestStatus Implemented
|
sl@0
|
1536 |
*/
|
sl@0
|
1537 |
void TestCreateRFile64()
|
sl@0
|
1538 |
{
|
sl@0
|
1539 |
TInt count;
|
sl@0
|
1540 |
TFileName fileName;
|
sl@0
|
1541 |
fileName.Append(gDriveToTest);
|
sl@0
|
1542 |
fileName.Append(KTestPath);
|
sl@0
|
1543 |
fileName.Append(_L("FileLargeOne.txt"));
|
sl@0
|
1544 |
|
sl@0
|
1545 |
test.Next(_L("create a file named FileLargeOne.txt\n"));
|
sl@0
|
1546 |
TestRFile1.Create(fileName, EFileWrite);
|
sl@0
|
1547 |
|
sl@0
|
1548 |
test.Next(_L("set the file size to 3GB - 4KB\n"));
|
sl@0
|
1549 |
TestRFile1.SetSize(K3GB-K4KB);
|
sl@0
|
1550 |
|
sl@0
|
1551 |
TInt64 size = 0;
|
sl@0
|
1552 |
TestRFile1.Size(size);
|
sl@0
|
1553 |
test (size == K3GB-K4KB);
|
sl@0
|
1554 |
|
sl@0
|
1555 |
test.Next(_L("seek to the end of the file\n"));
|
sl@0
|
1556 |
TInt64 seekPos = 0;
|
sl@0
|
1557 |
TestRFile1.Seek(ESeekEnd,seekPos);
|
sl@0
|
1558 |
test(seekPos == K3GB-K4KB);
|
sl@0
|
1559 |
|
sl@0
|
1560 |
test.Next(_L("write to the file current position and length = 4KB\n"));
|
sl@0
|
1561 |
TBuf8<4096> writeBufK4KB;
|
sl@0
|
1562 |
TBuf8<4096> readBufK4KB;
|
sl@0
|
1563 |
for (count = 0; count < 4096; count++)
|
sl@0
|
1564 |
{
|
sl@0
|
1565 |
writeBufK4KB.Append(count+1);
|
sl@0
|
1566 |
}
|
sl@0
|
1567 |
|
sl@0
|
1568 |
TestRFile1.Write(writeBufK4KB,K4KB);
|
sl@0
|
1569 |
|
sl@0
|
1570 |
test.Next(_L("read from the file from position K3GB-K4KB and length = 4KB\n"));
|
sl@0
|
1571 |
seekPos = K3GB - K4KB;
|
sl@0
|
1572 |
TestRFile1.Read(seekPos,readBufK4KB,K4KB);
|
sl@0
|
1573 |
test(writeBufK4KB == readBufK4KB);
|
sl@0
|
1574 |
|
sl@0
|
1575 |
test.Next(_L("get the size of the file\n"));
|
sl@0
|
1576 |
size = 0;
|
sl@0
|
1577 |
TestRFile1.Size(size);
|
sl@0
|
1578 |
test(size == K3GB);
|
sl@0
|
1579 |
|
sl@0
|
1580 |
test.Next(_L("write to the file at position 0 and length = 100bytes\n"));
|
sl@0
|
1581 |
TBuf8<0x64> writeBuf100B;
|
sl@0
|
1582 |
TBuf8<0x64> readBuf100B;
|
sl@0
|
1583 |
writeBuf100B.Zero();
|
sl@0
|
1584 |
for(count = 0; count < 100; count++)
|
sl@0
|
1585 |
{
|
sl@0
|
1586 |
writeBuf100B.Append(count);
|
sl@0
|
1587 |
}
|
sl@0
|
1588 |
seekPos = 0;
|
sl@0
|
1589 |
TestRFile1.Write(seekPos, writeBuf100B, 100);
|
sl@0
|
1590 |
|
sl@0
|
1591 |
test.Next(_L("Read 100 bytes from position 0"));
|
sl@0
|
1592 |
TestRFile1.Read(seekPos, readBuf100B, 100);
|
sl@0
|
1593 |
test(writeBuf100B == readBuf100B);
|
sl@0
|
1594 |
|
sl@0
|
1595 |
test.Next(_L("Write 1 byte to the file at position 4GB-2\n"));
|
sl@0
|
1596 |
TBuf8<01> writeBuf1Byte;
|
sl@0
|
1597 |
TBuf8<01> readBuf1Byte;
|
sl@0
|
1598 |
writeBuf1Byte.Zero();
|
sl@0
|
1599 |
writeBuf1Byte.Append(0);
|
sl@0
|
1600 |
seekPos = K4GBMinusTwo;
|
sl@0
|
1601 |
TestRFile1.SetSize(K4GB-1);
|
sl@0
|
1602 |
TestRFile1.Write(seekPos, writeBuf1Byte, 1);
|
sl@0
|
1603 |
|
sl@0
|
1604 |
test.Next(_L("Read 1 byte from position 4GB-2"));
|
sl@0
|
1605 |
seekPos = K4GBMinusTwo;
|
sl@0
|
1606 |
TestRFile1.Read(seekPos, readBuf1Byte, 1);
|
sl@0
|
1607 |
test(writeBuf1Byte == readBuf1Byte);
|
sl@0
|
1608 |
|
sl@0
|
1609 |
test.Next(_L("Write 3 bytes to the file at position 4GB-1\n"));
|
sl@0
|
1610 |
TBuf8<3> writeBuf3Byte;
|
sl@0
|
1611 |
|
sl@0
|
1612 |
writeBuf3Byte.Zero();
|
sl@0
|
1613 |
for(count = 0; count < 3; count++)
|
sl@0
|
1614 |
{
|
sl@0
|
1615 |
writeBuf3Byte.Append(count);
|
sl@0
|
1616 |
}
|
sl@0
|
1617 |
seekPos = K4GBMinusTwo;
|
sl@0
|
1618 |
TestRFile1.Write(seekPos, writeBuf1Byte, 3);
|
sl@0
|
1619 |
|
sl@0
|
1620 |
TestRFile1.Close();
|
sl@0
|
1621 |
|
sl@0
|
1622 |
test.Next(_L("create a file named FileLargeOne.txt(KErrAlreadyExists)\n"));
|
sl@0
|
1623 |
TestRFile1.Create(fileName,EFileWrite);
|
sl@0
|
1624 |
|
sl@0
|
1625 |
test.Next(_L("create a file with InvalidPath and fileName\n"));
|
sl@0
|
1626 |
RFile64 file64;
|
sl@0
|
1627 |
TInt r = file64.Create(TheFs, _L("C:\\InvalidPathName\\FileName"),EFileWrite);
|
sl@0
|
1628 |
test(r == KErrPathNotFound);
|
sl@0
|
1629 |
|
sl@0
|
1630 |
r = TheFs.Delete(fileName);
|
sl@0
|
1631 |
test(r == KErrNone);
|
sl@0
|
1632 |
}
|
sl@0
|
1633 |
|
sl@0
|
1634 |
/**
|
sl@0
|
1635 |
@SYMTestCaseID PBASE-T_FILE64BIT-0764
|
sl@0
|
1636 |
@SYMTestPriority High
|
sl@0
|
1637 |
@SYMTestRequirement REQ9531
|
sl@0
|
1638 |
@SYMTestType CIT
|
sl@0
|
1639 |
@SYMTestCaseDesc Tests the file creation using RFile64::Replace()
|
sl@0
|
1640 |
@SYMTestActions
|
sl@0
|
1641 |
1) Replace a file FileLargeOne.txt in write mode using RFile64::Replace.
|
sl@0
|
1642 |
2) Set the file size to 4GB-1
|
sl@0
|
1643 |
3) Write to a file with position = 4GB-4KB-2 and length = 4KB
|
sl@0
|
1644 |
4) Get the file size
|
sl@0
|
1645 |
5) Seek the file: Mode = ESeekEnd,pos = 0.
|
sl@0
|
1646 |
6) Write to a file with current position, length = 1 byte
|
sl@0
|
1647 |
7) Seek the file: Mode = ESeekStart
|
sl@0
|
1648 |
8) Write to a file with current position and length = 4KB
|
sl@0
|
1649 |
9) Seek the file: Mode = ESeekEnd
|
sl@0
|
1650 |
10)Read from the current position and length = 1 byte and compare with written data
|
sl@0
|
1651 |
11)Seek the file: Mode = ESeekStart
|
sl@0
|
1652 |
12)Read the data from the current position and length = 4KB and compare with written data
|
sl@0
|
1653 |
13)Close the file
|
sl@0
|
1654 |
14)Replace a file FileLargeOne.txt in write mode
|
sl@0
|
1655 |
15)Get the file size
|
sl@0
|
1656 |
16)Close the file.
|
sl@0
|
1657 |
17)Replace a file FileLargeOne.txt with invalid path
|
sl@0
|
1658 |
@SYMTestExpectedResults
|
sl@0
|
1659 |
1) File created successfully with KErrNone
|
sl@0
|
1660 |
2) File size = 4GB-1
|
sl@0
|
1661 |
3) Write successful with KErrNone
|
sl@0
|
1662 |
4) File size = 4GB-1
|
sl@0
|
1663 |
5) KErrNone
|
sl@0
|
1664 |
6) Write successful with KErrNone
|
sl@0
|
1665 |
7) KErrNone
|
sl@0
|
1666 |
8) Write successful with KErrNone
|
sl@0
|
1667 |
9) KErrNone
|
sl@0
|
1668 |
10)Written data == Read data
|
sl@0
|
1669 |
11)KErrNone
|
sl@0
|
1670 |
12)Written data == Read data
|
sl@0
|
1671 |
13)File Closed
|
sl@0
|
1672 |
14)File creatd successfully with KErrNone
|
sl@0
|
1673 |
15)File size = 0
|
sl@0
|
1674 |
16)File Closed
|
sl@0
|
1675 |
17)File creation failed with KErrPathNotFound.
|
sl@0
|
1676 |
@SYMTestStatus Implemented
|
sl@0
|
1677 |
*/
|
sl@0
|
1678 |
void TestReplaceRFile64()
|
sl@0
|
1679 |
{
|
sl@0
|
1680 |
TFileName fileName;
|
sl@0
|
1681 |
fileName.Append(gDriveToTest);
|
sl@0
|
1682 |
fileName.Append(KTestPath);
|
sl@0
|
1683 |
fileName.Append(_L("FileLargeOne.txt"));
|
sl@0
|
1684 |
|
sl@0
|
1685 |
test.Next(_L("Replace a file named FileLargeOne.txt\n"));
|
sl@0
|
1686 |
TestRFile1.Replace(fileName, EFileWrite);
|
sl@0
|
1687 |
|
sl@0
|
1688 |
test.Next(_L("Set the size of the file to 4GB-1\n"));
|
sl@0
|
1689 |
TestRFile1.SetSize(K4GB-1);
|
sl@0
|
1690 |
|
sl@0
|
1691 |
TBuf8<4096> writeBufK4KB;
|
sl@0
|
1692 |
TBuf8<4096> readBufK4KB;
|
sl@0
|
1693 |
for (TInt count = 0; count < 4096; count++)
|
sl@0
|
1694 |
{
|
sl@0
|
1695 |
writeBufK4KB.Append(count+1);
|
sl@0
|
1696 |
}
|
sl@0
|
1697 |
|
sl@0
|
1698 |
test.Next(_L("Write to a file with position = 4GB-4KB-2 and length = 4KB\n"));
|
sl@0
|
1699 |
TInt64 pos = K4GB-K4KB-2;
|
sl@0
|
1700 |
TestRFile1.Write(pos,writeBufK4KB,K4KB);
|
sl@0
|
1701 |
|
sl@0
|
1702 |
test.Next(_L("Read from 4GB-4KB-1 and compare data\n"));
|
sl@0
|
1703 |
TestRFile1.Read(pos,readBufK4KB,K4KB);
|
sl@0
|
1704 |
test(writeBufK4KB == readBufK4KB);
|
sl@0
|
1705 |
|
sl@0
|
1706 |
test.Next(_L("Get the file size\n"));
|
sl@0
|
1707 |
TInt64 size = 0;
|
sl@0
|
1708 |
TestRFile1.Size(size);
|
sl@0
|
1709 |
test (size == K4GB-1);
|
sl@0
|
1710 |
|
sl@0
|
1711 |
test.Next(_L("Seek the file: Mode = ESeekEnd,pos = 0.\n"));
|
sl@0
|
1712 |
TInt64 seekPos = 0;
|
sl@0
|
1713 |
TestRFile1.Seek(ESeekEnd,seekPos);
|
sl@0
|
1714 |
test(seekPos == K4GB-1);
|
sl@0
|
1715 |
|
sl@0
|
1716 |
test.Next(_L("Write to a file with current position, length = 1 byte\n"));
|
sl@0
|
1717 |
TBuf8<1> writeBuf1B(_L8("0"));
|
sl@0
|
1718 |
TBuf8<1> readBuf1B;
|
sl@0
|
1719 |
|
sl@0
|
1720 |
if(!KFileSizeMaxLargerThan4GBMinusOne)
|
sl@0
|
1721 |
seekPos--;
|
sl@0
|
1722 |
|
sl@0
|
1723 |
TestRFile1.Write(seekPos,writeBuf1B,1); //-- now seek pos is K4GB
|
sl@0
|
1724 |
|
sl@0
|
1725 |
|
sl@0
|
1726 |
test.Next(_L("Seek the file: Mode = ESeekStart\n"));
|
sl@0
|
1727 |
seekPos = 0;
|
sl@0
|
1728 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
1729 |
|
sl@0
|
1730 |
test.Next(_L("Write to a file with current position and length = 4KB\n"));
|
sl@0
|
1731 |
TestRFile1.Write(seekPos,writeBufK4KB,K4KB);
|
sl@0
|
1732 |
|
sl@0
|
1733 |
test.Next(_L("Seek the file: Mode = ESeekEnd\n"));
|
sl@0
|
1734 |
seekPos = 0;
|
sl@0
|
1735 |
TestRFile1.Seek(ESeekEnd,seekPos);
|
sl@0
|
1736 |
|
sl@0
|
1737 |
if(KFileSizeMaxLargerThan4GBMinusOne)
|
sl@0
|
1738 |
{//-- file is larger than 4G-1
|
sl@0
|
1739 |
test(seekPos == K4GB);
|
sl@0
|
1740 |
}
|
sl@0
|
1741 |
else
|
sl@0
|
1742 |
{
|
sl@0
|
1743 |
test(seekPos == K4GB-1);
|
sl@0
|
1744 |
}
|
sl@0
|
1745 |
|
sl@0
|
1746 |
seekPos--;
|
sl@0
|
1747 |
|
sl@0
|
1748 |
|
sl@0
|
1749 |
test.Next(_L("Read from pos = 4GB-1 and compare data\n"));
|
sl@0
|
1750 |
TestRFile1.Read(seekPos,readBuf1B,1);
|
sl@0
|
1751 |
test(writeBuf1B == readBuf1B);
|
sl@0
|
1752 |
|
sl@0
|
1753 |
test.Next(_L("Seek the file: Mode = ESeekStart\n"));
|
sl@0
|
1754 |
seekPos = 0;
|
sl@0
|
1755 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
1756 |
|
sl@0
|
1757 |
test.Next(_L("Read from the file and compare written data\n"));
|
sl@0
|
1758 |
TestRFile1.Read(seekPos,readBufK4KB,K4KB);
|
sl@0
|
1759 |
test (writeBufK4KB == readBufK4KB);
|
sl@0
|
1760 |
|
sl@0
|
1761 |
test.Next(_L("Close the file\n"));
|
sl@0
|
1762 |
TestRFile1.Close();
|
sl@0
|
1763 |
|
sl@0
|
1764 |
test.Next(_L("Replace a file FileLargeOne.txt in write mode\n"));
|
sl@0
|
1765 |
TestRFile1.Replace(fileName, EFileWrite);
|
sl@0
|
1766 |
|
sl@0
|
1767 |
test.Next(_L("Get the file size\n"));
|
sl@0
|
1768 |
size = 0;
|
sl@0
|
1769 |
TestRFile1.Size(size);
|
sl@0
|
1770 |
test (size == 0);
|
sl@0
|
1771 |
|
sl@0
|
1772 |
test.Next(_L("Close the file\n"));
|
sl@0
|
1773 |
TestRFile1.Close();
|
sl@0
|
1774 |
|
sl@0
|
1775 |
test.Next(_L("Replace a file FileLargeOne.txt with invalid path\n"));
|
sl@0
|
1776 |
RFile64 file64;
|
sl@0
|
1777 |
TInt r = file64.Replace(TheFs,_L("C:\\InvalidPath\\FileLargeOne.Txt"),EFileWrite);
|
sl@0
|
1778 |
test (r == KErrPathNotFound);
|
sl@0
|
1779 |
|
sl@0
|
1780 |
r = TheFs.Delete(fileName);
|
sl@0
|
1781 |
test(r == KErrNone);
|
sl@0
|
1782 |
}
|
sl@0
|
1783 |
|
sl@0
|
1784 |
/**
|
sl@0
|
1785 |
@SYMTestCaseID PBASE-T_FILE64BIT-0765
|
sl@0
|
1786 |
@SYMTestPriority High
|
sl@0
|
1787 |
@SYMTestRequirement REQXXXX
|
sl@0
|
1788 |
@SYMTestType CIT
|
sl@0
|
1789 |
@SYMTestCaseDesc Tests the file replace using RFs::Replace()
|
sl@0
|
1790 |
@SYMTestActions
|
sl@0
|
1791 |
1) Create a file named FileLargeOne.txt using RFile64::Replace()
|
sl@0
|
1792 |
2) Set the file size to 3GB and get the file size
|
sl@0
|
1793 |
3) Write 10 bytes to location 2GB+10 and close the file
|
sl@0
|
1794 |
4) Replace the file named ReNameFileLargeOne.txt using RFs::Replace()
|
sl@0
|
1795 |
5) Open the file ReNameFileLargeOne.txt
|
sl@0
|
1796 |
6) Set the file size to 4GB-1
|
sl@0
|
1797 |
7) Write 10 bytes to the location 3GB+10
|
sl@0
|
1798 |
8) Read the above file from the location 3GB+10
|
sl@0
|
1799 |
9) Compare the read and the written data
|
sl@0
|
1800 |
10)Close the file
|
sl@0
|
1801 |
@SYMTestExpectedResults
|
sl@0
|
1802 |
1) File created successfully with KErrNone
|
sl@0
|
1803 |
2) File size = 3GB
|
sl@0
|
1804 |
3) Write successful with KErrNone and file closed
|
sl@0
|
1805 |
4) FileLargeOne.txt is replaced with ReNameFileLargeOne.txt successfully
|
sl@0
|
1806 |
5) File ReNameFileLargeOne.txt is opened successfully
|
sl@0
|
1807 |
6) KErrNone
|
sl@0
|
1808 |
7) Write successful with KErrNone
|
sl@0
|
1809 |
8) Read is successful with KErrNone
|
sl@0
|
1810 |
9) Written data == Read data
|
sl@0
|
1811 |
10)File Closed
|
sl@0
|
1812 |
@SYMTestStatus Implemented
|
sl@0
|
1813 |
*/
|
sl@0
|
1814 |
void TestReplaceRFile64RFs()
|
sl@0
|
1815 |
{
|
sl@0
|
1816 |
|
sl@0
|
1817 |
TFileName fileName;
|
sl@0
|
1818 |
fileName.Append(gDriveToTest);
|
sl@0
|
1819 |
fileName.Append(KTestPath);
|
sl@0
|
1820 |
fileName.Append(_L("FileLargeOne.txt"));
|
sl@0
|
1821 |
|
sl@0
|
1822 |
test.Next(_L("Replace a file named FileLargeOne.txt\n"));
|
sl@0
|
1823 |
TestRFile1.Replace(fileName, EFileWrite);
|
sl@0
|
1824 |
|
sl@0
|
1825 |
test.Next(_L("Set the file size to 3GB and get the file size\n"));
|
sl@0
|
1826 |
TestRFile1.SetSize(K3GB);
|
sl@0
|
1827 |
TInt64 size = 0;
|
sl@0
|
1828 |
TestRFile1.Size(size);
|
sl@0
|
1829 |
test (size == K3GB);
|
sl@0
|
1830 |
|
sl@0
|
1831 |
|
sl@0
|
1832 |
test.Next(_L("Write 10 bytes to location 2GB+10 and close the file\n"));
|
sl@0
|
1833 |
TBuf8<10> writeBuf;
|
sl@0
|
1834 |
TBuf8<10> readBuf;
|
sl@0
|
1835 |
for (TInt count = 0; count < 10; count++)
|
sl@0
|
1836 |
{
|
sl@0
|
1837 |
writeBuf.Append(count+1);
|
sl@0
|
1838 |
}
|
sl@0
|
1839 |
TInt64 pos = K2GB+10;
|
sl@0
|
1840 |
TestRFile1.Write(pos,writeBuf,10);
|
sl@0
|
1841 |
TestRFile1.Read(pos,readBuf,10);
|
sl@0
|
1842 |
test(readBuf == writeBuf);
|
sl@0
|
1843 |
TestRFile1.Close();
|
sl@0
|
1844 |
|
sl@0
|
1845 |
test.Next(_L("Replace the file named ReNameFileLargeOne.txt using RFs::Replace()\n"));
|
sl@0
|
1846 |
TFileName fileNameReplace;
|
sl@0
|
1847 |
fileNameReplace.Append(gDriveToTest);
|
sl@0
|
1848 |
fileNameReplace.Append(KTestPath);
|
sl@0
|
1849 |
fileNameReplace.Append(_L("ReNameFileLargeOne.txt\n"));
|
sl@0
|
1850 |
TestRFs.Replace(fileName,fileNameReplace);
|
sl@0
|
1851 |
|
sl@0
|
1852 |
test.Next(_L("Open the file ReNameFileLargeOne.txt\n"));
|
sl@0
|
1853 |
TestRFile1.Open(fileNameReplace,EFileWrite);
|
sl@0
|
1854 |
|
sl@0
|
1855 |
test.Next(_L("Set the file size to 4GB-1\n"));
|
sl@0
|
1856 |
TestRFile1.SetSize(K4GB-1);
|
sl@0
|
1857 |
size = 0;
|
sl@0
|
1858 |
TestRFile1.Size(size);
|
sl@0
|
1859 |
test (size == K4GB-1);
|
sl@0
|
1860 |
|
sl@0
|
1861 |
test.Next(_L("Write 10 bytes to the location 3GB+10\n"));
|
sl@0
|
1862 |
pos = K3GB+10;
|
sl@0
|
1863 |
TestRFile1.Write(pos,_L8("ABCDEFGHIJ"),10);
|
sl@0
|
1864 |
|
sl@0
|
1865 |
test.Next(_L("Read the above file from the location 3GB+10 and compare\n"));
|
sl@0
|
1866 |
TBuf8<10> readBuffer;
|
sl@0
|
1867 |
TestRFile1.Read(pos,readBuffer,10);
|
sl@0
|
1868 |
test(readBuffer == _L8("ABCDEFGHIJ"));
|
sl@0
|
1869 |
|
sl@0
|
1870 |
test.Next(_L("Close the file and delete\n"));
|
sl@0
|
1871 |
TestRFile1.Close();
|
sl@0
|
1872 |
TInt r = TheFs.Delete(fileNameReplace);
|
sl@0
|
1873 |
test(r == KErrNone);
|
sl@0
|
1874 |
}
|
sl@0
|
1875 |
|
sl@0
|
1876 |
/**
|
sl@0
|
1877 |
@SYMTestCaseID PBASE-T_FILE64BIT-0766
|
sl@0
|
1878 |
@SYMTestPriority High
|
sl@0
|
1879 |
@SYMTestRequirement REQXXXX
|
sl@0
|
1880 |
@SYMTestType CIT
|
sl@0
|
1881 |
@SYMTestCaseDesc Test the file creation using RFile64::AdoptFromClient()
|
sl@0
|
1882 |
@SYMTestActions
|
sl@0
|
1883 |
1) Connect to the File server
|
sl@0
|
1884 |
2) Create a file and set the file size to 4GB-1
|
sl@0
|
1885 |
3) Write few bytes to the location 4GB-10, length = 9bytes
|
sl@0
|
1886 |
4) Transfer the file handle using TransferToServer() close the file
|
sl@0
|
1887 |
5) Adopt the already open file from a client using RFile64::Adopt::AdoptFromClient()
|
sl@0
|
1888 |
6) Read the file from position 4GB-10 and compare the data
|
sl@0
|
1889 |
@SYMTestExpectedResults
|
sl@0
|
1890 |
1) Connection successful
|
sl@0
|
1891 |
2) File created successfully
|
sl@0
|
1892 |
3) Write successful with KErrNone
|
sl@0
|
1893 |
4) KErrNone, Transfer to server is successful
|
sl@0
|
1894 |
5) successfully Allows the server to adopt an already open file from a client process
|
sl@0
|
1895 |
6) File read should be successful and Read Data = Test Data
|
sl@0
|
1896 |
@SYMTestStatus Implemented
|
sl@0
|
1897 |
*/
|
sl@0
|
1898 |
void TestRFile64AdoptFromClient()
|
sl@0
|
1899 |
{
|
sl@0
|
1900 |
test.Next(_L("Tests for checking RFile64::AdoptFromClient()"));
|
sl@0
|
1901 |
|
sl@0
|
1902 |
RProcess p;
|
sl@0
|
1903 |
TInt r = p.Create(_L("FHServer64Bit.exe"), KNullDesC);
|
sl@0
|
1904 |
test(r == KErrNone);
|
sl@0
|
1905 |
|
sl@0
|
1906 |
|
sl@0
|
1907 |
test.Next(_L("Connect to the File server \n"));
|
sl@0
|
1908 |
RFs fs;
|
sl@0
|
1909 |
r = fs.Connect();
|
sl@0
|
1910 |
test(r == KErrNone);
|
sl@0
|
1911 |
|
sl@0
|
1912 |
// Check the number of open file handles
|
sl@0
|
1913 |
TInt resCount = fs.ResourceCount();
|
sl@0
|
1914 |
test(resCount == 0);
|
sl@0
|
1915 |
|
sl@0
|
1916 |
r = fs.ShareProtected();
|
sl@0
|
1917 |
test(r == KErrNone);
|
sl@0
|
1918 |
|
sl@0
|
1919 |
r = fs.CreatePrivatePath(gDrive);
|
sl@0
|
1920 |
test(r == KErrNone);
|
sl@0
|
1921 |
r = fs.SetSessionToPrivate(gDrive);
|
sl@0
|
1922 |
|
sl@0
|
1923 |
test.Next(_L("Create a file and set the file size to 4GB-1\n"));
|
sl@0
|
1924 |
RFile64 file1;
|
sl@0
|
1925 |
r = file1.Replace(fs,KClientFileName,EFileWrite);
|
sl@0
|
1926 |
test(r == KErrNone);
|
sl@0
|
1927 |
r = file1.SetSize(K4GB-1);
|
sl@0
|
1928 |
test(r == KErrNone);
|
sl@0
|
1929 |
|
sl@0
|
1930 |
test.Next(_L("Write few bytes to the location 4GB-10, length = 9bytes\n"));
|
sl@0
|
1931 |
r = file1.Write(K4GB-10,KTestData3(),9);
|
sl@0
|
1932 |
test(r == KErrNone);
|
sl@0
|
1933 |
file1.Close();
|
sl@0
|
1934 |
|
sl@0
|
1935 |
r = p.SetParameter(3, gDrive);
|
sl@0
|
1936 |
test(r == KErrNone);
|
sl@0
|
1937 |
|
sl@0
|
1938 |
p.Resume();
|
sl@0
|
1939 |
|
sl@0
|
1940 |
|
sl@0
|
1941 |
test.Next(_L("Transfer the file handle using TransferToServer() close the file\n"));
|
sl@0
|
1942 |
RFileHandleSharer64Bit handsvr;
|
sl@0
|
1943 |
do
|
sl@0
|
1944 |
{
|
sl@0
|
1945 |
r = handsvr.Connect();
|
sl@0
|
1946 |
}
|
sl@0
|
1947 |
while(r == KErrNotFound);
|
sl@0
|
1948 |
test(r == KErrNone);
|
sl@0
|
1949 |
|
sl@0
|
1950 |
r = handsvr.SetTestDrive(gDrive);
|
sl@0
|
1951 |
test(r == KErrNone);
|
sl@0
|
1952 |
|
sl@0
|
1953 |
r = fs.SetSessionToPrivate(gDrive);
|
sl@0
|
1954 |
test(r == KErrNone);
|
sl@0
|
1955 |
|
sl@0
|
1956 |
r = file1.Open(fs,KClientFileName,EFileRead);
|
sl@0
|
1957 |
test(r == KErrNone);
|
sl@0
|
1958 |
|
sl@0
|
1959 |
// pass the file handle to FHServer
|
sl@0
|
1960 |
test.Next(_L("RFile::TransferToServer()"));
|
sl@0
|
1961 |
|
sl@0
|
1962 |
TIpcArgs ipcArgs;
|
sl@0
|
1963 |
r = file1.TransferToServer(ipcArgs, 0, 1);
|
sl@0
|
1964 |
test(r == KErrNone);
|
sl@0
|
1965 |
|
sl@0
|
1966 |
test.Next(_L("Adopt the already open file from a client using RFile64::AdoptFromClient()\n"));
|
sl@0
|
1967 |
r = handsvr.PassFileHandleProcessLargeFileClient(ipcArgs);
|
sl@0
|
1968 |
test(r == KErrNone);
|
sl@0
|
1969 |
|
sl@0
|
1970 |
// verify that the original file handle's position is unchanged
|
sl@0
|
1971 |
TInt64 pos = 0;
|
sl@0
|
1972 |
r = file1.Seek(ESeekCurrent, pos);
|
sl@0
|
1973 |
test(r == KErrNone);
|
sl@0
|
1974 |
test(pos == 0);
|
sl@0
|
1975 |
// make sure we can still use it
|
sl@0
|
1976 |
|
sl@0
|
1977 |
test.Next(_L("Read the file from position 4GB-10 and compare the data\n"));
|
sl@0
|
1978 |
TBuf8<9> rbuf;
|
sl@0
|
1979 |
r = file1.Read(K4GB-10,rbuf);
|
sl@0
|
1980 |
test(r == KErrNone);
|
sl@0
|
1981 |
test (rbuf == KTestData3);
|
sl@0
|
1982 |
|
sl@0
|
1983 |
// Close the file
|
sl@0
|
1984 |
file1.Close();
|
sl@0
|
1985 |
handsvr.Exit();
|
sl@0
|
1986 |
handsvr.Close();
|
sl@0
|
1987 |
r = fs.MkDir(_L("C:\\mdir"));
|
sl@0
|
1988 |
test(r == KErrNone || r == KErrAlreadyExists);
|
sl@0
|
1989 |
|
sl@0
|
1990 |
// Check the number of open file handles
|
sl@0
|
1991 |
resCount = fs.ResourceCount();
|
sl@0
|
1992 |
test(resCount == 0);
|
sl@0
|
1993 |
|
sl@0
|
1994 |
r = fs.Delete(KClientFileName);
|
sl@0
|
1995 |
test(r == KErrNone);
|
sl@0
|
1996 |
fs.Close();
|
sl@0
|
1997 |
}
|
sl@0
|
1998 |
|
sl@0
|
1999 |
/**
|
sl@0
|
2000 |
@SYMTestCaseID PBASE-T_FILE64BIT-0767
|
sl@0
|
2001 |
@SYMTestPriority High
|
sl@0
|
2002 |
@SYMTestRequirement REQXXXX
|
sl@0
|
2003 |
@SYMTestType CIT
|
sl@0
|
2004 |
@SYMTestCaseDesc Test the file creation using RFile64::AdoptFromCreator()
|
sl@0
|
2005 |
@SYMTestActions
|
sl@0
|
2006 |
1) Create a process named "FHServer64Bit.exe"
|
sl@0
|
2007 |
2) Connect to the File server
|
sl@0
|
2008 |
3) Create a file and set the file size to 4GB-1
|
sl@0
|
2009 |
4) Write few bytes to the location 4GB-10, length = 3 bytes
|
sl@0
|
2010 |
5) Transfer the file handle using TransferToProcess() close the file
|
sl@0
|
2011 |
6) Resume the process "FHServer64bit.exe"
|
sl@0
|
2012 |
7) Adopts the already open file from a client using RFile64::AdoptFromCreator()
|
sl@0
|
2013 |
8) Read the file from position 4GB-10 and compare the data
|
sl@0
|
2014 |
@SYMTestExpectedResults
|
sl@0
|
2015 |
1) Process is created successfully with KErrnone
|
sl@0
|
2016 |
2) Connection successful
|
sl@0
|
2017 |
3) File created successfully
|
sl@0
|
2018 |
4) Write successful with KErrNone
|
sl@0
|
2019 |
5) KErrNone, Transfer to other process is successful
|
sl@0
|
2020 |
6) Server process should be resumed
|
sl@0
|
2021 |
7) successfully Allows the server to adopt an already open file from a client process
|
sl@0
|
2022 |
8) File read should be successful and Read Data = Test Data
|
sl@0
|
2023 |
@SYMTestStatus Implemented
|
sl@0
|
2024 |
*/
|
sl@0
|
2025 |
|
sl@0
|
2026 |
void TestRFile64AdoptFromCreator()
|
sl@0
|
2027 |
{
|
sl@0
|
2028 |
TInt r;
|
sl@0
|
2029 |
test.Next(_L("Tests for checking RFile64::AdoptFromCreator()"));
|
sl@0
|
2030 |
//create test server
|
sl@0
|
2031 |
test.Next(_L("Create a process named FHServer64Bit.exe\n"));
|
sl@0
|
2032 |
RProcess p;
|
sl@0
|
2033 |
r = p.Create(_L("FHServer64Bit.exe"), KNullDesC);
|
sl@0
|
2034 |
test(r == KErrNone);
|
sl@0
|
2035 |
|
sl@0
|
2036 |
test.Next(_L("Connect to the file server\n"));
|
sl@0
|
2037 |
RFs fs;
|
sl@0
|
2038 |
r = fs.Connect();
|
sl@0
|
2039 |
test(r == KErrNone);
|
sl@0
|
2040 |
|
sl@0
|
2041 |
// Check the number of open file handles
|
sl@0
|
2042 |
TInt resCount = fs.ResourceCount();
|
sl@0
|
2043 |
test(resCount == 0);
|
sl@0
|
2044 |
|
sl@0
|
2045 |
r = fs.ShareProtected();
|
sl@0
|
2046 |
test(r == KErrNone);
|
sl@0
|
2047 |
|
sl@0
|
2048 |
r = fs.CreatePrivatePath(gDrive);
|
sl@0
|
2049 |
test(r == KErrNone);
|
sl@0
|
2050 |
r = fs.SetSessionToPrivate(gDrive);
|
sl@0
|
2051 |
|
sl@0
|
2052 |
test.Next(_L("Create a file and set the file size to 4GB-1\n"));
|
sl@0
|
2053 |
RFile64 file1;
|
sl@0
|
2054 |
r = file1.Replace(fs,KClientFileName,EFileWrite);
|
sl@0
|
2055 |
test(r == KErrNone);
|
sl@0
|
2056 |
r = file1.SetSize(K4GB-1);
|
sl@0
|
2057 |
test(r == KErrNone);
|
sl@0
|
2058 |
|
sl@0
|
2059 |
test.Next(_L("Write few bytes to the location 4GB-10, length = 3bytes\n"));
|
sl@0
|
2060 |
r = file1.Write(K4GB-10,KTestData2(),3);
|
sl@0
|
2061 |
test(r == KErrNone);
|
sl@0
|
2062 |
file1.Close();
|
sl@0
|
2063 |
|
sl@0
|
2064 |
r = file1.Open(fs, KClientFileName, EFileWrite);
|
sl@0
|
2065 |
|
sl@0
|
2066 |
test(r == KErrNone);
|
sl@0
|
2067 |
|
sl@0
|
2068 |
// NB slot 0 is reserved for the command line
|
sl@0
|
2069 |
|
sl@0
|
2070 |
test.Next(_L("Transfer the file handle using TransferToProcess() close the file"));
|
sl@0
|
2071 |
|
sl@0
|
2072 |
r = file1.TransferToProcess(p, 1, 2);
|
sl@0
|
2073 |
|
sl@0
|
2074 |
r = p.SetParameter(3, gDrive);
|
sl@0
|
2075 |
test(r == KErrNone);
|
sl@0
|
2076 |
|
sl@0
|
2077 |
r = fs.SetSessionToPrivate(gDrive);
|
sl@0
|
2078 |
test(r == KErrNone);
|
sl@0
|
2079 |
|
sl@0
|
2080 |
// make sure we can still read from the file
|
sl@0
|
2081 |
TBuf8<3> rbuf;
|
sl@0
|
2082 |
r = file1.Read(K4GB-10,rbuf,3);
|
sl@0
|
2083 |
test(r == KErrNone);
|
sl@0
|
2084 |
r = rbuf.CompareF(KTestData2());
|
sl@0
|
2085 |
test(r == KErrNone);
|
sl@0
|
2086 |
file1.Close();
|
sl@0
|
2087 |
|
sl@0
|
2088 |
r = fs.MkDir(_L("C:\\mdir"));
|
sl@0
|
2089 |
test(r == KErrNone || r == KErrAlreadyExists);
|
sl@0
|
2090 |
|
sl@0
|
2091 |
// Check the number of open file handles -
|
sl@0
|
2092 |
// should be 1 (the one duplicated for the other process)
|
sl@0
|
2093 |
resCount = fs.ResourceCount();
|
sl@0
|
2094 |
test(resCount == 1);
|
sl@0
|
2095 |
|
sl@0
|
2096 |
fs.Close();
|
sl@0
|
2097 |
|
sl@0
|
2098 |
test.Next(_L("Resume the process FHServer64bit.exe "));
|
sl@0
|
2099 |
// Start the server thread
|
sl@0
|
2100 |
p.Resume();
|
sl@0
|
2101 |
|
sl@0
|
2102 |
// connect to the server
|
sl@0
|
2103 |
RFileHandleSharer64Bit handsvr;
|
sl@0
|
2104 |
do
|
sl@0
|
2105 |
{
|
sl@0
|
2106 |
r = handsvr.Connect();
|
sl@0
|
2107 |
}
|
sl@0
|
2108 |
while(r == KErrNotFound);
|
sl@0
|
2109 |
test(r == KErrNone);
|
sl@0
|
2110 |
r = handsvr.SetTestDrive(gDrive);
|
sl@0
|
2111 |
test(r == KErrNone);
|
sl@0
|
2112 |
|
sl@0
|
2113 |
// wait for server to read the file
|
sl@0
|
2114 |
r = handsvr.PassFileHandleProcessLargeFileCreator();
|
sl@0
|
2115 |
test (r == KErrNone);
|
sl@0
|
2116 |
|
sl@0
|
2117 |
|
sl@0
|
2118 |
// cleanup
|
sl@0
|
2119 |
handsvr.Exit();
|
sl@0
|
2120 |
handsvr.Close();
|
sl@0
|
2121 |
p.Close();
|
sl@0
|
2122 |
}
|
sl@0
|
2123 |
|
sl@0
|
2124 |
/**
|
sl@0
|
2125 |
@SYMTestCaseID PBASE-T_FILE64BIT-0768
|
sl@0
|
2126 |
@SYMTestPriority High
|
sl@0
|
2127 |
@SYMTestRequirement REQXXXX
|
sl@0
|
2128 |
@SYMTestType CIT
|
sl@0
|
2129 |
@SYMTestCaseDesc Test the file creation using RFile64::AdoptFromServer()
|
sl@0
|
2130 |
@SYMTestActions
|
sl@0
|
2131 |
1) Connect to the File server
|
sl@0
|
2132 |
2) Create a file and set the file size to 4GB-1
|
sl@0
|
2133 |
3) Write few bytes to the location 4GB-10, length = 9bytes
|
sl@0
|
2134 |
4) Adopt an already open file from a server using RFile64::AdoptFromServer()
|
sl@0
|
2135 |
5) Read the file from position 4GB-10 and compare the data
|
sl@0
|
2136 |
@SYMTestExpectedResults
|
sl@0
|
2137 |
1) Connection successful
|
sl@0
|
2138 |
2) File created successfully
|
sl@0
|
2139 |
3) Write successful with KErrNone
|
sl@0
|
2140 |
4) successfully Allows the client to adopt an already open file from a server process
|
sl@0
|
2141 |
5) File read should be successful and Read Data = Test Data
|
sl@0
|
2142 |
@SYMTestStatus Implemented
|
sl@0
|
2143 |
*/
|
sl@0
|
2144 |
|
sl@0
|
2145 |
void TestRFile64AdoptFromServer()
|
sl@0
|
2146 |
{
|
sl@0
|
2147 |
|
sl@0
|
2148 |
test.Next(_L("Tests for checking RFile64::AdoptFromServer()"));
|
sl@0
|
2149 |
TInt r;
|
sl@0
|
2150 |
|
sl@0
|
2151 |
test.Next(_L("Connect to the file server\n"));
|
sl@0
|
2152 |
RFs fs;
|
sl@0
|
2153 |
r = fs.Connect();
|
sl@0
|
2154 |
test(r == KErrNone);
|
sl@0
|
2155 |
|
sl@0
|
2156 |
// Check the number of open file handles
|
sl@0
|
2157 |
TInt resCount = fs.ResourceCount();
|
sl@0
|
2158 |
test(resCount == 0);
|
sl@0
|
2159 |
|
sl@0
|
2160 |
r = fs.ShareProtected();
|
sl@0
|
2161 |
test(r == KErrNone);
|
sl@0
|
2162 |
|
sl@0
|
2163 |
r = fs.CreatePrivatePath(gDrive);
|
sl@0
|
2164 |
test(r == KErrNone);
|
sl@0
|
2165 |
r = fs.SetSessionToPrivate(gDrive);
|
sl@0
|
2166 |
|
sl@0
|
2167 |
test.Next(_L("Create a file and set the file size to 4GB-1\n"));
|
sl@0
|
2168 |
RFile64 file1;
|
sl@0
|
2169 |
r = file1.Replace(fs,KClientFileName,EFileWrite);
|
sl@0
|
2170 |
test(r == KErrNone);
|
sl@0
|
2171 |
r = file1.SetSize(K4GB-1);
|
sl@0
|
2172 |
test(r == KErrNone);
|
sl@0
|
2173 |
|
sl@0
|
2174 |
|
sl@0
|
2175 |
r = file1.Write(K4GB-10,KTestData3(),9);
|
sl@0
|
2176 |
test(r == KErrNone);
|
sl@0
|
2177 |
|
sl@0
|
2178 |
file1.Close();
|
sl@0
|
2179 |
r = fs.Delete(KClientFileName);
|
sl@0
|
2180 |
test(r == KErrNone);
|
sl@0
|
2181 |
|
sl@0
|
2182 |
RProcess p;
|
sl@0
|
2183 |
r = p.Create(_L("FHServer64Bit.exe"), KNullDesC);
|
sl@0
|
2184 |
test(r == KErrNone);
|
sl@0
|
2185 |
// Request an open file (write mode) from the server
|
sl@0
|
2186 |
// using RFile64::AdoptFromServer()
|
sl@0
|
2187 |
|
sl@0
|
2188 |
test.Next(_L("Adopt an already open file from a server using RFile64::AdoptFromServer()\n"));
|
sl@0
|
2189 |
p.Resume();
|
sl@0
|
2190 |
RFileHandleSharer64Bit handsvr;
|
sl@0
|
2191 |
do
|
sl@0
|
2192 |
{
|
sl@0
|
2193 |
r = handsvr.Connect();
|
sl@0
|
2194 |
}
|
sl@0
|
2195 |
while(r == KErrNotFound);
|
sl@0
|
2196 |
test(r == KErrNone);
|
sl@0
|
2197 |
|
sl@0
|
2198 |
r = handsvr.SetTestDrive(gDrive);
|
sl@0
|
2199 |
test(r == KErrNone);
|
sl@0
|
2200 |
|
sl@0
|
2201 |
TInt ssh;
|
sl@0
|
2202 |
TInt fsh = handsvr.GetFileHandleLargeFile2(ssh, EFileWrite);
|
sl@0
|
2203 |
test (fsh >= 0);
|
sl@0
|
2204 |
|
sl@0
|
2205 |
// Closing the handle to the server ensures the server has closed it's
|
sl@0
|
2206 |
// RFs and RFile handles - this provides a means of testing whether we
|
sl@0
|
2207 |
// can still adopt the RFile even if the server has closed it's one.
|
sl@0
|
2208 |
|
sl@0
|
2209 |
handsvr.Sync(); // make sure server has finished doing what it's doing
|
sl@0
|
2210 |
handsvr.Exit();
|
sl@0
|
2211 |
handsvr.Close();
|
sl@0
|
2212 |
|
sl@0
|
2213 |
// adopt the file handle from FHServer
|
sl@0
|
2214 |
test.Next(_L("RFile64::AdoptFromServer()"));
|
sl@0
|
2215 |
|
sl@0
|
2216 |
RFile64 file;
|
sl@0
|
2217 |
r = file.AdoptFromServer(fsh, ssh);
|
sl@0
|
2218 |
test(r == KErrNone);
|
sl@0
|
2219 |
|
sl@0
|
2220 |
test.Next(_L("Read the file from position 4GB-10 and compare the data\n"));
|
sl@0
|
2221 |
TBuf8<9> rbuf;
|
sl@0
|
2222 |
r = file.Read(K4GB-10,rbuf);
|
sl@0
|
2223 |
test(r == KErrNone);
|
sl@0
|
2224 |
// server should write KTestData1 ("Server!!!") to file
|
sl@0
|
2225 |
test (rbuf == KTestData4);
|
sl@0
|
2226 |
|
sl@0
|
2227 |
TFileName fileName;
|
sl@0
|
2228 |
r = file.FullName(fileName);
|
sl@0
|
2229 |
test(r == KErrNone);
|
sl@0
|
2230 |
|
sl@0
|
2231 |
file.Close();
|
sl@0
|
2232 |
//cleanup
|
sl@0
|
2233 |
r = fs.Delete(fileName);
|
sl@0
|
2234 |
test(r == KErrNone);
|
sl@0
|
2235 |
|
sl@0
|
2236 |
TFileName sessionPath;
|
sl@0
|
2237 |
r = fs.SessionPath(sessionPath);
|
sl@0
|
2238 |
test(r == KErrNone);
|
sl@0
|
2239 |
|
sl@0
|
2240 |
r = fs.RmDir(sessionPath);
|
sl@0
|
2241 |
test(r == KErrNone);
|
sl@0
|
2242 |
|
sl@0
|
2243 |
fs.Close();
|
sl@0
|
2244 |
|
sl@0
|
2245 |
}
|
sl@0
|
2246 |
|
sl@0
|
2247 |
|
sl@0
|
2248 |
/**
|
sl@0
|
2249 |
@SYMTestCaseID PBASE-T_FILE64BIT-0769
|
sl@0
|
2250 |
@SYMTestPriority High
|
sl@0
|
2251 |
@SYMTestRequirement REQ9526
|
sl@0
|
2252 |
@SYMTestType CIT
|
sl@0
|
2253 |
@SYMTestCaseDesc Tests for reading a big file synchronously with specified position
|
sl@0
|
2254 |
@SYMTestActions
|
sl@0
|
2255 |
1) Big file is read synchronously in a thread, with aPos = 0;
|
sl@0
|
2256 |
2) Big file is read synchronously in a thread, with aPos = 2GB-1;
|
sl@0
|
2257 |
3) Big file is read synchronously in a thread. With aPos = 4GB -2. File size= 4GB-1.
|
sl@0
|
2258 |
4) Check for FAT32 file system, Read from a big file synchronously in a thread with aPos = 4GB.
|
sl@0
|
2259 |
@SYMTestExpectedResults
|
sl@0
|
2260 |
1) KErrNone, file is read successfully
|
sl@0
|
2261 |
2) KErrNone, file is read successfully
|
sl@0
|
2262 |
3) KErrNone, file is read successfully
|
sl@0
|
2263 |
4) KErrNone and zero length descriptor, if NGFS is supported we should get the valid data
|
sl@0
|
2264 |
@SYMTestStatus Implemented
|
sl@0
|
2265 |
*/
|
sl@0
|
2266 |
void TestOpenAndReadSyncLargeFile()
|
sl@0
|
2267 |
{
|
sl@0
|
2268 |
const TUint KBufSize = KKB;
|
sl@0
|
2269 |
TUint pos;
|
sl@0
|
2270 |
TBuf8<KBufSize> readBuf1;
|
sl@0
|
2271 |
TBuf8<KBufSize> readBuf2;
|
sl@0
|
2272 |
TUint i;
|
sl@0
|
2273 |
TInt r = GenerateBigFileContents();
|
sl@0
|
2274 |
test(r == KErrNone);
|
sl@0
|
2275 |
|
sl@0
|
2276 |
test.Next(_L("Open & Read Synchronously Large File From Diff Offset:"));
|
sl@0
|
2277 |
|
sl@0
|
2278 |
TFileName fileName;
|
sl@0
|
2279 |
fileName.Append(gDriveToTest);
|
sl@0
|
2280 |
fileName.Append(KTestPath);
|
sl@0
|
2281 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
2282 |
TestRFile1.Open(fileName,EFileRead);
|
sl@0
|
2283 |
|
sl@0
|
2284 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 0\n"));
|
sl@0
|
2285 |
// Sync read from pos = 0
|
sl@0
|
2286 |
pos = 0;
|
sl@0
|
2287 |
readBuf1.Zero();
|
sl@0
|
2288 |
TestRFile1.ReadP(pos, readBuf1);
|
sl@0
|
2289 |
|
sl@0
|
2290 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2291 |
for(i = pos; i< pos + (KBufSize / 4); i+=4)
|
sl@0
|
2292 |
{
|
sl@0
|
2293 |
TUint j = * ((TUint*) &readBuf1[i - pos]);
|
sl@0
|
2294 |
test(i == j);
|
sl@0
|
2295 |
}
|
sl@0
|
2296 |
|
sl@0
|
2297 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB-1\n"));
|
sl@0
|
2298 |
// Sync read from pos = 2GB-1
|
sl@0
|
2299 |
pos = K2GB;
|
sl@0
|
2300 |
readBuf2.Zero();
|
sl@0
|
2301 |
TestRFile1.ReadP(pos, readBuf2);
|
sl@0
|
2302 |
|
sl@0
|
2303 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2304 |
for(i = pos; i< pos + (KBufSize / 4); i+=4)
|
sl@0
|
2305 |
{
|
sl@0
|
2306 |
TUint j = * ((TUint*) &readBuf2[i - pos]);
|
sl@0
|
2307 |
test(i == j);
|
sl@0
|
2308 |
}
|
sl@0
|
2309 |
|
sl@0
|
2310 |
|
sl@0
|
2311 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB-2\n"));
|
sl@0
|
2312 |
TBuf8<1> readBuffer;
|
sl@0
|
2313 |
pos = K4GBMinusTwo;
|
sl@0
|
2314 |
TestRFile1.ReadP(pos, readBuffer);
|
sl@0
|
2315 |
test(readBuffer.Length() == 1);
|
sl@0
|
2316 |
|
sl@0
|
2317 |
// tests need to be repeated for calling the TUint variant of RFile64::Read()
|
sl@0
|
2318 |
pos = 0;
|
sl@0
|
2319 |
TestRFile1.ReadU(pos, readBuf1);
|
sl@0
|
2320 |
|
sl@0
|
2321 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2322 |
for(i = pos; i< pos + (KBufSize / 4); i+=4)
|
sl@0
|
2323 |
{
|
sl@0
|
2324 |
TUint j = * ((TUint*) &readBuf1[i - pos]);
|
sl@0
|
2325 |
test(i == j);
|
sl@0
|
2326 |
}
|
sl@0
|
2327 |
|
sl@0
|
2328 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB\n"));
|
sl@0
|
2329 |
// Sync read from pos = 2GB
|
sl@0
|
2330 |
pos = K2GB;
|
sl@0
|
2331 |
readBuf2.Zero();
|
sl@0
|
2332 |
TestRFile1.ReadU(pos, readBuf2);
|
sl@0
|
2333 |
|
sl@0
|
2334 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2335 |
for(i = pos; i< pos + (KBufSize / 4); i+=4)
|
sl@0
|
2336 |
{
|
sl@0
|
2337 |
TUint j = * ((TUint*) &readBuf2[i - pos]);
|
sl@0
|
2338 |
test(i == j);
|
sl@0
|
2339 |
}
|
sl@0
|
2340 |
|
sl@0
|
2341 |
|
sl@0
|
2342 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB-2\n"));
|
sl@0
|
2343 |
pos = K4GBMinusTwo;
|
sl@0
|
2344 |
TestRFile1.ReadU(pos, readBuffer);
|
sl@0
|
2345 |
test(readBuffer.Length() == 1);
|
sl@0
|
2346 |
|
sl@0
|
2347 |
// tests need to be repeated for calling the current position variant of RFile64::Read()
|
sl@0
|
2348 |
TInt64 seekPos = 0;
|
sl@0
|
2349 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
2350 |
TestRFile1.Read(readBuf1);
|
sl@0
|
2351 |
|
sl@0
|
2352 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2353 |
for(i = (TUint)seekPos; i< seekPos + (KBufSize / 4); i+=4)
|
sl@0
|
2354 |
{
|
sl@0
|
2355 |
TUint j = * ((TUint*) &readBuf1[i - (TUint)seekPos]);
|
sl@0
|
2356 |
test(i == j);
|
sl@0
|
2357 |
}
|
sl@0
|
2358 |
|
sl@0
|
2359 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB\n"));
|
sl@0
|
2360 |
// Sync read from pos = 2GB
|
sl@0
|
2361 |
seekPos = K2GB;
|
sl@0
|
2362 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
2363 |
readBuf2.Zero();
|
sl@0
|
2364 |
TestRFile1.Read(readBuf2);
|
sl@0
|
2365 |
|
sl@0
|
2366 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2367 |
for(i = (TUint)seekPos; i< seekPos + (KBufSize / 4); i+=4)
|
sl@0
|
2368 |
{
|
sl@0
|
2369 |
TUint j = * ((TUint*) &readBuf2[i - (TUint)seekPos]);
|
sl@0
|
2370 |
test(i == j);
|
sl@0
|
2371 |
}
|
sl@0
|
2372 |
|
sl@0
|
2373 |
|
sl@0
|
2374 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB-2\n"));
|
sl@0
|
2375 |
seekPos = K4GBMinusTwo;
|
sl@0
|
2376 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
2377 |
TestRFile1.Read(readBuffer);
|
sl@0
|
2378 |
test(readBuffer.Length() == 1);
|
sl@0
|
2379 |
|
sl@0
|
2380 |
|
sl@0
|
2381 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
2382 |
{
|
sl@0
|
2383 |
TInt64 pos64 = K4GB;
|
sl@0
|
2384 |
TestRFile1.ReadP(pos64, readBuf1);
|
sl@0
|
2385 |
test(readBuf1.Length() == 0);
|
sl@0
|
2386 |
}
|
sl@0
|
2387 |
TestRFile1.Close();
|
sl@0
|
2388 |
}
|
sl@0
|
2389 |
|
sl@0
|
2390 |
/**
|
sl@0
|
2391 |
@SYMTestCaseID PBASE-T_FILE64BIT-0770
|
sl@0
|
2392 |
@SYMTestPriority High
|
sl@0
|
2393 |
@SYMTestRequirement REQ9526
|
sl@0
|
2394 |
@SYMTestType CIT
|
sl@0
|
2395 |
@SYMTestCaseDesc Tests for reading a big file asynchronously with specified position
|
sl@0
|
2396 |
@SYMTestActions
|
sl@0
|
2397 |
1) Big file is read asynchronously in a thread, with aPos = 0;
|
sl@0
|
2398 |
2) Big file is read asynchronously in a thread, with aPos = 2GB-1;
|
sl@0
|
2399 |
3) Big file is read asynchronously in a thread. With aPos = 4GB -1.
|
sl@0
|
2400 |
4) Check for FAT32 file system, Read from a big file asynchronously in a thread with aPos = 4GB.
|
sl@0
|
2401 |
@SYMTestExpectedResults
|
sl@0
|
2402 |
1) KErrNone, file is read successfully
|
sl@0
|
2403 |
2) KErrNone, file is read successfully
|
sl@0
|
2404 |
3) KErrNone, file is read successfully
|
sl@0
|
2405 |
4) KErrNone and zero length descriptor. If NGFS is supported we should get the valid data.
|
sl@0
|
2406 |
@SYMTestStatus Implemented
|
sl@0
|
2407 |
*/
|
sl@0
|
2408 |
void TestOpenAndReadAsyncLargeFile()
|
sl@0
|
2409 |
{
|
sl@0
|
2410 |
const TUint KBufSize = KKB;
|
sl@0
|
2411 |
TInt64 fileSize, size = 0;
|
sl@0
|
2412 |
TUint pos;
|
sl@0
|
2413 |
TUint i;
|
sl@0
|
2414 |
TBuf8<KBufSize> readBuf;
|
sl@0
|
2415 |
readBuf.SetLength(KBufSize);
|
sl@0
|
2416 |
|
sl@0
|
2417 |
|
sl@0
|
2418 |
test.Next(_L("Open & Read Asynchronously Large File From Diff Offset:"));
|
sl@0
|
2419 |
|
sl@0
|
2420 |
TFileName fileName;
|
sl@0
|
2421 |
fileName.Append(gDriveToTest);
|
sl@0
|
2422 |
fileName.Append(KTestPath);
|
sl@0
|
2423 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
2424 |
TestRFile1.Open(fileName,EFileRead);
|
sl@0
|
2425 |
|
sl@0
|
2426 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0\n"));
|
sl@0
|
2427 |
// Async read from pos = 0
|
sl@0
|
2428 |
TRequestStatus status1 = KRequestPending;
|
sl@0
|
2429 |
pos = 0;
|
sl@0
|
2430 |
TestRFile1.Read(pos, readBuf, status1);
|
sl@0
|
2431 |
|
sl@0
|
2432 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2433 |
for(i = pos; i< pos + (KBufSize / 4); i+=4)
|
sl@0
|
2434 |
{
|
sl@0
|
2435 |
TUint j = * ((TUint*) &readBuf[i - pos]);
|
sl@0
|
2436 |
test(i == j);
|
sl@0
|
2437 |
}
|
sl@0
|
2438 |
|
sl@0
|
2439 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB-1\n"));
|
sl@0
|
2440 |
// Async read from pos = 2GB-1
|
sl@0
|
2441 |
TRequestStatus status2 = KRequestPending;
|
sl@0
|
2442 |
pos = K2GB;
|
sl@0
|
2443 |
TestRFile1.Read(pos, readBuf, status2);
|
sl@0
|
2444 |
|
sl@0
|
2445 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2446 |
for(i = pos; i< pos + (KBufSize / 4); i+=4)
|
sl@0
|
2447 |
{
|
sl@0
|
2448 |
TUint j = * ((TUint*) &readBuf[i - pos]);
|
sl@0
|
2449 |
test(i == j);
|
sl@0
|
2450 |
}
|
sl@0
|
2451 |
|
sl@0
|
2452 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1\n"));
|
sl@0
|
2453 |
TBuf8<0x1> readBuf1;
|
sl@0
|
2454 |
// Async read from pos = 4GB-1
|
sl@0
|
2455 |
TRequestStatus status3 = KRequestPending;
|
sl@0
|
2456 |
pos = K4GBMinusTwo;
|
sl@0
|
2457 |
TestRFile1.Read(pos, readBuf1, status3);
|
sl@0
|
2458 |
test(readBuf1.Length() == 1);
|
sl@0
|
2459 |
|
sl@0
|
2460 |
fileSize = K4GBMinusOne;
|
sl@0
|
2461 |
TestRFile1.Size(size);
|
sl@0
|
2462 |
test(size == fileSize);
|
sl@0
|
2463 |
|
sl@0
|
2464 |
//tests need to be repeated for calling the TUint variant of RFile64::Read()
|
sl@0
|
2465 |
pos = 0;
|
sl@0
|
2466 |
TestRFile1.ReadU(pos, readBuf, status1);
|
sl@0
|
2467 |
|
sl@0
|
2468 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2469 |
for(i = pos; i< pos + (KBufSize / 4); i+=4)
|
sl@0
|
2470 |
{
|
sl@0
|
2471 |
TUint j = * ((TUint*) &readBuf[i - pos]);
|
sl@0
|
2472 |
test(i == j);
|
sl@0
|
2473 |
}
|
sl@0
|
2474 |
|
sl@0
|
2475 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB-1\n"));
|
sl@0
|
2476 |
// Async read from pos = 2GB-1
|
sl@0
|
2477 |
status2 = KRequestPending;
|
sl@0
|
2478 |
pos = K2GB;
|
sl@0
|
2479 |
TestRFile1.ReadU(pos, readBuf, status2);
|
sl@0
|
2480 |
|
sl@0
|
2481 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2482 |
for(i = pos; i< pos + (KBufSize / 4); i+=4)
|
sl@0
|
2483 |
{
|
sl@0
|
2484 |
TUint j = * ((TUint*) &readBuf[i - pos]);
|
sl@0
|
2485 |
test(i == j);
|
sl@0
|
2486 |
}
|
sl@0
|
2487 |
|
sl@0
|
2488 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1\n"));
|
sl@0
|
2489 |
// Async read from pos = 4GB-1
|
sl@0
|
2490 |
status3 = KRequestPending;
|
sl@0
|
2491 |
pos = K4GBMinusTwo;
|
sl@0
|
2492 |
TestRFile1.ReadU(pos, readBuf1, status3);
|
sl@0
|
2493 |
test(readBuf1.Length() == 1);
|
sl@0
|
2494 |
|
sl@0
|
2495 |
// tests need to be repeated for calling the current position variant of RFile64::Read()
|
sl@0
|
2496 |
TInt64 seekPos = 0;
|
sl@0
|
2497 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
2498 |
TestRFile1.Read(readBuf, status1);
|
sl@0
|
2499 |
|
sl@0
|
2500 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2501 |
for(i = (TUint)seekPos; i< seekPos + (KBufSize / 4); i+=4)
|
sl@0
|
2502 |
{
|
sl@0
|
2503 |
TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
|
sl@0
|
2504 |
test(i == j);
|
sl@0
|
2505 |
}
|
sl@0
|
2506 |
|
sl@0
|
2507 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB-1\n"));
|
sl@0
|
2508 |
// Async read from pos = 2GB-1
|
sl@0
|
2509 |
status2 = KRequestPending;
|
sl@0
|
2510 |
seekPos = K2GB;
|
sl@0
|
2511 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
2512 |
TestRFile1.Read(readBuf, status2);
|
sl@0
|
2513 |
|
sl@0
|
2514 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2515 |
for(i = (TUint)seekPos; i< seekPos + (KBufSize / 4); i+=4)
|
sl@0
|
2516 |
{
|
sl@0
|
2517 |
TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
|
sl@0
|
2518 |
test(i == j);
|
sl@0
|
2519 |
}
|
sl@0
|
2520 |
|
sl@0
|
2521 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1\n"));
|
sl@0
|
2522 |
// Async read from pos = 4GB-1
|
sl@0
|
2523 |
status3 = KRequestPending;
|
sl@0
|
2524 |
seekPos = K4GBMinusTwo;
|
sl@0
|
2525 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
2526 |
TestRFile1.Read(readBuf1, status3);
|
sl@0
|
2527 |
test(readBuf1.Length() == 1);
|
sl@0
|
2528 |
|
sl@0
|
2529 |
|
sl@0
|
2530 |
// Async read from pos = 4GB
|
sl@0
|
2531 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
2532 |
{
|
sl@0
|
2533 |
TRequestStatus status5 = KRequestPending;
|
sl@0
|
2534 |
TInt64 pos64;
|
sl@0
|
2535 |
pos64 = K4GB;
|
sl@0
|
2536 |
TestRFile1.Read(pos64, readBuf, status5);
|
sl@0
|
2537 |
test(readBuf.Length() == 0);
|
sl@0
|
2538 |
}
|
sl@0
|
2539 |
// Close the file
|
sl@0
|
2540 |
TestRFile1.Close();
|
sl@0
|
2541 |
}
|
sl@0
|
2542 |
|
sl@0
|
2543 |
/**
|
sl@0
|
2544 |
@SYMTestCaseID PBASE-T_FILE64BIT-0771
|
sl@0
|
2545 |
@SYMTestPriority High
|
sl@0
|
2546 |
@SYMTestRequirement REQ9526
|
sl@0
|
2547 |
@SYMTestType CIT
|
sl@0
|
2548 |
@SYMTestCaseDesc Tests for reading a big file synchronously with specified position and length
|
sl@0
|
2549 |
@SYMTestActions
|
sl@0
|
2550 |
1) Big file is read synchronously in a thread, with aPos = 0 and length = 256bytes
|
sl@0
|
2551 |
2) Big file is read synchronously in a thread, with aPos = 2GB-1 and length = 2KB
|
sl@0
|
2552 |
3) Big file is read synchronously in a thread, with aPos = 4GB -1 and length = 10 bytes
|
sl@0
|
2553 |
4) Check for FAT32 file system. Read from a big file, synchronously in a thread with aPos = 4GB and length = 1KB
|
sl@0
|
2554 |
5) Big file is read synchronously in a thread, with aPos = 0 and length = -1
|
sl@0
|
2555 |
6) Big file is read synchronously in a thread, with aPos = 0 and length = 0 bytes
|
sl@0
|
2556 |
@SYMTestExpectedResults
|
sl@0
|
2557 |
1) KErrNone, file is read successfully
|
sl@0
|
2558 |
2) KErrNone, file is read successfully
|
sl@0
|
2559 |
3) KErrNone, file is read successfully
|
sl@0
|
2560 |
4) KErrNone, with zero length descriptor. If NGFS is supported we should get the valid data
|
sl@0
|
2561 |
5) KErrArgument
|
sl@0
|
2562 |
6) KErrNone
|
sl@0
|
2563 |
@SYMTestStatus Implemented
|
sl@0
|
2564 |
*/
|
sl@0
|
2565 |
|
sl@0
|
2566 |
void TestOpenAndReadSyncLargeFileWithLen()
|
sl@0
|
2567 |
{
|
sl@0
|
2568 |
TInt64 pos;
|
sl@0
|
2569 |
TUint i;
|
sl@0
|
2570 |
TBuf8<KMAXBUFSIZE> readBuf;
|
sl@0
|
2571 |
readBuf.SetLength(KMAXBUFSIZE);
|
sl@0
|
2572 |
|
sl@0
|
2573 |
test.Next(_L("Open & Read Synchronously Large File From Different Offset and Length:"));
|
sl@0
|
2574 |
|
sl@0
|
2575 |
TFileName fileName;
|
sl@0
|
2576 |
fileName.Append(gDriveToTest);
|
sl@0
|
2577 |
fileName.Append(KTestPath);
|
sl@0
|
2578 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
2579 |
TestRFile1.Open(fileName,EFileRead);
|
sl@0
|
2580 |
|
sl@0
|
2581 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = 256bytes:"));
|
sl@0
|
2582 |
// Sync read from pos = 0 and length = 256
|
sl@0
|
2583 |
pos = 0;
|
sl@0
|
2584 |
TestRFile1.Read(pos, readBuf, 256);
|
sl@0
|
2585 |
test(readBuf.Length() == 256);
|
sl@0
|
2586 |
|
sl@0
|
2587 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2588 |
for(i = (TUint)pos; i< pos + (256 / 4); i+=4)
|
sl@0
|
2589 |
{
|
sl@0
|
2590 |
TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
|
sl@0
|
2591 |
test(i == j);
|
sl@0
|
2592 |
}
|
sl@0
|
2593 |
|
sl@0
|
2594 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB and length = K2KB:"));
|
sl@0
|
2595 |
// Sync read from pos = 2GB and length = K2KB
|
sl@0
|
2596 |
pos = K2GB;
|
sl@0
|
2597 |
TestRFile1.Read(pos, readBuf, K2KB);
|
sl@0
|
2598 |
test(readBuf.Length() == K2KB);
|
sl@0
|
2599 |
|
sl@0
|
2600 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2601 |
for(i = (TUint)pos; i< pos + (K2KB / 4); i+=4)
|
sl@0
|
2602 |
{
|
sl@0
|
2603 |
TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
|
sl@0
|
2604 |
test(i == j);
|
sl@0
|
2605 |
}
|
sl@0
|
2606 |
|
sl@0
|
2607 |
|
sl@0
|
2608 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB -1 and length = 10:"));
|
sl@0
|
2609 |
// Sync read from pos = 4GB-1 and length = 10
|
sl@0
|
2610 |
pos = K4GBMinusTwo;
|
sl@0
|
2611 |
TestRFile1.Read(pos, readBuf, 10);
|
sl@0
|
2612 |
test(readBuf.Length() == 1);
|
sl@0
|
2613 |
|
sl@0
|
2614 |
|
sl@0
|
2615 |
// Sync read from pos = 4GB and length = KKB
|
sl@0
|
2616 |
|
sl@0
|
2617 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
2618 |
{
|
sl@0
|
2619 |
pos = K4GB;
|
sl@0
|
2620 |
TestRFile1.Read(pos, readBuf, KKB);
|
sl@0
|
2621 |
test(readBuf.Length() == 0);
|
sl@0
|
2622 |
}
|
sl@0
|
2623 |
|
sl@0
|
2624 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = -1"));
|
sl@0
|
2625 |
// Sync read from pos = 0 and length = -1
|
sl@0
|
2626 |
pos = 0;
|
sl@0
|
2627 |
TestRFile1.Read(pos, readBuf, -1);
|
sl@0
|
2628 |
|
sl@0
|
2629 |
//tests need to repeated for TUint variant of RFile64::Read()
|
sl@0
|
2630 |
|
sl@0
|
2631 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = 256bytes:"));
|
sl@0
|
2632 |
// Sync read from pos = 0 and length = 256
|
sl@0
|
2633 |
pos = 0;
|
sl@0
|
2634 |
TestRFile1.ReadU((TUint)pos, readBuf, 256);
|
sl@0
|
2635 |
test(readBuf.Length() == 256);
|
sl@0
|
2636 |
|
sl@0
|
2637 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2638 |
for(i = (TUint)pos; i< pos + (256 / 4); i+=4)
|
sl@0
|
2639 |
{
|
sl@0
|
2640 |
TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
|
sl@0
|
2641 |
test(i == j);
|
sl@0
|
2642 |
}
|
sl@0
|
2643 |
|
sl@0
|
2644 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB and length = K2KB:"));
|
sl@0
|
2645 |
// Sync read from pos = 2GB and length = K2KB
|
sl@0
|
2646 |
pos = K2GB;
|
sl@0
|
2647 |
TestRFile1.ReadU((TUint)pos, readBuf, K2KB);
|
sl@0
|
2648 |
test(readBuf.Length() == K2KB);
|
sl@0
|
2649 |
|
sl@0
|
2650 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2651 |
for(i = (TUint)pos; i< pos + (K2KB / 4); i+=4)
|
sl@0
|
2652 |
{
|
sl@0
|
2653 |
TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
|
sl@0
|
2654 |
test(i == j);
|
sl@0
|
2655 |
}
|
sl@0
|
2656 |
|
sl@0
|
2657 |
|
sl@0
|
2658 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB -1 and length = 10:"));
|
sl@0
|
2659 |
// Sync read from pos = 4GB-1 and length = 10
|
sl@0
|
2660 |
pos = K4GBMinusTwo;
|
sl@0
|
2661 |
TestRFile1.ReadU((TUint)pos, readBuf, 10);
|
sl@0
|
2662 |
test(readBuf.Length() == 1);
|
sl@0
|
2663 |
|
sl@0
|
2664 |
//tests need to repeated for current position variant of RFile64::Read()
|
sl@0
|
2665 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = 256bytes:"));
|
sl@0
|
2666 |
// Sync read from pos = 0 and length = 256
|
sl@0
|
2667 |
TInt64 seekPos = 0;
|
sl@0
|
2668 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
2669 |
TestRFile1.Read(readBuf, 256);
|
sl@0
|
2670 |
test(readBuf.Length() == 256);
|
sl@0
|
2671 |
|
sl@0
|
2672 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2673 |
for(i = (TUint)seekPos; i< seekPos + (256 / 4); i+=4)
|
sl@0
|
2674 |
{
|
sl@0
|
2675 |
TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
|
sl@0
|
2676 |
test(i == j);
|
sl@0
|
2677 |
}
|
sl@0
|
2678 |
|
sl@0
|
2679 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 2GB and length = K2KB:"));
|
sl@0
|
2680 |
// Sync read from pos = 2GB and length = K2KB
|
sl@0
|
2681 |
seekPos = K2GB;
|
sl@0
|
2682 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
2683 |
TestRFile1.Read(readBuf, K2KB);
|
sl@0
|
2684 |
test(readBuf.Length() == K2KB);
|
sl@0
|
2685 |
|
sl@0
|
2686 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2687 |
for(i = (TUint)seekPos; i< seekPos + (K2KB / 4); i+=4)
|
sl@0
|
2688 |
{
|
sl@0
|
2689 |
TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
|
sl@0
|
2690 |
test(i == j);
|
sl@0
|
2691 |
}
|
sl@0
|
2692 |
|
sl@0
|
2693 |
|
sl@0
|
2694 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 4GB -1 and length = 10:"));
|
sl@0
|
2695 |
// Sync read from pos = 4GB-1 and length = 10
|
sl@0
|
2696 |
seekPos = K4GBMinusTwo;
|
sl@0
|
2697 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
2698 |
TestRFile1.Read(readBuf, 10);
|
sl@0
|
2699 |
test(readBuf.Length() == 1);
|
sl@0
|
2700 |
|
sl@0
|
2701 |
|
sl@0
|
2702 |
// Sync read from pos = 4GB and length = KKB
|
sl@0
|
2703 |
|
sl@0
|
2704 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
2705 |
{
|
sl@0
|
2706 |
pos = K4GB;
|
sl@0
|
2707 |
TestRFile1.Read(pos, readBuf, KKB);
|
sl@0
|
2708 |
test(readBuf.Length() == 0);
|
sl@0
|
2709 |
}
|
sl@0
|
2710 |
|
sl@0
|
2711 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = -1"));
|
sl@0
|
2712 |
// Sync read from pos = 0 and length = -1
|
sl@0
|
2713 |
pos = 0;
|
sl@0
|
2714 |
TestRFile1.Read(pos, readBuf, -1);
|
sl@0
|
2715 |
|
sl@0
|
2716 |
|
sl@0
|
2717 |
|
sl@0
|
2718 |
test.Next(_L("Big file is read synchronously in a thread, with aPos = 0 and length = 0 bytes"));
|
sl@0
|
2719 |
// Sync read from pos = 0 and length = 0
|
sl@0
|
2720 |
pos = 0;
|
sl@0
|
2721 |
TestRFile1.Read(pos, readBuf, 0);
|
sl@0
|
2722 |
test(readBuf.Length() == 0);
|
sl@0
|
2723 |
|
sl@0
|
2724 |
TestRFile1.Close();
|
sl@0
|
2725 |
}
|
sl@0
|
2726 |
/**
|
sl@0
|
2727 |
@SYMTestCaseID PBASE-T_FILE64BIT-0772
|
sl@0
|
2728 |
@SYMTestPriority High
|
sl@0
|
2729 |
@SYMTestRequirement REQ9526
|
sl@0
|
2730 |
@SYMTestType CIT
|
sl@0
|
2731 |
@SYMTestCaseDesc Tests for reading a big file asynchronously with specified position and length
|
sl@0
|
2732 |
@SYMTestActions
|
sl@0
|
2733 |
1) Big file is read asynchronously in a thread, with aPos = 0 and length = 256 bytes
|
sl@0
|
2734 |
2) Big file is read asynchronously in a thread, with aPos = 2GB-1 and length = 1KB
|
sl@0
|
2735 |
3) Big file is read asynchronously in a thread, with aPos = 4GB-1 and length = 1KB
|
sl@0
|
2736 |
4) Big file is read asynchronously in a thread, with aPos = 4GB and length = 256 bytes
|
sl@0
|
2737 |
5) Big file is read asynchronously in a thread, with aPos = 0 and length = -1
|
sl@0
|
2738 |
6) Big file is read asynchronously in a thread, with aPos = 0 and length = 0 bytes
|
sl@0
|
2739 |
@SYMTestExpectedResults
|
sl@0
|
2740 |
1) KErrNone, file is read successfully
|
sl@0
|
2741 |
2) KErrNone, file is read successfully
|
sl@0
|
2742 |
3) KErrNone, file is read successfully
|
sl@0
|
2743 |
4) KErrNone, with zero length descriptor. If NGFS is supported KErrNone with valid data
|
sl@0
|
2744 |
5) KErrArgument
|
sl@0
|
2745 |
6) KErrNone
|
sl@0
|
2746 |
@SYMTestStatus Implemented
|
sl@0
|
2747 |
*/
|
sl@0
|
2748 |
void TestOpenAndReadAsyncLargeFileWithLen()
|
sl@0
|
2749 |
{
|
sl@0
|
2750 |
TInt64 pos;
|
sl@0
|
2751 |
TUint i ;
|
sl@0
|
2752 |
TBuf8<KMAXBUFSIZE> readBuf;
|
sl@0
|
2753 |
readBuf.SetLength(KMAXBUFSIZE);
|
sl@0
|
2754 |
|
sl@0
|
2755 |
test.Next(_L("Open & Read Asynchronously Large File From Different Offset & Length:"));
|
sl@0
|
2756 |
|
sl@0
|
2757 |
TFileName fileName;
|
sl@0
|
2758 |
fileName.Append(gDriveToTest);
|
sl@0
|
2759 |
fileName.Append(KTestPath);
|
sl@0
|
2760 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
2761 |
TestRFile1.Open(fileName,EFileRead);
|
sl@0
|
2762 |
|
sl@0
|
2763 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0 and length = 256 bytes\n"));
|
sl@0
|
2764 |
// Async read from pos = 0 and length = 256
|
sl@0
|
2765 |
TRequestStatus status1 = KRequestPending;
|
sl@0
|
2766 |
pos = 0;
|
sl@0
|
2767 |
TestRFile1.Read(pos, readBuf, 256, status1);
|
sl@0
|
2768 |
test(readBuf.Length() == 256);
|
sl@0
|
2769 |
|
sl@0
|
2770 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2771 |
for(i = (TUint)pos; i< pos + (256 / 4); i+=4)
|
sl@0
|
2772 |
{
|
sl@0
|
2773 |
TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
|
sl@0
|
2774 |
test(i == j);
|
sl@0
|
2775 |
}
|
sl@0
|
2776 |
|
sl@0
|
2777 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB and length = KKB bytes\n"));
|
sl@0
|
2778 |
// Async read from pos = 2GB and length = KKb
|
sl@0
|
2779 |
TRequestStatus status2 = KRequestPending;
|
sl@0
|
2780 |
pos = K2GB;
|
sl@0
|
2781 |
TestRFile1.Read(pos, readBuf, KKB, status2);
|
sl@0
|
2782 |
test(readBuf.Length() == KKB);
|
sl@0
|
2783 |
|
sl@0
|
2784 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2785 |
for(i = (TUint)pos; i< pos + (KKB / 4); i+=4)
|
sl@0
|
2786 |
{
|
sl@0
|
2787 |
TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
|
sl@0
|
2788 |
test(i == j);
|
sl@0
|
2789 |
}
|
sl@0
|
2790 |
|
sl@0
|
2791 |
|
sl@0
|
2792 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1 and length = KKb bytes\n"));
|
sl@0
|
2793 |
// Async read from pos = 4GB-1 and length = KKb
|
sl@0
|
2794 |
TRequestStatus status3 = KRequestPending;
|
sl@0
|
2795 |
pos = K4GBMinusTwo;
|
sl@0
|
2796 |
TestRFile1.Read(pos, readBuf, KKB, status3);
|
sl@0
|
2797 |
test(readBuf.Length() == 1);
|
sl@0
|
2798 |
|
sl@0
|
2799 |
// tests need to be repeated for TUint variant of RFile64::Read()
|
sl@0
|
2800 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0 and length = 256 bytes\n"));
|
sl@0
|
2801 |
// Async read from pos = 0 and length = 256
|
sl@0
|
2802 |
status1 = KRequestPending;
|
sl@0
|
2803 |
pos = 0;
|
sl@0
|
2804 |
TestRFile1.ReadU((TUint)pos, readBuf, 256, status1);
|
sl@0
|
2805 |
test(readBuf.Length() == 256);
|
sl@0
|
2806 |
|
sl@0
|
2807 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2808 |
for(i = (TUint)pos; i< pos + (256 / 4); i+=4)
|
sl@0
|
2809 |
{
|
sl@0
|
2810 |
TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
|
sl@0
|
2811 |
test(i == j);
|
sl@0
|
2812 |
}
|
sl@0
|
2813 |
|
sl@0
|
2814 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB and length = KKB bytes\n"));
|
sl@0
|
2815 |
// Async read from pos = 2GB and length = KKb
|
sl@0
|
2816 |
status2 = KRequestPending;
|
sl@0
|
2817 |
pos = K2GB;
|
sl@0
|
2818 |
TestRFile1.ReadU((TUint)pos, readBuf, KKB, status2);
|
sl@0
|
2819 |
test(readBuf.Length() == KKB);
|
sl@0
|
2820 |
|
sl@0
|
2821 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2822 |
for(i = (TUint)pos; i< pos + (KKB / 4); i+=4)
|
sl@0
|
2823 |
{
|
sl@0
|
2824 |
TUint j = * ((TUint*) &readBuf[i - (TUint)pos]);
|
sl@0
|
2825 |
test(i == j);
|
sl@0
|
2826 |
}
|
sl@0
|
2827 |
|
sl@0
|
2828 |
|
sl@0
|
2829 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1 and length = KKb bytes\n"));
|
sl@0
|
2830 |
// Async read from pos = 4GB-1 and length = KKb
|
sl@0
|
2831 |
status3 = KRequestPending;
|
sl@0
|
2832 |
pos = K4GBMinusTwo;
|
sl@0
|
2833 |
TestRFile1.ReadU((TUint)pos, readBuf, KKB, status3);
|
sl@0
|
2834 |
test(readBuf.Length() == 1);
|
sl@0
|
2835 |
|
sl@0
|
2836 |
// tests need to be repeated for current position variant of RFile64::Read()
|
sl@0
|
2837 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0 and length = 256 bytes\n"));
|
sl@0
|
2838 |
// Async read from pos = 0 and length = 256
|
sl@0
|
2839 |
status1 = KRequestPending;
|
sl@0
|
2840 |
TInt64 seekPos = 0;
|
sl@0
|
2841 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
2842 |
TestRFile1.Read(readBuf, 256, status1);
|
sl@0
|
2843 |
test(readBuf.Length() == 256);
|
sl@0
|
2844 |
|
sl@0
|
2845 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2846 |
for(i = (TUint)seekPos; i< seekPos + (256 / 4); i+=4)
|
sl@0
|
2847 |
{
|
sl@0
|
2848 |
TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
|
sl@0
|
2849 |
test(i == j);
|
sl@0
|
2850 |
}
|
sl@0
|
2851 |
|
sl@0
|
2852 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 2GB and length = KKB bytes\n"));
|
sl@0
|
2853 |
// Async read from pos = 2GB and length = KKb
|
sl@0
|
2854 |
status2 = KRequestPending;
|
sl@0
|
2855 |
seekPos = K2GB;
|
sl@0
|
2856 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
2857 |
TestRFile1.Read(readBuf, KKB, status2);
|
sl@0
|
2858 |
test(readBuf.Length() == KKB);
|
sl@0
|
2859 |
|
sl@0
|
2860 |
test.Next(_L("Compare the data read to the expected data\n"));
|
sl@0
|
2861 |
for(i = (TUint)seekPos; i< seekPos + (KKB / 4); i+=4)
|
sl@0
|
2862 |
{
|
sl@0
|
2863 |
TUint j = * ((TUint*) &readBuf[i - (TUint)seekPos]);
|
sl@0
|
2864 |
test(i == j);
|
sl@0
|
2865 |
}
|
sl@0
|
2866 |
|
sl@0
|
2867 |
|
sl@0
|
2868 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB-1 and length = KKb bytes\n"));
|
sl@0
|
2869 |
// Async read from pos = 4GB-1 and length = KKb
|
sl@0
|
2870 |
status3 = KRequestPending;
|
sl@0
|
2871 |
seekPos = K4GBMinusTwo;
|
sl@0
|
2872 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
2873 |
TestRFile1.Read(readBuf, KKB, status3);
|
sl@0
|
2874 |
test(readBuf.Length() == 1);
|
sl@0
|
2875 |
|
sl@0
|
2876 |
|
sl@0
|
2877 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 4GB and length = 256 bytes\n"));
|
sl@0
|
2878 |
// Async read from pos = 4GB and length = 256
|
sl@0
|
2879 |
|
sl@0
|
2880 |
|
sl@0
|
2881 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
2882 |
{
|
sl@0
|
2883 |
TRequestStatus status5 = KRequestPending;
|
sl@0
|
2884 |
pos = K4GB;
|
sl@0
|
2885 |
TestRFile1.Read(pos, readBuf, 256, status5);
|
sl@0
|
2886 |
test(readBuf.Length() == 0);
|
sl@0
|
2887 |
}
|
sl@0
|
2888 |
|
sl@0
|
2889 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0 and length = -1 bytes\n"));
|
sl@0
|
2890 |
// Async read from pos = 0 and length = -1
|
sl@0
|
2891 |
TRequestStatus status6 = KRequestPending;
|
sl@0
|
2892 |
pos = 0;
|
sl@0
|
2893 |
TestRFile1.Read(pos, readBuf, -1, status6);
|
sl@0
|
2894 |
|
sl@0
|
2895 |
test.Next(_L("Big file is read asynchronously in a thread, with aPos = 0 and length = 0 bytes\n"));
|
sl@0
|
2896 |
// Async read from pos = 0 and length = 0
|
sl@0
|
2897 |
TRequestStatus status7 = KRequestPending;
|
sl@0
|
2898 |
pos = 0;
|
sl@0
|
2899 |
TestRFile1.Read(pos, readBuf, 0, status7);
|
sl@0
|
2900 |
|
sl@0
|
2901 |
TestRFile1.Close();
|
sl@0
|
2902 |
|
sl@0
|
2903 |
TInt r = TheFs.Delete(fileName);
|
sl@0
|
2904 |
test(r == KErrNone);
|
sl@0
|
2905 |
}
|
sl@0
|
2906 |
|
sl@0
|
2907 |
/**
|
sl@0
|
2908 |
@SYMTestCaseID PBASE-T_FILE64BIT-0773
|
sl@0
|
2909 |
@SYMTestPriority High
|
sl@0
|
2910 |
@SYMTestRequirement REQ9526
|
sl@0
|
2911 |
@SYMTestType CIT
|
sl@0
|
2912 |
@SYMTestCaseDesc Tests for writing to a big file synchronously with specified position
|
sl@0
|
2913 |
@SYMTestActions
|
sl@0
|
2914 |
1) Write to a big file synchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1
|
sl@0
|
2915 |
2) Write to a big file synchronously in a thread, with aPos = 2GB-1 and data = 1KB
|
sl@0
|
2916 |
3) Write to a big file synchronously in a thread, with aPos = 4GB-1 and data = 1 byte
|
sl@0
|
2917 |
4) Write a big file synchronously in a thread, with aPos = 4GB and data = 256 bytes
|
sl@0
|
2918 |
@SYMTestExpectedResults
|
sl@0
|
2919 |
1) KErrNone, write is successful
|
sl@0
|
2920 |
2) KErrNone, write is successful
|
sl@0
|
2921 |
3) KErrNone, write is successful
|
sl@0
|
2922 |
4) KErrNotSupported, if NGFS is supported KErrNone and write is successful
|
sl@0
|
2923 |
@SYMTestStatus Implemented
|
sl@0
|
2924 |
*/
|
sl@0
|
2925 |
|
sl@0
|
2926 |
void TestOpenAndWriteSyncLargeFile()
|
sl@0
|
2927 |
{
|
sl@0
|
2928 |
test.Next(_L("Open & Write Synchronously Large File From Different Offset:"));
|
sl@0
|
2929 |
|
sl@0
|
2930 |
TInt count;
|
sl@0
|
2931 |
TFileName fileName;
|
sl@0
|
2932 |
fileName.Append(gDriveToTest);
|
sl@0
|
2933 |
fileName.Append(KTestPath);
|
sl@0
|
2934 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
2935 |
TestRFile1.Replace(fileName, EFileWrite);
|
sl@0
|
2936 |
TestRFile1.SetSize(K4GBMinusOne);
|
sl@0
|
2937 |
|
sl@0
|
2938 |
TInt64 size;
|
sl@0
|
2939 |
TestRFile1.Size(size);
|
sl@0
|
2940 |
test(size == K4GBMinusOne);
|
sl@0
|
2941 |
|
sl@0
|
2942 |
|
sl@0
|
2943 |
test.Next(_L("Write to a big file synchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1\n"));
|
sl@0
|
2944 |
TBuf8<0x100> writeBuf100;
|
sl@0
|
2945 |
TBuf8<0x100> readBuf100;
|
sl@0
|
2946 |
writeBuf100.Zero();
|
sl@0
|
2947 |
writeBuf100.FillZ();
|
sl@0
|
2948 |
for (count = 0; count < 0x100; count++)
|
sl@0
|
2949 |
{
|
sl@0
|
2950 |
writeBuf100.Append((TChar)count);
|
sl@0
|
2951 |
}
|
sl@0
|
2952 |
TestRFile1.WriteP(0,writeBuf100);
|
sl@0
|
2953 |
TestRFile1.Size(size);
|
sl@0
|
2954 |
TestRFile1.ReadP(0,readBuf100);
|
sl@0
|
2955 |
test(writeBuf100 == readBuf100);
|
sl@0
|
2956 |
|
sl@0
|
2957 |
test.Next(_L("Write to a big file synchronously in a thread, with aPos = 2GB-1 and data = 1KB\n"));
|
sl@0
|
2958 |
TBuf8<0x400> writeBuf400;
|
sl@0
|
2959 |
TBuf8<0x400> readBuf400;
|
sl@0
|
2960 |
writeBuf400.Zero();
|
sl@0
|
2961 |
writeBuf400.FillZ();
|
sl@0
|
2962 |
for (count = 0; count < 0x400; count++)
|
sl@0
|
2963 |
{
|
sl@0
|
2964 |
writeBuf400.Append(count+20);
|
sl@0
|
2965 |
}
|
sl@0
|
2966 |
TestRFile1.WriteP(K2GBMinusOne,writeBuf400);
|
sl@0
|
2967 |
TestRFile1.ReadP(K2GBMinusOne,readBuf400); // just for validation
|
sl@0
|
2968 |
test(writeBuf400 == readBuf400);
|
sl@0
|
2969 |
|
sl@0
|
2970 |
test.Next(_L("Write to a big file synchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
|
sl@0
|
2971 |
TBuf8<1> testReadBuf;
|
sl@0
|
2972 |
TestRFile1.WriteP(K4GBMinusTwo,_L8("1"));
|
sl@0
|
2973 |
TestRFile1.ReadP(K4GBMinusTwo, testReadBuf);
|
sl@0
|
2974 |
test(testReadBuf.Length() == 1);
|
sl@0
|
2975 |
|
sl@0
|
2976 |
//tests need to be repeated for TUint variant of RFile64::Write()
|
sl@0
|
2977 |
readBuf100.Zero(); //to ensure that the previous data is removed
|
sl@0
|
2978 |
test.Next(_L("Write to a big file synchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1\n"));
|
sl@0
|
2979 |
TUint pos = 0;
|
sl@0
|
2980 |
TestRFile1.WriteU(pos,writeBuf100);
|
sl@0
|
2981 |
TestRFile1.ReadU(pos,readBuf100);
|
sl@0
|
2982 |
test(writeBuf100 == readBuf100);
|
sl@0
|
2983 |
|
sl@0
|
2984 |
test.Next(_L("Write to a big file synchronously in a thread, with aPos = 2GB-1 and data = 1KB\n"));
|
sl@0
|
2985 |
readBuf400.Zero();//to ensure that the previous data is removed
|
sl@0
|
2986 |
pos = K2GBMinusOne;
|
sl@0
|
2987 |
TestRFile1.WriteU(pos,writeBuf400);
|
sl@0
|
2988 |
TestRFile1.ReadU(pos,readBuf400); // just for validation
|
sl@0
|
2989 |
test(writeBuf400 == readBuf400);
|
sl@0
|
2990 |
|
sl@0
|
2991 |
|
sl@0
|
2992 |
test.Next(_L("Write to a big file synchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
|
sl@0
|
2993 |
pos = K4GBMinusTwo;
|
sl@0
|
2994 |
testReadBuf.Zero();//to ensure that the previous data is removed
|
sl@0
|
2995 |
TestRFile1.WriteU(pos,_L8("1"));
|
sl@0
|
2996 |
TestRFile1.ReadU(pos, testReadBuf);
|
sl@0
|
2997 |
test(testReadBuf.Length() == 1);
|
sl@0
|
2998 |
|
sl@0
|
2999 |
//
|
sl@0
|
3000 |
//tests need to be repeated for current position variant of RFile64::Write()
|
sl@0
|
3001 |
//testing with only current position as 4GB-2(boundary condition)
|
sl@0
|
3002 |
//
|
sl@0
|
3003 |
test.Next(_L("Write to a big file synchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
|
sl@0
|
3004 |
TInt64 seekPos = K4GBMinusTwo;
|
sl@0
|
3005 |
testReadBuf.Zero();//to ensure that the previous data is removed
|
sl@0
|
3006 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
3007 |
TestRFile1.Write(_L8("1"));
|
sl@0
|
3008 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
3009 |
TestRFile1.Read(testReadBuf);
|
sl@0
|
3010 |
test(testReadBuf.Length() == 1);
|
sl@0
|
3011 |
|
sl@0
|
3012 |
|
sl@0
|
3013 |
|
sl@0
|
3014 |
test.Next(_L("Write a big file synchronously in a thread, with aPos = 4GB and data = 256 bytes\n"));
|
sl@0
|
3015 |
|
sl@0
|
3016 |
|
sl@0
|
3017 |
TBuf8<0x100> writeBuffer256;
|
sl@0
|
3018 |
TBuf8<0x100> readBuffer256;
|
sl@0
|
3019 |
writeBuffer256.Zero();
|
sl@0
|
3020 |
writeBuffer256.FillZ();
|
sl@0
|
3021 |
readBuffer256.Zero();
|
sl@0
|
3022 |
readBuffer256.FillZ();
|
sl@0
|
3023 |
|
sl@0
|
3024 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
3025 |
{
|
sl@0
|
3026 |
for (TInt count = 0; count < 256; count++)
|
sl@0
|
3027 |
{
|
sl@0
|
3028 |
writeBuffer256.Append((TChar)count);
|
sl@0
|
3029 |
}
|
sl@0
|
3030 |
TestRFile1.WriteP(K4GB,writeBuffer256);
|
sl@0
|
3031 |
User::After(100000);
|
sl@0
|
3032 |
// Validation for boundary condition 4GB
|
sl@0
|
3033 |
TestRFile1.ReadP(K4GB,readBuffer256);
|
sl@0
|
3034 |
TInt rr = readBuffer256.Length();
|
sl@0
|
3035 |
test(rr == KErrNone);
|
sl@0
|
3036 |
test(readBuffer256.Length() == 0);
|
sl@0
|
3037 |
}
|
sl@0
|
3038 |
TestRFile1.Close();
|
sl@0
|
3039 |
|
sl@0
|
3040 |
TInt r = TheFs.Delete(fileName);
|
sl@0
|
3041 |
test(r == KErrNone);
|
sl@0
|
3042 |
}
|
sl@0
|
3043 |
|
sl@0
|
3044 |
/**
|
sl@0
|
3045 |
@SYMTestCaseID PBASE-T_FILE64BIT-0774
|
sl@0
|
3046 |
@SYMTestPriority High
|
sl@0
|
3047 |
@SYMTestRequirement REQ9526
|
sl@0
|
3048 |
@SYMTestType CIT
|
sl@0
|
3049 |
@SYMTestCaseDesc Tests for writing to a big file asynchronously with specified position
|
sl@0
|
3050 |
@SYMTestActions
|
sl@0
|
3051 |
1) Write to a big file asynchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1
|
sl@0
|
3052 |
2) Write to a big file asynchronously in a thread, with aPos = 2GB-1 and data = 1KB
|
sl@0
|
3053 |
3) Write to a big file asynchronously in a thread, with aPos = 4GB-1 and data = 1 byte
|
sl@0
|
3054 |
4) Check for FAT32 file system. Write to a big file asynchronously in a thread with aPos = 4GB and data length = 256 bytes
|
sl@0
|
3055 |
@SYMTestExpectedResults
|
sl@0
|
3056 |
1) KErrNone, write is successful
|
sl@0
|
3057 |
2) KErrNone, write is successful
|
sl@0
|
3058 |
3) KErrNone, write is successful
|
sl@0
|
3059 |
4) KErrNotSupported, if NGFS is available KErrNone and write is successful.
|
sl@0
|
3060 |
@SYMTestStatus Implemented
|
sl@0
|
3061 |
*/
|
sl@0
|
3062 |
|
sl@0
|
3063 |
void TestOpenAndWriteAsyncLargeFile()
|
sl@0
|
3064 |
{
|
sl@0
|
3065 |
test.Next(_L("Open & Write Asynchronously Large File From Different Offset:"));
|
sl@0
|
3066 |
|
sl@0
|
3067 |
TInt count;
|
sl@0
|
3068 |
TFileName fileName;
|
sl@0
|
3069 |
fileName.Append(gDriveToTest);
|
sl@0
|
3070 |
fileName.Append(KTestPath);
|
sl@0
|
3071 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
3072 |
TestRFile1.Replace(fileName, EFileWrite);
|
sl@0
|
3073 |
|
sl@0
|
3074 |
TestRFile1.SetSize(K4GBMinusOne);
|
sl@0
|
3075 |
TInt64 size;
|
sl@0
|
3076 |
TestRFile1.Size(size);
|
sl@0
|
3077 |
|
sl@0
|
3078 |
test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1\n"));
|
sl@0
|
3079 |
TBuf8<0x100> writeBuf100;
|
sl@0
|
3080 |
TBuf8<0x100> readBuf100;
|
sl@0
|
3081 |
writeBuf100.Zero();
|
sl@0
|
3082 |
writeBuf100.FillZ();
|
sl@0
|
3083 |
for (count = 0; count < 0x100; count++)
|
sl@0
|
3084 |
{
|
sl@0
|
3085 |
writeBuf100.Append((TChar)count);
|
sl@0
|
3086 |
}
|
sl@0
|
3087 |
TRequestStatus status1 = KRequestPending;
|
sl@0
|
3088 |
TestRFile1.Write(0,writeBuf100,status1);
|
sl@0
|
3089 |
TestRFile1.ReadP(0,readBuf100);
|
sl@0
|
3090 |
test (writeBuf100 == readBuf100);
|
sl@0
|
3091 |
|
sl@0
|
3092 |
test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 2GB-1 and data = 1KB\n"));
|
sl@0
|
3093 |
TBuf8<0x400> writeBuf400;
|
sl@0
|
3094 |
TBuf8<0x400> readBuf400;
|
sl@0
|
3095 |
writeBuf400.Zero();
|
sl@0
|
3096 |
writeBuf400.FillZ();
|
sl@0
|
3097 |
for (count = 0; count < 0x400; count++)
|
sl@0
|
3098 |
{
|
sl@0
|
3099 |
writeBuf400.Append(count+20);
|
sl@0
|
3100 |
}
|
sl@0
|
3101 |
TRequestStatus status2 = KRequestPending;
|
sl@0
|
3102 |
TestRFile1.Write(K2GBMinusOne,writeBuf400,status2);
|
sl@0
|
3103 |
TestRFile1.ReadP(K2GBMinusOne,readBuf400); // just for validation
|
sl@0
|
3104 |
test(writeBuf400 == readBuf400);
|
sl@0
|
3105 |
|
sl@0
|
3106 |
test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
|
sl@0
|
3107 |
TBuf8<0x1> writeBuf;
|
sl@0
|
3108 |
TBuf8<0x1> readBuf;
|
sl@0
|
3109 |
writeBuf.Zero();
|
sl@0
|
3110 |
writeBuf.FillZ();
|
sl@0
|
3111 |
for (count = 0; count < 0x1; count++)
|
sl@0
|
3112 |
{
|
sl@0
|
3113 |
writeBuf.Append((TChar)(count+17));
|
sl@0
|
3114 |
}
|
sl@0
|
3115 |
TRequestStatus status3 = KRequestPending;
|
sl@0
|
3116 |
TestRFile1.Write(K4GBMinusTwo,writeBuf,status3);
|
sl@0
|
3117 |
TestRFile1.ReadP(K4GBMinusTwo,readBuf);
|
sl@0
|
3118 |
test(readBuf.Length() == 1);
|
sl@0
|
3119 |
|
sl@0
|
3120 |
//tests need to be repeated for TUint variant of RFile64::Write()
|
sl@0
|
3121 |
test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0 and data = 256 bytes, File size = 4GB-1\n"));
|
sl@0
|
3122 |
readBuf100.Zero();//to ensure that the previous data is removed
|
sl@0
|
3123 |
status1 = KRequestPending;
|
sl@0
|
3124 |
TUint pos = 0;
|
sl@0
|
3125 |
TestRFile1.WriteU(pos,writeBuf100,status1);
|
sl@0
|
3126 |
TestRFile1.ReadU(pos,readBuf100);
|
sl@0
|
3127 |
test (writeBuf100 == readBuf100);
|
sl@0
|
3128 |
|
sl@0
|
3129 |
test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 2GB-1 and data = 1KB\n"));
|
sl@0
|
3130 |
readBuf400.Zero();//to ensure that the previous data is removed
|
sl@0
|
3131 |
status2 = KRequestPending;
|
sl@0
|
3132 |
pos = K2GBMinusOne;
|
sl@0
|
3133 |
TestRFile1.WriteU(pos,writeBuf400,status2);
|
sl@0
|
3134 |
TestRFile1.ReadU(pos,readBuf400); // just for validation
|
sl@0
|
3135 |
test(writeBuf400 == readBuf400);
|
sl@0
|
3136 |
|
sl@0
|
3137 |
test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
|
sl@0
|
3138 |
readBuf.Zero();//to ensure that the previous data is removed
|
sl@0
|
3139 |
status3 = KRequestPending;
|
sl@0
|
3140 |
pos = K4GBMinusTwo;
|
sl@0
|
3141 |
TestRFile1.WriteU(pos,writeBuf,status3);
|
sl@0
|
3142 |
TestRFile1.ReadU(pos,readBuf);
|
sl@0
|
3143 |
test(readBuf.Length() == 1);
|
sl@0
|
3144 |
|
sl@0
|
3145 |
//
|
sl@0
|
3146 |
//tests need to be repeated for current position variant of RFile64::Write()
|
sl@0
|
3147 |
//testing with only current position as 4GB-2(boundary condition)
|
sl@0
|
3148 |
//
|
sl@0
|
3149 |
test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-1 and data = 1 byte\n"));
|
sl@0
|
3150 |
readBuf.Zero();//to ensure that the previous data is removed
|
sl@0
|
3151 |
status3 = KRequestPending;
|
sl@0
|
3152 |
TInt64 seekPos = K4GBMinusTwo;
|
sl@0
|
3153 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
3154 |
TestRFile1.Write(writeBuf,status3);
|
sl@0
|
3155 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
3156 |
TestRFile1.Read(readBuf);
|
sl@0
|
3157 |
test(readBuf.Length() == 1);
|
sl@0
|
3158 |
|
sl@0
|
3159 |
|
sl@0
|
3160 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
3161 |
{
|
sl@0
|
3162 |
TBuf8<0x100> writeBuf256;
|
sl@0
|
3163 |
TBuf8<0x100> readBuf256;
|
sl@0
|
3164 |
writeBuf256.Zero();
|
sl@0
|
3165 |
writeBuf256.FillZ();
|
sl@0
|
3166 |
for (TInt count = 0; count < 0x100; count++)
|
sl@0
|
3167 |
{
|
sl@0
|
3168 |
writeBuf256.Append((TChar)(count+7));
|
sl@0
|
3169 |
}
|
sl@0
|
3170 |
TRequestStatus status4 = KRequestPending;
|
sl@0
|
3171 |
TestRFile1.Write(K4GB,writeBuf256,status4);
|
sl@0
|
3172 |
User::After(100000);
|
sl@0
|
3173 |
// Validation for boundary condition 4GB
|
sl@0
|
3174 |
TestRFile1.ReadP(K4GB,readBuf256);
|
sl@0
|
3175 |
test(readBuf256.Length() == 0);
|
sl@0
|
3176 |
}
|
sl@0
|
3177 |
TestRFile1.Close();
|
sl@0
|
3178 |
|
sl@0
|
3179 |
TInt r = TheFs.Delete(fileName);
|
sl@0
|
3180 |
test(r == KErrNone);
|
sl@0
|
3181 |
}
|
sl@0
|
3182 |
|
sl@0
|
3183 |
/**
|
sl@0
|
3184 |
@SYMTestCaseID PBASE-T_FILE64BIT-0775
|
sl@0
|
3185 |
@SYMTestPriority High
|
sl@0
|
3186 |
@SYMTestRequirement REQ9526
|
sl@0
|
3187 |
@SYMTestType CIT
|
sl@0
|
3188 |
@SYMTestCaseDesc Tests for writing to a big file synchronously with specified position and length
|
sl@0
|
3189 |
@SYMTestActions
|
sl@0
|
3190 |
1) Write to a big file synchronously in a thread with aPos = 0, data = 256 bytes and length = 255 bytes
|
sl@0
|
3191 |
2) Write to a big file synchronously in a thread with aPos = 2GB -1, data = 1KB and length = 200 bytes
|
sl@0
|
3192 |
3) Write to a big file synchronously in a thread with aPos = 4GB-10 and data = 1KB and length = 10 bytes
|
sl@0
|
3193 |
4) Check for FAT32 file system. Write to a big file synchronously in a thread with aPos = 4GB, data length = 256 bytes and length = 10 bytes
|
sl@0
|
3194 |
5) Write to a big file synchronously in a thread with aPos = 0 , data = 256 bytes and length =0 bytes
|
sl@0
|
3195 |
6) Write to a big file synchronously in a thread with aPos = 0 , data = 256 bytes and length = -1
|
sl@0
|
3196 |
@SYMTestExpectedResults
|
sl@0
|
3197 |
1) KErrNone, write is successful
|
sl@0
|
3198 |
2) KErrNone, write is successful
|
sl@0
|
3199 |
3) KErrNone, write is successful
|
sl@0
|
3200 |
4) KErrNotSupported. If NGFS is supported and write is successful
|
sl@0
|
3201 |
5) KErrNone
|
sl@0
|
3202 |
6) KErrArgument
|
sl@0
|
3203 |
@SYMTestStatus Implemented
|
sl@0
|
3204 |
*/
|
sl@0
|
3205 |
|
sl@0
|
3206 |
void TestOpenAndWriteSyncLargeFileWithLen()
|
sl@0
|
3207 |
{
|
sl@0
|
3208 |
test.Next(_L("Open & Write Synchronously Large File From Different Offset and length:"));
|
sl@0
|
3209 |
|
sl@0
|
3210 |
TInt count;
|
sl@0
|
3211 |
TFileName fileName;
|
sl@0
|
3212 |
fileName.Append(gDriveToTest);
|
sl@0
|
3213 |
fileName.Append(KTestPath);
|
sl@0
|
3214 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
3215 |
TestRFile1.Replace(fileName, EFileWrite);
|
sl@0
|
3216 |
|
sl@0
|
3217 |
TestRFile1.SetSize(K4GBMinusOne);
|
sl@0
|
3218 |
|
sl@0
|
3219 |
test.Next(_L("Write to a big file synchronously in a thread with aPos = 0, data = 256 bytes and length = 255 bytes\n"));
|
sl@0
|
3220 |
TBuf8<0x100> writeBuf100;
|
sl@0
|
3221 |
TBuf8<0x100> readBuf100;
|
sl@0
|
3222 |
TBuf8<0x100> validateBuf100;
|
sl@0
|
3223 |
writeBuf100.Zero();
|
sl@0
|
3224 |
writeBuf100.FillZ();
|
sl@0
|
3225 |
validateBuf100.Zero();
|
sl@0
|
3226 |
for (count = 0; count < 0x100; count++)
|
sl@0
|
3227 |
{
|
sl@0
|
3228 |
writeBuf100.Append((TChar)count);
|
sl@0
|
3229 |
if(count < 0xFF)
|
sl@0
|
3230 |
validateBuf100.Append((TChar)count);
|
sl@0
|
3231 |
}
|
sl@0
|
3232 |
TestRFile1.Write(0,writeBuf100,255);
|
sl@0
|
3233 |
TestRFile1.Read(0,readBuf100,255);
|
sl@0
|
3234 |
test(validateBuf100 == readBuf100);
|
sl@0
|
3235 |
|
sl@0
|
3236 |
test.Next(_L("Write to a big file synchronously in a thread with aPos = 2GB -1, data = 1KB and length = 200 bytes\n"));
|
sl@0
|
3237 |
TBuf8<0x400> writeBuf400;
|
sl@0
|
3238 |
TBuf8<0x400> readBuf400;
|
sl@0
|
3239 |
TBuf8<0x400> validateBuf400;
|
sl@0
|
3240 |
writeBuf400.Zero();
|
sl@0
|
3241 |
writeBuf400.FillZ();
|
sl@0
|
3242 |
for (count = 0; count < 0x400; count++)
|
sl@0
|
3243 |
{
|
sl@0
|
3244 |
writeBuf400.Append(count+20);
|
sl@0
|
3245 |
if(count<200)
|
sl@0
|
3246 |
validateBuf400.Append(count+20);
|
sl@0
|
3247 |
}
|
sl@0
|
3248 |
TestRFile1.Write(K2GBMinusOne,writeBuf400,200);
|
sl@0
|
3249 |
TestRFile1.Read(K2GBMinusOne,readBuf400,200);
|
sl@0
|
3250 |
test(validateBuf400 == readBuf400);
|
sl@0
|
3251 |
|
sl@0
|
3252 |
test.Next(_L("Write to a big file synchronously in a thread with aPos = 4GB-10 and data = 1KB and length = 10 bytes\n"));
|
sl@0
|
3253 |
TBuf8<0x400> writeBuf1024;
|
sl@0
|
3254 |
TBuf8<0x400> readBuf1024;
|
sl@0
|
3255 |
TBuf8<0x400> validateBuf1024;
|
sl@0
|
3256 |
writeBuf1024.Zero();
|
sl@0
|
3257 |
writeBuf1024.FillZ();
|
sl@0
|
3258 |
for (count = 0; count < 0x400; count++)
|
sl@0
|
3259 |
{
|
sl@0
|
3260 |
writeBuf1024.Append(count+3);
|
sl@0
|
3261 |
if(count < 9)
|
sl@0
|
3262 |
validateBuf1024.Append(count+3);
|
sl@0
|
3263 |
}
|
sl@0
|
3264 |
TestRFile1.Write(K4GBMinusTen,writeBuf1024,9);
|
sl@0
|
3265 |
TestRFile1.Read(K4GBMinusTen,readBuf1024,9);
|
sl@0
|
3266 |
test(validateBuf1024 == readBuf1024);
|
sl@0
|
3267 |
|
sl@0
|
3268 |
//tests need to be repeated for TUint variant of RFile64::Write()
|
sl@0
|
3269 |
test.Next(_L("Write to a big file synchronously in a thread with aPos = 0, data = 256 bytes and length = 255 bytes\n"));
|
sl@0
|
3270 |
readBuf100.Zero();//to ensure that the previous data is removed
|
sl@0
|
3271 |
TUint pos = 0;
|
sl@0
|
3272 |
TestRFile1.WriteU(pos,writeBuf100,255);
|
sl@0
|
3273 |
TestRFile1.ReadU(pos,readBuf100,255);
|
sl@0
|
3274 |
test(validateBuf100 == readBuf100);
|
sl@0
|
3275 |
|
sl@0
|
3276 |
test.Next(_L("Write to a big file synchronously in a thread with aPos = 2GB -1, data = 1KB and length = 200 bytes\n"));
|
sl@0
|
3277 |
readBuf400.Zero();//to ensure that the previous data is removed
|
sl@0
|
3278 |
pos = K2GBMinusOne;
|
sl@0
|
3279 |
TestRFile1.WriteU(pos,writeBuf400,200);
|
sl@0
|
3280 |
TestRFile1.ReadU(pos,readBuf400,200);
|
sl@0
|
3281 |
test(validateBuf400 == readBuf400);
|
sl@0
|
3282 |
|
sl@0
|
3283 |
test.Next(_L("Write to a big file synchronously in a thread with aPos = 4GB-10 and data = 1KB and length = 10 bytes\n"));
|
sl@0
|
3284 |
readBuf1024.Zero();//to ensure that the previous data is removed
|
sl@0
|
3285 |
pos = K4GBMinusTen;
|
sl@0
|
3286 |
TestRFile1.WriteU(pos,writeBuf1024,9);
|
sl@0
|
3287 |
TestRFile1.ReadU(pos,readBuf1024,9);
|
sl@0
|
3288 |
test(validateBuf1024 == readBuf1024);
|
sl@0
|
3289 |
|
sl@0
|
3290 |
//
|
sl@0
|
3291 |
//tests need to be repeated for current position variant of RFile64::Write()
|
sl@0
|
3292 |
//testing with only current position as 4GB-2(boundary condition)
|
sl@0
|
3293 |
//
|
sl@0
|
3294 |
test.Next(_L("Write to a big file synchronously in a thread with aPos = 4GB-10 and data = 1KB and length = 10 bytes\n"));
|
sl@0
|
3295 |
readBuf1024.Zero();//to ensure that the previous data is removed
|
sl@0
|
3296 |
TInt64 seekPos = K4GBMinusTen;
|
sl@0
|
3297 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
3298 |
TestRFile1.Write(writeBuf1024,9);
|
sl@0
|
3299 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
3300 |
TestRFile1.Read(readBuf1024,9);
|
sl@0
|
3301 |
test(validateBuf1024 == readBuf1024);
|
sl@0
|
3302 |
|
sl@0
|
3303 |
|
sl@0
|
3304 |
|
sl@0
|
3305 |
test.Next(_L("Check for FAT32 file system. Write to a big file synchronously in a thread with aPos = 4GB, data length = 256 bytes and length = 10 bytes\n"));
|
sl@0
|
3306 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
3307 |
{
|
sl@0
|
3308 |
TBuf8<0x100> writeBuf256;
|
sl@0
|
3309 |
TBuf8<0x100> readBuf256;
|
sl@0
|
3310 |
writeBuf256.Zero();
|
sl@0
|
3311 |
writeBuf256.FillZ();
|
sl@0
|
3312 |
for (TInt count = 0; count < 0x100; count++)
|
sl@0
|
3313 |
{
|
sl@0
|
3314 |
writeBuf256.Append(count+6);
|
sl@0
|
3315 |
}
|
sl@0
|
3316 |
TestRFile1.Write(K4GB,writeBuf256,10);
|
sl@0
|
3317 |
TestRFile1.Read(K4GB,readBuf256,10);
|
sl@0
|
3318 |
test(readBuf256.Length() == 0);
|
sl@0
|
3319 |
}
|
sl@0
|
3320 |
test.Next(_L(" Write to a big file synchronously in a thread with aPos = 0 , data = 256 bytes and length =0 bytes\n"));
|
sl@0
|
3321 |
TBuf8<0x100> wrBuf256;
|
sl@0
|
3322 |
TBuf8<0x100> reBuf256;
|
sl@0
|
3323 |
wrBuf256.Zero();
|
sl@0
|
3324 |
wrBuf256.FillZ();
|
sl@0
|
3325 |
for (count = 0; count < 0x100; count++)
|
sl@0
|
3326 |
{
|
sl@0
|
3327 |
wrBuf256.Append(count+6);
|
sl@0
|
3328 |
}
|
sl@0
|
3329 |
TestRFile1.Write(0,wrBuf256,0);
|
sl@0
|
3330 |
TestRFile1.Read(0,reBuf256,0);
|
sl@0
|
3331 |
test(reBuf256.Length() == 0);
|
sl@0
|
3332 |
|
sl@0
|
3333 |
test.Next(_L("Write to a big file synchronously in a thread with aPos = 0 , data = 256 bytes and length = -1\n"));
|
sl@0
|
3334 |
TBuf8<0x100> wBuf256;
|
sl@0
|
3335 |
wBuf256.Zero();
|
sl@0
|
3336 |
wBuf256.FillZ();
|
sl@0
|
3337 |
for (count = 0; count < 0x100; count++)
|
sl@0
|
3338 |
{
|
sl@0
|
3339 |
wBuf256.Append(count+3);
|
sl@0
|
3340 |
}
|
sl@0
|
3341 |
TestRFile1.Write(0,wrBuf256,-1);
|
sl@0
|
3342 |
TestRFile1.Close();
|
sl@0
|
3343 |
|
sl@0
|
3344 |
TInt r = TheFs.Delete(fileName);
|
sl@0
|
3345 |
test(r == KErrNone);
|
sl@0
|
3346 |
}
|
sl@0
|
3347 |
|
sl@0
|
3348 |
/**
|
sl@0
|
3349 |
@SYMTestCaseID PBASE-T_FILE64BIT-0776
|
sl@0
|
3350 |
@SYMTestPriority High
|
sl@0
|
3351 |
@SYMTestRequirement REQ9526
|
sl@0
|
3352 |
@SYMTestType CIT
|
sl@0
|
3353 |
@SYMTestCaseDesc Tests for writing to a big file asynchronously with specified position and length
|
sl@0
|
3354 |
@SYMTestActions
|
sl@0
|
3355 |
1) Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = 255 bytes
|
sl@0
|
3356 |
2) Write to a big file asynchronously in a thread, with aPos = 2GB-1, data = 1KB and length = 200 bytes
|
sl@0
|
3357 |
3) Write to a big file asynchronously in a thread, with aPos = 4GB-10, data = 10 bytes and length = 10 bytes
|
sl@0
|
3358 |
4) Check for FAT32 file system. Write to a big file asynchronously in a thread, with aPos = 4GB+1, data = 256 bytes and length = 10 bytes
|
sl@0
|
3359 |
5) Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = 0 bytes
|
sl@0
|
3360 |
6) Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = -1bytes
|
sl@0
|
3361 |
@SYMTestExpectedResults
|
sl@0
|
3362 |
1) KErrNone, write is successful
|
sl@0
|
3363 |
2) KErrNone, write is successful
|
sl@0
|
3364 |
3) KErrNone, write is successful
|
sl@0
|
3365 |
4) KErrNotSupported. If NGFS is supported KErrNone and write is successful
|
sl@0
|
3366 |
5) KErrNone
|
sl@0
|
3367 |
6) KErrArgument
|
sl@0
|
3368 |
@SYMTestStatus Implemented
|
sl@0
|
3369 |
*/
|
sl@0
|
3370 |
|
sl@0
|
3371 |
void TestOpenAndWriteAsyncLargeFileWithLen()
|
sl@0
|
3372 |
{
|
sl@0
|
3373 |
test.Next(_L("Open & Write Asynchronously Large File From Different Offset and length:"));
|
sl@0
|
3374 |
|
sl@0
|
3375 |
TInt count;
|
sl@0
|
3376 |
TFileName fileName;
|
sl@0
|
3377 |
fileName.Append(gDriveToTest);
|
sl@0
|
3378 |
fileName.Append(KTestPath);
|
sl@0
|
3379 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
3380 |
TestRFile1.Replace(fileName, EFileWrite);
|
sl@0
|
3381 |
|
sl@0
|
3382 |
TestRFile1.SetSize(K4GBMinusOne);
|
sl@0
|
3383 |
|
sl@0
|
3384 |
test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = 255 bytes \n"));
|
sl@0
|
3385 |
TBuf8<0x100> writeBuf100;
|
sl@0
|
3386 |
TBuf8<0x100> readBuf100;
|
sl@0
|
3387 |
TBuf8<0x100> validateBuf100;
|
sl@0
|
3388 |
writeBuf100.Zero();
|
sl@0
|
3389 |
writeBuf100.FillZ();
|
sl@0
|
3390 |
validateBuf100.Zero();
|
sl@0
|
3391 |
for (count = 0; count < 0x100; count++)
|
sl@0
|
3392 |
{
|
sl@0
|
3393 |
writeBuf100.Append((TChar)count);
|
sl@0
|
3394 |
if(count < 0xFF)
|
sl@0
|
3395 |
validateBuf100.Append((TChar)count);
|
sl@0
|
3396 |
}
|
sl@0
|
3397 |
TRequestStatus status1 = KRequestPending;
|
sl@0
|
3398 |
TestRFile1.Write(0,writeBuf100,255,status1);
|
sl@0
|
3399 |
TestRFile1.Read(0,readBuf100,255);
|
sl@0
|
3400 |
test(validateBuf100 == readBuf100);
|
sl@0
|
3401 |
|
sl@0
|
3402 |
test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 2GB-1, data = 1KB and length = 200 bytes\n"));
|
sl@0
|
3403 |
TBuf8<0x400> writeBuf400;
|
sl@0
|
3404 |
TBuf8<0x400> readBuf400;
|
sl@0
|
3405 |
TBuf8<0x400> validateBuf400;
|
sl@0
|
3406 |
writeBuf400.Zero();
|
sl@0
|
3407 |
writeBuf400.FillZ();
|
sl@0
|
3408 |
validateBuf400.Zero();
|
sl@0
|
3409 |
for (count = 0; count < 0x400; count++)
|
sl@0
|
3410 |
{
|
sl@0
|
3411 |
writeBuf400.Append(count+20);
|
sl@0
|
3412 |
if(count < 200)
|
sl@0
|
3413 |
validateBuf400.Append(count+20);
|
sl@0
|
3414 |
}
|
sl@0
|
3415 |
TRequestStatus status2 = KRequestPending;
|
sl@0
|
3416 |
TestRFile1.Write(K2GBMinusOne,writeBuf400,200,status2);
|
sl@0
|
3417 |
TestRFile1.Read(K2GBMinusOne,readBuf400,200);
|
sl@0
|
3418 |
test(validateBuf400 == readBuf400);
|
sl@0
|
3419 |
|
sl@0
|
3420 |
test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-10, data = 10 bytes and length = 10 bytes\n"));
|
sl@0
|
3421 |
TBuf8<0x0A> writeBuf0A;
|
sl@0
|
3422 |
TBuf8<0x0A> readBuf0A;
|
sl@0
|
3423 |
TBuf8<0x0A> validateBuf0A;
|
sl@0
|
3424 |
writeBuf0A.Zero();
|
sl@0
|
3425 |
readBuf0A.FillZ();
|
sl@0
|
3426 |
validateBuf0A.Zero();
|
sl@0
|
3427 |
for (count = 0; count < 0x0A; count++)
|
sl@0
|
3428 |
{
|
sl@0
|
3429 |
writeBuf0A.Append(count+3);
|
sl@0
|
3430 |
if(count<9)
|
sl@0
|
3431 |
validateBuf0A.Append(count+3);
|
sl@0
|
3432 |
}
|
sl@0
|
3433 |
TRequestStatus status3 = KRequestPending;
|
sl@0
|
3434 |
TestRFile1.Write(K4GBMinusTen,writeBuf0A,9,status3);
|
sl@0
|
3435 |
TestRFile1.Read(K4GBMinusTen,readBuf0A,9);
|
sl@0
|
3436 |
test(validateBuf0A == readBuf0A);
|
sl@0
|
3437 |
|
sl@0
|
3438 |
//tests need to be repeated for TUint variant of RFile64::Write()
|
sl@0
|
3439 |
|
sl@0
|
3440 |
test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = 255 bytes \n"));
|
sl@0
|
3441 |
readBuf100.Zero();//to ensure that the previous data is removed
|
sl@0
|
3442 |
status1 = KRequestPending;
|
sl@0
|
3443 |
TUint pos = 0;
|
sl@0
|
3444 |
TestRFile1.WriteU(pos,writeBuf100,255,status1);
|
sl@0
|
3445 |
TestRFile1.ReadU(pos,readBuf100,255);
|
sl@0
|
3446 |
test(validateBuf100 == readBuf100);
|
sl@0
|
3447 |
|
sl@0
|
3448 |
test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 2GB-1, data = 1KB and length = 200 bytes\n"));
|
sl@0
|
3449 |
readBuf400.Zero();//to ensure that the previous data is removed
|
sl@0
|
3450 |
status2 = KRequestPending;
|
sl@0
|
3451 |
pos = K2GBMinusOne;
|
sl@0
|
3452 |
TestRFile1.Write(pos,writeBuf400,200,status2);
|
sl@0
|
3453 |
TestRFile1.Read(pos,readBuf400,200);
|
sl@0
|
3454 |
test(validateBuf400 == readBuf400);
|
sl@0
|
3455 |
|
sl@0
|
3456 |
test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-10, data = 10 bytes and length = 10 bytes\n"));
|
sl@0
|
3457 |
readBuf0A.Zero();//to ensure that the previous data is removed
|
sl@0
|
3458 |
status3 = KRequestPending;
|
sl@0
|
3459 |
pos = K4GBMinusTen;
|
sl@0
|
3460 |
TestRFile1.Write(pos,writeBuf0A,9,status3);
|
sl@0
|
3461 |
TestRFile1.Read(pos,readBuf0A,9);
|
sl@0
|
3462 |
test(validateBuf0A == readBuf0A);
|
sl@0
|
3463 |
|
sl@0
|
3464 |
//
|
sl@0
|
3465 |
//tests need to be repeated for current position variant of RFile64::Write()
|
sl@0
|
3466 |
//testing with only current position as 4GB-2(boundary condition)
|
sl@0
|
3467 |
//
|
sl@0
|
3468 |
test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 4GB-10, data = 10 bytes and length = 10 bytes\n"));
|
sl@0
|
3469 |
readBuf0A.Zero();//to ensure that the previous data is removed
|
sl@0
|
3470 |
status3 = KRequestPending;
|
sl@0
|
3471 |
TInt64 seekPos = K4GBMinusTen;
|
sl@0
|
3472 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
3473 |
TestRFile1.Write(writeBuf0A,9,status3);
|
sl@0
|
3474 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
3475 |
TestRFile1.Read(readBuf0A,9);
|
sl@0
|
3476 |
test(validateBuf0A == readBuf0A);
|
sl@0
|
3477 |
|
sl@0
|
3478 |
|
sl@0
|
3479 |
|
sl@0
|
3480 |
test.Next(_L("Check for FAT32 file system. Write to a big file asynchronously in a thread, with aPos = 4GB+1, data = 256 bytes and length = 10 bytes\n"));
|
sl@0
|
3481 |
|
sl@0
|
3482 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
3483 |
{
|
sl@0
|
3484 |
TBuf8<0x100> writeBuf256;
|
sl@0
|
3485 |
TBuf8<0x100> readBuf256;
|
sl@0
|
3486 |
writeBuf256.Zero();
|
sl@0
|
3487 |
writeBuf256.FillZ();
|
sl@0
|
3488 |
for (TInt count = 0; count < 0x100; count++)
|
sl@0
|
3489 |
{
|
sl@0
|
3490 |
writeBuf256.Append(count+6);
|
sl@0
|
3491 |
}
|
sl@0
|
3492 |
TRequestStatus status5 = KRequestPending;
|
sl@0
|
3493 |
TestRFile1.Write(K4GBPlusOne,writeBuf256,10,status5);
|
sl@0
|
3494 |
TestRFile1.Read(K4GBPlusOne,readBuf256,10);
|
sl@0
|
3495 |
test(readBuf256.Length() == 0);
|
sl@0
|
3496 |
}
|
sl@0
|
3497 |
|
sl@0
|
3498 |
test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = 0 bytes\n"));
|
sl@0
|
3499 |
TBuf8<0x100> wrBuf256;
|
sl@0
|
3500 |
TBuf8<0x100> reBuf256;
|
sl@0
|
3501 |
wrBuf256.Zero();
|
sl@0
|
3502 |
wrBuf256.FillZ();
|
sl@0
|
3503 |
for (count = 0; count < 0x100; count++)
|
sl@0
|
3504 |
{
|
sl@0
|
3505 |
wrBuf256.Append(count+6);
|
sl@0
|
3506 |
}
|
sl@0
|
3507 |
TRequestStatus status6 = KRequestPending;
|
sl@0
|
3508 |
TestRFile1.Write(0,wrBuf256,0,status6);
|
sl@0
|
3509 |
TestRFile1.Read(0,reBuf256,0);
|
sl@0
|
3510 |
test(reBuf256.Length() == 0);
|
sl@0
|
3511 |
|
sl@0
|
3512 |
test.Next(_L("Write to a big file asynchronously in a thread, with aPos = 0, data = 256 bytes and length = -1bytes \n"));
|
sl@0
|
3513 |
TBuf8<0x100> wBuf256;
|
sl@0
|
3514 |
wBuf256.Zero();
|
sl@0
|
3515 |
wBuf256.FillZ();
|
sl@0
|
3516 |
for (count = 0; count < 0x100; count++)
|
sl@0
|
3517 |
{
|
sl@0
|
3518 |
wBuf256.Append(count+3);
|
sl@0
|
3519 |
}
|
sl@0
|
3520 |
TRequestStatus status7 = KRequestPending;
|
sl@0
|
3521 |
TestRFile1.Write(0,wrBuf256,-1,status7);
|
sl@0
|
3522 |
TestRFile1.Close();
|
sl@0
|
3523 |
|
sl@0
|
3524 |
TInt r = TheFs.Delete(fileName);
|
sl@0
|
3525 |
test(r == KErrNone);
|
sl@0
|
3526 |
}
|
sl@0
|
3527 |
|
sl@0
|
3528 |
/**
|
sl@0
|
3529 |
@SYMTestCaseID PBASE-T_FILE64BIT-0777
|
sl@0
|
3530 |
@SYMTestPriority High
|
sl@0
|
3531 |
@SYMTestRequirement REQ9526
|
sl@0
|
3532 |
@SYMTestType CIT
|
sl@0
|
3533 |
@SYMTestCaseDesc Tests for locking a large file using RFile64::Lock()
|
sl@0
|
3534 |
@SYMTestActions
|
sl@0
|
3535 |
1) Lock a big file with aPos = 0, aLength = 2GB-1
|
sl@0
|
3536 |
2) Lock a big file with aPos = 0, aLength = 2GB-1 ( i.e. again Lock with same parameters). This is to test multiple locks to same region.
|
sl@0
|
3537 |
3) Extend the Lock with aPos = 0, aLength = 2GB+10.This tests overlapped locks.
|
sl@0
|
3538 |
4) Extend the Lock with aPos = 2GB-100, aLength = 200. This also tests overlapped locks.
|
sl@0
|
3539 |
5) Lock with aPos = 100, aLength = 2GB-100.This tries to lock sub region of a Lock
|
sl@0
|
3540 |
6) Lock same file with aPos = 2GB-1 and aLength = 200. Lock same file with aPos = 2GB + 300 and aLength =200.
|
sl@0
|
3541 |
7) Lock a big file with aPos = 0, aLength = 4GB-1.Tests boundary condition.
|
sl@0
|
3542 |
8) Lock a file with aPos =4GB and aLength=10
|
sl@0
|
3543 |
@SYMTestExpectedResults
|
sl@0
|
3544 |
1) KErrNone, lock is successful
|
sl@0
|
3545 |
2) KErrLocked, lock is unsuccessful
|
sl@0
|
3546 |
3) KErrLocked, lock is unsuccessful
|
sl@0
|
3547 |
4) KErrLocked, lock is unsuccessful
|
sl@0
|
3548 |
5) KErrLocked, lock is unsuccessful
|
sl@0
|
3549 |
6) KErrNone, lock is successful
|
sl@0
|
3550 |
7) KErrLocked, lock is successful
|
sl@0
|
3551 |
8) KErrNone
|
sl@0
|
3552 |
@SYMTestStatus Implemented
|
sl@0
|
3553 |
*/
|
sl@0
|
3554 |
|
sl@0
|
3555 |
void TestFileLock()
|
sl@0
|
3556 |
{
|
sl@0
|
3557 |
test.Next(_L("Tests for locking a big file:"));
|
sl@0
|
3558 |
|
sl@0
|
3559 |
TFileName fileName;
|
sl@0
|
3560 |
fileName.Append(gDriveToTest);
|
sl@0
|
3561 |
fileName.Append(KTestPath);
|
sl@0
|
3562 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
3563 |
TestRFile1.Replace(fileName, EFileRead);
|
sl@0
|
3564 |
|
sl@0
|
3565 |
test.Next(_L("Lock a big file with aPos = 0, aLength = 2GB-1\n"));
|
sl@0
|
3566 |
TestRFile1.Lock(0, K2GBMinusOne);
|
sl@0
|
3567 |
|
sl@0
|
3568 |
|
sl@0
|
3569 |
test.Next(_L(" Attempt to lock the same region again\n"));
|
sl@0
|
3570 |
TestRFile1.LockE(0, K2GBMinusOne);
|
sl@0
|
3571 |
|
sl@0
|
3572 |
test.Next(_L("Extend the Lock with aPos = 0, aLength = 2GB+10\n"));
|
sl@0
|
3573 |
TestRFile1.LockE(0, K2GBPlusTen);
|
sl@0
|
3574 |
|
sl@0
|
3575 |
test.Next(_L("Extend the Lock with aPos = 2GB-100, aLength = 200\n"));
|
sl@0
|
3576 |
TestRFile1.LockE(K2GBMinus100, 200);
|
sl@0
|
3577 |
|
sl@0
|
3578 |
test.Next(_L("Lock with aPos = 100, aLength = 2GB-100.\n"));
|
sl@0
|
3579 |
TestRFile1.LockE(100, K2GBMinus100);
|
sl@0
|
3580 |
|
sl@0
|
3581 |
test.Next(_L("Lock same file with aPos = 2GB-1 and aLength = 200\n"));
|
sl@0
|
3582 |
TestRFile1.Lock(K2GBMinusOne, 200);
|
sl@0
|
3583 |
|
sl@0
|
3584 |
test.Next(_L("Lock a big file with aPos = 0, aLength = 4GB-1\n"));
|
sl@0
|
3585 |
TestRFile1.LockE(0, K4GBMinusOne);
|
sl@0
|
3586 |
|
sl@0
|
3587 |
|
sl@0
|
3588 |
if(KFileSizeMaxLargerThan4GBMinusOne)
|
sl@0
|
3589 |
{
|
sl@0
|
3590 |
test.Next(_L("Lock a file with aPos =4GB and aLength=10\n"));
|
sl@0
|
3591 |
TestRFile1.Lock(K4GB + 2, 10);
|
sl@0
|
3592 |
}
|
sl@0
|
3593 |
|
sl@0
|
3594 |
TestRFile1.Close();
|
sl@0
|
3595 |
|
sl@0
|
3596 |
TInt r = TheFs.Delete(fileName);
|
sl@0
|
3597 |
test(r == KErrNone);
|
sl@0
|
3598 |
}
|
sl@0
|
3599 |
|
sl@0
|
3600 |
|
sl@0
|
3601 |
/**
|
sl@0
|
3602 |
@SYMTestCaseID PBASE-T_FILE64BIT-0778
|
sl@0
|
3603 |
@SYMTestPriority High
|
sl@0
|
3604 |
@SYMTestRequirement REQ9526
|
sl@0
|
3605 |
@SYMTestType CIT
|
sl@0
|
3606 |
@SYMTestCaseDesc Tests the File unlock functionality using RFile64::UnLock()
|
sl@0
|
3607 |
@SYMTestActions
|
sl@0
|
3608 |
1) UnLock a big file, same region which is locked with aPos = 0, aLength = 2GB-1.
|
sl@0
|
3609 |
2) UnLock a big file, which is not locked with aPos = 0, aLength = 2GB-1.
|
sl@0
|
3610 |
3) UnLock a big file twice, same region which is locked with aPos = 0, aLength = 2GB-1.
|
sl@0
|
3611 |
4) UnLock a big file in a region which is sub region of Lock. aPos = 10, aLength = 2GB-100. File should have been locked with aPos = 0, aLength = 2GB-1.
|
sl@0
|
3612 |
5) UnLock a big file in a region which is extended region of Lock, with aPos = 0, aLength = 2GB +100. File should have been locked with aPos = 0, aLength = 2GB-1.
|
sl@0
|
3613 |
6) UnLock a big file to test boundary condition, with aPos = 0, aLength = 4GB-1.The file should have been locked with same arguments.
|
sl@0
|
3614 |
7) UnLock different regions of a file which were locked in same order with aPos = 0, aLength = 2GB+200.
|
sl@0
|
3615 |
Second Unlock aPos = 2GB+300 and aLength =200.
|
sl@0
|
3616 |
Third UnLock aPos = 2GB+600 and aLength = 200.
|
sl@0
|
3617 |
8) UnLock different regions of a file which were locked in different order with aPos = 0, aLength = 2GB+100.
|
sl@0
|
3618 |
Second Unlock aPos = 2GB+300 and aLength =200.
|
sl@0
|
3619 |
Third UnLock aPos = 2GB+600 and aLength = 200.
|
sl@0
|
3620 |
9) UnLock multiple locked regions with aPos = 0, aLength = 2GB-1.The file should have been locked in same region but with different locks
|
sl@0
|
3621 |
10)Unlock a locked file with aPos = 4GB and aLength = 10bytes
|
sl@0
|
3622 |
|
sl@0
|
3623 |
@SYMTestExpectedResults
|
sl@0
|
3624 |
1) KErrNone
|
sl@0
|
3625 |
2) KErrNotFound
|
sl@0
|
3626 |
3) KErrNotFound
|
sl@0
|
3627 |
4) KErrNotFound
|
sl@0
|
3628 |
5) KErrNotFound
|
sl@0
|
3629 |
6) KErrNone
|
sl@0
|
3630 |
7) KErrNone
|
sl@0
|
3631 |
8) KErrNone
|
sl@0
|
3632 |
9) KErrNotFound
|
sl@0
|
3633 |
10)KErrNone
|
sl@0
|
3634 |
@SYMTestStatus Implemented
|
sl@0
|
3635 |
*/
|
sl@0
|
3636 |
|
sl@0
|
3637 |
void TestFileUnlock()
|
sl@0
|
3638 |
{
|
sl@0
|
3639 |
test.Next(_L("Tests for Unlocking a big file:\n"));
|
sl@0
|
3640 |
|
sl@0
|
3641 |
TFileName fileName;
|
sl@0
|
3642 |
fileName.Append(gDriveToTest);
|
sl@0
|
3643 |
fileName.Append(KTestPath);
|
sl@0
|
3644 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
3645 |
TestRFile2.Replace(fileName, EFileRead);
|
sl@0
|
3646 |
|
sl@0
|
3647 |
test.Next(_L("UnLock a big file, same region which is locked with aPos = 0, aLength = 2GB-1.\n"));
|
sl@0
|
3648 |
TestRFile2.Lock(0, K2GBMinusOne);
|
sl@0
|
3649 |
TestRFile2.UnLock(0, K2GBMinusOne);
|
sl@0
|
3650 |
TestRFile2.UnLockE(0, K2GBMinusOne);
|
sl@0
|
3651 |
|
sl@0
|
3652 |
test.Next(_L("UnLock a big file, which is not locked with aPos = 0, aLength = 2GB-1\n"));
|
sl@0
|
3653 |
TestRFile2.UnLockE(0, K2GBMinusOne);
|
sl@0
|
3654 |
|
sl@0
|
3655 |
test.Next(_L("UnLock a big file twice, same region which is locked with aPos = 0, aLength = 2GB-1\n"));
|
sl@0
|
3656 |
TestRFile2.Lock(0, K2GBMinusOne);
|
sl@0
|
3657 |
TestRFile2.UnLockE(10, K2GBMinus100);
|
sl@0
|
3658 |
TestRFile2.UnLock(0, K2GBMinusOne);
|
sl@0
|
3659 |
|
sl@0
|
3660 |
test.Next(_L("UnLock a big file in a region which is sub region of Lock. aPos = 10, aLength = 2GB-100. File should have been locked with aPos = 0, aLength = 2GB-1\n"));
|
sl@0
|
3661 |
TestRFile2.Lock(0, K2GBMinusOne);
|
sl@0
|
3662 |
TestRFile2.UnLockE(10, K2GBMinus100);
|
sl@0
|
3663 |
TestRFile2.UnLock(0, K2GBMinusOne);
|
sl@0
|
3664 |
|
sl@0
|
3665 |
test.Next(_L("UnLock a big file in a region which is extended region of Lock, with aPos = 0, aLength = 2GB +100. File should have been locked with aPos = 0, aLength = 2GB-1.\n"));
|
sl@0
|
3666 |
TestRFile2.Lock(0, K2GBMinusOne);
|
sl@0
|
3667 |
TestRFile2.UnLockE(10, K2GBPlus100);
|
sl@0
|
3668 |
TestRFile2.UnLock(0, K2GBMinusOne);
|
sl@0
|
3669 |
|
sl@0
|
3670 |
test.Next(_L("UnLock a big file to test boundary condition, with aPos = 0, aLength = 4GB-1.The file should have been locked with same arguments\n"));
|
sl@0
|
3671 |
TestRFile2.Lock(0, K4GBMinusOne);
|
sl@0
|
3672 |
TestRFile2.UnLock(0, K4GBMinusOne);
|
sl@0
|
3673 |
|
sl@0
|
3674 |
test.Next(_L("UnLock different regions of a file which were locked in same order with aPos = 0, aLength = 2GB+200\n"));
|
sl@0
|
3675 |
TestRFile2.Lock(0, K2GBPlus200);
|
sl@0
|
3676 |
TestRFile2.Lock(K2GBPlus300, 200);
|
sl@0
|
3677 |
TestRFile2.Lock(K2GBPlus600, 200);
|
sl@0
|
3678 |
TestRFile2.UnLock(0, K2GBPlus200);
|
sl@0
|
3679 |
TestRFile2.UnLock(K2GBPlus300, 200);
|
sl@0
|
3680 |
TestRFile2.UnLock(K2GBPlus600, 200);
|
sl@0
|
3681 |
|
sl@0
|
3682 |
test.Next(_L("UnLock different regions of a file which were locked in different order with aPos = 0, aLength = 2GB+100\n"));
|
sl@0
|
3683 |
TestRFile2.Lock(0, K2GBPlus100);
|
sl@0
|
3684 |
TestRFile2.Lock(K2GBPlus600, 200);
|
sl@0
|
3685 |
TestRFile2.Lock(K2GBPlus300, 200);
|
sl@0
|
3686 |
TestRFile2.UnLock(K2GBPlus600, 200);
|
sl@0
|
3687 |
TestRFile2.UnLock(K2GBPlus300, 200);
|
sl@0
|
3688 |
TestRFile2.UnLock(0, K2GBPlus100);
|
sl@0
|
3689 |
|
sl@0
|
3690 |
test.Next(_L("UnLock multiple locked regions with aPos = 0, aLength = 2GB-1.The file should have been locked in same region but with different locks\n"));
|
sl@0
|
3691 |
TestRFile2.Lock(0, 100);
|
sl@0
|
3692 |
TestRFile2.Lock(100, K2GBMinusOne);
|
sl@0
|
3693 |
TestRFile2.UnLockE(0, K2GBMinusOne);
|
sl@0
|
3694 |
|
sl@0
|
3695 |
|
sl@0
|
3696 |
if(KFileSizeMaxLargerThan4GBMinusOne)
|
sl@0
|
3697 |
{
|
sl@0
|
3698 |
|
sl@0
|
3699 |
test.Next(_L("Unlock a locked file with aPos = 4GB and aLength = 10bytes\n"));
|
sl@0
|
3700 |
TestRFile2.Lock(K4GB, 10);
|
sl@0
|
3701 |
TestRFile2.UnLock(K4GB, 10);
|
sl@0
|
3702 |
}
|
sl@0
|
3703 |
|
sl@0
|
3704 |
TestRFile2.Close();
|
sl@0
|
3705 |
TInt r = TheFs.Delete(fileName);
|
sl@0
|
3706 |
test(r == KErrNone);
|
sl@0
|
3707 |
}
|
sl@0
|
3708 |
|
sl@0
|
3709 |
/**
|
sl@0
|
3710 |
@SYMTestCaseID PBASE-T_FILE64BIT-0779
|
sl@0
|
3711 |
@SYMTestPriority High
|
sl@0
|
3712 |
@SYMTestRequirement REQ9526
|
sl@0
|
3713 |
@SYMTestType CIT
|
sl@0
|
3714 |
@SYMTestCaseDesc Tests for file seek operation using RFile64::Seek()
|
sl@0
|
3715 |
@SYMTestActions
|
sl@0
|
3716 |
1) Set the file size as 20
|
sl@0
|
3717 |
2) Seek mode = ESeekEnd, seek position = 80, call RFile64::Seek()
|
sl@0
|
3718 |
3) Check Seek position
|
sl@0
|
3719 |
4) Set file size = 512
|
sl@0
|
3720 |
5) Seek mode =ESeekStart, assign seek position =513, get the seek position using RFile64::Seek()
|
sl@0
|
3721 |
6) Check the seek position
|
sl@0
|
3722 |
7) Seek mode = ESeekEnd, get the seek position using RFile64::Seek()
|
sl@0
|
3723 |
8) Check the seek position
|
sl@0
|
3724 |
9) Seek position =-530, seek mode = ESeekEnd, Get the seek position using RFile64::Seek()
|
sl@0
|
3725 |
10)Check the seek position
|
sl@0
|
3726 |
11)Seek position =-10, seek mode = ESeekEnd, get the seek position using RFile64::Seek()
|
sl@0
|
3727 |
12)Seek position =-10, seek mode = ESeekStart, get the seek position using RFile64::Seek()
|
sl@0
|
3728 |
13)Seek position =0, seek mode = ESeekEnd, get the seek position using RFile64::Seek()
|
sl@0
|
3729 |
@SYMTestExpectedResults
|
sl@0
|
3730 |
1) KErrNone
|
sl@0
|
3731 |
2) KErrNone
|
sl@0
|
3732 |
3) Seek position = 20
|
sl@0
|
3733 |
4) KErrNone
|
sl@0
|
3734 |
5) KErrNone
|
sl@0
|
3735 |
6) Seek position = 513
|
sl@0
|
3736 |
7) KErrNone
|
sl@0
|
3737 |
8) Seek position = 512
|
sl@0
|
3738 |
9) KErrNone
|
sl@0
|
3739 |
10)Seekposition = 0
|
sl@0
|
3740 |
11)Seek position =502
|
sl@0
|
3741 |
12)KErrArgument, seek position unchanged
|
sl@0
|
3742 |
13)Seek position =512
|
sl@0
|
3743 |
@SYMTestStatus Implemented
|
sl@0
|
3744 |
*/
|
sl@0
|
3745 |
|
sl@0
|
3746 |
void TestFileSeek()
|
sl@0
|
3747 |
{
|
sl@0
|
3748 |
TInt64 seekPos;
|
sl@0
|
3749 |
|
sl@0
|
3750 |
TFileName fileName;
|
sl@0
|
3751 |
fileName.Append(gDriveToTest);
|
sl@0
|
3752 |
fileName.Append(KTestPath);
|
sl@0
|
3753 |
fileName.Append(_L("seektest.txt"));
|
sl@0
|
3754 |
TestRFile1.Replace(fileName);
|
sl@0
|
3755 |
|
sl@0
|
3756 |
|
sl@0
|
3757 |
test.Next(_L("Set the file size as 20\n"));
|
sl@0
|
3758 |
TestRFile1.SetSize(20);
|
sl@0
|
3759 |
|
sl@0
|
3760 |
test.Next(_L("Seek mode = ESeekEnd, seek position = 80, call RFile64::Seek() "));
|
sl@0
|
3761 |
seekPos = 80;
|
sl@0
|
3762 |
TestRFile1.Seek(ESeekEnd, seekPos);
|
sl@0
|
3763 |
test(seekPos == 20);
|
sl@0
|
3764 |
|
sl@0
|
3765 |
test.Next(_L("Set the file size as 512\n"));
|
sl@0
|
3766 |
TestRFile1.SetSize(512);
|
sl@0
|
3767 |
|
sl@0
|
3768 |
test.Next(_L("Seek mode =ESeekStart, assign seek position =513, get the seek position using RFile64::Seek()\n"));
|
sl@0
|
3769 |
seekPos = 513;
|
sl@0
|
3770 |
TestRFile1.Seek(ESeekStart, seekPos);
|
sl@0
|
3771 |
test(seekPos == 513);
|
sl@0
|
3772 |
|
sl@0
|
3773 |
test.Next(_L("Seek mode = ESeekEnd, get the seek position using RFile64::Seek()\n"));
|
sl@0
|
3774 |
TestRFile1.Seek(ESeekEnd, seekPos);
|
sl@0
|
3775 |
test(seekPos == 512);
|
sl@0
|
3776 |
|
sl@0
|
3777 |
test.Next(_L("Seek position =-530, seek mode = ESeekEnd, Get the seek position using RFile64::Seek()\n"));
|
sl@0
|
3778 |
seekPos = -530;
|
sl@0
|
3779 |
TestRFile1.Seek(ESeekEnd, seekPos);
|
sl@0
|
3780 |
test(seekPos == 0);
|
sl@0
|
3781 |
|
sl@0
|
3782 |
test.Next(_L("Seek position =-10, seek mode = ESeekEnd, get the seek position using RFile64::Seek()\n"));
|
sl@0
|
3783 |
seekPos = -10;
|
sl@0
|
3784 |
TestRFile1.Seek(ESeekEnd, seekPos);
|
sl@0
|
3785 |
test(seekPos == 502);
|
sl@0
|
3786 |
|
sl@0
|
3787 |
test.Next(_L("Seek position =-10, seek mode = ESeekStart, get the seek position using RFile64::Seek()\n"));
|
sl@0
|
3788 |
seekPos = -10;
|
sl@0
|
3789 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
3790 |
test(seekPos == -10);
|
sl@0
|
3791 |
|
sl@0
|
3792 |
test.Next(_L("Seek position =0, seek mode = ESeekEnd, get the seek position using RFile64::Seek()\n"));
|
sl@0
|
3793 |
seekPos = 0;
|
sl@0
|
3794 |
TestRFile1.Seek(ESeekEnd,seekPos);
|
sl@0
|
3795 |
test(seekPos == 512);
|
sl@0
|
3796 |
|
sl@0
|
3797 |
TestRFile1.Close();
|
sl@0
|
3798 |
|
sl@0
|
3799 |
TInt r = TheFs.Delete(fileName);
|
sl@0
|
3800 |
test(r == KErrNone);
|
sl@0
|
3801 |
}
|
sl@0
|
3802 |
|
sl@0
|
3803 |
/**
|
sl@0
|
3804 |
@SYMTestCaseID PBASE-T_FILE64BIT-0780
|
sl@0
|
3805 |
@SYMTestPriority High
|
sl@0
|
3806 |
@SYMTestRequirement REQ9526
|
sl@0
|
3807 |
@SYMTestType CIT
|
sl@0
|
3808 |
@SYMTestCaseDesc Test file seek operation for large file
|
sl@0
|
3809 |
@SYMTestActions
|
sl@0
|
3810 |
1) Set the file size as 2GB-1
|
sl@0
|
3811 |
2) Seek mode = ESeekEnd, seek position = 2GB+80, call RFile64::Seek()
|
sl@0
|
3812 |
3) Check Seek position
|
sl@0
|
3813 |
4) Set file size = 4GB -1
|
sl@0
|
3814 |
5) Seek mode = ESeekStart, assign seek position = 4GB-1, get the seek position using RFile64::Seek()
|
sl@0
|
3815 |
6) Check the seek position
|
sl@0
|
3816 |
7) Seek mode = ESeekEnd, get the seek position using RFile64::Seek()
|
sl@0
|
3817 |
8) Check the seek position
|
sl@0
|
3818 |
9) Seek position = (4GB), seek mode = ESeekEnd, Get the seek position using RFile64::Seek()
|
sl@0
|
3819 |
10)Check the seek position
|
sl@0
|
3820 |
11)Seek position =-10, seek mode = ESeekEnd, get the seek position using RFile64::Seek()
|
sl@0
|
3821 |
12)Seek position =-10, seek mode = ESeekStart, get the seek position using RFile64::Seek()
|
sl@0
|
3822 |
13)Seek position =0, seek mode = ESeekEnd, get the seek position using RFile64::Seek()
|
sl@0
|
3823 |
@SYMTestExpectedResults
|
sl@0
|
3824 |
1) KErrNone
|
sl@0
|
3825 |
2) KErrNone
|
sl@0
|
3826 |
3) Seek position = 2GB-1
|
sl@0
|
3827 |
4) KErrNone
|
sl@0
|
3828 |
5) KErrNone
|
sl@0
|
3829 |
6) Seek position = 4GB-1
|
sl@0
|
3830 |
7) KErrNone
|
sl@0
|
3831 |
8) Seek position = 4GB-1
|
sl@0
|
3832 |
9) KErrNone
|
sl@0
|
3833 |
10)Seekposition = 0
|
sl@0
|
3834 |
11)Seek position =4GB-10
|
sl@0
|
3835 |
12)KErrArgument, seek position unchanged
|
sl@0
|
3836 |
13)Seek position =4GB - 1
|
sl@0
|
3837 |
@SYMTestStatus Implemented
|
sl@0
|
3838 |
*/
|
sl@0
|
3839 |
|
sl@0
|
3840 |
void TestFileSeekBigFile()
|
sl@0
|
3841 |
|
sl@0
|
3842 |
{
|
sl@0
|
3843 |
TInt64 seekPos;
|
sl@0
|
3844 |
|
sl@0
|
3845 |
|
sl@0
|
3846 |
TFileName fileName;
|
sl@0
|
3847 |
fileName.Append(gDriveToTest);
|
sl@0
|
3848 |
fileName.Append(KTestPath);
|
sl@0
|
3849 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
3850 |
TestRFile1.Replace(fileName, EFileRead|EFileWrite);
|
sl@0
|
3851 |
|
sl@0
|
3852 |
test.Next(_L("Set the file size as 2GB-1\n"));
|
sl@0
|
3853 |
TestRFile1.SetSize(K2GBMinusOne);
|
sl@0
|
3854 |
|
sl@0
|
3855 |
test.Next(_L("Seek mode = ESeekEnd, seek position = 2GB+80, call RFile64::Seek()\n"));
|
sl@0
|
3856 |
seekPos = K2GBPlus80;
|
sl@0
|
3857 |
TestRFile1.Seek(ESeekEnd, seekPos);
|
sl@0
|
3858 |
test(seekPos == K2GBMinusOne);
|
sl@0
|
3859 |
|
sl@0
|
3860 |
test.Next(_L("Set the file size to 4GB-1\n"));
|
sl@0
|
3861 |
TestRFile1.SetSize(K4GBMinusOne);
|
sl@0
|
3862 |
|
sl@0
|
3863 |
test.Next(_L("Seek mode = ESeekStart, assign seek position = 4GB-1, get the seek position using RFile64::Seek()\n"));
|
sl@0
|
3864 |
seekPos = K4GBMinusOne;
|
sl@0
|
3865 |
TestRFile1.Seek(ESeekStart, seekPos);
|
sl@0
|
3866 |
test(seekPos == K4GBMinusOne);
|
sl@0
|
3867 |
|
sl@0
|
3868 |
test.Next(_L("Seek mode = ESeekEnd, get the seek position using RFile64::Seek()\n"));
|
sl@0
|
3869 |
TestRFile1.Seek(ESeekEnd, seekPos);
|
sl@0
|
3870 |
test(seekPos == K4GBMinusOne);
|
sl@0
|
3871 |
|
sl@0
|
3872 |
if(KFileSizeMaxLargerThan4GBMinusOne)
|
sl@0
|
3873 |
{
|
sl@0
|
3874 |
TestRFile1.SetSize(K4GB);
|
sl@0
|
3875 |
TestRFile1.Seek(ESeekEnd, seekPos);
|
sl@0
|
3876 |
test(seekPos == K4GB);
|
sl@0
|
3877 |
seekPos = -10;
|
sl@0
|
3878 |
TestRFile1.Seek(ESeekEnd, seekPos);
|
sl@0
|
3879 |
test(seekPos == K4GB-10);
|
sl@0
|
3880 |
seekPos = -10;
|
sl@0
|
3881 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
3882 |
test(seekPos == -10);
|
sl@0
|
3883 |
seekPos = 0;
|
sl@0
|
3884 |
TestRFile1.Seek(ESeekEnd,seekPos);
|
sl@0
|
3885 |
test(seekPos == K4GB);
|
sl@0
|
3886 |
}
|
sl@0
|
3887 |
else
|
sl@0
|
3888 |
{
|
sl@0
|
3889 |
TestRFile1.SetSize(K4GB);
|
sl@0
|
3890 |
TestRFile1.Seek(ESeekEnd, seekPos);
|
sl@0
|
3891 |
test(seekPos == K4GBMinusOne);
|
sl@0
|
3892 |
seekPos = -10;
|
sl@0
|
3893 |
TestRFile1.Seek(ESeekEnd, seekPos);
|
sl@0
|
3894 |
test(seekPos == K4GBMinusOne-10);
|
sl@0
|
3895 |
seekPos = -10;
|
sl@0
|
3896 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
3897 |
test(seekPos == -10);
|
sl@0
|
3898 |
seekPos = 0;
|
sl@0
|
3899 |
TestRFile1.Seek(ESeekEnd,seekPos);
|
sl@0
|
3900 |
test(seekPos == K4GBMinusOne);
|
sl@0
|
3901 |
}
|
sl@0
|
3902 |
|
sl@0
|
3903 |
|
sl@0
|
3904 |
TestRFile1.Close();
|
sl@0
|
3905 |
|
sl@0
|
3906 |
TInt r = TheFs.Delete(fileName);
|
sl@0
|
3907 |
test(r == KErrNone);
|
sl@0
|
3908 |
}
|
sl@0
|
3909 |
|
sl@0
|
3910 |
/**
|
sl@0
|
3911 |
@SYMTestCaseID PBASE-T_FILE64BIT-0781
|
sl@0
|
3912 |
@SYMTestPriority High
|
sl@0
|
3913 |
@SYMTestRequirement REQ9527
|
sl@0
|
3914 |
@SYMTestType CIT
|
sl@0
|
3915 |
@SYMTestCaseDesc Test RFile64::SetSize() and RFile64::Size() functionality
|
sl@0
|
3916 |
@SYMTestActions
|
sl@0
|
3917 |
1) Set the file size =128KB
|
sl@0
|
3918 |
2) Write a test data = "ABCDEFGH", at position = 0
|
sl@0
|
3919 |
3) Get the file size
|
sl@0
|
3920 |
4) Read the data from position = 0
|
sl@0
|
3921 |
5) Compare the read data with written data
|
sl@0
|
3922 |
6) Set the file size to = 2GB-1
|
sl@0
|
3923 |
7) Write test data = "IJKLMnOPxY IJKLMnOPx", length=20 bytes, at position 2GB-10
|
sl@0
|
3924 |
8) Get the file size
|
sl@0
|
3925 |
9) Read the data from the position 2GB-10
|
sl@0
|
3926 |
10)Compare the read data
|
sl@0
|
3927 |
11)Set the file size = 4GB-1
|
sl@0
|
3928 |
12)Write test data = "IJKLMnOPxY IJKLMnOPx", length=10 bytes, at position 4GB-10
|
sl@0
|
3929 |
13)Get the file size
|
sl@0
|
3930 |
14)Read the data from the position 4GB-10
|
sl@0
|
3931 |
15)Compare the read data
|
sl@0
|
3932 |
@SYMTestExpectedResults
|
sl@0
|
3933 |
1) KErrNone
|
sl@0
|
3934 |
2) KErrNone, write is successful
|
sl@0
|
3935 |
3) KErrNone, File Size = 128KB
|
sl@0
|
3936 |
4) KErrNone, read is successful
|
sl@0
|
3937 |
5) Read data == Written data
|
sl@0
|
3938 |
6) KErrNone
|
sl@0
|
3939 |
7) KErrNone, write is successful
|
sl@0
|
3940 |
8) KErrNone File Size = 2GB+10
|
sl@0
|
3941 |
9) KErrNone, read is successful
|
sl@0
|
3942 |
10)Read data == Written data
|
sl@0
|
3943 |
11)KErrNone
|
sl@0
|
3944 |
12)KErrNone, write is successful for 10 bytes
|
sl@0
|
3945 |
13)KErrNone File Size == 4GB-1
|
sl@0
|
3946 |
14)KErrNone, read is successful
|
sl@0
|
3947 |
15)Read data == Written data
|
sl@0
|
3948 |
@SYMTestStatus Implemented
|
sl@0
|
3949 |
*/
|
sl@0
|
3950 |
|
sl@0
|
3951 |
void TestSetsize()
|
sl@0
|
3952 |
{
|
sl@0
|
3953 |
test.Next(_L("Create a large file"));
|
sl@0
|
3954 |
|
sl@0
|
3955 |
TFileName fileName;
|
sl@0
|
3956 |
fileName.Append(gDriveToTest);
|
sl@0
|
3957 |
fileName.Append(KTestPath);
|
sl@0
|
3958 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
3959 |
TestRFile1.Replace(fileName, EFileRead|EFileWrite);
|
sl@0
|
3960 |
|
sl@0
|
3961 |
CheckDisk();
|
sl@0
|
3962 |
|
sl@0
|
3963 |
test.Next(_L("Set the file size =128KB\n"));
|
sl@0
|
3964 |
TestRFile1.SetSize(131072); // 128KB
|
sl@0
|
3965 |
|
sl@0
|
3966 |
test.Next(_L("Write a test data = ABCDEFGH, at position = 0\n"));
|
sl@0
|
3967 |
TBuf8<16> testData = _L8("ABCDEFGH");
|
sl@0
|
3968 |
TestRFile1.WriteP(0,testData);
|
sl@0
|
3969 |
TInt64 size = 0;
|
sl@0
|
3970 |
|
sl@0
|
3971 |
test.Next(_L("Get the file size\n"));
|
sl@0
|
3972 |
TestRFile1.Size(size);
|
sl@0
|
3973 |
test(size == 131072) ;
|
sl@0
|
3974 |
|
sl@0
|
3975 |
test.Next(_L("Read and compare the data from position = 0\n"));
|
sl@0
|
3976 |
TBuf8<16> testData2;
|
sl@0
|
3977 |
TestRFile1.Read(0,testData2,8);
|
sl@0
|
3978 |
test(testData == testData2);
|
sl@0
|
3979 |
|
sl@0
|
3980 |
test.Next(_L("Set the file size =2GB - 1 \n"));
|
sl@0
|
3981 |
TestRFile1.SetSize(K2GBMinusOne); // 2GB-1
|
sl@0
|
3982 |
|
sl@0
|
3983 |
test.Next(_L("Write test data = IJKLMnOPxY IJKLMnOPx ,length=20 bytes, at position 2GB-10\n"));
|
sl@0
|
3984 |
TBuf8<20> testData3 = _L8("IJKLMnOPxY IJKLMnOPx");
|
sl@0
|
3985 |
TestRFile1.Write(K2GBMinusTen,testData3, 20);
|
sl@0
|
3986 |
|
sl@0
|
3987 |
test.Next(_L("Get the file size\n"));
|
sl@0
|
3988 |
TestRFile1.Size(size);
|
sl@0
|
3989 |
test(size == K2GBPlusTen);
|
sl@0
|
3990 |
|
sl@0
|
3991 |
test.Next(_L("Read and compare the data from position = 2GB-10\n"));
|
sl@0
|
3992 |
TBuf8<10> testData4;
|
sl@0
|
3993 |
TestRFile1.Read(K2GBMinusTen,testData4,10);
|
sl@0
|
3994 |
test(testData4 == _L8("IJKLMnOPxY"));
|
sl@0
|
3995 |
|
sl@0
|
3996 |
test.Next(_L("Set the file size =2GB - 1 \n"));
|
sl@0
|
3997 |
TestRFile1.SetSize(K4GBMinusOne); // 4GB-1
|
sl@0
|
3998 |
|
sl@0
|
3999 |
test.Next(_L("Write test data = IJKLMnOPxY IJKLMnOPx, length=10 bytes, at position 4GB-10\n"));
|
sl@0
|
4000 |
TBuf8<20> testData5 = _L8("IJKLMnOPxY IJKLMnOPx");
|
sl@0
|
4001 |
TestRFile1.Write(K4GBMinusTen,testData5,9);
|
sl@0
|
4002 |
|
sl@0
|
4003 |
test.Next(_L("Get the file size\n"));
|
sl@0
|
4004 |
TestRFile1.Size(size);
|
sl@0
|
4005 |
test(size == K4GBMinusOne);
|
sl@0
|
4006 |
|
sl@0
|
4007 |
test.Next(_L("Read the data from the position 4GB-10\n"));
|
sl@0
|
4008 |
TBuf8<10> testData6;
|
sl@0
|
4009 |
TestRFile1.Read(K4GBMinusTen,testData6,9);
|
sl@0
|
4010 |
test(testData6 == _L8("IJKLMnOPx"));
|
sl@0
|
4011 |
TestRFile1.Close();
|
sl@0
|
4012 |
|
sl@0
|
4013 |
TInt r = TheFs.Delete(fileName);
|
sl@0
|
4014 |
test(r == KErrNone);
|
sl@0
|
4015 |
}
|
sl@0
|
4016 |
|
sl@0
|
4017 |
/**
|
sl@0
|
4018 |
@SYMTestCaseID PBASE-T_FILE64BIT-0782
|
sl@0
|
4019 |
@SYMTestPriority High
|
sl@0
|
4020 |
@SYMTestRequirement REQ9528
|
sl@0
|
4021 |
@SYMTestType CIT
|
sl@0
|
4022 |
@SYMTestCaseDesc Tests for reading a data from a big file without opening it
|
sl@0
|
4023 |
@SYMTestActions
|
sl@0
|
4024 |
1) Read from a big file using RFs::ReadFileSection() from position 3GB-1,52byte lengths of data
|
sl@0
|
4025 |
2) Open a big file in EFileShareAny | EFileRead mode and read from it using RFs::ReadFileSection() from position 3GB-1, 52byte lengths of data
|
sl@0
|
4026 |
3) Open a big file in EFileShareExclusive | EFileRead mode and read from it using RFs::ReadFileSection( ) from position 3GB-1, 52byte lengths of data
|
sl@0
|
4027 |
4) Open a big file in EFileShareExclusive | EFileWrite mode and read from it using RFs::ReadFileSection( ) from position 3GB-1, 52byte lengths of data
|
sl@0
|
4028 |
5) Check for FAT32 file system. Read from a big file using RFs::ReadFileSection( ) from position equal to 4GB, 52byte lengths of data
|
sl@0
|
4029 |
@SYMTestExpectedResults
|
sl@0
|
4030 |
1) KErrNone, read is successful
|
sl@0
|
4031 |
2) KErrNone, open and read both are successful
|
sl@0
|
4032 |
3) KErrNone, open and read both are successful
|
sl@0
|
4033 |
4) KErrNone, open and read both are successful
|
sl@0
|
4034 |
5) KErrNone with zero length descriptor,if NGFS is supported we should get the valid data
|
sl@0
|
4035 |
@SYMTestStatus Implemented
|
sl@0
|
4036 |
*/
|
sl@0
|
4037 |
void TestReadFilesection()
|
sl@0
|
4038 |
{
|
sl@0
|
4039 |
test.Next(_L("Read data from a large file using RFs::ReadFileSection\n"));
|
sl@0
|
4040 |
TBuf8<52> testDes;
|
sl@0
|
4041 |
TBuf8<52> readBuf;
|
sl@0
|
4042 |
|
sl@0
|
4043 |
RFile64 file;
|
sl@0
|
4044 |
|
sl@0
|
4045 |
TFileName fileName;
|
sl@0
|
4046 |
fileName.Append(gDriveToTest);
|
sl@0
|
4047 |
fileName.Append(KTestPath);
|
sl@0
|
4048 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
4049 |
|
sl@0
|
4050 |
TInt r = file.Replace(TheFs,fileName,EFileWrite);
|
sl@0
|
4051 |
test(r == KErrNone);
|
sl@0
|
4052 |
r = file.SetSize(K4GBMinusOne);
|
sl@0
|
4053 |
test(r == KErrNone);
|
sl@0
|
4054 |
file.Close();
|
sl@0
|
4055 |
|
sl@0
|
4056 |
test.Next(_L("Read from a big file using RFs::ReadFileSection() from position 3GB-1,52byte lengths of data\n"));
|
sl@0
|
4057 |
TestRFs.ReadFileSection(fileName,K3GBMinusOne,testDes,52);
|
sl@0
|
4058 |
|
sl@0
|
4059 |
test.Next(_L("Open a big file in EFileShareAny | EFileRead mode and read from it using RFs::ReadFileSection() from position 3GB-1, 52byte lengths of data\n"));
|
sl@0
|
4060 |
TestRFile1.Open(fileName,EFileShareAny|EFileRead);
|
sl@0
|
4061 |
TestRFs.ReadFileSection(fileName,0,testDes,52);
|
sl@0
|
4062 |
test(testDes.Length() == 52);
|
sl@0
|
4063 |
TestRFile1.Close();
|
sl@0
|
4064 |
|
sl@0
|
4065 |
test.Next(_L("Open a big file in EFileShareExclusive | EFileRead mode and read from it using RFs::ReadFileSection( ) from position 3GB-1, 52byte lengths of data\n"));
|
sl@0
|
4066 |
TestRFile1.Open(fileName,EFileShareExclusive|EFileRead);
|
sl@0
|
4067 |
TestRFs.ReadFileSection(fileName,K3GBMinusOne,testDes,52);
|
sl@0
|
4068 |
TestRFile1.Close();
|
sl@0
|
4069 |
|
sl@0
|
4070 |
test.Next(_L("Open a big file in EFileShareExclusive | EFileWrite mode and read from it using RFs::ReadFileSection( ) from position 3GB-1, 52byte lengths of data\n"));
|
sl@0
|
4071 |
TestRFile1.Open(fileName,EFileShareExclusive|EFileWrite);
|
sl@0
|
4072 |
TestRFs.ReadFileSection(fileName,K3GBMinusOne,testDes,52);
|
sl@0
|
4073 |
TestRFile1.Close();
|
sl@0
|
4074 |
|
sl@0
|
4075 |
|
sl@0
|
4076 |
test.Next(_L("Check for FAT32 file system. Read from a big file using RFs::ReadFileSection( ) from position equal to 4GB, 52byte lengths of data\n"));
|
sl@0
|
4077 |
|
sl@0
|
4078 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
4079 |
{
|
sl@0
|
4080 |
TestRFs.ReadFileSection(fileName,K4GB,readBuf,52);
|
sl@0
|
4081 |
}
|
sl@0
|
4082 |
|
sl@0
|
4083 |
r = TheFs.Delete(fileName);
|
sl@0
|
4084 |
test(r == KErrNone);
|
sl@0
|
4085 |
}
|
sl@0
|
4086 |
|
sl@0
|
4087 |
/**
|
sl@0
|
4088 |
@SYMTestCaseID PBASE-T_FILE64BIT-0783
|
sl@0
|
4089 |
@SYMTestPriority High
|
sl@0
|
4090 |
@SYMTestRequirement REQ9530
|
sl@0
|
4091 |
@SYMTestType CIT
|
sl@0
|
4092 |
@SYMTestCaseDesc Check that we can get a valid directory listing of a directory containing large files using RDir and then CDir
|
sl@0
|
4093 |
TInt RFs::GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList) const;
|
sl@0
|
4094 |
@SYMTestActions
|
sl@0
|
4095 |
1) Get the directory listing, sort by size
|
sl@0
|
4096 |
2) Check the files count in the directory. Number of files in a directory is 4
|
sl@0
|
4097 |
3) Get the entry list & Check the files are listed in order of file sizes
|
sl@0
|
4098 |
@SYMTestExpectedResults
|
sl@0
|
4099 |
1) KErrNone
|
sl@0
|
4100 |
2) 4 Files in the directory
|
sl@0
|
4101 |
3) File size should match and arranged in ascending order
|
sl@0
|
4102 |
@SYMTestStatus Implemented
|
sl@0
|
4103 |
*/
|
sl@0
|
4104 |
void TestGetDirectory()
|
sl@0
|
4105 |
{
|
sl@0
|
4106 |
test.Next(_L("Read a directory containing large files using RDir"));
|
sl@0
|
4107 |
|
sl@0
|
4108 |
TFileName dirName;
|
sl@0
|
4109 |
dirName.Append(gDriveToTest);
|
sl@0
|
4110 |
dirName.Append(KTestPath);
|
sl@0
|
4111 |
|
sl@0
|
4112 |
TFileName file4GBMinusOne;
|
sl@0
|
4113 |
file4GBMinusOne.Append(gDriveToTest);
|
sl@0
|
4114 |
file4GBMinusOne.Append(KTestPath);
|
sl@0
|
4115 |
file4GBMinusOne.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
4116 |
TFileName file2GBMinusOne;
|
sl@0
|
4117 |
file2GBMinusOne.Append(gDriveToTest);
|
sl@0
|
4118 |
file2GBMinusOne.Append(KTestPath);
|
sl@0
|
4119 |
file2GBMinusOne.Append(_L("File2GBMinusOne.txt"));
|
sl@0
|
4120 |
TFileName file2GB;
|
sl@0
|
4121 |
file2GB.Append(gDriveToTest);
|
sl@0
|
4122 |
file2GB.Append(KTestPath);
|
sl@0
|
4123 |
file2GB.Append(_L("File2GB.txt"));
|
sl@0
|
4124 |
TFileName file3GB;
|
sl@0
|
4125 |
file3GB.Append(gDriveToTest);
|
sl@0
|
4126 |
file3GB.Append(KTestPath);
|
sl@0
|
4127 |
file3GB.Append(_L("File3GB.txt"));
|
sl@0
|
4128 |
|
sl@0
|
4129 |
TestRFile1.Replace(file4GBMinusOne);
|
sl@0
|
4130 |
TestRFile1.SetSize(K4GBMinusOne);
|
sl@0
|
4131 |
TestRFile1.Close();
|
sl@0
|
4132 |
|
sl@0
|
4133 |
TestRFile1.Replace(file2GBMinusOne);
|
sl@0
|
4134 |
TestRFile1.SetSize(K2GBMinusOne);
|
sl@0
|
4135 |
TestRFile1.Close();
|
sl@0
|
4136 |
|
sl@0
|
4137 |
TestRFile1.Replace(file2GB);
|
sl@0
|
4138 |
TestRFile1.SetSize(K2GB);
|
sl@0
|
4139 |
TestRFile1.Close();
|
sl@0
|
4140 |
|
sl@0
|
4141 |
TestRFile1.Replace(file3GB);
|
sl@0
|
4142 |
TestRFile1.SetSize(K3GB);
|
sl@0
|
4143 |
TestRFile1.Close();
|
sl@0
|
4144 |
|
sl@0
|
4145 |
test.Next(_L("Get the directory listing, sort by size\n"));
|
sl@0
|
4146 |
RDir dir;
|
sl@0
|
4147 |
TInt r = dir.Open(TheFs, dirName, KEntryAttNormal);
|
sl@0
|
4148 |
test (r == KErrNone);
|
sl@0
|
4149 |
|
sl@0
|
4150 |
TEntryArray entryArray;
|
sl@0
|
4151 |
r = dir.Read(entryArray);
|
sl@0
|
4152 |
test (r == KErrEof);
|
sl@0
|
4153 |
|
sl@0
|
4154 |
test.Next(_L("Check the files count in the directory. Number of files in a directory is 4\n"));
|
sl@0
|
4155 |
test(entryArray.Count() == gFilesInDirectory);
|
sl@0
|
4156 |
|
sl@0
|
4157 |
test.Next(_L("Get the entry list & Check the files are listed in order of file sizes\n"));
|
sl@0
|
4158 |
TInt n;
|
sl@0
|
4159 |
for (n = 0; n<entryArray.Count(); n++)
|
sl@0
|
4160 |
{
|
sl@0
|
4161 |
const TEntry& entry = entryArray[n];
|
sl@0
|
4162 |
if (entry.iName.MatchF(KFile2GBMinusOne()) == 0)
|
sl@0
|
4163 |
test(entry.FileSize() == K2GBMinusOne);
|
sl@0
|
4164 |
else if (entry.iName.MatchF(KFile2GB()) == 0)
|
sl@0
|
4165 |
test(entry.FileSize() == K2GB);
|
sl@0
|
4166 |
else if (entry.iName.MatchF(KFile3GB()) == 0)
|
sl@0
|
4167 |
test(entry.FileSize() == K3GB);
|
sl@0
|
4168 |
else if (entry.iName.MatchF(KFile4GBMinusOne()) == 0)
|
sl@0
|
4169 |
test(entry.FileSize() == K4GBMinusOne);
|
sl@0
|
4170 |
else
|
sl@0
|
4171 |
test(EFalse);
|
sl@0
|
4172 |
}
|
sl@0
|
4173 |
|
sl@0
|
4174 |
dir.Close();
|
sl@0
|
4175 |
|
sl@0
|
4176 |
test.Next(_L("Read a directory containing large files using CDir & sort by size"));
|
sl@0
|
4177 |
CDir* dirList = NULL;
|
sl@0
|
4178 |
TestRFs.GetDir(dirName, KEntryAttMaskSupported, ESortBySize, dirList);
|
sl@0
|
4179 |
test(dirList->Count() == gFilesInDirectory);
|
sl@0
|
4180 |
for (n = 0; n<dirList->Count(); n++)
|
sl@0
|
4181 |
{
|
sl@0
|
4182 |
TEntry entry;
|
sl@0
|
4183 |
entry = (*dirList)[n];
|
sl@0
|
4184 |
if (entry.iName.MatchF(KFile2GBMinusOne()) == 0)
|
sl@0
|
4185 |
test(entry.FileSize() == K2GBMinusOne);
|
sl@0
|
4186 |
else if (entry.iName.MatchF(KFile2GB()) == 0)
|
sl@0
|
4187 |
test(entry.FileSize() == K2GB);
|
sl@0
|
4188 |
else if (entry.iName.MatchF(KFile3GB()) == 0)
|
sl@0
|
4189 |
test(entry.FileSize() == K3GB);
|
sl@0
|
4190 |
else if (entry.iName.MatchF(KFile4GBMinusOne()) == 0)
|
sl@0
|
4191 |
test(entry.FileSize() == K4GBMinusOne);
|
sl@0
|
4192 |
else
|
sl@0
|
4193 |
test(EFalse);
|
sl@0
|
4194 |
}
|
sl@0
|
4195 |
delete dirList;
|
sl@0
|
4196 |
dirList = NULL;
|
sl@0
|
4197 |
}
|
sl@0
|
4198 |
|
sl@0
|
4199 |
|
sl@0
|
4200 |
/**
|
sl@0
|
4201 |
@SYMTestCaseID PBASE-T_FILE64BIT-0784
|
sl@0
|
4202 |
@SYMTestPriority High
|
sl@0
|
4203 |
@SYMTestRequirement REQ9533
|
sl@0
|
4204 |
@SYMTestType CIT
|
sl@0
|
4205 |
@SYMTestCaseDesc Tests functionality of TEntry
|
sl@0
|
4206 |
@SYMTestActions
|
sl@0
|
4207 |
1) Set the File Size to 4GB-1 using RFile64::SetSize()
|
sl@0
|
4208 |
2) Get the entry
|
sl@0
|
4209 |
3) Get the file size, using TEntry::FileSize()
|
sl@0
|
4210 |
4) Get the file size using iSize (i.e. without type cast to TUint)
|
sl@0
|
4211 |
5) Check for FAT32 file system. Set the file size to 4GB
|
sl@0
|
4212 |
6) Get the file size, using TEntry::FileSize()
|
sl@0
|
4213 |
7) Compare the File size with expected size
|
sl@0
|
4214 |
@SYMTestExpectedResults
|
sl@0
|
4215 |
1) KErrNone
|
sl@0
|
4216 |
2) KErrNone
|
sl@0
|
4217 |
3) File size = 4GB-1
|
sl@0
|
4218 |
4) File size = -1
|
sl@0
|
4219 |
5) KErrNotSupported for FAT32 and KErrNone for NGFS
|
sl@0
|
4220 |
6) FAT32 file size = 4GB-1 and NGFS file size = 4GB
|
sl@0
|
4221 |
7) File size = 4GB-1
|
sl@0
|
4222 |
@SYMTestStatus Implemented
|
sl@0
|
4223 |
*/
|
sl@0
|
4224 |
void TestTEntry()
|
sl@0
|
4225 |
{
|
sl@0
|
4226 |
test.Next(_L("Tests functionality for TEntry"));
|
sl@0
|
4227 |
|
sl@0
|
4228 |
TFileName fileName;
|
sl@0
|
4229 |
fileName.Append(gDriveToTest);
|
sl@0
|
4230 |
fileName.Append(KTestPath);
|
sl@0
|
4231 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
4232 |
TestRFile1.Replace(fileName, EFileRead|EFileWrite);
|
sl@0
|
4233 |
|
sl@0
|
4234 |
CDir* anEntryList;
|
sl@0
|
4235 |
TEntry entry;
|
sl@0
|
4236 |
TInt64 size = 0;
|
sl@0
|
4237 |
|
sl@0
|
4238 |
test.Next(_L("Set the File Size to 4GB-1 using RFile64::SetSize()\n"));
|
sl@0
|
4239 |
TestRFile1.SetSize(K4GBMinusOne);
|
sl@0
|
4240 |
|
sl@0
|
4241 |
test.Next(_L("Get the entry\n"));
|
sl@0
|
4242 |
TestRFs.GetDir(fileName, KEntryAttMaskSupported, ESortBySize, anEntryList);
|
sl@0
|
4243 |
for (TInt n = 0; n<anEntryList->Count(); n++)
|
sl@0
|
4244 |
{
|
sl@0
|
4245 |
entry = (*anEntryList)[n];
|
sl@0
|
4246 |
if (entry.iName.MatchF(KFile4GBMinusOne()) == 0)
|
sl@0
|
4247 |
{
|
sl@0
|
4248 |
test(entry.FileSize() == K4GBMinusOne);
|
sl@0
|
4249 |
}
|
sl@0
|
4250 |
}
|
sl@0
|
4251 |
|
sl@0
|
4252 |
test.Next(_L("Get the file size, using TEntry::FileSize()\n"));
|
sl@0
|
4253 |
size = entry.FileSize();
|
sl@0
|
4254 |
test(size == K4GBMinusOne);
|
sl@0
|
4255 |
test(entry.iSize == -1);
|
sl@0
|
4256 |
|
sl@0
|
4257 |
|
sl@0
|
4258 |
|
sl@0
|
4259 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)
|
sl@0
|
4260 |
{
|
sl@0
|
4261 |
TestRFile1.SetSize(K4GB);
|
sl@0
|
4262 |
size = entry.FileSize();
|
sl@0
|
4263 |
test(size == K4GBMinusOne);
|
sl@0
|
4264 |
}
|
sl@0
|
4265 |
TestRFile1.Close();
|
sl@0
|
4266 |
delete anEntryList;
|
sl@0
|
4267 |
anEntryList = NULL;
|
sl@0
|
4268 |
}
|
sl@0
|
4269 |
|
sl@0
|
4270 |
/**
|
sl@0
|
4271 |
@SYMTestCaseID PBASE-T_FILE64BIT-0785
|
sl@0
|
4272 |
@SYMTestPriority High
|
sl@0
|
4273 |
@SYMTestRequirement REQ9530
|
sl@0
|
4274 |
@SYMTestType CIT
|
sl@0
|
4275 |
@SYMTestCaseDesc Test the RDir read functionality with large file
|
sl@0
|
4276 |
@SYMTestActions
|
sl@0
|
4277 |
1) Open the directory containing large file, using RDir open()
|
sl@0
|
4278 |
2) Read the directory entry using TEntryArray as parameter
|
sl@0
|
4279 |
3) Check the count
|
sl@0
|
4280 |
4) Close using RDir
|
sl@0
|
4281 |
@SYMTestExpectedResults
|
sl@0
|
4282 |
1) KErrNone, open is successful
|
sl@0
|
4283 |
2) KErrEof
|
sl@0
|
4284 |
3) count = 4 files
|
sl@0
|
4285 |
4) Closes the directory
|
sl@0
|
4286 |
@SYMTestStatus Implemented
|
sl@0
|
4287 |
*/
|
sl@0
|
4288 |
|
sl@0
|
4289 |
void TestReadDirectory()
|
sl@0
|
4290 |
{
|
sl@0
|
4291 |
test.Next(_L("RDir::Read()"));
|
sl@0
|
4292 |
|
sl@0
|
4293 |
TFileName dirName;
|
sl@0
|
4294 |
dirName.Append(gDriveToTest);
|
sl@0
|
4295 |
dirName.Append(KTestPath);
|
sl@0
|
4296 |
|
sl@0
|
4297 |
test.Next(_L("Open the directory containing large file, using RDir open()\n"));
|
sl@0
|
4298 |
RDir dir;
|
sl@0
|
4299 |
TInt r = dir.Open(TheFs, dirName, KEntryAttNormal);
|
sl@0
|
4300 |
test (r == KErrNone);
|
sl@0
|
4301 |
|
sl@0
|
4302 |
test.Next(_L("Read the directory entry using TEntryArray as parameter\n"));
|
sl@0
|
4303 |
TEntryArray entryArray;
|
sl@0
|
4304 |
r = dir.Read(entryArray);
|
sl@0
|
4305 |
test (r == KErrEof);
|
sl@0
|
4306 |
|
sl@0
|
4307 |
test.Next(_L("Check the count\n"));
|
sl@0
|
4308 |
test(entryArray.Count() == gFilesInDirectory);
|
sl@0
|
4309 |
|
sl@0
|
4310 |
test.Next(_L("Close using RDir\n"));
|
sl@0
|
4311 |
dir.Close();
|
sl@0
|
4312 |
}
|
sl@0
|
4313 |
|
sl@0
|
4314 |
/**
|
sl@0
|
4315 |
@SYMTestCaseID PBASE-T_FILE64BIT-0786
|
sl@0
|
4316 |
@SYMTestPriority High
|
sl@0
|
4317 |
@SYMTestRequirement REQ9530
|
sl@0
|
4318 |
@SYMTestType CIT
|
sl@0
|
4319 |
@SYMTestCaseDesc Test the sorting of directory entries using CDir::Sort()
|
sl@0
|
4320 |
@SYMTestActions
|
sl@0
|
4321 |
1) Sort with number of entries =0
|
sl@0
|
4322 |
2) Sort the directory entries with large files, sort key = ESortBySize
|
sl@0
|
4323 |
3) Get the entries count
|
sl@0
|
4324 |
4) Check the files are arranged in increasing file size
|
sl@0
|
4325 |
@SYMTestExpectedResults
|
sl@0
|
4326 |
1) KErrNone
|
sl@0
|
4327 |
2) KErrNone, sort is successful
|
sl@0
|
4328 |
3) count = 4
|
sl@0
|
4329 |
4) sequence should be in increasing order
|
sl@0
|
4330 |
@SYMTestStatus Implemented
|
sl@0
|
4331 |
*/
|
sl@0
|
4332 |
|
sl@0
|
4333 |
void TestSortDirectory()
|
sl@0
|
4334 |
{
|
sl@0
|
4335 |
CDir* anEntryList;
|
sl@0
|
4336 |
TEntry entry;
|
sl@0
|
4337 |
|
sl@0
|
4338 |
|
sl@0
|
4339 |
TFileName testDir0;
|
sl@0
|
4340 |
testDir0.Append(gDriveToTest);
|
sl@0
|
4341 |
testDir0.Append(_L("F32-TEST"));
|
sl@0
|
4342 |
|
sl@0
|
4343 |
TInt r = TheFs.MkDir(testDir0);
|
sl@0
|
4344 |
test(r == KErrNone || r == KErrAlreadyExists);
|
sl@0
|
4345 |
|
sl@0
|
4346 |
test.Next(_L("Sort with number of entries =0\n"));
|
sl@0
|
4347 |
TestRFs.GetDir(testDir0, KEntryAttMaskSupported, ESortBySize, anEntryList);
|
sl@0
|
4348 |
test(anEntryList->Count() == 0);
|
sl@0
|
4349 |
delete anEntryList;
|
sl@0
|
4350 |
anEntryList = NULL;
|
sl@0
|
4351 |
|
sl@0
|
4352 |
test.Next(_L(" Sort the directory entries with large files, sort key = ESortBySize\n"));
|
sl@0
|
4353 |
TFileName testDir;
|
sl@0
|
4354 |
testDir.Append(gDriveToTest);
|
sl@0
|
4355 |
testDir.Append(KTestPath);
|
sl@0
|
4356 |
CDir* aDirList;
|
sl@0
|
4357 |
TestRFs.GetDir(testDir, KEntryAttMaskSupported, ESortBySize, aDirList);
|
sl@0
|
4358 |
|
sl@0
|
4359 |
test.Next(_L("Get the entries count\n"));
|
sl@0
|
4360 |
test(aDirList->Count() == gFilesInDirectory);
|
sl@0
|
4361 |
|
sl@0
|
4362 |
|
sl@0
|
4363 |
test.Next(_L("Check the files are arranged in increasing file size\n"));
|
sl@0
|
4364 |
for (TInt n = 0; n<aDirList->Count(); n++)
|
sl@0
|
4365 |
{
|
sl@0
|
4366 |
entry = (*aDirList)[n];
|
sl@0
|
4367 |
if (entry.iName.MatchF(KFile2GBMinusOne()) == 0)
|
sl@0
|
4368 |
{
|
sl@0
|
4369 |
test(entry.FileSize() == K2GBMinusOne);
|
sl@0
|
4370 |
test(n == 0);
|
sl@0
|
4371 |
}
|
sl@0
|
4372 |
else if (entry.iName.MatchF(KFile2GB()) == 0)
|
sl@0
|
4373 |
{
|
sl@0
|
4374 |
test(entry.FileSize() == K2GB);
|
sl@0
|
4375 |
test(n == 1);
|
sl@0
|
4376 |
}
|
sl@0
|
4377 |
else if (entry.iName.MatchF(KFile3GB()) == 0)
|
sl@0
|
4378 |
{
|
sl@0
|
4379 |
test(entry.FileSize() == K3GB);
|
sl@0
|
4380 |
test(n == 2);
|
sl@0
|
4381 |
}
|
sl@0
|
4382 |
else if (entry.iName.MatchF(KFile4GBMinusOne()) == 0)
|
sl@0
|
4383 |
{
|
sl@0
|
4384 |
test(entry.FileSize() == K4GBMinusOne);
|
sl@0
|
4385 |
test(n == 3);
|
sl@0
|
4386 |
}
|
sl@0
|
4387 |
else
|
sl@0
|
4388 |
test(EFalse);
|
sl@0
|
4389 |
}
|
sl@0
|
4390 |
delete aDirList;
|
sl@0
|
4391 |
aDirList = NULL;
|
sl@0
|
4392 |
}
|
sl@0
|
4393 |
|
sl@0
|
4394 |
/**
|
sl@0
|
4395 |
@SYMTestCaseID PBASE-T_FILE64BIT-0787
|
sl@0
|
4396 |
@SYMTestPriority High
|
sl@0
|
4397 |
@SYMTestRequirement REQ9530
|
sl@0
|
4398 |
@SYMTestType CIT
|
sl@0
|
4399 |
@SYMTestCaseDesc Test cases for validating CDir::AddL()
|
sl@0
|
4400 |
@SYMTestActions
|
sl@0
|
4401 |
1) Fill the directory entry with details of large files contained in them
|
sl@0
|
4402 |
2) Get the directory entry,using RFs::GetDir()
|
sl@0
|
4403 |
3) Compare with entry added
|
sl@0
|
4404 |
@SYMTestExpectedResults
|
sl@0
|
4405 |
1) KErrNone
|
sl@0
|
4406 |
2) KErrNone
|
sl@0
|
4407 |
3) Added entry == retrieved entry
|
sl@0
|
4408 |
@SYMTestStatus Implemented
|
sl@0
|
4409 |
*/
|
sl@0
|
4410 |
void TestAddLDirectory()
|
sl@0
|
4411 |
{
|
sl@0
|
4412 |
CDir* aDirList;
|
sl@0
|
4413 |
TEntry entry;
|
sl@0
|
4414 |
|
sl@0
|
4415 |
TFileName testDir;
|
sl@0
|
4416 |
testDir.Append(gDriveToTest);
|
sl@0
|
4417 |
testDir.Append(KTestPath);
|
sl@0
|
4418 |
|
sl@0
|
4419 |
test.Next(_L("Get the directory entry,using RFs::GetDir()\n"));
|
sl@0
|
4420 |
TestRFs.GetDir(testDir, KEntryAttMaskSupported, ESortBySize, aDirList);
|
sl@0
|
4421 |
test(aDirList->Count() == gFilesInDirectory);
|
sl@0
|
4422 |
|
sl@0
|
4423 |
test.Next(_L("Compare with entry added\n"));
|
sl@0
|
4424 |
for (TInt n = 0; n<aDirList->Count(); n++)
|
sl@0
|
4425 |
{
|
sl@0
|
4426 |
entry = (*aDirList)[n];
|
sl@0
|
4427 |
if (entry.iName.MatchF(KFile2GBMinusOne()) ==0 )
|
sl@0
|
4428 |
{
|
sl@0
|
4429 |
test(entry.FileSize() == K2GBMinusOne);
|
sl@0
|
4430 |
test(n == 0);
|
sl@0
|
4431 |
}
|
sl@0
|
4432 |
else if (entry.iName.MatchF(KFile2GB) == 0)
|
sl@0
|
4433 |
{
|
sl@0
|
4434 |
test(entry.FileSize() == K2GB);
|
sl@0
|
4435 |
test(n == 1);
|
sl@0
|
4436 |
}
|
sl@0
|
4437 |
else if (entry.iName.MatchF(KFile3GB()) == 0)
|
sl@0
|
4438 |
{
|
sl@0
|
4439 |
test(entry.FileSize() == K3GB);
|
sl@0
|
4440 |
test(n == 2);
|
sl@0
|
4441 |
}
|
sl@0
|
4442 |
else if (entry.iName.MatchF(KFile4GBMinusOne()) == 0)
|
sl@0
|
4443 |
{
|
sl@0
|
4444 |
test(entry.FileSize() == K4GBMinusOne);
|
sl@0
|
4445 |
test(n == 3);
|
sl@0
|
4446 |
}
|
sl@0
|
4447 |
else
|
sl@0
|
4448 |
test(EFalse);
|
sl@0
|
4449 |
}
|
sl@0
|
4450 |
delete aDirList;
|
sl@0
|
4451 |
aDirList = NULL;
|
sl@0
|
4452 |
|
sl@0
|
4453 |
TFileName file4GBMinusOne;
|
sl@0
|
4454 |
file4GBMinusOne.Append(gDriveToTest);
|
sl@0
|
4455 |
file4GBMinusOne.Append(KTestPath);
|
sl@0
|
4456 |
file4GBMinusOne.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
4457 |
TFileName file2GBMinusOne;
|
sl@0
|
4458 |
file2GBMinusOne.Append(gDriveToTest);
|
sl@0
|
4459 |
file2GBMinusOne.Append(KTestPath);
|
sl@0
|
4460 |
file2GBMinusOne.Append(_L("File2GBMinusOne.txt"));
|
sl@0
|
4461 |
TFileName file2GB;
|
sl@0
|
4462 |
file2GB.Append(gDriveToTest);
|
sl@0
|
4463 |
file2GB.Append(KTestPath);
|
sl@0
|
4464 |
file2GB.Append(_L("File2GB.txt"));
|
sl@0
|
4465 |
TFileName file3GB;
|
sl@0
|
4466 |
file3GB.Append(gDriveToTest);
|
sl@0
|
4467 |
file3GB.Append(KTestPath);
|
sl@0
|
4468 |
file3GB.Append(_L("File3GB.txt"));
|
sl@0
|
4469 |
|
sl@0
|
4470 |
TInt r = TheFs.Delete(file4GBMinusOne);
|
sl@0
|
4471 |
test(r == KErrNone);
|
sl@0
|
4472 |
r = TheFs.Delete(file2GBMinusOne);
|
sl@0
|
4473 |
test(r == KErrNone);
|
sl@0
|
4474 |
r = TheFs.Delete(file2GB);
|
sl@0
|
4475 |
test(r == KErrNone);
|
sl@0
|
4476 |
r = TheFs.Delete(file3GB);
|
sl@0
|
4477 |
test(r == KErrNone);
|
sl@0
|
4478 |
}
|
sl@0
|
4479 |
|
sl@0
|
4480 |
/**
|
sl@0
|
4481 |
@SYMTestCaseID PBASE-T_FILE64BIT-0788
|
sl@0
|
4482 |
@SYMTestPriority High
|
sl@0
|
4483 |
@SYMTestRequirement REQXXXX
|
sl@0
|
4484 |
@SYMTestType CIT
|
sl@0
|
4485 |
@SYMTestCaseDesc Test cases for validating TFileText changes.
|
sl@0
|
4486 |
@SYMTestActions
|
sl@0
|
4487 |
1) Open test file and get the file size using RFile64::Size() and set the file handle to TFileText object
|
sl@0
|
4488 |
2) Seek to the file end using TFileText::Seek()
|
sl@0
|
4489 |
3) Get current file position using RFile64::Seek() and verify it is at file end.
|
sl@0
|
4490 |
4) Seek to location greater than 2GB-1 using RFile64::Seek
|
sl@0
|
4491 |
5) Write data to the file using RFile64::Write
|
sl@0
|
4492 |
6) Read data using TFileText::Read
|
sl@0
|
4493 |
7) Compare the data read in steps 6 to the data written in step 5.
|
sl@0
|
4494 |
8) Seek to the file end using TFileText::Seek(ESeekEnd).
|
sl@0
|
4495 |
9) Write known data using TFileText::Write
|
sl@0
|
4496 |
10) Read the data using RFile64::Read
|
sl@0
|
4497 |
11) Compare the source data with read data.
|
sl@0
|
4498 |
@SYMTestExpectedResults
|
sl@0
|
4499 |
1) KErrNone
|
sl@0
|
4500 |
2) KErrNone
|
sl@0
|
4501 |
3) Current file position is file end.
|
sl@0
|
4502 |
4) KErrNone
|
sl@0
|
4503 |
5) KErrNone
|
sl@0
|
4504 |
6) KErrNone
|
sl@0
|
4505 |
7) Read data == Written data
|
sl@0
|
4506 |
8) KErrNone
|
sl@0
|
4507 |
9) KErrNone
|
sl@0
|
4508 |
10) KErrNone
|
sl@0
|
4509 |
11) Read data == Source data
|
sl@0
|
4510 |
@SYMTestStatus Implemented
|
sl@0
|
4511 |
*/
|
sl@0
|
4512 |
void TestTFileText()
|
sl@0
|
4513 |
{
|
sl@0
|
4514 |
TFileName fileName;
|
sl@0
|
4515 |
fileName.Append(gDriveToTest);
|
sl@0
|
4516 |
fileName.Append(KTestPath);
|
sl@0
|
4517 |
fileName.Append(_L("test.txt"));
|
sl@0
|
4518 |
TInt r;
|
sl@0
|
4519 |
RFile64 file64;
|
sl@0
|
4520 |
TInt64 sizeK3GB = K3GB;
|
sl@0
|
4521 |
|
sl@0
|
4522 |
test.Next(_L("Open test file and get the file size using RFile64::Size() and set the file handle to TFileText object\n"));
|
sl@0
|
4523 |
r = file64.Replace(TheFs,fileName,EFileRead|EFileWrite);
|
sl@0
|
4524 |
test(r == KErrNone);
|
sl@0
|
4525 |
r = file64.SetSize(sizeK3GB);
|
sl@0
|
4526 |
test(r == KErrNone);
|
sl@0
|
4527 |
TFileText fileText;
|
sl@0
|
4528 |
fileText.Set(file64);
|
sl@0
|
4529 |
|
sl@0
|
4530 |
test.Next(_L("Seek to the file end using TFileText::Seek()\n"));
|
sl@0
|
4531 |
r = fileText.Seek(ESeekEnd);
|
sl@0
|
4532 |
test(r == KErrNone);
|
sl@0
|
4533 |
|
sl@0
|
4534 |
test.Next(_L("Get current file position using RFile64::Seek() and verify it is at file end.\n"));
|
sl@0
|
4535 |
TInt64 pos = 0;
|
sl@0
|
4536 |
r = file64.Seek(ESeekCurrent, pos);
|
sl@0
|
4537 |
test(r == KErrNone);
|
sl@0
|
4538 |
test(pos == sizeK3GB);
|
sl@0
|
4539 |
|
sl@0
|
4540 |
test.Next(_L("Write data to the file using RFile64::Write\n"));
|
sl@0
|
4541 |
HBufC* record = HBufC::NewL(10);
|
sl@0
|
4542 |
record->Des().SetLength(10);
|
sl@0
|
4543 |
record->Des().Fill('A');
|
sl@0
|
4544 |
TPtrC8 bufPtr;
|
sl@0
|
4545 |
bufPtr.Set((TUint8*)record->Ptr(),record->Size()); // Size() returns length in bytes
|
sl@0
|
4546 |
r = file64.Write(pos,bufPtr);
|
sl@0
|
4547 |
test(r == KErrNone);
|
sl@0
|
4548 |
|
sl@0
|
4549 |
test.Next(_L("Read data using TFileText::Read\n"));
|
sl@0
|
4550 |
TBuf<20> fileTextReadBuf;
|
sl@0
|
4551 |
file64.Seek(ESeekStart,pos);//seek to the position where the data has been written
|
sl@0
|
4552 |
r = fileText.Read(fileTextReadBuf);
|
sl@0
|
4553 |
test(fileTextReadBuf == _L("AAAAAAAAAA"));
|
sl@0
|
4554 |
|
sl@0
|
4555 |
test.Next(_L("Seek to the file end using TFileText::Seek(ESeekEnd)\n"));
|
sl@0
|
4556 |
r = fileText.Seek(ESeekEnd);
|
sl@0
|
4557 |
test(r == KErrNone);
|
sl@0
|
4558 |
|
sl@0
|
4559 |
test.Next(_L("Write known data using TFileText::Write\n"));
|
sl@0
|
4560 |
TBuf<20> fileTextWriteBuf(_L("AAAAAAAAAA"));
|
sl@0
|
4561 |
pos = 0;
|
sl@0
|
4562 |
r = file64.Seek(ESeekCurrent,pos);
|
sl@0
|
4563 |
r = fileText.Write(fileTextWriteBuf);
|
sl@0
|
4564 |
test(r == KErrNone);
|
sl@0
|
4565 |
|
sl@0
|
4566 |
test.Next(_L("Read the data using RFile64::Read\n"));
|
sl@0
|
4567 |
TBuf8<20> file64ReadBuf;
|
sl@0
|
4568 |
file64ReadBuf.Zero();
|
sl@0
|
4569 |
r = file64.Read(pos,file64ReadBuf);
|
sl@0
|
4570 |
r = bufPtr.Compare(file64ReadBuf);
|
sl@0
|
4571 |
test (r == KErrNone);
|
sl@0
|
4572 |
|
sl@0
|
4573 |
file64.Close();
|
sl@0
|
4574 |
|
sl@0
|
4575 |
r = TheFs.Delete(fileName);
|
sl@0
|
4576 |
test(r == KErrNone);
|
sl@0
|
4577 |
User::Free(record);
|
sl@0
|
4578 |
}
|
sl@0
|
4579 |
|
sl@0
|
4580 |
|
sl@0
|
4581 |
/**
|
sl@0
|
4582 |
@SYMTestCaseID PBASE-T_FILE64BIT-0789
|
sl@0
|
4583 |
@SYMTestPriority High
|
sl@0
|
4584 |
@SYMTestRequirement REQ9526
|
sl@0
|
4585 |
@SYMTestType CIT
|
sl@0
|
4586 |
@SYMTestCaseDesc Test the file read and write with locking a specified region of the file.
|
sl@0
|
4587 |
@SYMTestActions
|
sl@0
|
4588 |
1) Set the File Size to 2GB-1
|
sl@0
|
4589 |
2) Lock a section of large file, position =0, aLength = 2GB-1
|
sl@0
|
4590 |
3) Read from position = 2GB-100 and length = 99
|
sl@0
|
4591 |
4) Write to the File, position = 2GB-100 and length = 99
|
sl@0
|
4592 |
5) Use RFs::ReadFileSection () and with position = 2GB -100 and length = 99
|
sl@0
|
4593 |
6) Set the file size to 4GB-1
|
sl@0
|
4594 |
7) Lock a section of large file, position =2GB, aLength = 4GB-1
|
sl@0
|
4595 |
8) Write to the File, position = 4GB-100 and length = 99
|
sl@0
|
4596 |
@SYMTestExpectedResults
|
sl@0
|
4597 |
1) KErrNone
|
sl@0
|
4598 |
2) KErrNone, file lock successful
|
sl@0
|
4599 |
3) KErrNone, read is successful
|
sl@0
|
4600 |
4) KErrLocked, write is unsuccessful
|
sl@0
|
4601 |
5) KErrNone, read is successful
|
sl@0
|
4602 |
6) KErrNone
|
sl@0
|
4603 |
7) KErrNone, lock is successful
|
sl@0
|
4604 |
8) KErrLocked, write is unsuccessful
|
sl@0
|
4605 |
@SYMTestStatus Implemented
|
sl@0
|
4606 |
*/
|
sl@0
|
4607 |
void TestReadWriteLock()
|
sl@0
|
4608 |
{
|
sl@0
|
4609 |
TBuf8<0x63> readBuf;
|
sl@0
|
4610 |
TBuf8<0x63> buf;
|
sl@0
|
4611 |
TFileName fileName;
|
sl@0
|
4612 |
fileName.Append(gDriveToTest);
|
sl@0
|
4613 |
fileName.Append(KTestPath);
|
sl@0
|
4614 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
4615 |
|
sl@0
|
4616 |
test.Start(_L("Test Lock Functionality\n"));
|
sl@0
|
4617 |
TestRFile1.Replace(fileName, EFileWrite|EFileShareAny);
|
sl@0
|
4618 |
TestRFile2.Open(fileName);
|
sl@0
|
4619 |
|
sl@0
|
4620 |
test.Next(_L("Creating test pattern"));
|
sl@0
|
4621 |
pattern.SetLength(pattern.MaxLength());
|
sl@0
|
4622 |
for (TInt i = 0;i<pattern.MaxLength();i++)
|
sl@0
|
4623 |
pattern[i] = (TText8)(i + 10);
|
sl@0
|
4624 |
|
sl@0
|
4625 |
TInt64 size = 0;
|
sl@0
|
4626 |
test.Next(_L("Multi file tests"));
|
sl@0
|
4627 |
|
sl@0
|
4628 |
test.Next(_L("Set the File Size to 2GB-1\n"));
|
sl@0
|
4629 |
TestRFile1.SetSize(K2GBMinusOne);
|
sl@0
|
4630 |
TestRFile1.Size(size);
|
sl@0
|
4631 |
test(size == K2GBMinusOne);
|
sl@0
|
4632 |
|
sl@0
|
4633 |
test.Next(_L("Lock a section of large file, position =0, aLength = 2GB-1\n"));
|
sl@0
|
4634 |
TestRFile1.Lock(0,K2GBMinusOne);
|
sl@0
|
4635 |
TestRFile1.LockE(0,K2GBMinusOne);
|
sl@0
|
4636 |
|
sl@0
|
4637 |
test.Next(_L("Read from position = 2GB-100 and length = 99\n"));
|
sl@0
|
4638 |
TestRFile1.Read(K2GBMinus100,buf,99);
|
sl@0
|
4639 |
|
sl@0
|
4640 |
test.Next(_L("Write to the File, position = 2GB-100 and length = 99\n"));
|
sl@0
|
4641 |
TestRFile2.WriteE(K2GBMinus100,pattern,99);
|
sl@0
|
4642 |
TestRFile1.UnLock(0,K2GBMinusOne);
|
sl@0
|
4643 |
TestRFile2.Write(K2GBMinus100,pattern,99);
|
sl@0
|
4644 |
|
sl@0
|
4645 |
test.Next(_L("Use RFs::ReadFileSection () and with position = 2GB -100 and length = 99\n"));
|
sl@0
|
4646 |
TestRFs.ReadFileSection(fileName,K2GBMinus100,readBuf,99);
|
sl@0
|
4647 |
|
sl@0
|
4648 |
test.Next(_L("Set the file size to 4GB-1\n"));
|
sl@0
|
4649 |
TestRFile1.SetSize(K4GBMinusOne);
|
sl@0
|
4650 |
TestRFile1.Size(size);
|
sl@0
|
4651 |
test(size == K4GBMinusOne);
|
sl@0
|
4652 |
|
sl@0
|
4653 |
if(KFileSizeMaxLargerThan4GBMinusOne)
|
sl@0
|
4654 |
{
|
sl@0
|
4655 |
|
sl@0
|
4656 |
test.Next(_L("Lock a section of large file, position =2GB, aLength = 4GB-1\n"));
|
sl@0
|
4657 |
TestRFile1.Lock(K2GB,K4GBMinusOne);
|
sl@0
|
4658 |
TestRFile1.LockE(K2GB,K4GBMinusOne);
|
sl@0
|
4659 |
|
sl@0
|
4660 |
test.Next(_L("Write to the File, position = 4GB-100 and length = 99\n"));
|
sl@0
|
4661 |
TestRFile2.WriteE(K4GBMinus100,pattern,99);
|
sl@0
|
4662 |
TestRFile1.UnLock(K2GB,K4GBMinusOne);
|
sl@0
|
4663 |
}
|
sl@0
|
4664 |
|
sl@0
|
4665 |
TestRFile2.Close();
|
sl@0
|
4666 |
TestRFile1.Close();
|
sl@0
|
4667 |
|
sl@0
|
4668 |
TInt r = TheFs.Delete(fileName);
|
sl@0
|
4669 |
test(r == KErrNone);
|
sl@0
|
4670 |
test.End();
|
sl@0
|
4671 |
}
|
sl@0
|
4672 |
|
sl@0
|
4673 |
/**
|
sl@0
|
4674 |
@SYMTestCaseID PBASE-T_FILE64BIT-0790
|
sl@0
|
4675 |
@SYMTestPriority High
|
sl@0
|
4676 |
@SYMTestRequirement REQ9526
|
sl@0
|
4677 |
@SYMTestType CIT
|
sl@0
|
4678 |
@SYMTestCaseDesc Test the files unlock functionality and performs file read and write.
|
sl@0
|
4679 |
@SYMTestActions
|
sl@0
|
4680 |
1) Set the File Size to 2GB-1
|
sl@0
|
4681 |
2) Lock a section of file, position =0, aLength = 2GB-1
|
sl@0
|
4682 |
3) UnLock a section of large file, position = 0, aLength = 2GB-1
|
sl@0
|
4683 |
4) Read a file with position = 2GB-100 and length = 99
|
sl@0
|
4684 |
5) Write to a file with position = 2GB-100 and length = 99
|
sl@0
|
4685 |
6) Use RFs::ReadFileSection() to read from a file, position = 0 and length = 100(Open mode = EFileShareAny)
|
sl@0
|
4686 |
7) Set the File Size to 4GB-1
|
sl@0
|
4687 |
8) Lock a section of large file, position =2GB, aLength = 4GB-1
|
sl@0
|
4688 |
9) UnLock a section of large file, position =2GB, aLength = 4GB-1
|
sl@0
|
4689 |
10)Write to the File, position = 4GB-100 and length = 99
|
sl@0
|
4690 |
@SYMTestExpectedResults returns
|
sl@0
|
4691 |
1) KErrNone
|
sl@0
|
4692 |
2) KErrNone, file locked successfully
|
sl@0
|
4693 |
3) KErrNone, File unlocked successfully
|
sl@0
|
4694 |
4) KErrNone, read is successful
|
sl@0
|
4695 |
5) KErrNone, write is successful
|
sl@0
|
4696 |
6) KErrNone, read is successful
|
sl@0
|
4697 |
7) KErrNone
|
sl@0
|
4698 |
8) KErrNone, lock is successful
|
sl@0
|
4699 |
9) KErrNone, unlock is successful
|
sl@0
|
4700 |
10)KErrNone, write is successful
|
sl@0
|
4701 |
@SYMTestStatus Implemented
|
sl@0
|
4702 |
*/
|
sl@0
|
4703 |
void TestUnLock()
|
sl@0
|
4704 |
{
|
sl@0
|
4705 |
TBuf8<0x63> buf;
|
sl@0
|
4706 |
TBuf8<0x64> readBuf;
|
sl@0
|
4707 |
TInt64 size = 0;
|
sl@0
|
4708 |
TFileName fileName;
|
sl@0
|
4709 |
fileName.Append(gDriveToTest);
|
sl@0
|
4710 |
fileName.Append(KTestPath);
|
sl@0
|
4711 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
4712 |
|
sl@0
|
4713 |
test.Start(_L("Test Unlock Functionality\n"));
|
sl@0
|
4714 |
TestRFile1.Replace(fileName,EFileWrite|EFileShareAny);
|
sl@0
|
4715 |
TestRFile2.Open(fileName);
|
sl@0
|
4716 |
|
sl@0
|
4717 |
test.Next(_L("Creating test pattern"));
|
sl@0
|
4718 |
pattern.SetLength(pattern.MaxLength());
|
sl@0
|
4719 |
for (TInt i = 0;i < pattern.MaxLength();i++)
|
sl@0
|
4720 |
pattern[i] = (TText8)(i+10);
|
sl@0
|
4721 |
|
sl@0
|
4722 |
test.Next(_L("Set the File Size to 2GB-1\n"));
|
sl@0
|
4723 |
TestRFile1.SetSize(K2GBMinusOne);
|
sl@0
|
4724 |
TestRFile1.Size(size);
|
sl@0
|
4725 |
test(size == K2GBMinusOne);
|
sl@0
|
4726 |
|
sl@0
|
4727 |
test.Next(_L("Lock a section of file, position =0, aLength = 2GB-1\n"));
|
sl@0
|
4728 |
TestRFile1.Lock(0,K2GBMinusOne);
|
sl@0
|
4729 |
TestRFile1.LockE(0,K2GBMinusOne);
|
sl@0
|
4730 |
|
sl@0
|
4731 |
test.Next(_L("UnLock a section of large file, position = 0, aLength = 2GB-1\n"));
|
sl@0
|
4732 |
TestRFile1.UnLock(0,K2GBMinusOne);
|
sl@0
|
4733 |
|
sl@0
|
4734 |
test.Next(_L("Read a file with position = 2GB-100 and length = 99\n"));
|
sl@0
|
4735 |
TestRFile1.Read(K2GBMinus100,buf,99);
|
sl@0
|
4736 |
|
sl@0
|
4737 |
test.Next(_L("Write to a file with position = 2GB-100 and length = 99\n"));
|
sl@0
|
4738 |
TestRFile2.Write(K2GBMinus100,pattern,99);
|
sl@0
|
4739 |
TestRFile1.Read(K2GBMinus100,buf,99);
|
sl@0
|
4740 |
test(pattern == buf); // Written data == Read data
|
sl@0
|
4741 |
|
sl@0
|
4742 |
test.Next(_L("Use RFs::ReadFileSection() to read from a file, position = 0 and length = 100(Open mode = EFileShareAny)\n"));
|
sl@0
|
4743 |
TFileName fileName1;
|
sl@0
|
4744 |
fileName1.Append(gDriveToTest);
|
sl@0
|
4745 |
fileName1.Append(KTestPath);
|
sl@0
|
4746 |
fileName1.Append(_L("File2GB.txt"));
|
sl@0
|
4747 |
RFile64 file;
|
sl@0
|
4748 |
TInt r = file.Replace(TheFs, fileName1, EFileWrite);
|
sl@0
|
4749 |
test (r == KErrNone);
|
sl@0
|
4750 |
file.SetSize(K2GB);
|
sl@0
|
4751 |
test (r == KErrNone);
|
sl@0
|
4752 |
file.Close();
|
sl@0
|
4753 |
TestRFs.ReadFileSection(fileName1,0,readBuf,100);
|
sl@0
|
4754 |
r = TheFs.Delete(fileName1);
|
sl@0
|
4755 |
test (r == KErrNone);
|
sl@0
|
4756 |
test.Next(_L("Creating test pattern"));
|
sl@0
|
4757 |
|
sl@0
|
4758 |
TBuf8<0x63> writeBuf63;
|
sl@0
|
4759 |
TBuf8<0x63> readBuf63;
|
sl@0
|
4760 |
for (TInt count = 0; count < 0x63; count++)
|
sl@0
|
4761 |
{
|
sl@0
|
4762 |
writeBuf63.Append((TChar)count);
|
sl@0
|
4763 |
}
|
sl@0
|
4764 |
|
sl@0
|
4765 |
test.Next(_L("Set the File Size to 4GB-1\n"));
|
sl@0
|
4766 |
TestRFile1.SetSize(K4GBMinusOne);
|
sl@0
|
4767 |
TestRFile1.Size(size);
|
sl@0
|
4768 |
test(size == K4GBMinusOne);
|
sl@0
|
4769 |
|
sl@0
|
4770 |
if(KFileSizeMaxLargerThan4GBMinusOne)
|
sl@0
|
4771 |
{
|
sl@0
|
4772 |
test.Next(_L("Lock a section of large file, position =2GB, aLength = 4GB-1\n"));
|
sl@0
|
4773 |
TestRFile1.Lock(K2GB,K4GBMinusOne);
|
sl@0
|
4774 |
|
sl@0
|
4775 |
|
sl@0
|
4776 |
test.Next(_L("UnLock a section of large file, position =2GB, aLength = 4GB-1\n"));
|
sl@0
|
4777 |
TestRFile1.UnLock(K2GB,K4GBMinusOne);
|
sl@0
|
4778 |
|
sl@0
|
4779 |
test.Next(_L("Write to the File, position = 4GB-100 and length = 99\n"));
|
sl@0
|
4780 |
TestRFile2.Write(K4GBMinus100,writeBuf63,99);
|
sl@0
|
4781 |
TestRFile2.Read(K4GBMinus100,readBuf63,99);
|
sl@0
|
4782 |
test(writeBuf63 == readBuf63); // Written data == Read data
|
sl@0
|
4783 |
}
|
sl@0
|
4784 |
|
sl@0
|
4785 |
TestRFile2.Close();
|
sl@0
|
4786 |
TestRFile1.Close();
|
sl@0
|
4787 |
|
sl@0
|
4788 |
r = TheFs.Delete(fileName);
|
sl@0
|
4789 |
test(r == KErrNone);
|
sl@0
|
4790 |
test.End();
|
sl@0
|
4791 |
}
|
sl@0
|
4792 |
|
sl@0
|
4793 |
/**
|
sl@0
|
4794 |
@SYMTestCaseID PBASE-T_FILE64BIT-2349
|
sl@0
|
4795 |
@SYMTestPriority High
|
sl@0
|
4796 |
@SYMTestRequirement REQ9529
|
sl@0
|
4797 |
@SYMTestType CIT
|
sl@0
|
4798 |
@SYMTestCaseDesc Test RFile64::Seek(), Read() & Write() functionality for synchronous calls
|
sl@0
|
4799 |
|
sl@0
|
4800 |
IMPORT_C TInt Read(TDes8 &aDes) const;
|
sl@0
|
4801 |
IMPORT_C TInt Write(const TDesC8 &aDes);
|
sl@0
|
4802 |
@SYMTestActions
|
sl@0
|
4803 |
1) Open the large file, Set the File Size to 2GB-1
|
sl@0
|
4804 |
2) File Seek with: Mode= ESeekCurrent, position = 2GB-100
|
sl@0
|
4805 |
3) Write to a file with current position and length = 99
|
sl@0
|
4806 |
4) Seek the file: Mode= ESeekStart, position = 2GB-100
|
sl@0
|
4807 |
5) Read a file with current position and length =99
|
sl@0
|
4808 |
6) Compare the read data with written data
|
sl@0
|
4809 |
7) Seek the file: Mode = ESeekEnd
|
sl@0
|
4810 |
8) Write to a file with current position and length =99
|
sl@0
|
4811 |
9) Set the file size to 4GB-1
|
sl@0
|
4812 |
10)Check for FAT32 File system. Seek the file: Mode = ESeekEnd
|
sl@0
|
4813 |
11)Write to a file with current position and length =99
|
sl@0
|
4814 |
12)If NGFS is supported, Set the file size to 4GB+10
|
sl@0
|
4815 |
13)Seek the file: Mode = ESeekEnd
|
sl@0
|
4816 |
14)Write to a file with current position and length =99
|
sl@0
|
4817 |
@SYMTestExpectedResults
|
sl@0
|
4818 |
1) KErrNone, open is successful
|
sl@0
|
4819 |
2) KErrNone, Seek Position = 2GB-100
|
sl@0
|
4820 |
3) KErrNone, write is successful
|
sl@0
|
4821 |
4) KErrNone, Seek Position = 2GB-100
|
sl@0
|
4822 |
5) KErrNone, read is successful
|
sl@0
|
4823 |
6) Read data == written data
|
sl@0
|
4824 |
7) KErrNone
|
sl@0
|
4825 |
8) KErrNone, write is successful
|
sl@0
|
4826 |
9) KErrNone
|
sl@0
|
4827 |
10)KErrNone
|
sl@0
|
4828 |
11)
|
sl@0
|
4829 |
12)KErrNone
|
sl@0
|
4830 |
13)KErrNone
|
sl@0
|
4831 |
14)KErrNone
|
sl@0
|
4832 |
@SYMTestStatus Implemented
|
sl@0
|
4833 |
*/
|
sl@0
|
4834 |
void TestSeekReadWrite()
|
sl@0
|
4835 |
{
|
sl@0
|
4836 |
TBuf8<0x63> readBuf;
|
sl@0
|
4837 |
TBuf8<0x63> writeBuf;
|
sl@0
|
4838 |
TInt count;
|
sl@0
|
4839 |
TInt64 seekPos = 0;
|
sl@0
|
4840 |
TFileName fileName;
|
sl@0
|
4841 |
fileName.Append(gDriveToTest);
|
sl@0
|
4842 |
fileName.Append(KTestPath);
|
sl@0
|
4843 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
4844 |
|
sl@0
|
4845 |
test.Start(_L("Test RFile64::Seek(), RFile64::Read() & RFile64::Write() for synchronous calls\n"));
|
sl@0
|
4846 |
|
sl@0
|
4847 |
test.Next(_L("Open the large file, Set the File Size to 2GB-1\n"));
|
sl@0
|
4848 |
TestRFile1.Replace(fileName,EFileWrite|EFileShareAny);
|
sl@0
|
4849 |
|
sl@0
|
4850 |
for (count = 0; count < 0x63; count++)
|
sl@0
|
4851 |
{
|
sl@0
|
4852 |
writeBuf.Append(count);
|
sl@0
|
4853 |
}
|
sl@0
|
4854 |
|
sl@0
|
4855 |
test.Next(_L("Single file tests"));
|
sl@0
|
4856 |
TInt64 size2GBMinusOne = 1;
|
sl@0
|
4857 |
size2GBMinusOne <<= 31;
|
sl@0
|
4858 |
size2GBMinusOne -= 1;
|
sl@0
|
4859 |
TestRFile1.SetSize(size2GBMinusOne);
|
sl@0
|
4860 |
|
sl@0
|
4861 |
test.Next(_L("File Seek with: Mode= ESeekCurrent, position = 2GB-100\n"));
|
sl@0
|
4862 |
seekPos = K2GBMinus100;
|
sl@0
|
4863 |
TestRFile1.Seek(ESeekCurrent,seekPos);
|
sl@0
|
4864 |
seekPos = 0;
|
sl@0
|
4865 |
TestRFile1.Seek(ESeekCurrent,seekPos);
|
sl@0
|
4866 |
test(seekPos == K2GBMinus100);
|
sl@0
|
4867 |
|
sl@0
|
4868 |
test.Next(_L("Write to a file with current position and length = 99\n"));
|
sl@0
|
4869 |
TestRFile1.Write(writeBuf); // Write 99 bytes of data to a file
|
sl@0
|
4870 |
|
sl@0
|
4871 |
test.Next(_L("Seek the file: Mode= ESeekStart, position = 2GB-100\n"));
|
sl@0
|
4872 |
seekPos = 0;
|
sl@0
|
4873 |
TestRFile1.Seek(ESeekCurrent,seekPos);
|
sl@0
|
4874 |
test(seekPos == K2GBMinusOne);
|
sl@0
|
4875 |
|
sl@0
|
4876 |
test.Next(_L("Read a file with current position and length =99\n"));
|
sl@0
|
4877 |
seekPos = K2GBMinus100;
|
sl@0
|
4878 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
4879 |
TestRFile1.Read(readBuf);
|
sl@0
|
4880 |
|
sl@0
|
4881 |
test.Next(_L("Compare the read data with written data\n"));
|
sl@0
|
4882 |
test(writeBuf == readBuf); // Written data == Read data
|
sl@0
|
4883 |
|
sl@0
|
4884 |
TBuf8<0x63> writeBuf99;
|
sl@0
|
4885 |
TBuf8<0x63> readBuf99;
|
sl@0
|
4886 |
TInt64 size = 0;
|
sl@0
|
4887 |
|
sl@0
|
4888 |
test.Next(_L("Seek the file: Mode = ESeekEnd\n"));
|
sl@0
|
4889 |
TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
|
sl@0
|
4890 |
test(seekPos == K2GBMinusOne);
|
sl@0
|
4891 |
|
sl@0
|
4892 |
test.Next(_L("Write to a file with current position and length =99\n"));
|
sl@0
|
4893 |
for (count = 0; count < 0x63; count++)
|
sl@0
|
4894 |
{
|
sl@0
|
4895 |
writeBuf99.Append(count+1);
|
sl@0
|
4896 |
}
|
sl@0
|
4897 |
TestRFile1.Write(writeBuf99);
|
sl@0
|
4898 |
seekPos = K2GBMinusOne;
|
sl@0
|
4899 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
4900 |
TestRFile1.Read(readBuf99);
|
sl@0
|
4901 |
test(writeBuf99 == readBuf99); // Written data == Read data
|
sl@0
|
4902 |
// Query Size
|
sl@0
|
4903 |
TestRFile1.Size(size);
|
sl@0
|
4904 |
test(size == K2GBPlus98); // Validate the file size
|
sl@0
|
4905 |
|
sl@0
|
4906 |
TBuf8<0x63> readBufx63;
|
sl@0
|
4907 |
TBuf8<0x63> writeBufx63;
|
sl@0
|
4908 |
size = 0;
|
sl@0
|
4909 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) //File Systems supporting size of upto 4GB-1
|
sl@0
|
4910 |
{
|
sl@0
|
4911 |
TestRFile1.SetSize(K4GBMinusOne);
|
sl@0
|
4912 |
TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
|
sl@0
|
4913 |
test(seekPos == K4GBMinusOne);
|
sl@0
|
4914 |
for (TInt count = 0; count < 0x63; count++)
|
sl@0
|
4915 |
{
|
sl@0
|
4916 |
writeBufx63.Append(count+2);
|
sl@0
|
4917 |
}
|
sl@0
|
4918 |
TestRFile1.Write(writeBufx63);
|
sl@0
|
4919 |
TestRFile1.Size(size);
|
sl@0
|
4920 |
test(size == K4GBMinusOne);
|
sl@0
|
4921 |
}
|
sl@0
|
4922 |
else
|
sl@0
|
4923 |
{ //-- the currenc file system supports files larger than 4G-1
|
sl@0
|
4924 |
TestRFile1.SetSize(K4GB+10);
|
sl@0
|
4925 |
TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
|
sl@0
|
4926 |
test(seekPos == K4GB+10);
|
sl@0
|
4927 |
for (TInt count = 0; count < 0x63; count++)
|
sl@0
|
4928 |
{
|
sl@0
|
4929 |
writeBufx63.Append(count+2);
|
sl@0
|
4930 |
}
|
sl@0
|
4931 |
TestRFile1.Write(writeBufx63);
|
sl@0
|
4932 |
TestRFile1.Size(size);
|
sl@0
|
4933 |
test(size == K4GB+109);
|
sl@0
|
4934 |
TestRFile1.Read(readBufx63); // validating the content
|
sl@0
|
4935 |
}
|
sl@0
|
4936 |
|
sl@0
|
4937 |
TestRFile1.Close();
|
sl@0
|
4938 |
|
sl@0
|
4939 |
TInt r = TheFs.Delete(fileName);
|
sl@0
|
4940 |
test(r == KErrNone);
|
sl@0
|
4941 |
test.End();
|
sl@0
|
4942 |
}
|
sl@0
|
4943 |
|
sl@0
|
4944 |
/**
|
sl@0
|
4945 |
@SYMTestCaseID PBASE-T_FILE64BIT-2350
|
sl@0
|
4946 |
@SYMTestPriority High
|
sl@0
|
4947 |
@SYMTestRequirement REQ9529
|
sl@0
|
4948 |
@SYMTestType CIT
|
sl@0
|
4949 |
@SYMTestCaseDesc Test RFile64::Seek(), Read() & Write() functionality for asynchronous calls
|
sl@0
|
4950 |
|
sl@0
|
4951 |
IMPORT_C void Read(TDes8 &aDes, TRequestStatus &aStatus) const;
|
sl@0
|
4952 |
IMPORT_C void Write(const TDesC8 &aDes, TRequestStatus &aStatus);
|
sl@0
|
4953 |
@SYMTestActions
|
sl@0
|
4954 |
1) Open the large file, Set the File Size to 2GB-1
|
sl@0
|
4955 |
2) File Seek with: Mode= ESeekCurrent, position = 2GB-100
|
sl@0
|
4956 |
3) Write to a file with current position and length = 99
|
sl@0
|
4957 |
4) Seek the file: Mode= ESeekStart, position = 2GB-100
|
sl@0
|
4958 |
5) Read a file with current position and length =99
|
sl@0
|
4959 |
6) Compare the read data with written data
|
sl@0
|
4960 |
7) Seek the file: Mode = ESeekEnd
|
sl@0
|
4961 |
8) Write to a file with current position and length =99
|
sl@0
|
4962 |
9) Set the file size to 4GB-1
|
sl@0
|
4963 |
10)Check for FAT32 File system. Seek the file: Mode = ESeekEnd
|
sl@0
|
4964 |
11)Write to a file with current position and length =99
|
sl@0
|
4965 |
12)If NGFS is supported, Set the file size to 4GB+10
|
sl@0
|
4966 |
13)Seek the file: Mode = ESeekEnd
|
sl@0
|
4967 |
14)Write to a file with current position and length =99
|
sl@0
|
4968 |
@SYMTestExpectedResults
|
sl@0
|
4969 |
1) KErrNone, open is successful
|
sl@0
|
4970 |
2) KErrNone, Seek Position = 2GB-100
|
sl@0
|
4971 |
3) KErrNone, write is successful
|
sl@0
|
4972 |
4) KErrNone, Seek Position = 2GB-100
|
sl@0
|
4973 |
5) KErrNone, read is successful
|
sl@0
|
4974 |
6) Read data == written data
|
sl@0
|
4975 |
7) KErrNone
|
sl@0
|
4976 |
8) KErrNone, write is successful
|
sl@0
|
4977 |
9) KErrNone
|
sl@0
|
4978 |
10)KErrNone
|
sl@0
|
4979 |
11)
|
sl@0
|
4980 |
12)KErrNone
|
sl@0
|
4981 |
13)KErrNone
|
sl@0
|
4982 |
14)KErrNone
|
sl@0
|
4983 |
@SYMTestStatus Implemented
|
sl@0
|
4984 |
*/
|
sl@0
|
4985 |
void TestSeekAsyncReadWrite()
|
sl@0
|
4986 |
{
|
sl@0
|
4987 |
TBuf8<0x63> readBuf;
|
sl@0
|
4988 |
TBuf8<0x63> writeBuf;
|
sl@0
|
4989 |
TInt count;
|
sl@0
|
4990 |
TFileName fileName;
|
sl@0
|
4991 |
fileName.Append(gDriveToTest);
|
sl@0
|
4992 |
fileName.Append(KTestPath);
|
sl@0
|
4993 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
4994 |
|
sl@0
|
4995 |
test.Start(_L("Test RFile64::Seek(), RFile64::Read() & RFile64::Write() for Asynchronous calls\n"));
|
sl@0
|
4996 |
|
sl@0
|
4997 |
TestRFile1.Replace(fileName,EFileWrite|EFileShareAny);
|
sl@0
|
4998 |
|
sl@0
|
4999 |
for (count = 0; count < 0x63; count++)
|
sl@0
|
5000 |
{
|
sl@0
|
5001 |
writeBuf.Append(count);
|
sl@0
|
5002 |
}
|
sl@0
|
5003 |
|
sl@0
|
5004 |
test.Next(_L("Single file tests"));
|
sl@0
|
5005 |
TestRFile1.SetSize(K2GBMinusOne);
|
sl@0
|
5006 |
TInt64 seekPos = K2GBMinus100;
|
sl@0
|
5007 |
TestRFile1.Seek(ESeekCurrent,seekPos);
|
sl@0
|
5008 |
seekPos = 0;
|
sl@0
|
5009 |
TestRFile1.Seek(ESeekCurrent,seekPos);
|
sl@0
|
5010 |
test(seekPos == K2GBMinus100);
|
sl@0
|
5011 |
|
sl@0
|
5012 |
TRequestStatus status1 = KRequestPending;
|
sl@0
|
5013 |
TestRFile1.Write(writeBuf,status1); // Write 99 bytes of data to a file
|
sl@0
|
5014 |
seekPos = 0;
|
sl@0
|
5015 |
TestRFile1.Seek(ESeekCurrent,seekPos);
|
sl@0
|
5016 |
test(seekPos == K2GBMinusOne);
|
sl@0
|
5017 |
seekPos = K2GBMinus100;
|
sl@0
|
5018 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
5019 |
TRequestStatus status2 = KRequestPending;
|
sl@0
|
5020 |
TestRFile1.Read(readBuf, status2);
|
sl@0
|
5021 |
test(writeBuf == readBuf); // Written data == Read data
|
sl@0
|
5022 |
|
sl@0
|
5023 |
TBuf8<0x63> writeBuf99;
|
sl@0
|
5024 |
TBuf8<0x63> readBuf99;
|
sl@0
|
5025 |
TInt64 size = 0;
|
sl@0
|
5026 |
TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
|
sl@0
|
5027 |
test(seekPos == K2GBMinusOne);
|
sl@0
|
5028 |
for (count = 0; count < 0x63; count++)
|
sl@0
|
5029 |
{
|
sl@0
|
5030 |
writeBuf99.Append(count+1);
|
sl@0
|
5031 |
}
|
sl@0
|
5032 |
TRequestStatus status3 = KRequestPending;
|
sl@0
|
5033 |
TestRFile1.Write(writeBuf99, status3);
|
sl@0
|
5034 |
seekPos = K2GBMinusOne;
|
sl@0
|
5035 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
5036 |
TRequestStatus status4 = KRequestPending;
|
sl@0
|
5037 |
TestRFile1.Read(readBuf99, status4);
|
sl@0
|
5038 |
test(writeBuf99 == readBuf99); // Written data == Read data
|
sl@0
|
5039 |
// Query Size
|
sl@0
|
5040 |
TestRFile1.Size(size);
|
sl@0
|
5041 |
test(size == K2GBPlus98); // Validate the file size
|
sl@0
|
5042 |
|
sl@0
|
5043 |
TBuf8<0x63> readBufx63;
|
sl@0
|
5044 |
TBuf8<0x63> writeBufx63;
|
sl@0
|
5045 |
size = 0;
|
sl@0
|
5046 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)//File Systems supporting size of upto 4GB-1
|
sl@0
|
5047 |
{
|
sl@0
|
5048 |
TestRFile1.SetSize(K4GBMinusOne);
|
sl@0
|
5049 |
TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
|
sl@0
|
5050 |
test(seekPos == K4GBMinusOne);
|
sl@0
|
5051 |
for (TInt count = 0; count < 0x63; count++)
|
sl@0
|
5052 |
{
|
sl@0
|
5053 |
writeBufx63.Append(count+2);
|
sl@0
|
5054 |
}
|
sl@0
|
5055 |
TRequestStatus status5 = KRequestPending;
|
sl@0
|
5056 |
TestRFile1.Write(writeBufx63, status5);
|
sl@0
|
5057 |
TestRFile1.Size(size);
|
sl@0
|
5058 |
test(size == K4GBMinusOne);
|
sl@0
|
5059 |
}
|
sl@0
|
5060 |
else
|
sl@0
|
5061 |
{
|
sl@0
|
5062 |
TestRFile1.SetSize(K4GB+10);
|
sl@0
|
5063 |
TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
|
sl@0
|
5064 |
test(seekPos == K4GB+10);
|
sl@0
|
5065 |
for (TInt count = 0; count < 0x63; count++)
|
sl@0
|
5066 |
{
|
sl@0
|
5067 |
writeBufx63.Append(count+2);
|
sl@0
|
5068 |
}
|
sl@0
|
5069 |
TRequestStatus status7 = KRequestPending;
|
sl@0
|
5070 |
TestRFile1.Write(writeBufx63, status7);
|
sl@0
|
5071 |
TestRFile1.Size(size);
|
sl@0
|
5072 |
test(size == K4GB+109);
|
sl@0
|
5073 |
TRequestStatus status8 = KRequestPending;;
|
sl@0
|
5074 |
TestRFile1.Read(readBufx63, status8); // validating the content
|
sl@0
|
5075 |
}
|
sl@0
|
5076 |
TestRFile1.Close();
|
sl@0
|
5077 |
|
sl@0
|
5078 |
TInt r = TheFs.Delete(fileName);
|
sl@0
|
5079 |
test(r == KErrNone);
|
sl@0
|
5080 |
test.End();
|
sl@0
|
5081 |
}
|
sl@0
|
5082 |
|
sl@0
|
5083 |
/**
|
sl@0
|
5084 |
@SYMTestCaseID PBASE-T_FILE64BIT-2351
|
sl@0
|
5085 |
@SYMTestPriority High
|
sl@0
|
5086 |
@SYMTestRequirement REQ9529
|
sl@0
|
5087 |
@SYMTestType CIT
|
sl@0
|
5088 |
@SYMTestCaseDesc Test RFile64::Seek(), Read() & Write() functionality for synchronous calls with length
|
sl@0
|
5089 |
|
sl@0
|
5090 |
IMPORT_C TInt Read(TDes8 &aDes, TInt aLength) const;
|
sl@0
|
5091 |
IMPORT_C TInt Write(const TDesC8 &aDes, TInt aLength);
|
sl@0
|
5092 |
@SYMTestActions
|
sl@0
|
5093 |
1) Open the large file, Set the File Size to 2GB-1
|
sl@0
|
5094 |
2) File Seek with: Mode= ESeekCurrent, position = 2GB-100
|
sl@0
|
5095 |
3) Write to a file with current position and length = 99
|
sl@0
|
5096 |
4) Seek the file: Mode= ESeekStart, position = 2GB-100
|
sl@0
|
5097 |
5) Read a file with current position and length =99
|
sl@0
|
5098 |
6) Compare the read data with written data
|
sl@0
|
5099 |
7) Seek the file: Mode = ESeekEnd
|
sl@0
|
5100 |
8) Write to a file with current position and length =99
|
sl@0
|
5101 |
9) Set the file size to 4GB-1
|
sl@0
|
5102 |
10)Check for FAT32 File system. Seek the file: Mode = ESeekEnd
|
sl@0
|
5103 |
11)Write to a file with current position and length =99
|
sl@0
|
5104 |
12)If NGFS is supported, Set the file size to 4GB+10
|
sl@0
|
5105 |
13)Seek the file: Mode = ESeekEnd
|
sl@0
|
5106 |
14)Write to a file with current position and length =99
|
sl@0
|
5107 |
@SYMTestExpectedResults
|
sl@0
|
5108 |
1) KErrNone, open is successful
|
sl@0
|
5109 |
2) KErrNone, Seek Position = 2GB-100
|
sl@0
|
5110 |
3) KErrNone, write is successful
|
sl@0
|
5111 |
4) KErrNone, Seek Position = 2GB-100
|
sl@0
|
5112 |
5) KErrNone, read is successful
|
sl@0
|
5113 |
6) Read data == written data
|
sl@0
|
5114 |
7) KErrNone
|
sl@0
|
5115 |
8) KErrNone, write is successful
|
sl@0
|
5116 |
9) KErrNone
|
sl@0
|
5117 |
10)KErrNone
|
sl@0
|
5118 |
11)
|
sl@0
|
5119 |
12)KErrNone
|
sl@0
|
5120 |
13)KErrNone
|
sl@0
|
5121 |
14)KErrNone
|
sl@0
|
5122 |
@SYMTestStatus Implemented
|
sl@0
|
5123 |
*/
|
sl@0
|
5124 |
void TestSeekReadWriteLen()
|
sl@0
|
5125 |
{
|
sl@0
|
5126 |
TBuf8<0x63> readBuf;
|
sl@0
|
5127 |
TBuf8<0x63> writeBuf;
|
sl@0
|
5128 |
TInt count;
|
sl@0
|
5129 |
TFileName fileName;
|
sl@0
|
5130 |
fileName.Append(gDriveToTest);
|
sl@0
|
5131 |
fileName.Append(KTestPath);
|
sl@0
|
5132 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
5133 |
|
sl@0
|
5134 |
test.Start(_L("Test RFile64::Seek(), RFile64::Read() & RFile64::Write() with Length\n"));
|
sl@0
|
5135 |
|
sl@0
|
5136 |
TestRFile1.Replace(fileName,EFileWrite|EFileShareAny);
|
sl@0
|
5137 |
|
sl@0
|
5138 |
for (count = 0; count < 0x63; count++)
|
sl@0
|
5139 |
{
|
sl@0
|
5140 |
writeBuf.Append(count);
|
sl@0
|
5141 |
}
|
sl@0
|
5142 |
|
sl@0
|
5143 |
test.Next(_L("Single file tests"));
|
sl@0
|
5144 |
|
sl@0
|
5145 |
test.Next(_L("Open the large file, Set the File Size to 2GB-1\n"));
|
sl@0
|
5146 |
TestRFile1.SetSize(K2GBMinusOne);
|
sl@0
|
5147 |
|
sl@0
|
5148 |
test.Next(_L("File Seek with: Mode= ESeekCurrent, position = 2GB-100\n"));
|
sl@0
|
5149 |
TInt64 seekPos = K2GBMinus100;
|
sl@0
|
5150 |
TestRFile1.Seek(ESeekCurrent,seekPos);
|
sl@0
|
5151 |
seekPos = 0;
|
sl@0
|
5152 |
TestRFile1.Seek(ESeekCurrent,seekPos);
|
sl@0
|
5153 |
test(seekPos == K2GBMinus100);
|
sl@0
|
5154 |
|
sl@0
|
5155 |
test.Next(_L("Write to a file with current position and length = 99\n"));
|
sl@0
|
5156 |
TestRFile1.Write(writeBuf, 99); // Write 99 bytes of data to a file
|
sl@0
|
5157 |
seekPos = 0;
|
sl@0
|
5158 |
TestRFile1.Seek(ESeekCurrent,seekPos);
|
sl@0
|
5159 |
test(seekPos == K2GBMinusOne);
|
sl@0
|
5160 |
|
sl@0
|
5161 |
test.Next(_L("Seek the file: Mode= ESeekStart, position = 2GB-100\n"));
|
sl@0
|
5162 |
seekPos = K2GBMinus100;
|
sl@0
|
5163 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
5164 |
|
sl@0
|
5165 |
test.Next(_L("Read a file with current position and length =99\n"));
|
sl@0
|
5166 |
TestRFile1.Read(readBuf, 99);
|
sl@0
|
5167 |
|
sl@0
|
5168 |
test.Next(_L("Compare the read data with written data\n"));
|
sl@0
|
5169 |
test(writeBuf == readBuf); // Written data == Read data
|
sl@0
|
5170 |
|
sl@0
|
5171 |
test.Next(_L("Seek the file: Mode = ESeekEnd\n"));
|
sl@0
|
5172 |
TBuf8<0x63> writeBuf99;
|
sl@0
|
5173 |
TBuf8<0x63> readBuf99;
|
sl@0
|
5174 |
TInt64 size = 0;
|
sl@0
|
5175 |
TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
|
sl@0
|
5176 |
test(seekPos == K2GBMinusOne);
|
sl@0
|
5177 |
|
sl@0
|
5178 |
test.Next(_L("Write to a file with current position and length =99\n"));
|
sl@0
|
5179 |
for (count = 0; count < 0x63; count++)
|
sl@0
|
5180 |
{
|
sl@0
|
5181 |
writeBuf99.Append(count+1);
|
sl@0
|
5182 |
}
|
sl@0
|
5183 |
TestRFile1.Write(writeBuf99, 99);
|
sl@0
|
5184 |
seekPos = K2GBMinusOne;
|
sl@0
|
5185 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
5186 |
TestRFile1.Read(readBuf99, 99);
|
sl@0
|
5187 |
test(writeBuf99 == readBuf99); // Written data == Read data
|
sl@0
|
5188 |
// Query Size
|
sl@0
|
5189 |
TestRFile1.Size(size);
|
sl@0
|
5190 |
test(size == K2GBPlus98); // Validate the file size
|
sl@0
|
5191 |
|
sl@0
|
5192 |
TBuf8<0x63> readBufx63;
|
sl@0
|
5193 |
TBuf8<0x63> writeBufx63;
|
sl@0
|
5194 |
size = 0;
|
sl@0
|
5195 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse)//File Systems supporting size of upto 4GB-1
|
sl@0
|
5196 |
{
|
sl@0
|
5197 |
TestRFile1.SetSize(K4GBMinusOne);
|
sl@0
|
5198 |
TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
|
sl@0
|
5199 |
test(seekPos == K4GBMinusOne);
|
sl@0
|
5200 |
for (TInt count = 0; count < 0x63; count++)
|
sl@0
|
5201 |
{
|
sl@0
|
5202 |
writeBufx63.Append(count+2);
|
sl@0
|
5203 |
}
|
sl@0
|
5204 |
TestRFile1.Write(writeBufx63, 99);
|
sl@0
|
5205 |
TestRFile1.Size(size);
|
sl@0
|
5206 |
test(size == K4GBMinusOne);
|
sl@0
|
5207 |
}
|
sl@0
|
5208 |
else
|
sl@0
|
5209 |
{
|
sl@0
|
5210 |
TestRFile1.SetSize(K4GB+10);
|
sl@0
|
5211 |
TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
|
sl@0
|
5212 |
test(seekPos == K4GB+10);
|
sl@0
|
5213 |
for (TInt count = 0; count < 0x63; count++)
|
sl@0
|
5214 |
{
|
sl@0
|
5215 |
writeBufx63.Append(count+2);
|
sl@0
|
5216 |
}
|
sl@0
|
5217 |
TestRFile1.Write(writeBufx63, 99);
|
sl@0
|
5218 |
TestRFile1.Size(size);
|
sl@0
|
5219 |
test(size == K4GB+109);
|
sl@0
|
5220 |
TestRFile1.Read(readBufx63, 99); // validating the content
|
sl@0
|
5221 |
}
|
sl@0
|
5222 |
|
sl@0
|
5223 |
TestRFile1.Close();
|
sl@0
|
5224 |
|
sl@0
|
5225 |
TInt r = TheFs.Delete(fileName);
|
sl@0
|
5226 |
test(r == KErrNone);
|
sl@0
|
5227 |
test.End();
|
sl@0
|
5228 |
}
|
sl@0
|
5229 |
/**
|
sl@0
|
5230 |
@SYMTestCaseID PBASE-T_FILE64BIT-2352
|
sl@0
|
5231 |
@SYMTestPriority High
|
sl@0
|
5232 |
@SYMTestRequirement REQ9529
|
sl@0
|
5233 |
@SYMTestType CIT
|
sl@0
|
5234 |
@SYMTestCaseDesc Test RFile64::Seek(), Read() & Write() functionality for asynchronous calls with length
|
sl@0
|
5235 |
IMPORT_C void Read(TDes8 &aDes, TRequestStatus &aStatus) const;
|
sl@0
|
5236 |
IMPORT_C void Write(const TDesC8 &aDes, TRequestStatus &aStatus);
|
sl@0
|
5237 |
@SYMTestActions
|
sl@0
|
5238 |
1) Open the large file, Set the File Size to 2GB-1
|
sl@0
|
5239 |
2) File Seek with: Mode= ESeekCurrent, position = 2GB-100
|
sl@0
|
5240 |
3) Write to a file with current position and length = 99
|
sl@0
|
5241 |
4) Seek the file: Mode= ESeekStart, position = 2GB-100
|
sl@0
|
5242 |
5) Read a file with current position and length =99
|
sl@0
|
5243 |
6) Compare the read data with written data
|
sl@0
|
5244 |
7) Seek the file: Mode = ESeekEnd
|
sl@0
|
5245 |
8) Write to a file with current position and length =99
|
sl@0
|
5246 |
9) Set the file size to 4GB-1
|
sl@0
|
5247 |
10)Check for FAT32 File system. Seek the file: Mode = ESeekEnd
|
sl@0
|
5248 |
11)Write to a file with current position and length =99
|
sl@0
|
5249 |
12)If NGFS is supported, Set the file size to 4GB+10
|
sl@0
|
5250 |
13)Seek the file: Mode = ESeekEnd
|
sl@0
|
5251 |
14)Write to a file with current position and length =99
|
sl@0
|
5252 |
@SYMTestExpectedResults
|
sl@0
|
5253 |
1) KErrNone, open is successful
|
sl@0
|
5254 |
2) KErrNone, Seek Position = 2GB-100
|
sl@0
|
5255 |
3) KErrNone, write is successful
|
sl@0
|
5256 |
4) KErrNone, Seek Position = 2GB-100
|
sl@0
|
5257 |
5) KErrNone, read is successful
|
sl@0
|
5258 |
6) Read data == written data
|
sl@0
|
5259 |
7) KErrNone
|
sl@0
|
5260 |
8) KErrNone, write is successful
|
sl@0
|
5261 |
9) KErrNone
|
sl@0
|
5262 |
10)KErrNone
|
sl@0
|
5263 |
11)
|
sl@0
|
5264 |
12)KErrNone
|
sl@0
|
5265 |
13)KErrNone
|
sl@0
|
5266 |
14)KErrNone
|
sl@0
|
5267 |
@SYMTestStatus Implemented
|
sl@0
|
5268 |
*/
|
sl@0
|
5269 |
|
sl@0
|
5270 |
void TestSeekAsyncReadWriteLen()
|
sl@0
|
5271 |
{
|
sl@0
|
5272 |
TBuf8<0x63> readBuf;
|
sl@0
|
5273 |
TBuf8<0x63> writeBuf;
|
sl@0
|
5274 |
TInt count;
|
sl@0
|
5275 |
TFileName fileName;
|
sl@0
|
5276 |
fileName.Append(gDriveToTest);
|
sl@0
|
5277 |
fileName.Append(KTestPath);
|
sl@0
|
5278 |
fileName.Append(_L("File4GBMinusOne.txt"));
|
sl@0
|
5279 |
|
sl@0
|
5280 |
|
sl@0
|
5281 |
test.Start(_L("Test RFile64::Seek, RFile64::Read & RFile64::Write\n"));
|
sl@0
|
5282 |
|
sl@0
|
5283 |
test.Next(_L("Open the large file, Set the File Size to 2GB-1\n"));
|
sl@0
|
5284 |
TestRFile1.Replace(fileName,EFileWrite|EFileShareAny);
|
sl@0
|
5285 |
|
sl@0
|
5286 |
for (count = 0; count < 0x63; count++)
|
sl@0
|
5287 |
{
|
sl@0
|
5288 |
writeBuf.Append(count);
|
sl@0
|
5289 |
}
|
sl@0
|
5290 |
|
sl@0
|
5291 |
test.Next(_L("Single file tests"));
|
sl@0
|
5292 |
TestRFile1.SetSize(K2GBMinusOne);
|
sl@0
|
5293 |
|
sl@0
|
5294 |
test.Next(_L("File Seek with: Mode= ESeekCurrent, position = 2GB-100\n"));
|
sl@0
|
5295 |
TInt64 seekPos = K2GBMinus100;
|
sl@0
|
5296 |
TestRFile1.Seek(ESeekCurrent,seekPos);
|
sl@0
|
5297 |
seekPos = 0;
|
sl@0
|
5298 |
TestRFile1.Seek(ESeekCurrent,seekPos);
|
sl@0
|
5299 |
test(seekPos == K2GBMinus100);
|
sl@0
|
5300 |
|
sl@0
|
5301 |
test.Next(_L("Write to a file with current position and length = 99"));
|
sl@0
|
5302 |
TRequestStatus status1 = KRequestPending;
|
sl@0
|
5303 |
TestRFile1.Write(writeBuf,99,status1); // Write 99 bytes of data to a file
|
sl@0
|
5304 |
|
sl@0
|
5305 |
test.Next(_L("Seek the file: Mode= ESeekStart, position = 2GB-100\n"));
|
sl@0
|
5306 |
seekPos = 0;
|
sl@0
|
5307 |
TestRFile1.Seek(ESeekCurrent,seekPos);
|
sl@0
|
5308 |
test(seekPos == K2GBMinusOne);
|
sl@0
|
5309 |
seekPos = K2GBMinus100;
|
sl@0
|
5310 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
5311 |
|
sl@0
|
5312 |
test.Next(_L("Read a file with current position and length =99\n"));
|
sl@0
|
5313 |
TRequestStatus status2 = KRequestPending;
|
sl@0
|
5314 |
TestRFile1.Read(readBuf,99,status2);
|
sl@0
|
5315 |
|
sl@0
|
5316 |
test.Next(_L("Compare the read data with written data\n"));
|
sl@0
|
5317 |
test(writeBuf == readBuf); // Written data == Read data
|
sl@0
|
5318 |
|
sl@0
|
5319 |
test.Next(_L("Seek the file: Mode = ESeekEnd\n"));
|
sl@0
|
5320 |
TBuf8<0x63> writeBuf99;
|
sl@0
|
5321 |
TBuf8<0x63> readBuf99;
|
sl@0
|
5322 |
TInt64 size = 0;
|
sl@0
|
5323 |
TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
|
sl@0
|
5324 |
test(seekPos == K2GBMinusOne);
|
sl@0
|
5325 |
for (count = 0; count < 0x63; count++)
|
sl@0
|
5326 |
{
|
sl@0
|
5327 |
writeBuf99.Append(count+1);
|
sl@0
|
5328 |
}
|
sl@0
|
5329 |
|
sl@0
|
5330 |
test.Next(_L("Write to a file with current position and length =99\n"));
|
sl@0
|
5331 |
TRequestStatus status3 = KRequestPending;
|
sl@0
|
5332 |
TestRFile1.Write(writeBuf99,99,status3);
|
sl@0
|
5333 |
seekPos = K2GBMinusOne;
|
sl@0
|
5334 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
5335 |
TRequestStatus status4 = KRequestPending;
|
sl@0
|
5336 |
TestRFile1.Read(readBuf99,99,status4);
|
sl@0
|
5337 |
test(writeBuf99 == readBuf99); // Written data == Read data
|
sl@0
|
5338 |
// Query Size
|
sl@0
|
5339 |
TestRFile1.Size(size);
|
sl@0
|
5340 |
test(size == K2GBPlus98); // Validate the file size
|
sl@0
|
5341 |
|
sl@0
|
5342 |
TBuf8<0x63> readBufx63;
|
sl@0
|
5343 |
TBuf8<0x63> writeBufx63;
|
sl@0
|
5344 |
size = 0;
|
sl@0
|
5345 |
if(KFileSizeMaxLargerThan4GBMinusOne == EFalse) //File Systems supporting size of upto 4GB-1
|
sl@0
|
5346 |
{
|
sl@0
|
5347 |
test.Next(_L("Set the file size to 4GB-1\n"));
|
sl@0
|
5348 |
TestRFile1.SetSize(K4GBMinusOne);
|
sl@0
|
5349 |
TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
|
sl@0
|
5350 |
test(seekPos == K4GBMinusOne);
|
sl@0
|
5351 |
for (TInt count = 0; count < 0x63; count++)
|
sl@0
|
5352 |
{
|
sl@0
|
5353 |
writeBufx63.Append(count+2);
|
sl@0
|
5354 |
}
|
sl@0
|
5355 |
TRequestStatus status5 = KRequestPending;
|
sl@0
|
5356 |
TestRFile1.Write(writeBufx63,99,status5);
|
sl@0
|
5357 |
TestRFile1.Size(size);
|
sl@0
|
5358 |
test(size == K4GBMinusOne);
|
sl@0
|
5359 |
}
|
sl@0
|
5360 |
else
|
sl@0
|
5361 |
{
|
sl@0
|
5362 |
TestRFile1.SetSize(K4GB+10);
|
sl@0
|
5363 |
TestRFile1.Seek(ESeekEnd,seekPos); // Seek to end
|
sl@0
|
5364 |
test(seekPos == K4GB+10);
|
sl@0
|
5365 |
for (TInt count = 0; count < 0x63; count++)
|
sl@0
|
5366 |
{
|
sl@0
|
5367 |
writeBufx63.Append(count+2);
|
sl@0
|
5368 |
}
|
sl@0
|
5369 |
TRequestStatus status7 = KRequestPending;
|
sl@0
|
5370 |
TestRFile1.Write(writeBufx63,99,status7);
|
sl@0
|
5371 |
TestRFile1.Size(size);
|
sl@0
|
5372 |
test(size == K4GB+109);
|
sl@0
|
5373 |
TRequestStatus status8 = KRequestPending;;
|
sl@0
|
5374 |
TestRFile1.Read(readBufx63,99,status8);
|
sl@0
|
5375 |
}
|
sl@0
|
5376 |
TestRFile1.Close();
|
sl@0
|
5377 |
TInt r = TheFs.Delete(fileName);
|
sl@0
|
5378 |
test(r == KErrNone);
|
sl@0
|
5379 |
test.End();
|
sl@0
|
5380 |
}
|
sl@0
|
5381 |
/**
|
sl@0
|
5382 |
@SYMTestCaseID PBASE-T_FILE64BIT-2353
|
sl@0
|
5383 |
@SYMTestPriority High
|
sl@0
|
5384 |
@SYMTestRequirement REQ9529
|
sl@0
|
5385 |
@SYMTestType CIT
|
sl@0
|
5386 |
@SYMTestCaseDesc Tests File resizing functionality
|
sl@0
|
5387 |
@SYMTestActions
|
sl@0
|
5388 |
1) Create a file name "test" in write mode
|
sl@0
|
5389 |
2) Generate a random file size
|
sl@0
|
5390 |
3) Set the file size using RFile64::SetSize()
|
sl@0
|
5391 |
4) Get the file size.
|
sl@0
|
5392 |
5) Seek to the file position RFile64::Size() -100 & File position >0
|
sl@0
|
5393 |
6) Write 99 bytes to the current file position
|
sl@0
|
5394 |
7) Read from the current file position.
|
sl@0
|
5395 |
8) Compare the file read with written data.
|
sl@0
|
5396 |
9) Repeat step 2 to 8 for <10> times in a loop.
|
sl@0
|
5397 |
10) Close the file
|
sl@0
|
5398 |
@SYMTestExpectedResults
|
sl@0
|
5399 |
1) File create successfully.
|
sl@0
|
5400 |
2) Ramdom file size generated.
|
sl@0
|
5401 |
3) File size set successfully.
|
sl@0
|
5402 |
4) File size = Random file size set.
|
sl@0
|
5403 |
5) File seek successful.
|
sl@0
|
5404 |
6) File write successful with KErrNone.
|
sl@0
|
5405 |
7) File read successful with KErrNone.
|
sl@0
|
5406 |
8) Read data == Written data.
|
sl@0
|
5407 |
9) Expect result same as step 2 to 8.
|
sl@0
|
5408 |
10) File closed successfully.
|
sl@0
|
5409 |
@SYMTestStatus Implemented
|
sl@0
|
5410 |
*/
|
sl@0
|
5411 |
void TestFileReSize()
|
sl@0
|
5412 |
{
|
sl@0
|
5413 |
TInt64 seed = K4GBMinusOne;
|
sl@0
|
5414 |
TBuf8<0x63> readBuf;
|
sl@0
|
5415 |
TBuf8<0x63> writeBuf;
|
sl@0
|
5416 |
TFileName fileName;
|
sl@0
|
5417 |
fileName.Append(gDriveToTest);
|
sl@0
|
5418 |
fileName.Append(KTestPath);
|
sl@0
|
5419 |
fileName.Append(_L("test.txt"));
|
sl@0
|
5420 |
for (TInt count = 0; count < 0x63; count++)
|
sl@0
|
5421 |
{
|
sl@0
|
5422 |
writeBuf.Append(count);
|
sl@0
|
5423 |
}
|
sl@0
|
5424 |
test.Next(_L("Create a file name test in write mode\n"));
|
sl@0
|
5425 |
TestRFile1.Replace(fileName, EFileWrite);
|
sl@0
|
5426 |
TInt randSize;
|
sl@0
|
5427 |
TInt64 size;
|
sl@0
|
5428 |
for (TInt i = 0; i<10; i++)
|
sl@0
|
5429 |
{
|
sl@0
|
5430 |
test.Next(_L("Generate a random file size\n"));
|
sl@0
|
5431 |
randSize = Math::Rand(seed);
|
sl@0
|
5432 |
|
sl@0
|
5433 |
test.Next(_L("Set the file size using RFile64::SetSize()\n"));
|
sl@0
|
5434 |
TestRFile1.SetSize(randSize);
|
sl@0
|
5435 |
|
sl@0
|
5436 |
test.Next(_L("Get the file size.\n"));
|
sl@0
|
5437 |
TestRFile1.Size(size);
|
sl@0
|
5438 |
test(randSize == size);
|
sl@0
|
5439 |
|
sl@0
|
5440 |
test.Next(_L("Seek to the file position RFile64::Size() -100 & File position >0\n"));
|
sl@0
|
5441 |
TInt64 seekPos = size - 100;
|
sl@0
|
5442 |
if(size>100) //carry out tests for file sizes greater than 100 bytes
|
sl@0
|
5443 |
{
|
sl@0
|
5444 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
5445 |
TRequestStatus status1 = KRequestPending;
|
sl@0
|
5446 |
|
sl@0
|
5447 |
test.Next(_L("Write 99 bytes to the current file position\n"));
|
sl@0
|
5448 |
TestRFile1.Write(writeBuf,99,status1); // Write 99 bytes of data to a file
|
sl@0
|
5449 |
TestRFile1.Seek(ESeekStart,seekPos);
|
sl@0
|
5450 |
|
sl@0
|
5451 |
|
sl@0
|
5452 |
test.Next(_L("Read from the current file position.\n"));
|
sl@0
|
5453 |
TRequestStatus status2 = KRequestPending;
|
sl@0
|
5454 |
|
sl@0
|
5455 |
test.Next(_L("Compare the file read with written data.\n"));
|
sl@0
|
5456 |
TestRFile1.Read(readBuf,99,status2);
|
sl@0
|
5457 |
test(writeBuf == readBuf); // Written data == Read data
|
sl@0
|
5458 |
}
|
sl@0
|
5459 |
}
|
sl@0
|
5460 |
TestRFile1.Close();
|
sl@0
|
5461 |
TInt r = TheFs.Delete(fileName);
|
sl@0
|
5462 |
test(r == KErrNone);
|
sl@0
|
5463 |
}
|
sl@0
|
5464 |
/**
|
sl@0
|
5465 |
@SYMTestCaseID PBASE-T_FILE64BIT-2354
|
sl@0
|
5466 |
@SYMTestPriority High
|
sl@0
|
5467 |
@SYMTestRequirement REQ9532
|
sl@0
|
5468 |
@SYMTestType CIT
|
sl@0
|
5469 |
@SYMTestCaseDesc Tests for copying a directory containing large files using CFileMan::Copy()
|
sl@0
|
5470 |
@SYMTestActions
|
sl@0
|
5471 |
1) Create one large file in the specified test path
|
sl@0
|
5472 |
2) Set the file size to 3GB-4KB
|
sl@0
|
5473 |
3) Seek to the end of the file
|
sl@0
|
5474 |
4) Check the seek position
|
sl@0
|
5475 |
5) Write to a file with position = 3GB-4KB and length = 4KB
|
sl@0
|
5476 |
6) Get the file size
|
sl@0
|
5477 |
7) Create 3 small files in the specified test path
|
sl@0
|
5478 |
8) Write 10 bytes to the created files
|
sl@0
|
5479 |
9) Copy the files from one folder to another using CFileMan::Copy()
|
sl@0
|
5480 |
10)Get the directory entry and find how many files are copied
|
sl@0
|
5481 |
11)Set file man observer
|
sl@0
|
5482 |
12)Copy the files from one folder to another, source folder has 3 small files and a large file
|
sl@0
|
5483 |
13)Check observer for number of successful copy and failed copy
|
sl@0
|
5484 |
14)Get the directory entry and find how many files copied
|
sl@0
|
5485 |
@SYMTestExpectedResults
|
sl@0
|
5486 |
1) KErrNone, file created successfully
|
sl@0
|
5487 |
2) KErrNone
|
sl@0
|
5488 |
3) KErrNone
|
sl@0
|
5489 |
4) Seek position = 3GB-4KB
|
sl@0
|
5490 |
5) KErrNone, write is successful
|
sl@0
|
5491 |
6) File size = 3GB
|
sl@0
|
5492 |
7) KErrNone, 3 small files created successfully
|
sl@0
|
5493 |
8) KErrNone, write is successful
|
sl@0
|
5494 |
9) KErrNone, copy is successful
|
sl@0
|
5495 |
10)4 files copied successfully
|
sl@0
|
5496 |
11)KErrNone
|
sl@0
|
5497 |
12)KErrNone, copy is successful
|
sl@0
|
5498 |
13)Number of success file copy = 4, Failed = 0
|
sl@0
|
5499 |
14)4 files copied successfully
|
sl@0
|
5500 |
@SYMTestStatus Implemented
|
sl@0
|
5501 |
*/
|
sl@0
|
5502 |
|
sl@0
|
5503 |
void TestCopyDirectory()
|
sl@0
|
5504 |
{
|
sl@0
|
5505 |
test.Next(_L("Copy a directory containing large files"));
|
sl@0
|
5506 |
CFileMan* fileMan = CFileMan::NewL(TheFs);
|
sl@0
|
5507 |
test(fileMan != NULL);
|
sl@0
|
5508 |
|
sl@0
|
5509 |
CFileManObserver* observer = new CFileManObserver(fileMan);
|
sl@0
|
5510 |
test(observer != NULL);
|
sl@0
|
5511 |
|
sl@0
|
5512 |
TPath filePathOld;
|
sl@0
|
5513 |
filePathOld.Append(gDriveToTest);
|
sl@0
|
5514 |
filePathOld.Append(KTestPath);
|
sl@0
|
5515 |
|
sl@0
|
5516 |
|
sl@0
|
5517 |
TPath filePathNew;
|
sl@0
|
5518 |
filePathNew.Append(gDriveToTest);
|
sl@0
|
5519 |
filePathNew.Append(_L(":\\TEST\\"));
|
sl@0
|
5520 |
|
sl@0
|
5521 |
|
sl@0
|
5522 |
// create some small files in the source directory
|
sl@0
|
5523 |
// so that there is a combination of small files and one large files
|
sl@0
|
5524 |
RDir dir;
|
sl@0
|
5525 |
TEntryArray entryArray;
|
sl@0
|
5526 |
|
sl@0
|
5527 |
TFileName fileLarge1;
|
sl@0
|
5528 |
fileLarge1.Append(gDriveToTest);
|
sl@0
|
5529 |
fileLarge1.Append(KTestPath);
|
sl@0
|
5530 |
fileLarge1.Append(_L("FileLargeOne.txt"));
|
sl@0
|
5531 |
|
sl@0
|
5532 |
test.Next(_L(" Create one large file in the specified test path\n"));
|
sl@0
|
5533 |
TestRFile1.Replace(fileLarge1, EFileWrite | EFileShareAny);
|
sl@0
|
5534 |
|
sl@0
|
5535 |
|
sl@0
|
5536 |
test.Next(_L("Set the file size to 3GB-4KB\n"));
|
sl@0
|
5537 |
TestRFile1.SetSize(K3GB-K4KB);
|
sl@0
|
5538 |
TInt64 size1 = 0;
|
sl@0
|
5539 |
TestRFile1.Size(size1);
|
sl@0
|
5540 |
|
sl@0
|
5541 |
test.Next(_L("Seek to the end of the file\n"));
|
sl@0
|
5542 |
TInt64 seekPos = 0;
|
sl@0
|
5543 |
TestRFile1.Seek(ESeekEnd,seekPos);
|
sl@0
|
5544 |
test(seekPos == K3GB-K4KB);
|
sl@0
|
5545 |
|
sl@0
|
5546 |
test.Next(_L("Write to a file with position = 3GB-4KB and length = 4KB\n"));
|
sl@0
|
5547 |
TBuf8<4096> writeBufK4KB;
|
sl@0
|
5548 |
for (TInt count = 0; count < 4096; count++)
|
sl@0
|
5549 |
{
|
sl@0
|
5550 |
writeBufK4KB.Append(count+1);
|
sl@0
|
5551 |
}
|
sl@0
|
5552 |
TestRFile1.Write(seekPos, writeBufK4KB, writeBufK4KB.Length());
|
sl@0
|
5553 |
TestRFile1.Size(size1);
|
sl@0
|
5554 |
test.Next(_L("Get the file size\n"));
|
sl@0
|
5555 |
TInt64 size = 0;
|
sl@0
|
5556 |
TestRFile1.Size(size);
|
sl@0
|
5557 |
test(size == K3GB);
|
sl@0
|
5558 |
TestRFile1.Close();
|
sl@0
|
5559 |
|
sl@0
|
5560 |
test.Next(_L("Create 3 small files in the specified test path and Write 10 bytes to the created files\n"));
|
sl@0
|
5561 |
TFileName fileSmall1;
|
sl@0
|
5562 |
fileSmall1.Append(gDriveToTest);
|
sl@0
|
5563 |
fileSmall1.Append(KTestPath);
|
sl@0
|
5564 |
fileSmall1.Append(_L("FileSmallOne.txt"));
|
sl@0
|
5565 |
|
sl@0
|
5566 |
TFileName fileSmall2;
|
sl@0
|
5567 |
fileSmall2.Append(gDriveToTest);
|
sl@0
|
5568 |
fileSmall2.Append(KTestPath);
|
sl@0
|
5569 |
fileSmall2.Append(_L("FileSmallTwo.txt"));
|
sl@0
|
5570 |
|
sl@0
|
5571 |
TFileName fileSmall3;
|
sl@0
|
5572 |
fileSmall3.Append(gDriveToTest);
|
sl@0
|
5573 |
fileSmall3.Append(KTestPath);
|
sl@0
|
5574 |
fileSmall3.Append(_L("FileSmallThree.txt"));
|
sl@0
|
5575 |
|
sl@0
|
5576 |
TestRFile1.Create(fileSmall1, EFileWrite | EFileShareAny);
|
sl@0
|
5577 |
TestRFile1.Write(_L8("1234567891"));
|
sl@0
|
5578 |
TestRFile1.Close();
|
sl@0
|
5579 |
|
sl@0
|
5580 |
TestRFile1.Create(fileSmall2, EFileWrite | EFileShareAny);
|
sl@0
|
5581 |
TestRFile1.Write(_L8("1234567891"));
|
sl@0
|
5582 |
TestRFile1.Close();
|
sl@0
|
5583 |
|
sl@0
|
5584 |
TestRFile1.Create(fileSmall3, EFileWrite | EFileShareAny);
|
sl@0
|
5585 |
TestRFile1.Write(_L8("1234567891"));
|
sl@0
|
5586 |
TestRFile1.Close();
|
sl@0
|
5587 |
|
sl@0
|
5588 |
test.Next(_L("Copy the files from one folder to another using CFileMan::Copy()\n"));
|
sl@0
|
5589 |
TInt r = fileMan->Copy(filePathOld, filePathNew, CFileMan::ERecurse | CFileMan::EOverWrite);
|
sl@0
|
5590 |
test(r == KErrNone || r == KErrTooBig);
|
sl@0
|
5591 |
|
sl@0
|
5592 |
test.Next(_L("Get the directory entry and find how many files are copied\n"));
|
sl@0
|
5593 |
// check SMALL and LARGE files have been copied
|
sl@0
|
5594 |
r = dir.Open(TheFs, filePathNew, KEntryAttNormal);
|
sl@0
|
5595 |
test (r == KErrNone);
|
sl@0
|
5596 |
r = dir.Read(entryArray);
|
sl@0
|
5597 |
test (r == KErrEof);
|
sl@0
|
5598 |
test(entryArray.Count() == gFilesInDirectory);
|
sl@0
|
5599 |
dir.Close();
|
sl@0
|
5600 |
|
sl@0
|
5601 |
// then delete the new directory
|
sl@0
|
5602 |
r = fileMan->Delete(filePathNew);
|
sl@0
|
5603 |
test(r == KErrNone);
|
sl@0
|
5604 |
|
sl@0
|
5605 |
test.Next(_L("Set file man observer\n"));
|
sl@0
|
5606 |
// attempt to copy to new directory again - this time with an observer
|
sl@0
|
5607 |
fileMan->SetObserver(observer);
|
sl@0
|
5608 |
|
sl@0
|
5609 |
test.Next(_L("Copy the files from one folder to another, source folder has 3 small files and a large file\n"));
|
sl@0
|
5610 |
r = fileMan->Copy(filePathOld, filePathNew, CFileMan::ERecurse | CFileMan::EOverWrite);
|
sl@0
|
5611 |
test(r == KErrNone || r == KErrTooBig);
|
sl@0
|
5612 |
|
sl@0
|
5613 |
test.Next(_L("Check observer for number of successful copy and failed copy\n"));
|
sl@0
|
5614 |
// test that 3 small files and 1 large file were copied
|
sl@0
|
5615 |
// (For 8 GB disk, the 4GB file is missing)
|
sl@0
|
5616 |
test(observer->iNotifyEndedSuccesses == gFilesInDirectory);
|
sl@0
|
5617 |
test(observer->iNotifyEndedFailures == 0);
|
sl@0
|
5618 |
|
sl@0
|
5619 |
test.Next(_L("Get the directory entry and find how many files copied\n"));
|
sl@0
|
5620 |
// check SMALL files have been copied
|
sl@0
|
5621 |
r = dir.Open(TheFs, filePathNew, KEntryAttNormal);
|
sl@0
|
5622 |
test (r == KErrNone);
|
sl@0
|
5623 |
r = dir.Read(entryArray);
|
sl@0
|
5624 |
test (r == KErrEof);
|
sl@0
|
5625 |
|
sl@0
|
5626 |
test(entryArray.Count() == gFilesInDirectory);
|
sl@0
|
5627 |
dir.Close();
|
sl@0
|
5628 |
|
sl@0
|
5629 |
// then delete the new directory
|
sl@0
|
5630 |
r = fileMan->Delete(filePathNew);
|
sl@0
|
5631 |
test(r == KErrNone);
|
sl@0
|
5632 |
|
sl@0
|
5633 |
delete observer;
|
sl@0
|
5634 |
delete fileMan;
|
sl@0
|
5635 |
|
sl@0
|
5636 |
r = TheFs.Delete(fileSmall1);
|
sl@0
|
5637 |
test(r == KErrNone);
|
sl@0
|
5638 |
r = TheFs.Delete(fileSmall2);
|
sl@0
|
5639 |
test(r == KErrNone);
|
sl@0
|
5640 |
r = TheFs.Delete(fileSmall3);
|
sl@0
|
5641 |
test(r == KErrNone);
|
sl@0
|
5642 |
r = TheFs.Delete(fileLarge1);
|
sl@0
|
5643 |
test(r == KErrNone);
|
sl@0
|
5644 |
}
|
sl@0
|
5645 |
/**
|
sl@0
|
5646 |
@SYMTestCaseID PBASE-T_FILE64BIT-2355
|
sl@0
|
5647 |
@SYMTestPriority High
|
sl@0
|
5648 |
@SYMTestRequirement REQ9532
|
sl@0
|
5649 |
@SYMTestType CIT
|
sl@0
|
5650 |
@SYMTestCaseDesc Tests for moving a directory containing large files using CFileMan::Move()
|
sl@0
|
5651 |
@SYMTestActions
|
sl@0
|
5652 |
1) Create 3 small files and 1 large file
|
sl@0
|
5653 |
2) Write 10 bytes to the created files
|
sl@0
|
5654 |
3) Move the files from one folder to another using CFileMan Move
|
sl@0
|
5655 |
4) Get the directory entry and find how many files moved in a directory
|
sl@0
|
5656 |
5) Move the files back to the original folder
|
sl@0
|
5657 |
@SYMTestExpectedResults
|
sl@0
|
5658 |
1) KErrNone, files created successfully
|
sl@0
|
5659 |
2) KErrNone, write is successful
|
sl@0
|
5660 |
3) KErrNone
|
sl@0
|
5661 |
4) 4 files moved successfully
|
sl@0
|
5662 |
5) KErrNone
|
sl@0
|
5663 |
@SYMTestStatus Implemented
|
sl@0
|
5664 |
*/
|
sl@0
|
5665 |
void TestMoveDirectory()
|
sl@0
|
5666 |
{
|
sl@0
|
5667 |
test.Next(_L("Move a directory containing large files"));
|
sl@0
|
5668 |
CFileMan* fileMan = CFileMan::NewL(TheFs);
|
sl@0
|
5669 |
test(fileMan != NULL);
|
sl@0
|
5670 |
|
sl@0
|
5671 |
TPath filePathOld;
|
sl@0
|
5672 |
filePathOld.Append(gDriveToTest);
|
sl@0
|
5673 |
filePathOld.Append(KTestPath);
|
sl@0
|
5674 |
|
sl@0
|
5675 |
|
sl@0
|
5676 |
TPath filePathNew;
|
sl@0
|
5677 |
filePathNew.Append(gDriveToTest);
|
sl@0
|
5678 |
filePathNew.Append(_L(":\\TEST\\"));
|
sl@0
|
5679 |
|
sl@0
|
5680 |
test.Next(_L("Create 3 small files and 1 large file\n"));
|
sl@0
|
5681 |
|
sl@0
|
5682 |
TFileName fileLarge1;
|
sl@0
|
5683 |
fileLarge1.Append(gDriveToTest);
|
sl@0
|
5684 |
fileLarge1.Append(KTestPath);
|
sl@0
|
5685 |
fileLarge1.Append(_L("FileLargeOne.txt"));
|
sl@0
|
5686 |
TestRFile1.Replace(fileLarge1, EFileWrite | EFileShareAny);
|
sl@0
|
5687 |
TestRFile1.SetSize(K4GB-1);
|
sl@0
|
5688 |
TestRFile1.Close();
|
sl@0
|
5689 |
|
sl@0
|
5690 |
|
sl@0
|
5691 |
TFileName fileSmall1;
|
sl@0
|
5692 |
fileSmall1.Append(gDriveToTest);
|
sl@0
|
5693 |
fileSmall1.Append(KTestPath);
|
sl@0
|
5694 |
fileSmall1.Append(_L("FileSmallOne.txt"));
|
sl@0
|
5695 |
|
sl@0
|
5696 |
TFileName fileSmall2;
|
sl@0
|
5697 |
fileSmall2.Append(gDriveToTest);
|
sl@0
|
5698 |
fileSmall2.Append(KTestPath);
|
sl@0
|
5699 |
fileSmall2.Append(_L("FileSmallTwo.txt"));
|
sl@0
|
5700 |
|
sl@0
|
5701 |
TFileName fileSmall3;
|
sl@0
|
5702 |
fileSmall3.Append(gDriveToTest);
|
sl@0
|
5703 |
fileSmall3.Append(KTestPath);
|
sl@0
|
5704 |
fileSmall3.Append(_L("FileSmallThree.txt"));
|
sl@0
|
5705 |
|
sl@0
|
5706 |
TestRFile1.Create(fileSmall1, EFileWrite | EFileShareAny);
|
sl@0
|
5707 |
TestRFile1.Write(_L8("1234567891"));
|
sl@0
|
5708 |
TestRFile1.Close();
|
sl@0
|
5709 |
|
sl@0
|
5710 |
TestRFile1.Create(fileSmall2, EFileWrite | EFileShareAny);
|
sl@0
|
5711 |
TestRFile1.Write(_L8("1234567891"));
|
sl@0
|
5712 |
TestRFile1.Close();
|
sl@0
|
5713 |
|
sl@0
|
5714 |
TestRFile1.Create(fileSmall3, EFileWrite | EFileShareAny);
|
sl@0
|
5715 |
TestRFile1.Write(_L8("1234567891"));
|
sl@0
|
5716 |
TestRFile1.Close();
|
sl@0
|
5717 |
|
sl@0
|
5718 |
|
sl@0
|
5719 |
// move to new directory
|
sl@0
|
5720 |
TInt r = fileMan->Move(filePathOld, filePathNew, CFileMan::ERecurse | CFileMan::EOverWrite);
|
sl@0
|
5721 |
test(r == KErrNone || r == KErrTooBig);
|
sl@0
|
5722 |
|
sl@0
|
5723 |
// check SMALL and LARGE files have been moved
|
sl@0
|
5724 |
RDir dir;
|
sl@0
|
5725 |
r = dir.Open(TheFs, filePathNew, KEntryAttNormal);
|
sl@0
|
5726 |
test (r == KErrNone);
|
sl@0
|
5727 |
TEntryArray entryArray;
|
sl@0
|
5728 |
r = dir.Read(entryArray);
|
sl@0
|
5729 |
test (r == KErrEof);
|
sl@0
|
5730 |
test(entryArray.Count() == 4);
|
sl@0
|
5731 |
dir.Close();
|
sl@0
|
5732 |
|
sl@0
|
5733 |
// then delete the new directory
|
sl@0
|
5734 |
r = fileMan->Delete(filePathNew);
|
sl@0
|
5735 |
test(r == KErrNone);
|
sl@0
|
5736 |
delete fileMan;
|
sl@0
|
5737 |
}
|
sl@0
|
5738 |
|
sl@0
|
5739 |
|
sl@0
|
5740 |
static void TestOpenFiles()
|
sl@0
|
5741 |
{
|
sl@0
|
5742 |
TestOpen2GB();
|
sl@0
|
5743 |
TestOpen3GB();
|
sl@0
|
5744 |
TestOpen4GBMinusOne();
|
sl@0
|
5745 |
TestOpen4GB();
|
sl@0
|
5746 |
TestOpenMoreThan2GB();
|
sl@0
|
5747 |
TestOpenRFileRFile64();
|
sl@0
|
5748 |
TestCreateTempFile();
|
sl@0
|
5749 |
TestCreateRFile64();
|
sl@0
|
5750 |
TestReplaceRFile64();
|
sl@0
|
5751 |
TestReplaceRFile64RFs();
|
sl@0
|
5752 |
}
|
sl@0
|
5753 |
|
sl@0
|
5754 |
static void TestAdoptFiles()
|
sl@0
|
5755 |
{
|
sl@0
|
5756 |
TInt r;
|
sl@0
|
5757 |
RFs fs;
|
sl@0
|
5758 |
r = fs.Connect();
|
sl@0
|
5759 |
test(r == KErrNone);
|
sl@0
|
5760 |
r = fs.ShareProtected();
|
sl@0
|
5761 |
test(r == KErrNone);
|
sl@0
|
5762 |
TFileName sessionp;
|
sl@0
|
5763 |
fs.SessionPath(sessionp);
|
sl@0
|
5764 |
r = fs.MkDirAll(sessionp);
|
sl@0
|
5765 |
test(r == KErrNone || r == KErrAlreadyExists);
|
sl@0
|
5766 |
fs.Close();
|
sl@0
|
5767 |
TestRFile64AdoptFromCreator();
|
sl@0
|
5768 |
TestRFile64AdoptFromClient();
|
sl@0
|
5769 |
TestRFile64AdoptFromServer();
|
sl@0
|
5770 |
}
|
sl@0
|
5771 |
|
sl@0
|
5772 |
|
sl@0
|
5773 |
static void TestReadFile()
|
sl@0
|
5774 |
{
|
sl@0
|
5775 |
//
|
sl@0
|
5776 |
//The order of these tests need to be preserved, since the first test creates
|
sl@0
|
5777 |
//a 4GB file, while the last one deletes it.
|
sl@0
|
5778 |
//
|
sl@0
|
5779 |
TestOpenAndReadSyncLargeFile();
|
sl@0
|
5780 |
TestOpenAndReadAsyncLargeFile();
|
sl@0
|
5781 |
TestOpenAndReadSyncLargeFileWithLen();
|
sl@0
|
5782 |
TestOpenAndReadAsyncLargeFileWithLen();
|
sl@0
|
5783 |
}
|
sl@0
|
5784 |
|
sl@0
|
5785 |
static void TestWriteFile()
|
sl@0
|
5786 |
{
|
sl@0
|
5787 |
TestOpenAndWriteSyncLargeFile();
|
sl@0
|
5788 |
TestOpenAndWriteAsyncLargeFile();
|
sl@0
|
5789 |
TestOpenAndWriteSyncLargeFileWithLen();
|
sl@0
|
5790 |
TestOpenAndWriteAsyncLargeFileWithLen();
|
sl@0
|
5791 |
}
|
sl@0
|
5792 |
|
sl@0
|
5793 |
static void TestFileAccess()
|
sl@0
|
5794 |
{
|
sl@0
|
5795 |
TestFileLock();
|
sl@0
|
5796 |
TestFileUnlock();
|
sl@0
|
5797 |
TestFileSeek();
|
sl@0
|
5798 |
TestFileSeekBigFile();
|
sl@0
|
5799 |
}
|
sl@0
|
5800 |
|
sl@0
|
5801 |
static void TestLockUnLock()
|
sl@0
|
5802 |
{
|
sl@0
|
5803 |
TestReadWriteLock();
|
sl@0
|
5804 |
TestUnLock();
|
sl@0
|
5805 |
TestSeekReadWrite();
|
sl@0
|
5806 |
TestSeekAsyncReadWrite();
|
sl@0
|
5807 |
TestSeekReadWriteLen();
|
sl@0
|
5808 |
TestSeekAsyncReadWriteLen();
|
sl@0
|
5809 |
}
|
sl@0
|
5810 |
|
sl@0
|
5811 |
static void TestCopyMoveDirectory()
|
sl@0
|
5812 |
{
|
sl@0
|
5813 |
TestCopyDirectory();
|
sl@0
|
5814 |
TestMoveDirectory();
|
sl@0
|
5815 |
}
|
sl@0
|
5816 |
|
sl@0
|
5817 |
TInt testLockPanic(TAny* aPtr)
|
sl@0
|
5818 |
{
|
sl@0
|
5819 |
TInt aPos=128;
|
sl@0
|
5820 |
TInt aLen=-1;
|
sl@0
|
5821 |
RFile64 * ptr = (RFile64 *)aPtr;
|
sl@0
|
5822 |
TInt r=ptr->Lock(aPos, aLen);
|
sl@0
|
5823 |
test (KErrNone == r);
|
sl@0
|
5824 |
return KErrNone;
|
sl@0
|
5825 |
}
|
sl@0
|
5826 |
|
sl@0
|
5827 |
TInt testUnLockPanic(TAny* aPtr)
|
sl@0
|
5828 |
{
|
sl@0
|
5829 |
TInt aPos=128;
|
sl@0
|
5830 |
TInt aLen=-1;
|
sl@0
|
5831 |
RFile64 * ptr = (RFile64 *)aPtr;
|
sl@0
|
5832 |
TInt r=ptr->UnLock(aPos, aLen);
|
sl@0
|
5833 |
test (KErrNone == r);
|
sl@0
|
5834 |
return KErrNone;
|
sl@0
|
5835 |
}
|
sl@0
|
5836 |
|
sl@0
|
5837 |
TInt testSetSizePanic(TAny* aPtr)
|
sl@0
|
5838 |
{
|
sl@0
|
5839 |
TInt aSize=-1;
|
sl@0
|
5840 |
RFile64 * ptr = (RFile64 *)aPtr;
|
sl@0
|
5841 |
TInt r=ptr->SetSize(aSize);
|
sl@0
|
5842 |
test (KErrNone == r);
|
sl@0
|
5843 |
return KErrNone;
|
sl@0
|
5844 |
}
|
sl@0
|
5845 |
|
sl@0
|
5846 |
static void TestRFile64NegLen()
|
sl@0
|
5847 |
{
|
sl@0
|
5848 |
test.Start(_L("Test RFile64::Lock, RFile64::Unlock, RFile64::SetSize and RFile::Write with Negative Length parameter"));
|
sl@0
|
5849 |
|
sl@0
|
5850 |
test(TheFs.ShareProtected() == KErrNone);
|
sl@0
|
5851 |
|
sl@0
|
5852 |
RFile64 aFile;
|
sl@0
|
5853 |
TInt r = aFile.Create(TheFs, _L("\\testRFile64NegLen.txt"), EFileWrite);
|
sl@0
|
5854 |
test((KErrNone == r) || (KErrAlreadyExists == r));
|
sl@0
|
5855 |
|
sl@0
|
5856 |
TRequestStatus status = KRequestPending;
|
sl@0
|
5857 |
|
sl@0
|
5858 |
// launch call on separate thread as expected to panic
|
sl@0
|
5859 |
// Test Lock with a negative length
|
sl@0
|
5860 |
User::SetJustInTime(EFalse);
|
sl@0
|
5861 |
RThread t;
|
sl@0
|
5862 |
test(t.Create(_L("testLockPanic"), testLockPanic, KDefaultStackSize, 0x2000, 0x2000, &aFile) == KErrNone);
|
sl@0
|
5863 |
t.Logon(status);
|
sl@0
|
5864 |
t.Resume();
|
sl@0
|
5865 |
User::WaitForRequest(status);
|
sl@0
|
5866 |
User::SetJustInTime(ETrue);
|
sl@0
|
5867 |
test(t.ExitType() == EExitPanic);
|
sl@0
|
5868 |
test(t.ExitReason() == 17);
|
sl@0
|
5869 |
t.Close();
|
sl@0
|
5870 |
|
sl@0
|
5871 |
// Test Unlock with a negative length
|
sl@0
|
5872 |
User::SetJustInTime(EFalse);
|
sl@0
|
5873 |
status = KRequestPending;
|
sl@0
|
5874 |
test(t.Create(_L("testUnLockPanic"), testUnLockPanic, KDefaultStackSize, 0x2000, 0x2000, &aFile) == KErrNone);
|
sl@0
|
5875 |
t.Logon(status);
|
sl@0
|
5876 |
t.Resume();
|
sl@0
|
5877 |
User::WaitForRequest(status);
|
sl@0
|
5878 |
test(t.ExitType() == EExitPanic);
|
sl@0
|
5879 |
test(t.ExitReason() == 18);
|
sl@0
|
5880 |
t.Close();
|
sl@0
|
5881 |
User::SetJustInTime(ETrue);
|
sl@0
|
5882 |
|
sl@0
|
5883 |
// Test SetSize with a negative length
|
sl@0
|
5884 |
User::SetJustInTime(EFalse);
|
sl@0
|
5885 |
status = KRequestPending;
|
sl@0
|
5886 |
test(t.Create(_L("testSetSizePanic"), testSetSizePanic, KDefaultStackSize, 0x2000, 0x2000, &aFile) == KErrNone);
|
sl@0
|
5887 |
t.Logon(status);
|
sl@0
|
5888 |
t.Resume();
|
sl@0
|
5889 |
User::WaitForRequest(status);
|
sl@0
|
5890 |
test(t.ExitType() == EExitPanic);
|
sl@0
|
5891 |
test(t.ExitReason() == 20);
|
sl@0
|
5892 |
t.Close();
|
sl@0
|
5893 |
User::SetJustInTime(ETrue);
|
sl@0
|
5894 |
|
sl@0
|
5895 |
// Test RFile64::Write with a zero or negative length
|
sl@0
|
5896 |
TInt aPos=128;
|
sl@0
|
5897 |
TInt aLen=-1;
|
sl@0
|
5898 |
TBuf8<0x100> gBuf=_L8("1234567891");
|
sl@0
|
5899 |
gBuf.Zero();
|
sl@0
|
5900 |
TRequestStatus status1=KRequestPending;
|
sl@0
|
5901 |
TRequestStatus status2=KRequestPending;
|
sl@0
|
5902 |
|
sl@0
|
5903 |
// If a zero length is passed into the Write function, KErrNone should be returned.
|
sl@0
|
5904 |
r=aFile.Write(aPos,gBuf);
|
sl@0
|
5905 |
test(r==KErrNone);
|
sl@0
|
5906 |
|
sl@0
|
5907 |
// If the length is a negative, KErrArgument should be returned.
|
sl@0
|
5908 |
r=aFile.Write(aPos,gBuf,aLen);
|
sl@0
|
5909 |
test(r==KErrArgument);
|
sl@0
|
5910 |
|
sl@0
|
5911 |
// Test the asynchronous requests
|
sl@0
|
5912 |
aFile.Write(aPos,gBuf,aLen,status1);
|
sl@0
|
5913 |
aFile.Write(aPos,gBuf,aLen,status2);
|
sl@0
|
5914 |
User::WaitForRequest(status1);
|
sl@0
|
5915 |
test(status1.Int()==KErrArgument);
|
sl@0
|
5916 |
User::WaitForRequest(status2);
|
sl@0
|
5917 |
test(status2.Int()==KErrArgument);
|
sl@0
|
5918 |
|
sl@0
|
5919 |
aFile.Close();
|
sl@0
|
5920 |
r = TheFs.Delete(_L("\\testRFile64NegLen.txt"));
|
sl@0
|
5921 |
test(r == KErrNone);
|
sl@0
|
5922 |
test.End();
|
sl@0
|
5923 |
}
|
sl@0
|
5924 |
//-------------------------------------------------------------------------------------------------------------------
|
sl@0
|
5925 |
|
sl@0
|
5926 |
static TInt PrepareDisk(TInt aDrive)
|
sl@0
|
5927 |
{
|
sl@0
|
5928 |
TInt r;
|
sl@0
|
5929 |
|
sl@0
|
5930 |
r = FormatDrive(TheFs, aDrive, ETrue);
|
sl@0
|
5931 |
|
sl@0
|
5932 |
r = TheFs.Volume(gDriveVolumeInfo, aDrive);
|
sl@0
|
5933 |
if(KErrNone != r)
|
sl@0
|
5934 |
{
|
sl@0
|
5935 |
test.Printf(_L("\nError in getting drive volume information!! Error code is %d"),r);
|
sl@0
|
5936 |
test(EFalse);
|
sl@0
|
5937 |
}
|
sl@0
|
5938 |
test.Printf(_L("\nDrive volume size is %LU\n"), gDriveVolumeInfo.iSize);
|
sl@0
|
5939 |
|
sl@0
|
5940 |
// don't test if media size is less than 4 GB
|
sl@0
|
5941 |
if (gDriveVolumeInfo.iFree <= K4GB)
|
sl@0
|
5942 |
{
|
sl@0
|
5943 |
test.Printf(_L("\nSkipping test: test requires disk with capacity more than 4 GB"));
|
sl@0
|
5944 |
return KErrNotSupported;
|
sl@0
|
5945 |
}
|
sl@0
|
5946 |
|
sl@0
|
5947 |
TFileName fileName;
|
sl@0
|
5948 |
fileName.Append(gDriveToTest);
|
sl@0
|
5949 |
fileName.Append(KTestPath);
|
sl@0
|
5950 |
|
sl@0
|
5951 |
MakeDir(fileName);
|
sl@0
|
5952 |
|
sl@0
|
5953 |
|
sl@0
|
5954 |
//-- decide if we need to test files >= 4G. As soon as there is no appropriate API yet, this way is dodgy..
|
sl@0
|
5955 |
if(Is_Fat(TheFs, aDrive))
|
sl@0
|
5956 |
{
|
sl@0
|
5957 |
KFileSizeMaxLargerThan4GBMinusOne = EFalse; //-- FAT doesn't support >= 4G files
|
sl@0
|
5958 |
}
|
sl@0
|
5959 |
else if(Is_Win32(TheFs, aDrive))
|
sl@0
|
5960 |
{//-- this is the emulator's windows drive. The maximal file size depends on the Windows FS used for this drive.
|
sl@0
|
5961 |
//-- if it is NTFS, files >= 4G are supported.
|
sl@0
|
5962 |
r = CreateEmptyFile(TheFs, _L("\\test_file"), K4GB);
|
sl@0
|
5963 |
|
sl@0
|
5964 |
KFileSizeMaxLargerThan4GBMinusOne = (r == KErrNone);
|
sl@0
|
5965 |
r = TheFs.Delete(_L("\\test_file"));
|
sl@0
|
5966 |
|
sl@0
|
5967 |
}
|
sl@0
|
5968 |
else
|
sl@0
|
5969 |
{//-- something else, exFAT for example
|
sl@0
|
5970 |
if(Is_ExFat(TheFs, aDrive))
|
sl@0
|
5971 |
KFileSizeMaxLargerThan4GBMinusOne = ETrue;
|
sl@0
|
5972 |
}
|
sl@0
|
5973 |
|
sl@0
|
5974 |
|
sl@0
|
5975 |
return KErrNone;
|
sl@0
|
5976 |
}
|
sl@0
|
5977 |
|
sl@0
|
5978 |
|
sl@0
|
5979 |
void CallTestsL()
|
sl@0
|
5980 |
{
|
sl@0
|
5981 |
TInt r;
|
sl@0
|
5982 |
r = RFs::CharToDrive(gDriveToTest, gDrive);
|
sl@0
|
5983 |
test(r == KErrNone);
|
sl@0
|
5984 |
|
sl@0
|
5985 |
//-- set up console output
|
sl@0
|
5986 |
F32_Test_Utils::SetConsole(test.Console());
|
sl@0
|
5987 |
|
sl@0
|
5988 |
PrintDrvInfo(TheFs, gDrive);
|
sl@0
|
5989 |
|
sl@0
|
5990 |
r = PrepareDisk(gDrive);
|
sl@0
|
5991 |
if(r == KErrNotSupported)
|
sl@0
|
5992 |
return;
|
sl@0
|
5993 |
|
sl@0
|
5994 |
|
sl@0
|
5995 |
TestRFile64NegLen();
|
sl@0
|
5996 |
TestOpenFiles();
|
sl@0
|
5997 |
TestAdoptFiles();
|
sl@0
|
5998 |
TestReadFile();
|
sl@0
|
5999 |
TestWriteFile();
|
sl@0
|
6000 |
TestFileAccess();
|
sl@0
|
6001 |
TestSetsize();
|
sl@0
|
6002 |
TestReadFilesection();
|
sl@0
|
6003 |
TestTFileText();
|
sl@0
|
6004 |
|
sl@0
|
6005 |
TestLockUnLock();
|
sl@0
|
6006 |
TestFileReSize();
|
sl@0
|
6007 |
//
|
sl@0
|
6008 |
// these tests require disk capacity of aaround 12GB.
|
sl@0
|
6009 |
//order of these tests need to be preserved since the files are
|
sl@0
|
6010 |
//created only in TestGetDirectory() and then deleted in TestAddLDirectory
|
sl@0
|
6011 |
//but all the intermediate tests uses those files.
|
sl@0
|
6012 |
//
|
sl@0
|
6013 |
if (gDriveVolumeInfo.iFree >= K12GB)
|
sl@0
|
6014 |
{
|
sl@0
|
6015 |
TestGetDirectory();
|
sl@0
|
6016 |
TestTEntry();
|
sl@0
|
6017 |
TestReadDirectory();
|
sl@0
|
6018 |
TestSortDirectory();
|
sl@0
|
6019 |
TestAddLDirectory();
|
sl@0
|
6020 |
}
|
sl@0
|
6021 |
// these tests require disk capacity of aaround 9GB.
|
sl@0
|
6022 |
if (gDriveVolumeInfo.iFree >= K9GB)
|
sl@0
|
6023 |
{
|
sl@0
|
6024 |
TestCopyMoveDirectory();
|
sl@0
|
6025 |
}
|
sl@0
|
6026 |
|
sl@0
|
6027 |
// Delete the test directory
|
sl@0
|
6028 |
TFileName dirName;
|
sl@0
|
6029 |
dirName.Append(gDriveToTest);
|
sl@0
|
6030 |
dirName.Append(KTestPath);
|
sl@0
|
6031 |
r = TheFs.RmDir(dirName);
|
sl@0
|
6032 |
test(r == KErrNone);
|
sl@0
|
6033 |
}
|
sl@0
|
6034 |
|
sl@0
|
6035 |
|
sl@0
|
6036 |
|
sl@0
|
6037 |
|
sl@0
|
6038 |
|
sl@0
|
6039 |
|
sl@0
|
6040 |
|