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 |
// f32test\bench\t_fsrvbm.cpp
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include <f32file.h>
|
|
19 |
#include <e32test.h>
|
|
20 |
#include "t_select.h"
|
|
21 |
#include "../server/t_server.h"
|
|
22 |
|
|
23 |
GLDEF_D RTest test(_L("File Server Benchmarks"));
|
|
24 |
|
|
25 |
LOCAL_D RSemaphore client;
|
|
26 |
LOCAL_D TInt speedCount;
|
|
27 |
LOCAL_D const TInt KHeapSize=0x2000;
|
|
28 |
LOCAL_D TBuf8<4096> buf;
|
|
29 |
//
|
|
30 |
LOCAL_D TDriveList gDriveList;
|
|
31 |
//
|
|
32 |
LOCAL_D TInt gLocalDrive;
|
|
33 |
LOCAL_D TInt gLocalDriveReadSize;
|
|
34 |
LOCAL_D TInt gLocalDriveWriteSize;
|
|
35 |
//
|
|
36 |
LOCAL_D TFileName gFindEntryDir;
|
|
37 |
LOCAL_D TInt gFindEntrySearchStart;
|
|
38 |
LOCAL_D TInt gFindEntrySearchFinish;
|
|
39 |
//
|
|
40 |
LOCAL_D TInt gSeekPos1;
|
|
41 |
LOCAL_D TInt gSeekPos2;
|
|
42 |
LOCAL_D TFileName gSeekFile;
|
|
43 |
|
|
44 |
LOCAL_D TInt ThreadCount=0;
|
|
45 |
|
|
46 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
|
47 |
|
|
48 |
const TInt64 KGb = 1 << 30;
|
|
49 |
const TInt64 K2GB = 2 * KGb;
|
|
50 |
const TInt64 K3GB = 3 * KGb;
|
|
51 |
|
|
52 |
LOCAL_D TInt64 gLSeekPos1;
|
|
53 |
LOCAL_D TInt64 gLSeekPos2;
|
|
54 |
|
|
55 |
enum TSelectedTest
|
|
56 |
{
|
|
57 |
ELocalDriveTest, EFindEntryTest, EFileSeekTest, EFileSeekRFile64Test
|
|
58 |
};
|
|
59 |
#else
|
|
60 |
enum TSelectedTest
|
|
61 |
{
|
|
62 |
ELocalDriveTest, EFindEntryTest, EFileSeekTest
|
|
63 |
};
|
|
64 |
#endif ////SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
|
65 |
|
|
66 |
|
|
67 |
// RFs::CheckDisk() will return an error if the directory depth exceeds this value :
|
|
68 |
const TInt KCheckDskMaxRecursionLevel = 50;
|
|
69 |
|
|
70 |
LOCAL_C void FormatFat(TDriveUnit aDrive)
|
|
71 |
//
|
|
72 |
// Call all RFormat methods
|
|
73 |
//
|
|
74 |
{
|
|
75 |
|
|
76 |
RFormat format;
|
|
77 |
TPckgBuf<TInt> count;
|
|
78 |
TInt r=format.Open(TheFs,aDrive.Name(),EHighDensity,count());
|
|
79 |
test(r==KErrNone);
|
|
80 |
test(count()==100);
|
|
81 |
TRequestStatus status;
|
|
82 |
while (count())
|
|
83 |
{
|
|
84 |
format.Next(count,status);
|
|
85 |
User::WaitForRequest(status);
|
|
86 |
test(status==KErrNone);
|
|
87 |
}
|
|
88 |
format.Close();
|
|
89 |
}
|
|
90 |
|
|
91 |
LOCAL_C void DoTest(TThreadFunction aFunction)
|
|
92 |
//
|
|
93 |
// Do a speed test
|
|
94 |
//
|
|
95 |
{
|
|
96 |
|
|
97 |
RThread speedy;
|
|
98 |
TBuf<8> buf=_L("Speedy");
|
|
99 |
buf.AppendNum(ThreadCount++);
|
|
100 |
TInt r=speedy.Create(buf,aFunction,KDefaultStackSize,KHeapSize,KHeapSize,NULL);
|
|
101 |
test(r==KErrNone);
|
|
102 |
//
|
|
103 |
speedy.SetPriority(EPriorityLess);
|
|
104 |
speedy.Resume();
|
|
105 |
client.Wait();
|
|
106 |
|
|
107 |
r = TheFs.CheckDisk(gSessionPath);
|
|
108 |
test (r == KErrNone);
|
|
109 |
|
|
110 |
//
|
|
111 |
User::After(300000);
|
|
112 |
TInt b=speedCount;
|
|
113 |
User::After(3000000);
|
|
114 |
TInt n=speedCount;
|
|
115 |
test.Printf(_L(" Completed %d calls per second\n"),(n-b)/3);
|
|
116 |
|
|
117 |
test(TheFs.CheckDisk(gSessionPath) == KErrNone);
|
|
118 |
|
|
119 |
//
|
|
120 |
speedy.Kill(KErrNone);
|
|
121 |
test(r==KErrNone);
|
|
122 |
speedy.Close();
|
|
123 |
}
|
|
124 |
|
|
125 |
LOCAL_C TInt rawReadData(TAny*)
|
|
126 |
//
|
|
127 |
// The entry point for the speed test thread.
|
|
128 |
//
|
|
129 |
{
|
|
130 |
|
|
131 |
speedCount=0;
|
|
132 |
TBusLocalDrive localDrive;
|
|
133 |
TBool changed;
|
|
134 |
localDrive.Connect(gLocalDrive,changed);
|
|
135 |
client.Signal();
|
|
136 |
FOREVER
|
|
137 |
{
|
|
138 |
localDrive.Read(512+32,gLocalDriveReadSize,buf);
|
|
139 |
speedCount++;
|
|
140 |
}
|
|
141 |
// return(KErrNone);
|
|
142 |
}
|
|
143 |
|
|
144 |
LOCAL_C TInt rawWriteData(TAny*)
|
|
145 |
//
|
|
146 |
// The entry point for the speed test thread.
|
|
147 |
//
|
|
148 |
{
|
|
149 |
|
|
150 |
speedCount=0;
|
|
151 |
TBusLocalDrive localDrive;
|
|
152 |
TBool changed;
|
|
153 |
localDrive.Connect(gLocalDrive,changed);
|
|
154 |
buf.SetLength(gLocalDriveWriteSize);
|
|
155 |
client.Signal();
|
|
156 |
FOREVER
|
|
157 |
{
|
|
158 |
localDrive.Write(512+32,buf);
|
|
159 |
speedCount++;
|
|
160 |
}
|
|
161 |
// return(KErrNone);
|
|
162 |
}
|
|
163 |
|
|
164 |
LOCAL_C void TestLocalDriveRead(TInt drive,TInt readsize)
|
|
165 |
//
|
|
166 |
// Test TBusLocalDrive read
|
|
167 |
//
|
|
168 |
{
|
|
169 |
|
|
170 |
test.Printf(_L("TBusLocalDrive %d Reading %d bytes"),drive,readsize);
|
|
171 |
#if defined(__WINS__)
|
|
172 |
if (drive==EDriveX)
|
|
173 |
drive=1;
|
|
174 |
else if (drive==EDriveY)
|
|
175 |
drive=0;
|
|
176 |
#endif
|
|
177 |
gLocalDrive=drive;
|
|
178 |
gLocalDriveReadSize=readsize;
|
|
179 |
DoTest(rawReadData);
|
|
180 |
}
|
|
181 |
|
|
182 |
LOCAL_C void TestLocalDriveWrite(TInt drive,TInt writesize)
|
|
183 |
//
|
|
184 |
// Test TBusLocalDrive write
|
|
185 |
//
|
|
186 |
{
|
|
187 |
|
|
188 |
test.Printf(_L("TBusLocalDrive %d Writing %d bytes"),drive,writesize);
|
|
189 |
#if defined(__WINS__)
|
|
190 |
if (drive==EDriveX)
|
|
191 |
drive=1;
|
|
192 |
else if (drive==EDriveY)
|
|
193 |
drive=0;
|
|
194 |
#endif
|
|
195 |
gLocalDrive=drive;
|
|
196 |
gLocalDriveWriteSize=writesize;
|
|
197 |
DoTest(rawWriteData);
|
|
198 |
}
|
|
199 |
|
|
200 |
LOCAL_C TInt FindEntryBounce(TAny*)
|
|
201 |
//
|
|
202 |
// Find entries in hierarchy
|
|
203 |
//
|
|
204 |
{
|
|
205 |
|
|
206 |
speedCount=0;
|
|
207 |
RFs fs;
|
|
208 |
TInt r=fs.Connect();
|
|
209 |
test(r==KErrNone);
|
|
210 |
r=fs.SetSessionPath(gSessionPath);
|
|
211 |
test(r==KErrNone);
|
|
212 |
client.Signal();
|
|
213 |
FOREVER
|
|
214 |
{
|
|
215 |
TEntry entry;
|
|
216 |
r=fs.Entry(gFindEntryDir,entry);
|
|
217 |
test(r==KErrNone);
|
|
218 |
r=fs.Entry(_L("\\F32-TST"),entry);
|
|
219 |
test(r==KErrNone);
|
|
220 |
speedCount++;
|
|
221 |
}
|
|
222 |
// fs.Close();
|
|
223 |
// return(KErrNone);
|
|
224 |
}
|
|
225 |
|
|
226 |
LOCAL_C void TestFindEntryBounce(TInt aDepth)
|
|
227 |
//
|
|
228 |
// Find entries at different depths
|
|
229 |
//
|
|
230 |
{
|
|
231 |
|
|
232 |
test.Printf(_L("Find entry 1 then find entry %d"),aDepth);
|
|
233 |
gFindEntryDir=_L("\\F32-TST\\");
|
|
234 |
TInt i;
|
|
235 |
for(i=0;i<aDepth;i++)
|
|
236 |
{
|
|
237 |
gFindEntryDir+=_L("X");
|
|
238 |
gFindEntryDir.AppendNum(i);
|
|
239 |
gFindEntryDir+=_L("\\");
|
|
240 |
}
|
|
241 |
gFindEntryDir+=_L("X");
|
|
242 |
gFindEntryDir.AppendNum(i);
|
|
243 |
DoTest(FindEntryBounce);
|
|
244 |
}
|
|
245 |
|
|
246 |
LOCAL_C TInt FindEntrySearch(TAny*)
|
|
247 |
//
|
|
248 |
// Find entries in hierarchy
|
|
249 |
//
|
|
250 |
{
|
|
251 |
|
|
252 |
speedCount=0;
|
|
253 |
RFs fs;
|
|
254 |
TInt r=fs.Connect();
|
|
255 |
test(r==KErrNone);
|
|
256 |
r=fs.SetSessionPath(gSessionPath);
|
|
257 |
test(r==KErrNone);
|
|
258 |
client.Signal();
|
|
259 |
FOREVER
|
|
260 |
{
|
|
261 |
TFileName temp=gFindEntryDir;
|
|
262 |
for(TInt i=gFindEntrySearchStart;i<gFindEntrySearchFinish;i++)
|
|
263 |
{
|
|
264 |
temp+=_L("X");
|
|
265 |
temp.AppendNum(i);
|
|
266 |
TEntry entry;
|
|
267 |
r=fs.Entry(temp,entry);
|
|
268 |
test(r==KErrNone);
|
|
269 |
temp+=_L("\\");
|
|
270 |
}
|
|
271 |
speedCount++;
|
|
272 |
}
|
|
273 |
// fs.Close();
|
|
274 |
// return(KErrNone);
|
|
275 |
}
|
|
276 |
|
|
277 |
LOCAL_C void TestFindEntrySearch(TInt aStart, TInt aFinish)
|
|
278 |
//
|
|
279 |
// Find entries at different depths
|
|
280 |
//
|
|
281 |
{
|
|
282 |
|
|
283 |
test.Printf(_L("Find entries %d to %d"),aStart,aFinish);
|
|
284 |
gFindEntrySearchStart=aStart;
|
|
285 |
gFindEntrySearchFinish=aFinish;
|
|
286 |
gFindEntryDir=_L("\\F32-TST\\");
|
|
287 |
for(TInt i=0;i<aStart;i++)
|
|
288 |
{
|
|
289 |
gFindEntryDir+=_L("X");
|
|
290 |
gFindEntryDir.AppendNum(i);
|
|
291 |
gFindEntryDir+=_L("\\");
|
|
292 |
}
|
|
293 |
DoTest(FindEntrySearch);
|
|
294 |
}
|
|
295 |
|
|
296 |
LOCAL_C TInt FileSeekTest(TAny*)
|
|
297 |
//
|
|
298 |
// Read 16bytes at different locations
|
|
299 |
//
|
|
300 |
{
|
|
301 |
|
|
302 |
speedCount=0;
|
|
303 |
RFs fs;
|
|
304 |
TInt r=fs.Connect();
|
|
305 |
test(r==KErrNone);
|
|
306 |
r=fs.SetSessionPath(gSessionPath);
|
|
307 |
test(r==KErrNone);
|
|
308 |
RFile f;
|
|
309 |
r=f.Open(fs,gSeekFile,EFileRead); // 3rd arg was EFileRandomAccess, but this no longer exists
|
|
310 |
test(r==KErrNone);
|
|
311 |
client.Signal();
|
|
312 |
FOREVER
|
|
313 |
{
|
|
314 |
r=f.Read(gSeekPos1,buf,16);
|
|
315 |
test(r==KErrNone);
|
|
316 |
r=f.Read(gSeekPos2,buf,16);
|
|
317 |
test(r==KErrNone);
|
|
318 |
speedCount++;
|
|
319 |
}
|
|
320 |
// f.Close();
|
|
321 |
// fs.Close();
|
|
322 |
// return(KErrNone);
|
|
323 |
}
|
|
324 |
|
|
325 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
|
326 |
|
|
327 |
LOCAL_C TInt FileSeekRFile64Test(TAny*)
|
|
328 |
//
|
|
329 |
// Read 16bytes at different locations
|
|
330 |
//
|
|
331 |
{
|
|
332 |
|
|
333 |
speedCount=0;
|
|
334 |
RFs fs;
|
|
335 |
TInt r=fs.Connect();
|
|
336 |
test(r==KErrNone);
|
|
337 |
r=fs.SetSessionPath(gSessionPath);
|
|
338 |
test(r==KErrNone);
|
|
339 |
RFile64 f;
|
|
340 |
r=f.Open(fs,gSeekFile,EFileRead); // 3rd arg was EFileRandomAccess, but this no longer exists
|
|
341 |
test(r==KErrNone);
|
|
342 |
client.Signal();
|
|
343 |
FOREVER
|
|
344 |
{
|
|
345 |
r=f.Read(gLSeekPos1,buf,16);
|
|
346 |
test(r==KErrNone);
|
|
347 |
r=f.Read(gLSeekPos2,buf,16);
|
|
348 |
test(r==KErrNone);
|
|
349 |
speedCount++;
|
|
350 |
}
|
|
351 |
}
|
|
352 |
|
|
353 |
LOCAL_C void TestSeek64(TInt64 aLoc1, TInt64 aLoc2)
|
|
354 |
//
|
|
355 |
// Read 16bytes at different locations
|
|
356 |
//
|
|
357 |
{
|
|
358 |
|
|
359 |
test.Printf(_L("Read 16bytes at positions %ld and %ld"),aLoc1,aLoc2);
|
|
360 |
|
|
361 |
gLSeekPos1=aLoc1;
|
|
362 |
gLSeekPos2=aLoc2;
|
|
363 |
DoTest(FileSeekRFile64Test);
|
|
364 |
}
|
|
365 |
|
|
366 |
#endif //SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
|
367 |
|
|
368 |
LOCAL_C void TestSeek(TInt aLoc1, TInt aLoc2)
|
|
369 |
//
|
|
370 |
// Read 16bytes at different locations
|
|
371 |
//
|
|
372 |
{
|
|
373 |
|
|
374 |
test.Printf(_L("Read 16bytes at positions %d and %d"),aLoc1,aLoc2);
|
|
375 |
gSeekPos1=aLoc1;
|
|
376 |
gSeekPos2=aLoc2;
|
|
377 |
DoTest(FileSeekTest);
|
|
378 |
}
|
|
379 |
|
|
380 |
LOCAL_C void InitializeDrive(CSelectionBox* aSelector)
|
|
381 |
//
|
|
382 |
// Get the drive into a good state
|
|
383 |
//
|
|
384 |
{
|
|
385 |
|
|
386 |
TDriveUnit drive=((CSelectionBox*)aSelector)->CurrentDrive();
|
|
387 |
gSessionPath[0]=TUint8('A'+drive);
|
|
388 |
TInt r=TheFs.SetSessionPath(gSessionPath);
|
|
389 |
test(r==KErrNone);
|
|
390 |
TDriveInfo driveInfo;
|
|
391 |
r=TheFs.Drive(driveInfo);
|
|
392 |
test(r==KErrNone);
|
|
393 |
if (driveInfo.iType==EMediaNotPresent)
|
|
394 |
{
|
|
395 |
test.Printf(_L("ERROR: MEDIA NOT PRESENT <Press return to continue>\n"));
|
|
396 |
test.Getch();
|
|
397 |
return;
|
|
398 |
}
|
|
399 |
r=TheFs.MkDirAll(gSessionPath);
|
|
400 |
test(r==KErrCorrupt || r==KErrAlreadyExists || r==KErrNone);
|
|
401 |
if (r==KErrCorrupt)
|
|
402 |
FormatFat(gSessionPath[0]-'A');
|
|
403 |
if (r!=KErrNone && r!=KErrAlreadyExists)
|
|
404 |
{
|
|
405 |
r=TheFs.MkDirAll(gSessionPath);
|
|
406 |
test(r==KErrNone);
|
|
407 |
}
|
|
408 |
}
|
|
409 |
|
|
410 |
|
|
411 |
LOCAL_C TInt ValidateDriveSelection(TDriveUnit aDrive,TSelectedTest aTest)
|
|
412 |
{
|
|
413 |
if ((aDrive==EDriveZ)||((aDrive==EDriveC)&&(aTest==ELocalDriveTest)))
|
|
414 |
{
|
|
415 |
|
|
416 |
test.Printf(_L("Test not available for this drive\n"));
|
|
417 |
test.Printf(_L("Press any key to continue...\n"));
|
|
418 |
test.Getch();
|
|
419 |
return (KErrNotSupported);
|
|
420 |
}
|
|
421 |
else
|
|
422 |
return (KErrNone);
|
|
423 |
}
|
|
424 |
|
|
425 |
|
|
426 |
|
|
427 |
LOCAL_C TInt TestLocalDrive(TAny* aSelector)
|
|
428 |
//
|
|
429 |
// Test TBusLocalDrive
|
|
430 |
//
|
|
431 |
{
|
|
432 |
|
|
433 |
if (((CSelectionBox*)aSelector)->CurrentKeyPress()!=EKeyEnter)
|
|
434 |
return(KErrNone);
|
|
435 |
TDriveUnit drive=((CSelectionBox*)aSelector)->CurrentDrive();
|
|
436 |
TInt r=ValidateDriveSelection(drive,ELocalDriveTest);
|
|
437 |
if (r==KErrNotSupported)
|
|
438 |
return (r);
|
|
439 |
|
|
440 |
InitializeDrive((CSelectionBox*)aSelector);
|
|
441 |
//
|
|
442 |
TBuf<128> testTitle;
|
|
443 |
TBuf<KMaxFileName> name=drive.Name();
|
|
444 |
testTitle.Format(_L("Test TBusLocalDrive %S"),&name);
|
|
445 |
test.Start(testTitle);
|
|
446 |
TestLocalDriveRead(drive,16);
|
|
447 |
TestLocalDriveRead(drive,1024);
|
|
448 |
TestLocalDriveRead(drive,4096);
|
|
449 |
//
|
|
450 |
TestLocalDriveWrite(drive,16);
|
|
451 |
TestLocalDriveWrite(drive,1024);
|
|
452 |
TestLocalDriveWrite(drive,4096);
|
|
453 |
//
|
|
454 |
test.Printf(_L("Test finished, reformatting drive %d\n"),gSessionPath[0]-'A');
|
|
455 |
FormatFat(gSessionPath[0]-'A');
|
|
456 |
test.End();
|
|
457 |
return(KErrNone);
|
|
458 |
}
|
|
459 |
|
|
460 |
LOCAL_C TInt TestFindEntries(TAny* aSelector)
|
|
461 |
//
|
|
462 |
// Test Entry
|
|
463 |
//
|
|
464 |
{
|
|
465 |
|
|
466 |
if (((CSelectionBox*)aSelector)->CurrentKeyPress()!=EKeyEnter)
|
|
467 |
return(KErrNone);
|
|
468 |
|
|
469 |
TInt r=ValidateDriveSelection(((CSelectionBox*)aSelector)->CurrentDrive(),EFindEntryTest);
|
|
470 |
if (r==KErrNotSupported)
|
|
471 |
return(r);
|
|
472 |
|
|
473 |
InitializeDrive((CSelectionBox*)aSelector);
|
|
474 |
//
|
|
475 |
test.Start(_L("Test Entry"));
|
|
476 |
TFileName dirFiftyDeep=_L("\\F32-TST\\"); // root + first directory = 2 directory levels
|
|
477 |
for(TInt i=0;i<KCheckDskMaxRecursionLevel-2;i++) // 0 to 47 = 48 directory levels
|
|
478 |
{
|
|
479 |
dirFiftyDeep+=_L("X");
|
|
480 |
dirFiftyDeep.AppendNum(i);
|
|
481 |
dirFiftyDeep+=_L("\\");
|
|
482 |
}
|
|
483 |
r=TheFs.MkDirAll(dirFiftyDeep);
|
|
484 |
test(r==KErrNone || r==KErrAlreadyExists);
|
|
485 |
//
|
|
486 |
TestFindEntryBounce(2);
|
|
487 |
TestFindEntryBounce(10);
|
|
488 |
TestFindEntryBounce(20);
|
|
489 |
TestFindEntryBounce(KCheckDskMaxRecursionLevel-3);
|
|
490 |
//
|
|
491 |
TestFindEntrySearch(1,5);
|
|
492 |
TestFindEntrySearch(1,10);
|
|
493 |
TestFindEntrySearch(10,15);
|
|
494 |
TestFindEntrySearch(10,20);
|
|
495 |
//
|
|
496 |
test.Printf(_L("Test finished, removing directory\n"));
|
|
497 |
CFileMan* fMan=CFileMan::NewL(TheFs);
|
|
498 |
r=fMan->RmDir(_L("\\F32-TST\\X0\\"));
|
|
499 |
test(r==KErrNone);
|
|
500 |
delete fMan;
|
|
501 |
test.End();
|
|
502 |
return(KErrNone);
|
|
503 |
}
|
|
504 |
|
|
505 |
LOCAL_C TInt TestFileSeek(TAny* aSelector)
|
|
506 |
//
|
|
507 |
// Test Seek
|
|
508 |
//
|
|
509 |
{
|
|
510 |
|
|
511 |
if (((CSelectionBox*)aSelector)->CurrentKeyPress()!=EKeyEnter)
|
|
512 |
return(KErrNone);
|
|
513 |
|
|
514 |
TInt r=ValidateDriveSelection(((CSelectionBox*)aSelector)->CurrentDrive(),EFileSeekTest);
|
|
515 |
if (r==KErrNotSupported)
|
|
516 |
return (r);
|
|
517 |
|
|
518 |
InitializeDrive((CSelectionBox*)aSelector);
|
|
519 |
//
|
|
520 |
test.Start(_L("Test Seek"));
|
|
521 |
RFile f;
|
|
522 |
gSeekFile=_L("\\F32-TST\\FILE512K.BIG");
|
|
523 |
r=f.Replace(TheFs,gSeekFile,EFileWrite);
|
|
524 |
test(r==KErrNone);
|
|
525 |
r=f.SetSize(524268);
|
|
526 |
test(r==KErrNone);
|
|
527 |
f.Close();
|
|
528 |
//
|
|
529 |
TestSeek(0,1000);
|
|
530 |
TestSeek(0,10000);
|
|
531 |
TestSeek(5000,6000);
|
|
532 |
TestSeek(5000,15000);
|
|
533 |
TestSeek(10000,100000);
|
|
534 |
TestSeek(200000,500000);
|
|
535 |
//
|
|
536 |
r=TheFs.Delete(gSeekFile);
|
|
537 |
test(r==KErrNone);
|
|
538 |
test.End();
|
|
539 |
return(KErrNone);
|
|
540 |
}
|
|
541 |
|
|
542 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
|
543 |
//Read the file at position beyond 2GB-1
|
|
544 |
//Minimum required disk space for this test is 3GB
|
|
545 |
//
|
|
546 |
LOCAL_C TInt TestLargeFileSeek(TAny* aSelector)
|
|
547 |
{
|
|
548 |
|
|
549 |
if (((CSelectionBox*)aSelector)->CurrentKeyPress()!=EKeyEnter)
|
|
550 |
return(KErrNone);
|
|
551 |
|
|
552 |
TInt r=ValidateDriveSelection(((CSelectionBox*)aSelector)->CurrentDrive(),EFileSeekRFile64Test);
|
|
553 |
if (r==KErrNotSupported)
|
|
554 |
return (r);
|
|
555 |
|
|
556 |
InitializeDrive((CSelectionBox*)aSelector);
|
|
557 |
//
|
|
558 |
test.Start(_L("Test large File Seek"));
|
|
559 |
|
|
560 |
RFile64 BigFile;
|
|
561 |
gSeekFile=_L("\\F32-TST\\FILE4GBMINUS2.BIG");
|
|
562 |
r=BigFile.Replace(TheFs,gSeekFile,EFileWrite);
|
|
563 |
test(r==KErrNone);
|
|
564 |
|
|
565 |
//check Disk space
|
|
566 |
TVolumeInfo volInfo;
|
|
567 |
|
|
568 |
r = TheFs.Volume(volInfo);
|
|
569 |
test(r==KErrNone);
|
|
570 |
|
|
571 |
//Get the free space available for test
|
|
572 |
if(volInfo.iFree < (K3GB-2))
|
|
573 |
{
|
|
574 |
BigFile.Close();
|
|
575 |
test(r==KErrNone);
|
|
576 |
r=TheFs.Delete(gSeekFile);
|
|
577 |
test.Printf(_L("Large File test is skipped: Free space %ld \n"),volInfo.iFree);
|
|
578 |
return r;
|
|
579 |
}
|
|
580 |
|
|
581 |
r=BigFile.SetSize(K3GB-2);
|
|
582 |
test(r==KErrNone);
|
|
583 |
BigFile.Close();
|
|
584 |
|
|
585 |
TestSeek64(0,1000);
|
|
586 |
TestSeek64(5000,6000);
|
|
587 |
TestSeek64(200000,500000);
|
|
588 |
TestSeek64(K2GB,K2GB+1000);
|
|
589 |
TestSeek64(K3GB-1000,K3GB-2000);
|
|
590 |
TestSeek64(K3GB-50, K3GB-20);
|
|
591 |
r=TheFs.Delete(gSeekFile);
|
|
592 |
test(r==KErrNone);
|
|
593 |
|
|
594 |
test.End();
|
|
595 |
return(KErrNone);
|
|
596 |
|
|
597 |
}
|
|
598 |
#endif //SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
|
599 |
|
|
600 |
GLDEF_C void CallTestsL()
|
|
601 |
//
|
|
602 |
// Call all tests
|
|
603 |
//
|
|
604 |
{
|
|
605 |
|
|
606 |
TInt r=client.CreateLocal(0);
|
|
607 |
test(r==KErrNone);
|
|
608 |
gSessionPath=_L("?:\\F32-TST\\");
|
|
609 |
CSelectionBox* TheSelector=CSelectionBox::NewL(test.Console());
|
|
610 |
TCallBack localDrivesCb(TestLocalDrive,TheSelector);
|
|
611 |
TCallBack findEntriesCb(TestFindEntries,TheSelector);
|
|
612 |
TCallBack fileSeekCb(TestFileSeek,TheSelector);
|
|
613 |
|
|
614 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
|
615 |
TCallBack largefileSeekCb(TestLargeFileSeek,TheSelector);
|
|
616 |
#endif //SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
|
617 |
|
|
618 |
TheSelector->AddDriveSelectorL(TheFs);
|
|
619 |
TheSelector->AddLineL(_L("Test LocalDrive"),localDrivesCb);
|
|
620 |
TheSelector->AddLineL(_L("Test Find Entries"),findEntriesCb);
|
|
621 |
TheSelector->AddLineL(_L("Test File Seek"),fileSeekCb);
|
|
622 |
|
|
623 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
|
624 |
TheSelector->AddLineL(_L("Test large File Seek"),largefileSeekCb);
|
|
625 |
#endif //SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
|
|
626 |
TheSelector->Run();
|
|
627 |
client.Close();
|
|
628 |
delete TheSelector;
|
|
629 |
}
|