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