0
|
1 |
// Copyright (c) 2006-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_fsrdel.cpp
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
|
|
19 |
#include <f32file.h>
|
|
20 |
#include <e32test.h>
|
|
21 |
#include "t_benchmain.h"
|
|
22 |
|
|
23 |
GLDEF_D RTest test(_L("File Server Benchmarks, deletion of a massive amount of files"));
|
|
24 |
|
|
25 |
//----------------------------------------------------------------------------------------------
|
|
26 |
//! @SYMTestCaseID PBASE-T_FSRDEL-0272
|
|
27 |
//! @SYMTestType CIT
|
|
28 |
//! @SYMPREQ PREQ000
|
|
29 |
//! @SYMTestCaseDesc This test case is measuring performance of the FAT implementation.
|
|
30 |
//! @SYMTestActions 0. Expects the files to exist in order to successful execution
|
|
31 |
//! 1. Time the deletion of a file from each directory with RFs::Delete
|
|
32 |
//! 2. Time the deletion of a file from each directory with CFileMan::Delete
|
|
33 |
//! 3. Time the deletion of all the files from each directory
|
|
34 |
//! with RFs::Delete
|
|
35 |
//! 4. Time the deletion of all the files from each directory with
|
|
36 |
//! CFileMan::Delete (wildcard F*.*)
|
|
37 |
//! 5. Time the deletion of a file from each directory with RFs::Delete
|
|
38 |
//! with two clients accessing the directory
|
|
39 |
//! 6. Time the deletion of a file from each directory with CFileMan::Delete
|
|
40 |
//! with two clients accessing the directory
|
|
41 |
//! 7. Time the deletion of all the files from each directory with RFs::Delete
|
|
42 |
//! with two clients accessing the directory
|
|
43 |
//! 8. Time the deletion of all the files from each directory with
|
|
44 |
//! CFileMan::Delete with two clients accessing the directory (wildcard F*.*)
|
|
45 |
//! 9. Time the deletion of a file from each directory with RFs::Delete
|
|
46 |
//! with two clients accessing different directories
|
|
47 |
//! 10. Time the deletion of a file from each directory with CFileMan::Delete
|
|
48 |
//! with two clients accessing different directories
|
|
49 |
//! 11. Time the deletion of all the files from each directory with RFs::Delete
|
|
50 |
//! with two clients accessing different directories
|
|
51 |
//! 12. Time the deletion of all the files from each directory with
|
|
52 |
//! CFileMan::Delete with two clients accessing different directories (wildcard F*.*)
|
|
53 |
//! @SYMTestExpectedResults Finishes if the system behaves as expected, panics otherwise
|
|
54 |
//! @SYMTestPriority High
|
|
55 |
//! @SYMTestStatus Implemented
|
|
56 |
//----------------------------------------------------------------------------------------------
|
|
57 |
|
|
58 |
LOCAL_D RSemaphore client,write_screen;
|
|
59 |
LOCAL_D const TInt KHeapSize=0x4000;
|
|
60 |
LOCAL_D TBuf8<4096> buf;
|
|
61 |
LOCAL_D TDriveList gDriveList;
|
|
62 |
|
|
63 |
// Concurrent thread varibles
|
|
64 |
RThread gSpeedy;
|
|
65 |
RThread gSpeedyII;
|
|
66 |
TInt gT1;
|
|
67 |
TInt gT2;
|
|
68 |
LOCAL_D TFileName gDelEntryDir;
|
|
69 |
LOCAL_D TFileName gDelEntryDir2;
|
|
70 |
LOCAL_D TInt ThreadCount=0;
|
|
71 |
TBool gWriting = EFalse;
|
|
72 |
|
|
73 |
TBool gKillMe=EFalse;
|
|
74 |
|
|
75 |
_LIT(KDeleteMe,"delete%d.me");
|
|
76 |
_LIT(KDeleteMe2,"blabla%d.rhd");
|
|
77 |
|
|
78 |
|
|
79 |
/** Send content through the RDebug for trgtest
|
|
80 |
not to hung, when the test is not writing
|
|
81 |
|
|
82 |
*/
|
|
83 |
LOCAL_C TInt noise(TAny* )
|
|
84 |
{
|
|
85 |
FOREVER
|
|
86 |
{
|
|
87 |
User::After(2147483647); // max value, 35 minutes, 47 seconds
|
|
88 |
if(!gWriting)
|
|
89 |
RDebug::Print(_L("."));
|
|
90 |
}
|
|
91 |
}
|
|
92 |
|
|
93 |
/** Create background noise by deleting/creating file in gDelEntryDir2 directory
|
|
94 |
|
|
95 |
*/
|
|
96 |
LOCAL_C TInt DeleteEntryAccess2(TAny* )
|
|
97 |
{
|
|
98 |
RFs fs;
|
|
99 |
TInt r = 0;
|
|
100 |
TBuf<100> dirfile;
|
|
101 |
TBuf<50> filename;
|
|
102 |
RFile file;
|
|
103 |
RTest test(_L("test 2"));
|
|
104 |
|
|
105 |
// Not checking error state until main thread has been signalled, to avoid deadlock
|
|
106 |
fs.Connect();
|
|
107 |
r = fs.SetSessionPath(gSessionPath);
|
|
108 |
|
|
109 |
filename.Format(KDeleteMe2,gT2);
|
|
110 |
|
|
111 |
dirfile = gDelEntryDir2;
|
|
112 |
dirfile.Append(filename);
|
|
113 |
|
|
114 |
client.Signal();
|
|
115 |
FailIfError(r);
|
|
116 |
|
|
117 |
FOREVER
|
|
118 |
{
|
|
119 |
if(!gKillMe)
|
|
120 |
{
|
|
121 |
r = file.Create(fs, dirfile, EFileShareAny|EFileWrite);
|
|
122 |
if(r == KErrAlreadyExists)
|
|
123 |
r = file.Open(fs, dirfile, EFileShareAny|EFileWrite);
|
|
124 |
file.Close();
|
|
125 |
FailIfError(r);
|
|
126 |
|
|
127 |
r = fs.Delete(dirfile);
|
|
128 |
if((r != KErrNone) && (r != KErrInUse))
|
|
129 |
FailIfError(r);
|
|
130 |
}
|
|
131 |
}
|
|
132 |
}
|
|
133 |
|
|
134 |
/** Create background noise by deleting/creating file in gDelEntryDir directory
|
|
135 |
|
|
136 |
*/
|
|
137 |
LOCAL_C TInt DeleteEntryAccess(TAny*)
|
|
138 |
{
|
|
139 |
RFs fs2;
|
|
140 |
TInt r = 0;
|
|
141 |
TBuf<100> dirfile;
|
|
142 |
TBuf<50> filename;
|
|
143 |
RFile file2;
|
|
144 |
RTest test(_L("test 2"));
|
|
145 |
|
|
146 |
// Not checking error state until main thread has been signalled, to avoid deadlock
|
|
147 |
fs2.Connect();
|
|
148 |
r = fs2.SetSessionPath(gSessionPath);
|
|
149 |
|
|
150 |
filename.Format(KDeleteMe,gT1);
|
|
151 |
|
|
152 |
dirfile = gDelEntryDir;
|
|
153 |
dirfile.Append(filename);
|
|
154 |
|
|
155 |
client.Signal();
|
|
156 |
FailIfError(r);
|
|
157 |
|
|
158 |
FOREVER
|
|
159 |
{
|
|
160 |
if(!gKillMe)
|
|
161 |
{
|
|
162 |
r = file2.Create(fs2, dirfile, EFileShareAny|EFileWrite);
|
|
163 |
if(r == KErrAlreadyExists)
|
|
164 |
r = file2.Open(fs2, dirfile, EFileShareAny|EFileWrite);
|
|
165 |
file2.Close();
|
|
166 |
FailIfError(r);
|
|
167 |
r = fs2.Delete(dirfile);
|
|
168 |
if((r != KErrNone) && (r != KErrInUse))
|
|
169 |
FailIfError(r);
|
|
170 |
}
|
|
171 |
}
|
|
172 |
}
|
|
173 |
|
|
174 |
/** Starts a concurrent client session in different directories
|
|
175 |
|
|
176 |
*/
|
|
177 |
LOCAL_C void DoTest(TThreadFunction aFunction)
|
|
178 |
{
|
|
179 |
gKillMe = EFalse;
|
|
180 |
|
|
181 |
TBuf<20> buffer = _L("Speedy");
|
|
182 |
buffer.AppendNum(ThreadCount++);
|
|
183 |
gT1 = ThreadCount;
|
|
184 |
TInt r = gSpeedy.Create(buffer, aFunction, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
|
|
185 |
FailIfError(r);
|
|
186 |
|
|
187 |
buffer = _L("Speedy");
|
|
188 |
buffer.AppendNum(ThreadCount++);
|
|
189 |
gT2=ThreadCount;
|
|
190 |
r = gSpeedyII.Create(buffer, DeleteEntryAccess2, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
|
|
191 |
FailIfError(r);
|
|
192 |
|
|
193 |
gSpeedy.SetPriority(EPriorityLess);
|
|
194 |
gSpeedyII.SetPriority(EPriorityLess);
|
|
195 |
|
|
196 |
gSpeedy.Resume();
|
|
197 |
gSpeedyII.Resume();
|
|
198 |
|
|
199 |
client.Wait();
|
|
200 |
client.Wait();
|
|
201 |
}
|
|
202 |
|
|
203 |
/** Kills the concurrent sessions
|
|
204 |
|
|
205 |
*/
|
|
206 |
LOCAL_C void DoTestKill()
|
|
207 |
{
|
|
208 |
gKillMe = ETrue;
|
|
209 |
User::After(10000000);
|
|
210 |
|
|
211 |
gSpeedy.Kill(KErrNone);
|
|
212 |
gSpeedy.Close();
|
|
213 |
|
|
214 |
gSpeedyII.Kill(KErrNone);
|
|
215 |
gSpeedyII.Close();
|
|
216 |
}
|
|
217 |
|
|
218 |
/** Creates again the last.txt file in each directory that is being used
|
|
219 |
|
|
220 |
*/
|
|
221 |
LOCAL_C void ReCreateLast()
|
|
222 |
{
|
|
223 |
TInt i = 1, r = 0;
|
|
224 |
RFile file;
|
|
225 |
TBuf16<50> dirtemp;
|
|
226 |
|
|
227 |
TBuf16<50> path;
|
|
228 |
TBuf8<1024> dummy(1024);
|
|
229 |
|
|
230 |
|
|
231 |
while(i <= gTypes)
|
|
232 |
{
|
|
233 |
path = gSessionPath;
|
|
234 |
dirtemp.Format(KDirMultipleName, i, 100);
|
|
235 |
path.Append(dirtemp);
|
|
236 |
path.Append(KCommonFile);
|
|
237 |
r = file.Create(TheFs, path, EFileShareAny|EFileWrite);
|
|
238 |
if(r == KErrAlreadyExists)
|
|
239 |
{
|
|
240 |
r = file.Open(TheFs, path, EFileShareAny|EFileWrite);
|
|
241 |
FailIfError(r);
|
|
242 |
}
|
|
243 |
r = file.Write(dummy);
|
|
244 |
FailIfError(r);
|
|
245 |
file.Close();
|
|
246 |
i++;
|
|
247 |
}
|
|
248 |
|
|
249 |
if(gFilesLimit >= 1000)
|
|
250 |
{
|
|
251 |
i = 1;
|
|
252 |
while(i <= gTypes)
|
|
253 |
{
|
|
254 |
path = gSessionPath;
|
|
255 |
dirtemp.Format(KDirMultipleName, i, 1000);
|
|
256 |
path.Append(dirtemp);
|
|
257 |
path.Append(KCommonFile);
|
|
258 |
r = file.Create(TheFs, path, EFileShareAny|EFileWrite);
|
|
259 |
if(r == KErrAlreadyExists)
|
|
260 |
{
|
|
261 |
r = file.Open(TheFs, path, EFileShareAny|EFileWrite);
|
|
262 |
FailIfError(r);
|
|
263 |
}
|
|
264 |
r = file.Write(dummy);
|
|
265 |
FailIfError(r);
|
|
266 |
file.Close();
|
|
267 |
i++;
|
|
268 |
}
|
|
269 |
}
|
|
270 |
|
|
271 |
if(gFilesLimit >= 5000)
|
|
272 |
{
|
|
273 |
i = 1;
|
|
274 |
while(i <= gTypes)
|
|
275 |
{
|
|
276 |
path = gSessionPath;
|
|
277 |
dirtemp.Format(KDirMultipleName, i, 5000);
|
|
278 |
path.Append(dirtemp);
|
|
279 |
path.Append(KCommonFile);
|
|
280 |
r = file.Create(TheFs, path, EFileShareAny|EFileWrite);
|
|
281 |
if(r == KErrAlreadyExists)
|
|
282 |
{
|
|
283 |
r = file.Open(TheFs, path, EFileShareAny|EFileWrite);
|
|
284 |
FailIfError(r);
|
|
285 |
}
|
|
286 |
r = file.Write(dummy);
|
|
287 |
FailIfError(r);
|
|
288 |
file.Close();
|
|
289 |
i++;
|
|
290 |
}
|
|
291 |
}
|
|
292 |
if(gFilesLimit >= 10000)
|
|
293 |
{
|
|
294 |
i = 1;
|
|
295 |
while(i <= gTypes)
|
|
296 |
{
|
|
297 |
path = gSessionPath;
|
|
298 |
dirtemp.Format(KDirMultipleName, i, 10000);
|
|
299 |
path.Append(dirtemp);
|
|
300 |
path.Append(KCommonFile);
|
|
301 |
r = file.Create(TheFs, path, EFileShareAny|EFileWrite);
|
|
302 |
if(r ==KErrAlreadyExists)
|
|
303 |
{
|
|
304 |
r = file.Open(TheFs, path, EFileShareAny|EFileWrite);
|
|
305 |
FailIfError(r);
|
|
306 |
}
|
|
307 |
r = file.Write(dummy);
|
|
308 |
FailIfError(r);
|
|
309 |
file.Close();
|
|
310 |
i++;
|
|
311 |
}
|
|
312 |
}
|
|
313 |
}
|
|
314 |
|
|
315 |
/** Deletes all files in a given directory one by one
|
|
316 |
|
|
317 |
@param aN Number of files in the directory
|
|
318 |
@param aStep Test step
|
|
319 |
*/
|
|
320 |
LOCAL_C TInt DelAllFiles1(TInt aN, TInt aStep)
|
|
321 |
{
|
|
322 |
TInt i = 0, r = 0;
|
|
323 |
TBuf16<50> directory;
|
|
324 |
TBuf16<50> dirtemp;
|
|
325 |
|
|
326 |
TBuf16<50> path;
|
|
327 |
TBuf16<50> buffer(50);
|
|
328 |
|
|
329 |
_LIT(KMsg, "This file caused a problem: %S\n");
|
|
330 |
|
|
331 |
TTime startTime;
|
|
332 |
TTime endTime;
|
|
333 |
TTimeIntervalMicroSeconds timeTaken(0);
|
|
334 |
TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
|
|
335 |
|
|
336 |
if(aN <= gFilesLimit)
|
|
337 |
{
|
|
338 |
if(gTypes >= 1)
|
|
339 |
{
|
|
340 |
// all 8.3
|
|
341 |
directory = gSessionPath;
|
|
342 |
dirtemp.Format(KDirMultipleName, 1, aN);
|
|
343 |
directory.Append(dirtemp);
|
|
344 |
|
|
345 |
i = 0;
|
|
346 |
startTime.HomeTime();
|
|
347 |
while(i < aN)
|
|
348 |
{
|
|
349 |
FileNamesGeneration(buffer, 8, i, i%3+1) ;
|
|
350 |
path = directory;
|
|
351 |
path.Append(buffer);
|
|
352 |
r = TheFs.Delete(path);
|
|
353 |
if(r != KErrNone)
|
|
354 |
{
|
|
355 |
TBuf16<250> msg;
|
|
356 |
msg.Format(KMsg, &path);
|
|
357 |
test.Printf(msg);
|
|
358 |
FailIfError(r);
|
|
359 |
}
|
|
360 |
i++;
|
|
361 |
}
|
|
362 |
endTime.HomeTime();
|
|
363 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
364 |
timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
365 |
}
|
|
366 |
|
|
367 |
if(gTypes >= 2)
|
|
368 |
{
|
|
369 |
// all 20.3 chars
|
|
370 |
dirtemp.Format(KDirMultipleName, 2, aN);
|
|
371 |
directory = gSessionPath;
|
|
372 |
directory.Append(dirtemp);
|
|
373 |
|
|
374 |
i = 0;
|
|
375 |
startTime.HomeTime();
|
|
376 |
while(i < aN)
|
|
377 |
{
|
|
378 |
FileNamesGeneration(buffer, 20, i, i%3+1) ;
|
|
379 |
path = directory;
|
|
380 |
path.Append(buffer);
|
|
381 |
r = TheFs.Delete(path);
|
|
382 |
if(r != KErrNone)
|
|
383 |
{
|
|
384 |
TBuf16<250> msg;
|
|
385 |
msg.Format(KMsg, &path);
|
|
386 |
test.Printf(msg);
|
|
387 |
FailIfError(r);
|
|
388 |
}
|
|
389 |
i++;
|
|
390 |
}
|
|
391 |
endTime.HomeTime();
|
|
392 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
393 |
timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
394 |
}
|
|
395 |
|
|
396 |
if(gTypes >= 3)
|
|
397 |
{
|
|
398 |
// 50/50
|
|
399 |
dirtemp.Format(KDirMultipleName, 3, aN);
|
|
400 |
directory = gSessionPath;
|
|
401 |
directory.Append(dirtemp);
|
|
402 |
i = 0;
|
|
403 |
startTime.HomeTime();
|
|
404 |
while(i < aN)
|
|
405 |
{
|
|
406 |
if(1 == (i % 2)) FileNamesGeneration(buffer, 8, i, i%3+1) ;
|
|
407 |
else FileNamesGeneration(buffer, 20, i, i%3+1) ;
|
|
408 |
|
|
409 |
path = directory;
|
|
410 |
path.Append(buffer);
|
|
411 |
r = TheFs.Delete(path);
|
|
412 |
if(r != KErrNone)
|
|
413 |
{
|
|
414 |
TBuf16<250> msg;
|
|
415 |
msg.Format(KMsg, &path);
|
|
416 |
test.Printf(msg);
|
|
417 |
FailIfError(r);
|
|
418 |
}
|
|
419 |
i++;
|
|
420 |
}
|
|
421 |
endTime.HomeTime();
|
|
422 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
423 |
timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
|
|
424 |
}
|
|
425 |
}
|
|
426 |
|
|
427 |
gWriting = ETrue; User::After(1000000);
|
|
428 |
PrintResult(aStep, 1, aN);
|
|
429 |
PrintResultTime(aStep, 2, timeTaken1);
|
|
430 |
PrintResultTime(aStep, 3, timeTaken2);
|
|
431 |
PrintResultTime(aStep, 4, timeTaken3);
|
|
432 |
gWriting = EFalse;
|
|
433 |
|
|
434 |
return(KErrNone);
|
|
435 |
}
|
|
436 |
|
|
437 |
/** Deletes all files in a given directory using wildcards
|
|
438 |
|
|
439 |
@param aN Number of files in the directory
|
|
440 |
@param aStep Test step
|
|
441 |
*/
|
|
442 |
LOCAL_C TInt DelAllFiles2(TInt aN, TInt aStep)
|
|
443 |
{
|
|
444 |
TInt r = 0;
|
|
445 |
|
|
446 |
TBuf16<50> directory;
|
|
447 |
TBuf16<50> dirtemp;
|
|
448 |
|
|
449 |
TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
|
|
450 |
TTime startTime;
|
|
451 |
TTime endTime;
|
|
452 |
TTimeIntervalMicroSeconds timeTaken(0);
|
|
453 |
CFileMan* fMan=CFileMan::NewL(TheFs);
|
|
454 |
|
|
455 |
|
|
456 |
if(aN <= gFilesLimit)
|
|
457 |
{
|
|
458 |
if(gTypes >= 1)
|
|
459 |
{
|
|
460 |
// all 8.3
|
|
461 |
dirtemp.Format(KDirMultipleName, 1, aN);
|
|
462 |
directory = gSessionPath;
|
|
463 |
directory.Append(dirtemp);
|
|
464 |
|
|
465 |
startTime.HomeTime();
|
|
466 |
directory.Append(_L("F*.*"));
|
|
467 |
|
|
468 |
r = fMan->Delete(directory);
|
|
469 |
FailIfError(r);
|
|
470 |
|
|
471 |
endTime.HomeTime();
|
|
472 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
473 |
timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
474 |
}
|
|
475 |
if(gTypes >= 2)
|
|
476 |
{
|
|
477 |
// all 20.3 chars
|
|
478 |
dirtemp.Format(KDirMultipleName, 2, aN);
|
|
479 |
directory = gSessionPath;
|
|
480 |
directory.Append(dirtemp);
|
|
481 |
|
|
482 |
startTime.HomeTime();
|
|
483 |
directory.Append(_L("F*.*"));
|
|
484 |
r = fMan->Delete(directory);
|
|
485 |
FailIfError(r);
|
|
486 |
|
|
487 |
endTime.HomeTime();
|
|
488 |
|
|
489 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
490 |
timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
491 |
}
|
|
492 |
|
|
493 |
if(gTypes >= 3)
|
|
494 |
{
|
|
495 |
// 50/50
|
|
496 |
dirtemp.Format(KDirMultipleName,3, aN);
|
|
497 |
directory = gSessionPath;
|
|
498 |
directory.Append(dirtemp);
|
|
499 |
|
|
500 |
startTime.HomeTime();
|
|
501 |
directory.Append(_L("F*.*"));
|
|
502 |
r = fMan->Delete(directory);
|
|
503 |
FailIfError(r);
|
|
504 |
|
|
505 |
endTime.HomeTime();
|
|
506 |
|
|
507 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
508 |
timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
509 |
}
|
|
510 |
}
|
|
511 |
delete fMan;
|
|
512 |
|
|
513 |
gWriting = ETrue; User::After(1000000);
|
|
514 |
PrintResult(aStep, 1, aN);
|
|
515 |
PrintResultTime(aStep, 2, timeTaken1);
|
|
516 |
PrintResultTime(aStep, 3, timeTaken2);
|
|
517 |
PrintResultTime(aStep, 4, timeTaken3);
|
|
518 |
gWriting = EFalse;
|
|
519 |
|
|
520 |
return(KErrNone);
|
|
521 |
}
|
|
522 |
|
|
523 |
/** Delete last.txt with two threads accessing the current directory and
|
|
524 |
creating/deleting a file with RFs::Delete
|
|
525 |
|
|
526 |
@param aN Number of files in the directory
|
|
527 |
@param aStep Test step
|
|
528 |
*/
|
|
529 |
LOCAL_C void DelFileM1(TInt aN, TInt aStep)
|
|
530 |
{
|
|
531 |
TBuf16<100> dir1;
|
|
532 |
TBuf16<100> dir2;
|
|
533 |
TBuf16<100> dir3;
|
|
534 |
TBuf16<100> dir4;
|
|
535 |
|
|
536 |
TInt r = 0;
|
|
537 |
TTime startTime;
|
|
538 |
TTime endTime;
|
|
539 |
TTimeIntervalMicroSeconds timeTaken(0);
|
|
540 |
TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
|
|
541 |
|
|
542 |
dir1 = gSessionPath;
|
|
543 |
dir2 = gSessionPath;
|
|
544 |
dir3 = gSessionPath;
|
|
545 |
|
|
546 |
dir4.Format(KDirMultipleName, 1, aN);
|
|
547 |
dir1.Append(dir4);
|
|
548 |
dir4.Format(KDirMultipleName, 2, aN);
|
|
549 |
dir2.Append(dir4);
|
|
550 |
dir4.Format(KDirMultipleName, 3, aN);
|
|
551 |
dir3.Append(dir4);
|
|
552 |
|
|
553 |
if(aN <= gFilesLimit)
|
|
554 |
{
|
|
555 |
if(gTypes >= 1)
|
|
556 |
{
|
|
557 |
gDelEntryDir = dir1;
|
|
558 |
gDelEntryDir2 = dir1;
|
|
559 |
dir1.Append(KCommonFile);
|
|
560 |
|
|
561 |
DoTest(DeleteEntryAccess);
|
|
562 |
|
|
563 |
startTime.HomeTime();
|
|
564 |
|
|
565 |
r = TheFs.Delete(dir1);
|
|
566 |
FailIfError(r);
|
|
567 |
|
|
568 |
endTime.HomeTime();
|
|
569 |
|
|
570 |
DoTestKill();
|
|
571 |
|
|
572 |
timeTaken=endTime.MicroSecondsFrom(startTime);
|
|
573 |
timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
574 |
}
|
|
575 |
|
|
576 |
if(gTypes >= 2)
|
|
577 |
{
|
|
578 |
gDelEntryDir = dir2;
|
|
579 |
gDelEntryDir2 = dir2;
|
|
580 |
|
|
581 |
dir2.Append(KCommonFile);
|
|
582 |
|
|
583 |
DoTest(DeleteEntryAccess);
|
|
584 |
|
|
585 |
startTime.HomeTime();
|
|
586 |
|
|
587 |
r = TheFs.Delete(dir2);
|
|
588 |
FailIfError(r);
|
|
589 |
|
|
590 |
endTime.HomeTime();
|
|
591 |
timeTaken=endTime.MicroSecondsFrom(startTime);
|
|
592 |
|
|
593 |
DoTestKill();
|
|
594 |
timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
595 |
}
|
|
596 |
|
|
597 |
if(gTypes >= 3)
|
|
598 |
{
|
|
599 |
gDelEntryDir = dir3;
|
|
600 |
gDelEntryDir2 = dir3;
|
|
601 |
|
|
602 |
dir3.Append(KCommonFile);
|
|
603 |
|
|
604 |
|
|
605 |
DoTest(DeleteEntryAccess);
|
|
606 |
|
|
607 |
startTime.HomeTime();
|
|
608 |
|
|
609 |
r = TheFs.Delete(dir3);
|
|
610 |
FailIfError(r);
|
|
611 |
|
|
612 |
endTime.HomeTime();
|
|
613 |
DoTestKill();
|
|
614 |
|
|
615 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
616 |
timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
617 |
}
|
|
618 |
}
|
|
619 |
|
|
620 |
gWriting = ETrue; User::After(1000000);
|
|
621 |
PrintResult(aStep, 1, aN);
|
|
622 |
PrintResultTime(aStep, 2, timeTaken1);
|
|
623 |
PrintResultTime(aStep, 3, timeTaken2);
|
|
624 |
PrintResultTime(aStep, 4, timeTaken3);
|
|
625 |
gWriting = EFalse;
|
|
626 |
}
|
|
627 |
|
|
628 |
/** Delete last.txt by opening it and with two threads accessing the current
|
|
629 |
directory and creating/deleting a file with CFileMan::Delete
|
|
630 |
|
|
631 |
@param aN Number of files in the directory
|
|
632 |
@param aStep Test step
|
|
633 |
*/
|
|
634 |
LOCAL_C void DelFileM2(TInt aN, TInt aStep)
|
|
635 |
{
|
|
636 |
TBuf16<100> dir1;
|
|
637 |
TBuf16<100> dir2;
|
|
638 |
TBuf16<100> dir3;
|
|
639 |
TBuf16<100> dir4;
|
|
640 |
|
|
641 |
TInt r = 0;
|
|
642 |
TTime startTime;
|
|
643 |
TTime endTime;
|
|
644 |
TTimeIntervalMicroSeconds timeTaken(0);
|
|
645 |
TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
|
|
646 |
|
|
647 |
CFileMan* fMan = CFileMan::NewL(TheFs);
|
|
648 |
|
|
649 |
dir1 = gSessionPath;
|
|
650 |
dir2 = gSessionPath;
|
|
651 |
dir3 = gSessionPath;
|
|
652 |
|
|
653 |
dir4.Format(KDirMultipleName, 1, aN);
|
|
654 |
dir1.Append(dir4);
|
|
655 |
dir4.Format(KDirMultipleName, 2, aN);
|
|
656 |
dir2.Append(dir4);
|
|
657 |
dir4.Format(KDirMultipleName, 3, aN);
|
|
658 |
dir3.Append(dir4);
|
|
659 |
|
|
660 |
if(aN <= gFilesLimit)
|
|
661 |
{
|
|
662 |
if(gTypes >= 1)
|
|
663 |
{
|
|
664 |
gDelEntryDir = dir1;
|
|
665 |
gDelEntryDir2 = dir1;
|
|
666 |
|
|
667 |
dir1.Append(KCommonFile);
|
|
668 |
|
|
669 |
DoTest(DeleteEntryAccess);
|
|
670 |
|
|
671 |
startTime.HomeTime();
|
|
672 |
|
|
673 |
r = fMan->Delete(dir1);
|
|
674 |
FailIfError(r);
|
|
675 |
|
|
676 |
endTime.HomeTime();
|
|
677 |
DoTestKill();
|
|
678 |
|
|
679 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
680 |
timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
681 |
}
|
|
682 |
|
|
683 |
if(gTypes >= 2)
|
|
684 |
{
|
|
685 |
gDelEntryDir = dir2;
|
|
686 |
gDelEntryDir2 = dir2;
|
|
687 |
|
|
688 |
dir2.Append(KCommonFile);
|
|
689 |
|
|
690 |
DoTest(DeleteEntryAccess);
|
|
691 |
|
|
692 |
startTime.HomeTime();
|
|
693 |
|
|
694 |
r = fMan->Delete(dir2);
|
|
695 |
FailIfError(r);
|
|
696 |
|
|
697 |
endTime.HomeTime();
|
|
698 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
699 |
DoTestKill();
|
|
700 |
timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
701 |
}
|
|
702 |
|
|
703 |
if(gTypes >= 3)
|
|
704 |
{
|
|
705 |
gDelEntryDir = dir3;
|
|
706 |
gDelEntryDir2 = dir3;
|
|
707 |
dir3.Append(KCommonFile);
|
|
708 |
|
|
709 |
|
|
710 |
DoTest(DeleteEntryAccess);
|
|
711 |
|
|
712 |
startTime.HomeTime();
|
|
713 |
|
|
714 |
r = fMan->Delete(dir3);
|
|
715 |
FailIfError(r);
|
|
716 |
|
|
717 |
endTime.HomeTime();
|
|
718 |
DoTestKill();
|
|
719 |
|
|
720 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
721 |
timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
722 |
}
|
|
723 |
}
|
|
724 |
delete fMan;
|
|
725 |
|
|
726 |
gWriting = ETrue; User::After(1000000);
|
|
727 |
PrintResult(aStep, 1, aN);
|
|
728 |
PrintResultTime(aStep, 2, timeTaken1);
|
|
729 |
PrintResultTime(aStep, 3, timeTaken2);
|
|
730 |
PrintResultTime(aStep, 4, timeTaken3);
|
|
731 |
gWriting = EFalse;
|
|
732 |
|
|
733 |
}
|
|
734 |
|
|
735 |
/** Delete all files with two threads accessing the current directory and creating/deleting a file
|
|
736 |
with RFs::Delete
|
|
737 |
|
|
738 |
@param aN Number of files in the directory
|
|
739 |
@param aStep Test step
|
|
740 |
*/
|
|
741 |
LOCAL_C void DelAllM1(TInt aN, TInt aStep)
|
|
742 |
{
|
|
743 |
TInt i = 0, r = 0;
|
|
744 |
|
|
745 |
TBuf16<50> directory;
|
|
746 |
TBuf16<50> dirtemp;
|
|
747 |
|
|
748 |
TBuf16<50> path;
|
|
749 |
TBuf16<50> buffer(50);
|
|
750 |
|
|
751 |
TTime startTime;
|
|
752 |
TTime endTime;
|
|
753 |
TTimeIntervalMicroSeconds timeTaken(0);
|
|
754 |
TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
|
|
755 |
|
|
756 |
if(aN <= gFilesLimit)
|
|
757 |
{
|
|
758 |
// Start the noise in the background
|
|
759 |
gDelEntryDir = directory;
|
|
760 |
gDelEntryDir2 = directory;
|
|
761 |
DoTest(DeleteEntryAccess);
|
|
762 |
|
|
763 |
if(gTypes >= 1)
|
|
764 |
{
|
|
765 |
// all 8.3
|
|
766 |
dirtemp.Format(KDirMultipleName, 1, aN);
|
|
767 |
directory = gSessionPath;
|
|
768 |
directory.Append(dirtemp);
|
|
769 |
|
|
770 |
i = 0;
|
|
771 |
|
|
772 |
startTime.HomeTime();
|
|
773 |
while(i < aN)
|
|
774 |
{
|
|
775 |
FileNamesGeneration(buffer, 8, i, i%3+1) ;
|
|
776 |
path = directory;
|
|
777 |
path.Append(buffer);
|
|
778 |
r = TheFs.Delete(path);
|
|
779 |
FailIfError(r);
|
|
780 |
i++;
|
|
781 |
}
|
|
782 |
endTime.HomeTime();
|
|
783 |
|
|
784 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
785 |
timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
786 |
}
|
|
787 |
|
|
788 |
if(gTypes >= 2)
|
|
789 |
{
|
|
790 |
// all 20.3 chars
|
|
791 |
dirtemp.Format(KDirMultipleName, 2, aN);
|
|
792 |
directory = gSessionPath;
|
|
793 |
directory.Append(dirtemp);
|
|
794 |
|
|
795 |
i = 0;
|
|
796 |
startTime.HomeTime();
|
|
797 |
while(i < aN)
|
|
798 |
{
|
|
799 |
FileNamesGeneration(buffer, 20, i, i%3+1) ;
|
|
800 |
path = directory;
|
|
801 |
path.Append(buffer);
|
|
802 |
r = TheFs.Delete(path);
|
|
803 |
FailIfError(r);
|
|
804 |
i++;
|
|
805 |
}
|
|
806 |
endTime.HomeTime();
|
|
807 |
|
|
808 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
809 |
timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
810 |
}
|
|
811 |
|
|
812 |
if(gTypes >= 3)
|
|
813 |
{
|
|
814 |
// 50/50
|
|
815 |
dirtemp.Format(KDirMultipleName,3, aN);
|
|
816 |
directory = gSessionPath;
|
|
817 |
directory.Append(dirtemp);
|
|
818 |
|
|
819 |
i = 0;
|
|
820 |
startTime.HomeTime();
|
|
821 |
while(i < aN)
|
|
822 |
{
|
|
823 |
if(1 == (i % 2)) FileNamesGeneration(buffer, 8, i, i%3+1) ;
|
|
824 |
else FileNamesGeneration(buffer, 20, i, i%3+1) ;
|
|
825 |
|
|
826 |
path = directory;
|
|
827 |
path.Append(buffer);
|
|
828 |
r = TheFs.Delete(path);
|
|
829 |
FailIfError(r);
|
|
830 |
i++;
|
|
831 |
}
|
|
832 |
endTime.HomeTime();
|
|
833 |
|
|
834 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
835 |
timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
836 |
}
|
|
837 |
// Stop the noise in the background
|
|
838 |
DoTestKill();
|
|
839 |
}
|
|
840 |
|
|
841 |
gWriting = ETrue; User::After(1000000);
|
|
842 |
PrintResult(aStep, 1, aN);
|
|
843 |
PrintResultTime(aStep, 2, timeTaken1);
|
|
844 |
PrintResultTime(aStep, 3, timeTaken2);
|
|
845 |
PrintResultTime(aStep, 4, timeTaken3);
|
|
846 |
gWriting = EFalse;
|
|
847 |
}
|
|
848 |
|
|
849 |
/** Delete all files with two threads accessing the same directory and creating/deleting a file
|
|
850 |
with CFileMan::Delete
|
|
851 |
|
|
852 |
@param aN Number of files in the directory
|
|
853 |
@param aStep Test step
|
|
854 |
*/
|
|
855 |
LOCAL_C void DelAllM2(TInt aN, TInt aStep)
|
|
856 |
{
|
|
857 |
TInt r = 0;
|
|
858 |
TBuf16<50> directory;
|
|
859 |
TBuf16<50> dirtemp;
|
|
860 |
|
|
861 |
TTime startTime;
|
|
862 |
TTime endTime;
|
|
863 |
TTimeIntervalMicroSeconds timeTaken(0);
|
|
864 |
TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
|
|
865 |
|
|
866 |
CFileMan* fMan = CFileMan::NewL(TheFs);
|
|
867 |
|
|
868 |
if(aN <= gFilesLimit)
|
|
869 |
{
|
|
870 |
// Start the noise in the background
|
|
871 |
gDelEntryDir = directory;
|
|
872 |
gDelEntryDir2 = directory;
|
|
873 |
DoTest(DeleteEntryAccess);
|
|
874 |
|
|
875 |
if(gTypes >= 1)
|
|
876 |
{
|
|
877 |
// all 8.3
|
|
878 |
dirtemp.Format(KDirMultipleName, 1, aN);
|
|
879 |
directory = gSessionPath;
|
|
880 |
directory.Append(dirtemp);
|
|
881 |
|
|
882 |
startTime.HomeTime();
|
|
883 |
directory.Append(_L("F*.*"));
|
|
884 |
r = fMan->Delete(directory);
|
|
885 |
FailIfError(r);
|
|
886 |
|
|
887 |
endTime.HomeTime();
|
|
888 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
889 |
timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
890 |
}
|
|
891 |
|
|
892 |
if(gTypes >= 2)
|
|
893 |
{
|
|
894 |
// all 20.3 chars
|
|
895 |
dirtemp.Format(KDirMultipleName, 2, aN);
|
|
896 |
directory = gSessionPath;
|
|
897 |
directory.Append(dirtemp);
|
|
898 |
|
|
899 |
startTime.HomeTime();
|
|
900 |
directory.Append(_L("F*.*"));
|
|
901 |
r = fMan->Delete(directory);
|
|
902 |
FailIfError(r);
|
|
903 |
endTime.HomeTime();
|
|
904 |
|
|
905 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
906 |
timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
907 |
|
|
908 |
}
|
|
909 |
if(gTypes >= 3)
|
|
910 |
{
|
|
911 |
// 50/50
|
|
912 |
dirtemp.Format(KDirMultipleName, 3, aN);
|
|
913 |
directory = gSessionPath;
|
|
914 |
directory.Append(dirtemp);
|
|
915 |
|
|
916 |
startTime.HomeTime();
|
|
917 |
directory.Append(_L("F*.*"));
|
|
918 |
r = fMan->Delete(directory);
|
|
919 |
FailIfError(r);
|
|
920 |
endTime.HomeTime();
|
|
921 |
|
|
922 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
923 |
timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
924 |
}
|
|
925 |
|
|
926 |
// Stop the noise in the background
|
|
927 |
DoTestKill();
|
|
928 |
}
|
|
929 |
|
|
930 |
delete fMan;
|
|
931 |
|
|
932 |
gWriting = ETrue; User::After(1000000);
|
|
933 |
PrintResult(aStep, 1, aN);
|
|
934 |
PrintResultTime(aStep, 2, timeTaken1);
|
|
935 |
PrintResultTime(aStep, 3, timeTaken2);
|
|
936 |
PrintResultTime(aStep, 4, timeTaken3);
|
|
937 |
gWriting = EFalse;
|
|
938 |
}
|
|
939 |
|
|
940 |
|
|
941 |
/** Delete last.txt file with two threads accessing different directories and
|
|
942 |
creating/deleting a file in them
|
|
943 |
|
|
944 |
@param aN Number of files in the directory
|
|
945 |
@param aStep Test step
|
|
946 |
*/
|
|
947 |
LOCAL_C void DelFileMD1(TInt aN, TInt aStep)
|
|
948 |
{
|
|
949 |
TBuf16<100> dir1;
|
|
950 |
TBuf16<100> dir2;
|
|
951 |
TBuf16<100> dir3;
|
|
952 |
TBuf16<100> dir4;
|
|
953 |
TBuf16<100> temp;
|
|
954 |
|
|
955 |
TInt r = 0;
|
|
956 |
TTime startTime;
|
|
957 |
TTime endTime;
|
|
958 |
TTimeIntervalMicroSeconds timeTaken(0);
|
|
959 |
TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
|
|
960 |
|
|
961 |
|
|
962 |
dir1 = gSessionPath;
|
|
963 |
dir2 = gSessionPath;
|
|
964 |
dir3 = gSessionPath;
|
|
965 |
|
|
966 |
dir4.Format(KDirMultipleName, 1, aN);
|
|
967 |
dir1.Append(dir4);
|
|
968 |
dir4.Format(KDirMultipleName, 2, aN);
|
|
969 |
dir2.Append(dir4);
|
|
970 |
dir4.Format(KDirMultipleName, 3, aN);
|
|
971 |
dir3.Append(dir4);
|
|
972 |
|
|
973 |
|
|
974 |
temp = gSessionPath;
|
|
975 |
dir4.Format(KDirMultipleName, 3 ,300);
|
|
976 |
temp.Append(dir4);
|
|
977 |
|
|
978 |
if(aN <= gFilesLimit)
|
|
979 |
{
|
|
980 |
if(gTypes >= 1)
|
|
981 |
{
|
|
982 |
gDelEntryDir = dir1;
|
|
983 |
gDelEntryDir2=temp;
|
|
984 |
dir1.Append(KCommonFile);
|
|
985 |
|
|
986 |
DoTest(DeleteEntryAccess);
|
|
987 |
|
|
988 |
startTime.HomeTime();
|
|
989 |
|
|
990 |
r = TheFs.Delete(dir1);
|
|
991 |
FailIfError(r);
|
|
992 |
|
|
993 |
endTime.HomeTime();
|
|
994 |
DoTestKill();
|
|
995 |
|
|
996 |
timeTaken=endTime.MicroSecondsFrom(startTime);
|
|
997 |
timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
998 |
}
|
|
999 |
|
|
1000 |
if(gTypes >= 2)
|
|
1001 |
{
|
|
1002 |
gDelEntryDir = dir2;
|
|
1003 |
|
|
1004 |
dir2.Append(KCommonFile);
|
|
1005 |
|
|
1006 |
DoTest(DeleteEntryAccess);
|
|
1007 |
|
|
1008 |
startTime.HomeTime();
|
|
1009 |
|
|
1010 |
r = TheFs.Delete(dir2);
|
|
1011 |
FailIfError(r);
|
|
1012 |
|
|
1013 |
endTime.HomeTime();
|
|
1014 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
1015 |
DoTestKill();
|
|
1016 |
timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
1017 |
}
|
|
1018 |
|
|
1019 |
if(gTypes >= 3)
|
|
1020 |
{
|
|
1021 |
gDelEntryDir = dir3;
|
|
1022 |
|
|
1023 |
dir3.Append(KCommonFile);
|
|
1024 |
|
|
1025 |
DoTest(DeleteEntryAccess);
|
|
1026 |
|
|
1027 |
startTime.HomeTime();
|
|
1028 |
|
|
1029 |
r = TheFs.Delete(dir3);
|
|
1030 |
FailIfError(r);
|
|
1031 |
|
|
1032 |
endTime.HomeTime();
|
|
1033 |
DoTestKill();
|
|
1034 |
|
|
1035 |
timeTaken=endTime.MicroSecondsFrom(startTime);
|
|
1036 |
timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
1037 |
}
|
|
1038 |
}
|
|
1039 |
|
|
1040 |
gWriting = ETrue; User::After(1000000);
|
|
1041 |
PrintResult(aStep, 1, aN);
|
|
1042 |
PrintResultTime(aStep, 2, timeTaken1);
|
|
1043 |
PrintResultTime(aStep, 3, timeTaken2);
|
|
1044 |
PrintResultTime(aStep, 4, timeTaken3);
|
|
1045 |
gWriting = EFalse;
|
|
1046 |
}
|
|
1047 |
|
|
1048 |
/** Delete last.txt file with two threads accessing different directories and
|
|
1049 |
creating/deleting a file in them
|
|
1050 |
|
|
1051 |
@param aN Number of files in the directory
|
|
1052 |
@param aStep Test step
|
|
1053 |
*/
|
|
1054 |
LOCAL_C void DelFileMD2(TInt aN, TInt aStep)
|
|
1055 |
{
|
|
1056 |
TBuf16<100> dir1;
|
|
1057 |
TBuf16<100> dir2;
|
|
1058 |
TBuf16<100> dir3;
|
|
1059 |
TBuf16<100> dir4;
|
|
1060 |
TBuf16<100> temp;
|
|
1061 |
|
|
1062 |
TInt r = 0;
|
|
1063 |
TTime startTime;
|
|
1064 |
TTime endTime;
|
|
1065 |
TTimeIntervalMicroSeconds timeTaken(0);
|
|
1066 |
TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
|
|
1067 |
|
|
1068 |
CFileMan* fMan=CFileMan::NewL(TheFs);
|
|
1069 |
|
|
1070 |
dir1 = gSessionPath;
|
|
1071 |
dir2 = gSessionPath;
|
|
1072 |
dir3 = gSessionPath;
|
|
1073 |
|
|
1074 |
dir4.Format(KDirMultipleName, 1, aN);
|
|
1075 |
dir1.Append(dir4);
|
|
1076 |
dir4.Format(KDirMultipleName, 2, aN);
|
|
1077 |
dir2.Append(dir4);
|
|
1078 |
dir4.Format(KDirMultipleName, 3, aN);
|
|
1079 |
dir3.Append(dir4);
|
|
1080 |
|
|
1081 |
|
|
1082 |
temp=gSessionPath;
|
|
1083 |
dir4.Format(KDirMultipleName, 3, 300);
|
|
1084 |
temp.Append(dir4);
|
|
1085 |
|
|
1086 |
if(aN <= gFilesLimit)
|
|
1087 |
{
|
|
1088 |
if(gTypes >= 1)
|
|
1089 |
{
|
|
1090 |
gDelEntryDir = dir1;
|
|
1091 |
gDelEntryDir2=temp;
|
|
1092 |
|
|
1093 |
dir1.Append(KCommonFile);
|
|
1094 |
|
|
1095 |
DoTest(DeleteEntryAccess);
|
|
1096 |
|
|
1097 |
startTime.HomeTime();
|
|
1098 |
|
|
1099 |
r = fMan->Delete(dir1);
|
|
1100 |
FailIfError(r);
|
|
1101 |
|
|
1102 |
endTime.HomeTime();
|
|
1103 |
DoTestKill();
|
|
1104 |
|
|
1105 |
timeTaken=endTime.MicroSecondsFrom(startTime);
|
|
1106 |
timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
1107 |
}
|
|
1108 |
|
|
1109 |
if(gTypes >= 2)
|
|
1110 |
{
|
|
1111 |
dir4=dir2;
|
|
1112 |
gDelEntryDir = dir4;
|
|
1113 |
|
|
1114 |
dir2.Append(KCommonFile);
|
|
1115 |
|
|
1116 |
DoTest(DeleteEntryAccess);
|
|
1117 |
|
|
1118 |
startTime.HomeTime();
|
|
1119 |
|
|
1120 |
r = fMan->Delete(dir2);
|
|
1121 |
FailIfError(r);
|
|
1122 |
|
|
1123 |
endTime.HomeTime();
|
|
1124 |
timeTaken=endTime.MicroSecondsFrom(startTime);
|
|
1125 |
DoTestKill();
|
|
1126 |
timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
1127 |
}
|
|
1128 |
if(gTypes >= 3)
|
|
1129 |
{
|
|
1130 |
dir4=dir3;
|
|
1131 |
gDelEntryDir = dir4;
|
|
1132 |
|
|
1133 |
dir3.Append(KCommonFile);
|
|
1134 |
|
|
1135 |
|
|
1136 |
DoTest(DeleteEntryAccess);
|
|
1137 |
|
|
1138 |
startTime.HomeTime();
|
|
1139 |
|
|
1140 |
r = fMan->Delete(dir3);
|
|
1141 |
FailIfError(r);
|
|
1142 |
|
|
1143 |
endTime.HomeTime();
|
|
1144 |
DoTestKill();
|
|
1145 |
|
|
1146 |
timeTaken=endTime.MicroSecondsFrom(startTime);
|
|
1147 |
timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
1148 |
}
|
|
1149 |
}
|
|
1150 |
|
|
1151 |
delete fMan;
|
|
1152 |
|
|
1153 |
gWriting = ETrue; User::After(1000000);
|
|
1154 |
PrintResult(aStep, 1, aN);
|
|
1155 |
PrintResultTime(aStep, 2, timeTaken1);
|
|
1156 |
PrintResultTime(aStep, 3, timeTaken2);
|
|
1157 |
PrintResultTime(aStep, 4, timeTaken3);
|
|
1158 |
gWriting = EFalse;
|
|
1159 |
}
|
|
1160 |
|
|
1161 |
/** Delete all files with two threads accessing different directories and
|
|
1162 |
creating/deleting a file in them using RFs::Delete
|
|
1163 |
|
|
1164 |
@param aN Number of files in the directory
|
|
1165 |
@param aStep Test step
|
|
1166 |
*/
|
|
1167 |
LOCAL_C void DelAllMD1(TInt aN, TInt aStep)
|
|
1168 |
{
|
|
1169 |
TInt i = 0,r = 0;
|
|
1170 |
|
|
1171 |
TBuf16<50> directory;
|
|
1172 |
TBuf16<50> dirtemp;
|
|
1173 |
TBuf16<50> temp;
|
|
1174 |
TBuf16<50> dir4;
|
|
1175 |
|
|
1176 |
|
|
1177 |
TBuf16<50> path;
|
|
1178 |
TBuf16<50> buffer(50);
|
|
1179 |
|
|
1180 |
TTime startTime;
|
|
1181 |
TTime endTime;
|
|
1182 |
TTimeIntervalMicroSeconds timeTaken(0);
|
|
1183 |
TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
|
|
1184 |
|
|
1185 |
|
|
1186 |
temp=gSessionPath;
|
|
1187 |
dir4.Format(KDirMultipleName, 3, 300);
|
|
1188 |
temp.Append(dir4);
|
|
1189 |
|
|
1190 |
if(aN <= gFilesLimit)
|
|
1191 |
{
|
|
1192 |
if(gTypes >= 1)
|
|
1193 |
{
|
|
1194 |
// all 8.3
|
|
1195 |
dirtemp.Format(KDirMultipleName,1, aN);
|
|
1196 |
directory = gSessionPath;
|
|
1197 |
directory.Append(dirtemp);
|
|
1198 |
|
|
1199 |
gDelEntryDir = directory;
|
|
1200 |
gDelEntryDir2 = temp;
|
|
1201 |
|
|
1202 |
i = 0;
|
|
1203 |
|
|
1204 |
DoTest(DeleteEntryAccess);
|
|
1205 |
|
|
1206 |
startTime.HomeTime();
|
|
1207 |
while(i < aN)
|
|
1208 |
{
|
|
1209 |
FileNamesGeneration(buffer, 8, i, i%3+1) ;
|
|
1210 |
path = directory;
|
|
1211 |
path.Append(buffer);
|
|
1212 |
r = TheFs.Delete(path);
|
|
1213 |
FailIfError(r);
|
|
1214 |
i++;
|
|
1215 |
}
|
|
1216 |
endTime.HomeTime();
|
|
1217 |
DoTestKill();
|
|
1218 |
|
|
1219 |
timeTaken=endTime.MicroSecondsFrom(startTime);
|
|
1220 |
timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
1221 |
}
|
|
1222 |
|
|
1223 |
if(gTypes >= 2)
|
|
1224 |
{
|
|
1225 |
// all 20.3 chars
|
|
1226 |
dirtemp.Format(KDirMultipleName,2, aN);
|
|
1227 |
directory = gSessionPath;
|
|
1228 |
directory.Append(dirtemp);
|
|
1229 |
gDelEntryDir = directory;
|
|
1230 |
DoTest(DeleteEntryAccess);
|
|
1231 |
|
|
1232 |
i = 0;
|
|
1233 |
startTime.HomeTime();
|
|
1234 |
while(i<aN)
|
|
1235 |
{
|
|
1236 |
FileNamesGeneration(buffer, 20, i, i%3+1) ;
|
|
1237 |
path = directory;
|
|
1238 |
path.Append(buffer);
|
|
1239 |
r = TheFs.Delete(path);
|
|
1240 |
FailIfError(r);
|
|
1241 |
i++;
|
|
1242 |
}
|
|
1243 |
endTime.HomeTime();
|
|
1244 |
DoTestKill();
|
|
1245 |
|
|
1246 |
timeTaken=endTime.MicroSecondsFrom(startTime);
|
|
1247 |
timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
1248 |
}
|
|
1249 |
|
|
1250 |
if(gTypes >= 3)
|
|
1251 |
{
|
|
1252 |
// 50/50
|
|
1253 |
dirtemp.Format(KDirMultipleName,3, aN);
|
|
1254 |
directory = gSessionPath;
|
|
1255 |
directory.Append(dirtemp);
|
|
1256 |
|
|
1257 |
gDelEntryDir = directory;
|
|
1258 |
DoTest(DeleteEntryAccess);
|
|
1259 |
i = 0;
|
|
1260 |
startTime.HomeTime();
|
|
1261 |
while(i<aN)
|
|
1262 |
{
|
|
1263 |
if(1==(i%2)) FileNamesGeneration(buffer, 8, i, i%3+1) ;
|
|
1264 |
else FileNamesGeneration(buffer, 20, i, i%3+1) ;
|
|
1265 |
|
|
1266 |
path = directory;
|
|
1267 |
path.Append(buffer);
|
|
1268 |
r = TheFs.Delete(path);
|
|
1269 |
FailIfError(r);
|
|
1270 |
i++;
|
|
1271 |
}
|
|
1272 |
endTime.HomeTime();
|
|
1273 |
DoTestKill();
|
|
1274 |
|
|
1275 |
timeTaken=endTime.MicroSecondsFrom(startTime);
|
|
1276 |
timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
1277 |
}
|
|
1278 |
}
|
|
1279 |
|
|
1280 |
gWriting = ETrue; User::After(1000000);
|
|
1281 |
PrintResult(aStep, 1, aN);
|
|
1282 |
PrintResultTime(aStep, 2, timeTaken1);
|
|
1283 |
PrintResultTime(aStep, 3, timeTaken2);
|
|
1284 |
PrintResultTime(aStep, 4, timeTaken3);
|
|
1285 |
gWriting = EFalse;
|
|
1286 |
}
|
|
1287 |
|
|
1288 |
/** Delete all files with two threads accessing different directories and
|
|
1289 |
creating/deleting a file in them using CFileMan::Delete
|
|
1290 |
|
|
1291 |
@param aN Number of files in the directory
|
|
1292 |
@param aStep Test step
|
|
1293 |
*/
|
|
1294 |
LOCAL_C void DelAllMD2(TInt aN, TInt aStep)
|
|
1295 |
{
|
|
1296 |
TInt r = 0;
|
|
1297 |
TBuf16<50> directory;
|
|
1298 |
TBuf16<50> dirtemp;
|
|
1299 |
TBuf16<50> dir4;
|
|
1300 |
TBuf16<50> temp;
|
|
1301 |
|
|
1302 |
|
|
1303 |
TTime startTime;
|
|
1304 |
TTime endTime;
|
|
1305 |
TTimeIntervalMicroSeconds timeTaken(0);
|
|
1306 |
TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
|
|
1307 |
CFileMan* fMan=CFileMan::NewL(TheFs);
|
|
1308 |
|
|
1309 |
|
|
1310 |
// Creating directory for being accessed by other thread
|
|
1311 |
temp=gSessionPath;
|
|
1312 |
dir4.Format(KDirMultipleName, 3, 300);
|
|
1313 |
temp.Append(dir4);
|
|
1314 |
gDelEntryDir2=temp;
|
|
1315 |
|
|
1316 |
if(aN <= gFilesLimit)
|
|
1317 |
{
|
|
1318 |
if(gTypes >= 1)
|
|
1319 |
{
|
|
1320 |
// all 8.3
|
|
1321 |
dirtemp.Format(KDirMultipleName,1, aN);
|
|
1322 |
directory = gSessionPath;
|
|
1323 |
directory.Append(dirtemp);
|
|
1324 |
|
|
1325 |
gDelEntryDir = directory;
|
|
1326 |
|
|
1327 |
DoTest(DeleteEntryAccess);
|
|
1328 |
|
|
1329 |
startTime.HomeTime();
|
|
1330 |
directory.Append(_L("F*.*"));
|
|
1331 |
r = fMan->Delete(directory);
|
|
1332 |
FailIfError(r);
|
|
1333 |
|
|
1334 |
endTime.HomeTime();
|
|
1335 |
timeTaken=endTime.MicroSecondsFrom(startTime);
|
|
1336 |
timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
1337 |
DoTestKill();
|
|
1338 |
}
|
|
1339 |
|
|
1340 |
if(gTypes >= 2)
|
|
1341 |
{
|
|
1342 |
// all 20.3 chars
|
|
1343 |
dirtemp.Format(KDirMultipleName,2, aN);
|
|
1344 |
directory = gSessionPath;
|
|
1345 |
directory.Append(dirtemp);
|
|
1346 |
gDelEntryDir = directory;
|
|
1347 |
|
|
1348 |
DoTest(DeleteEntryAccess);
|
|
1349 |
|
|
1350 |
startTime.HomeTime();
|
|
1351 |
directory.Append(_L("F*.*"));
|
|
1352 |
r = fMan->Delete(directory);
|
|
1353 |
FailIfError(r);
|
|
1354 |
|
|
1355 |
endTime.HomeTime();
|
|
1356 |
DoTestKill();
|
|
1357 |
|
|
1358 |
timeTaken=endTime.MicroSecondsFrom(startTime);
|
|
1359 |
timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
1360 |
}
|
|
1361 |
if(gTypes >= 3)
|
|
1362 |
{
|
|
1363 |
// 50/50
|
|
1364 |
dirtemp.Format(KDirMultipleName,3, aN);
|
|
1365 |
directory = gSessionPath;
|
|
1366 |
directory.Append(dirtemp);
|
|
1367 |
gDelEntryDir = directory;
|
|
1368 |
|
|
1369 |
DoTest(DeleteEntryAccess);
|
|
1370 |
|
|
1371 |
startTime.HomeTime();
|
|
1372 |
directory.Append(_L("F*.*"));
|
|
1373 |
r = fMan->Delete(directory);
|
|
1374 |
FailIfError(r);
|
|
1375 |
|
|
1376 |
endTime.HomeTime();
|
|
1377 |
DoTestKill();
|
|
1378 |
|
|
1379 |
timeTaken=endTime.MicroSecondsFrom(startTime);
|
|
1380 |
timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
1381 |
}
|
|
1382 |
}
|
|
1383 |
|
|
1384 |
delete fMan;
|
|
1385 |
|
|
1386 |
gWriting = ETrue; User::After(1000000);
|
|
1387 |
PrintResult(aStep, 1, aN);
|
|
1388 |
PrintResultTime(aStep, 2, timeTaken1);
|
|
1389 |
PrintResultTime(aStep, 3, timeTaken2);
|
|
1390 |
PrintResultTime(aStep, 4, timeTaken3);
|
|
1391 |
gWriting = EFalse;
|
|
1392 |
}
|
|
1393 |
|
|
1394 |
|
|
1395 |
/** Delete last.txt with RFs::Delete
|
|
1396 |
|
|
1397 |
@param aN Number of files in the directory
|
|
1398 |
@param aStep Test step
|
|
1399 |
*/
|
|
1400 |
LOCAL_C void DelFile1(TInt aN, TInt aStep)
|
|
1401 |
{
|
|
1402 |
TBuf16<100> dir1;
|
|
1403 |
TBuf16<100> dir2;
|
|
1404 |
TBuf16<100> dir3;
|
|
1405 |
TBuf16<100> dir4;
|
|
1406 |
|
|
1407 |
TInt r = 0;
|
|
1408 |
TTime startTime;
|
|
1409 |
TTime endTime;
|
|
1410 |
TTimeIntervalMicroSeconds timeTaken(0);
|
|
1411 |
TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
|
|
1412 |
|
|
1413 |
dir1 = gSessionPath;
|
|
1414 |
dir2 = gSessionPath;
|
|
1415 |
dir3 = gSessionPath;
|
|
1416 |
|
|
1417 |
dir4.Format(KDirMultipleName, 1, aN);
|
|
1418 |
dir1.Append(dir4);
|
|
1419 |
dir4.Format(KDirMultipleName, 2, aN);
|
|
1420 |
dir2.Append(dir4);
|
|
1421 |
dir4.Format(KDirMultipleName, 3, aN);
|
|
1422 |
dir3.Append(dir4);
|
|
1423 |
|
|
1424 |
dir1.Append(KCommonFile);
|
|
1425 |
dir2.Append(KCommonFile);
|
|
1426 |
dir3.Append(KCommonFile);
|
|
1427 |
|
|
1428 |
if(aN <= gFilesLimit)
|
|
1429 |
{
|
|
1430 |
if(gTypes >= 1)
|
|
1431 |
{
|
|
1432 |
startTime.HomeTime();
|
|
1433 |
|
|
1434 |
r = TheFs.Delete(dir1);
|
|
1435 |
FailIfError(r);
|
|
1436 |
|
|
1437 |
endTime.HomeTime();
|
|
1438 |
|
|
1439 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
1440 |
timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
1441 |
}
|
|
1442 |
if(gTypes >= 2)
|
|
1443 |
{
|
|
1444 |
startTime.HomeTime();
|
|
1445 |
|
|
1446 |
r = TheFs.Delete(dir2);
|
|
1447 |
FailIfError(r);
|
|
1448 |
|
|
1449 |
endTime.HomeTime();
|
|
1450 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
1451 |
|
|
1452 |
timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
1453 |
}
|
|
1454 |
if(gTypes >= 3)
|
|
1455 |
{
|
|
1456 |
startTime.HomeTime();
|
|
1457 |
|
|
1458 |
r = TheFs.Delete(dir3);
|
|
1459 |
FailIfError(r);
|
|
1460 |
|
|
1461 |
endTime.HomeTime();
|
|
1462 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
1463 |
timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
1464 |
}
|
|
1465 |
}
|
|
1466 |
|
|
1467 |
gWriting = ETrue; User::After(1000000);
|
|
1468 |
PrintResult(aStep, 1, aN);
|
|
1469 |
PrintResultTime(aStep, 2, timeTaken1);
|
|
1470 |
PrintResultTime(aStep, 3, timeTaken2);
|
|
1471 |
PrintResultTime(aStep, 4, timeTaken3);
|
|
1472 |
gWriting = EFalse;
|
|
1473 |
}
|
|
1474 |
|
|
1475 |
/** Delete last.txt with CFileMan::Delete
|
|
1476 |
|
|
1477 |
@param aN Number of files in the directory
|
|
1478 |
@param aStep Test step
|
|
1479 |
*/
|
|
1480 |
LOCAL_C void DelFile2(TInt aN, TInt aStep)
|
|
1481 |
{
|
|
1482 |
TBuf16<100> dir1;
|
|
1483 |
TBuf16<100> dir2;
|
|
1484 |
TBuf16<100> dir3;
|
|
1485 |
TBuf16<100> dir4;
|
|
1486 |
|
|
1487 |
TInt r = 0;
|
|
1488 |
|
|
1489 |
TTime startTime;
|
|
1490 |
TTime endTime;
|
|
1491 |
TTimeIntervalMicroSeconds timeTaken(0);
|
|
1492 |
TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
|
|
1493 |
|
|
1494 |
if(aN <= gFilesLimit)
|
|
1495 |
{
|
|
1496 |
CFileMan* fMan = CFileMan::NewL(TheFs);
|
|
1497 |
|
|
1498 |
dir1 = gSessionPath;
|
|
1499 |
dir2 = gSessionPath;
|
|
1500 |
dir3 = gSessionPath;
|
|
1501 |
|
|
1502 |
dir4.Format(KDirMultipleName, 1, aN);
|
|
1503 |
dir1.Append(dir4);
|
|
1504 |
dir4.Format(KDirMultipleName, 2, aN);
|
|
1505 |
dir2.Append(dir4);
|
|
1506 |
dir4.Format(KDirMultipleName, 3, aN);
|
|
1507 |
dir3.Append(dir4);
|
|
1508 |
|
|
1509 |
dir1.Append(KCommonFile);
|
|
1510 |
dir2.Append(KCommonFile);
|
|
1511 |
dir3.Append(KCommonFile);
|
|
1512 |
|
|
1513 |
if(gTypes >= 1)
|
|
1514 |
{
|
|
1515 |
startTime.HomeTime();
|
|
1516 |
|
|
1517 |
r = fMan->Delete(dir1);
|
|
1518 |
FailIfError(r);
|
|
1519 |
|
|
1520 |
endTime.HomeTime();
|
|
1521 |
|
|
1522 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
1523 |
timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
1524 |
}
|
|
1525 |
|
|
1526 |
if(gTypes >= 2)
|
|
1527 |
{
|
|
1528 |
startTime.HomeTime();
|
|
1529 |
|
|
1530 |
r = fMan->Delete(dir2);
|
|
1531 |
FailIfError(r);
|
|
1532 |
|
|
1533 |
endTime.HomeTime();
|
|
1534 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
1535 |
timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
|
|
1536 |
}
|
|
1537 |
|
|
1538 |
if(gTypes >= 3)
|
|
1539 |
{
|
|
1540 |
startTime.HomeTime();
|
|
1541 |
|
|
1542 |
r = fMan->Delete(dir3);
|
|
1543 |
FailIfError(r);
|
|
1544 |
|
|
1545 |
endTime.HomeTime();
|
|
1546 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
|
1547 |
timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
|
|
1548 |
}
|
|
1549 |
|
|
1550 |
delete fMan;
|
|
1551 |
}
|
|
1552 |
|
|
1553 |
gWriting = ETrue; User::After(1000000);
|
|
1554 |
PrintResult(aStep, 1, aN);
|
|
1555 |
PrintResultTime(aStep, 2, timeTaken1);
|
|
1556 |
PrintResultTime(aStep, 3, timeTaken2);
|
|
1557 |
PrintResultTime(aStep, 4, timeTaken3);
|
|
1558 |
gWriting = EFalse;
|
|
1559 |
}
|
|
1560 |
|
|
1561 |
/** Tests the deletion of one file with both API: RFs::Delete and CFileMan::Delete
|
|
1562 |
|
|
1563 |
@param aSelector Configuration in case of manual execution
|
|
1564 |
*/
|
|
1565 |
LOCAL_C TInt TestDelEntry(TAny* aSelector)
|
|
1566 |
{
|
|
1567 |
// Precondition: the drive already filled with the right files
|
|
1568 |
|
|
1569 |
TInt i = 100;
|
|
1570 |
TInt testStep = 1;
|
|
1571 |
|
|
1572 |
Validate(aSelector);
|
|
1573 |
|
|
1574 |
test.Printf(_L("#~TS_Title_%d,%d: Delete last.txt, RFs::Delete\n"), gTestHarness, gTestCase);
|
|
1575 |
|
|
1576 |
i = 100;
|
|
1577 |
testStep = 1;
|
|
1578 |
while(i <= KMaxFiles)
|
|
1579 |
{
|
|
1580 |
if(i == 100 || i == 1000 || i == 5000 || i == 10000)
|
|
1581 |
DelFile1(i, testStep++);
|
|
1582 |
i += 100;
|
|
1583 |
}
|
|
1584 |
|
|
1585 |
ReCreateLast();
|
|
1586 |
gTestCase++;
|
|
1587 |
test.Printf(_L("#~TS_Title_%d,%d: Delete last.txt, CFileMan::Delete\n"), gTestHarness, gTestCase);
|
|
1588 |
|
|
1589 |
i = 100;
|
|
1590 |
testStep = 1;
|
|
1591 |
while(i <= KMaxFiles)
|
|
1592 |
{
|
|
1593 |
if(i == 100 || i == 1000 || i == 5000 || i == 10000)
|
|
1594 |
DelFile2(i, testStep++);
|
|
1595 |
i += 100;
|
|
1596 |
}
|
|
1597 |
|
|
1598 |
gTestCase++;
|
|
1599 |
|
|
1600 |
return(KErrNone);
|
|
1601 |
}
|
|
1602 |
|
|
1603 |
/** Tests the deletion of all the files in a directory with both API:
|
|
1604 |
RFs::Delete and CFileMan::Delete
|
|
1605 |
|
|
1606 |
@param aSelector Configuration in case of manual execution
|
|
1607 |
*/
|
|
1608 |
LOCAL_C TInt TestDelAllFiles(TAny* aSelector)
|
|
1609 |
{
|
|
1610 |
// Precondition: drive already filled with the right files
|
|
1611 |
|
|
1612 |
TInt i = 100;
|
|
1613 |
TInt testStep = 1;
|
|
1614 |
|
|
1615 |
Validate(aSelector);
|
|
1616 |
|
|
1617 |
test.Printf(_L("#~TS_Title_%d,%d: Delete all, RFs::Delete\n"), gTestHarness, gTestCase);
|
|
1618 |
|
|
1619 |
testStep = 1;
|
|
1620 |
while(i <= KMaxFiles)
|
|
1621 |
{
|
|
1622 |
if(i == 100 || i == 1000 || i == 5000 || i == 10000)
|
|
1623 |
DelAllFiles1(i, testStep++);
|
|
1624 |
i += 100;
|
|
1625 |
}
|
|
1626 |
|
|
1627 |
TestFileCreate(aSelector);
|
|
1628 |
gTestCase++;
|
|
1629 |
test.Printf(_L("#~TS_Title_%d,%d: Delete all, CFileMan::Delete\n"), gTestHarness, gTestCase);
|
|
1630 |
|
|
1631 |
|
|
1632 |
i = 100;
|
|
1633 |
testStep = 1;
|
|
1634 |
while(i <= KMaxFiles)
|
|
1635 |
{
|
|
1636 |
if(i == 100 || i == 1000 || i == 5000 || i == 10000)
|
|
1637 |
DelAllFiles2(i, testStep++);
|
|
1638 |
i += 100;
|
|
1639 |
}
|
|
1640 |
|
|
1641 |
gTestCase++;
|
|
1642 |
return(KErrNone);
|
|
1643 |
}
|
|
1644 |
|
|
1645 |
/** Tests the deletion of last.txt in a directory with both API:
|
|
1646 |
RFs::Delete and CFileMan::Delete while 2 other threads accessing the directory
|
|
1647 |
|
|
1648 |
@param aSelector Configuration in case of manual execution
|
|
1649 |
*/
|
|
1650 |
LOCAL_C TInt TestDelMultSame(TAny* aSelector)
|
|
1651 |
{
|
|
1652 |
TInt i = 100;
|
|
1653 |
TInt testStep = 1;
|
|
1654 |
|
|
1655 |
|
|
1656 |
Validate(aSelector);
|
|
1657 |
|
|
1658 |
TestFileCreate(aSelector);
|
|
1659 |
|
|
1660 |
test.Printf(_L("#~TS_Title_%d,%d: Delete last.txt mult. clients del in same dir, RFs::Delete\n"), gTestHarness, gTestCase);
|
|
1661 |
|
|
1662 |
testStep = 1;
|
|
1663 |
while(i <= KMaxFiles)
|
|
1664 |
{
|
|
1665 |
if(i == 100 || i == 1000 || i == 5000 || i == 10000)
|
|
1666 |
DelFileM1(i, testStep++);
|
|
1667 |
i += 100;
|
|
1668 |
}
|
|
1669 |
|
|
1670 |
ReCreateLast();
|
|
1671 |
gTestCase++;
|
|
1672 |
test.Printf(_L("#~TS_Title_%d,%d: Delete last.txt mult. clients del in same dir, CFileMan::Delete\n"), gTestHarness, gTestCase);
|
|
1673 |
|
|
1674 |
i = 100;
|
|
1675 |
testStep = 1;
|
|
1676 |
while(i <= KMaxFiles)
|
|
1677 |
{
|
|
1678 |
if(i == 100 || i == 1000 || i == 5000 || i == 10000)
|
|
1679 |
{
|
|
1680 |
DelFileM2(i, testStep);
|
|
1681 |
testStep++;
|
|
1682 |
}
|
|
1683 |
i += 100;
|
|
1684 |
}
|
|
1685 |
|
|
1686 |
ReCreateLast();
|
|
1687 |
gTestCase++;
|
|
1688 |
test.Printf(_L("#~TS_Title_%d,%d: Delete all mult. clients del in same dir, RFs::Delete\n"), gTestHarness, gTestCase);
|
|
1689 |
|
|
1690 |
i = 100;
|
|
1691 |
testStep = 1;
|
|
1692 |
while(i <= KMaxFiles)
|
|
1693 |
{
|
|
1694 |
if(i == 100 || i == 1000 || i == 5000 || i == 10000)
|
|
1695 |
DelAllM1(i, testStep++);
|
|
1696 |
i += 100;
|
|
1697 |
}
|
|
1698 |
|
|
1699 |
TestFileCreate(aSelector);
|
|
1700 |
gTestCase++;
|
|
1701 |
test.Printf(_L("#~TS_Title_%d,%d: Delete all mult. clients del in same dir, CFileMan::Delete\n"), gTestHarness, gTestCase);
|
|
1702 |
|
|
1703 |
i = 100;
|
|
1704 |
testStep = 1;
|
|
1705 |
while(i <= KMaxFiles)
|
|
1706 |
{
|
|
1707 |
if(i == 100 || i == 1000 || i == 5000 || i == 10000)
|
|
1708 |
DelAllM2(i, testStep++);
|
|
1709 |
i += 100;
|
|
1710 |
}
|
|
1711 |
|
|
1712 |
gTestCase++;
|
|
1713 |
|
|
1714 |
return(KErrNone);
|
|
1715 |
}
|
|
1716 |
|
|
1717 |
|
|
1718 |
/** Tests the deletion of last.txt in a directory with both API:
|
|
1719 |
RFs::Delete and CFileMan::Delete while 2 threads accessing different directories
|
|
1720 |
(the current and one with 300 files)
|
|
1721 |
|
|
1722 |
@param aSelector Configuration in case of manual execution
|
|
1723 |
*/
|
|
1724 |
LOCAL_C TInt TestDelMultDif(TAny* aSelector)
|
|
1725 |
{
|
|
1726 |
TInt i = 100;
|
|
1727 |
TInt testStep = 1;
|
|
1728 |
|
|
1729 |
Validate(aSelector);
|
|
1730 |
|
|
1731 |
TestFileCreate(aSelector);
|
|
1732 |
CreateDirWithNFiles(300, 3);
|
|
1733 |
|
|
1734 |
test.Printf(_L("#~TS_Title_%d,%d: Delete last.txt mult. clients del in dif dirs, RFs::Delete\n"), gTestHarness, gTestCase);
|
|
1735 |
|
|
1736 |
testStep = 1;
|
|
1737 |
while(i <= KMaxFiles)
|
|
1738 |
{
|
|
1739 |
if(i == 100 || i == 1000 || i == 5000 || i == 10000)
|
|
1740 |
DelFileMD1(i, testStep++);
|
|
1741 |
i += 100;
|
|
1742 |
}
|
|
1743 |
|
|
1744 |
ReCreateLast();
|
|
1745 |
gTestCase++;
|
|
1746 |
test.Printf(_L("#~TS_Title_%d,%d: Delete last.txt mult. clients del in dif dirs, CFileMan::Delete\n"), gTestHarness, gTestCase);
|
|
1747 |
|
|
1748 |
i = 100;
|
|
1749 |
testStep = 1;
|
|
1750 |
while(i <= KMaxFiles)
|
|
1751 |
{
|
|
1752 |
if(i == 100 || i == 1000 || i == 5000 || i == 10000)
|
|
1753 |
DelFileMD2(i, testStep++);
|
|
1754 |
i += 100;
|
|
1755 |
}
|
|
1756 |
|
|
1757 |
ReCreateLast();
|
|
1758 |
gTestCase++;
|
|
1759 |
test.Printf(_L("#~TS_Title_%d,%d: Delete all mult. clients del in dif dirs, RFs::Delete\n"), gTestHarness, gTestCase);
|
|
1760 |
|
|
1761 |
i = 100;
|
|
1762 |
testStep = 1;
|
|
1763 |
while(i <= KMaxFiles)
|
|
1764 |
{
|
|
1765 |
if(i == 100 || i == 1000 || i == 5000 || i == 10000)
|
|
1766 |
DelAllMD1(i, testStep++);
|
|
1767 |
i += 100;
|
|
1768 |
}
|
|
1769 |
|
|
1770 |
TestFileCreate(aSelector);
|
|
1771 |
gTestCase++;
|
|
1772 |
test.Printf(_L("#~TS_Title_%d,%d: Delete all mult. clients del in dif dirs, CFileMan::Delete\n"), gTestHarness, gTestCase);
|
|
1773 |
|
|
1774 |
|
|
1775 |
i = 100;
|
|
1776 |
testStep = 1;
|
|
1777 |
while(i <= KMaxFiles)
|
|
1778 |
{
|
|
1779 |
if(i == 100 || i == 1000 || i == 5000 || i == 10000)
|
|
1780 |
DelAllMD2(i, testStep++);
|
|
1781 |
i += 100;
|
|
1782 |
}
|
|
1783 |
|
|
1784 |
gTestCase++;
|
|
1785 |
|
|
1786 |
return(KErrNone);
|
|
1787 |
}
|
|
1788 |
|
|
1789 |
/** Goes automatically through all the options
|
|
1790 |
|
|
1791 |
@param aSelector Configuration in case of manual execution
|
|
1792 |
*/
|
|
1793 |
LOCAL_C TInt TestAll(TAny* aSelector)
|
|
1794 |
{
|
|
1795 |
Validate(aSelector);
|
|
1796 |
|
|
1797 |
gFormat=ETrue; // The card will be formatted after this test execution
|
|
1798 |
|
|
1799 |
TestDelEntry(aSelector);
|
|
1800 |
TestDelAllFiles(aSelector);
|
|
1801 |
TestDelMultSame(aSelector);
|
|
1802 |
TestDelMultDif(aSelector);
|
|
1803 |
|
|
1804 |
return KErrNone;
|
|
1805 |
}
|
|
1806 |
|
|
1807 |
/** Call all tests
|
|
1808 |
|
|
1809 |
*/
|
|
1810 |
GLDEF_C void CallTestsL()
|
|
1811 |
{
|
|
1812 |
|
|
1813 |
TInt r = client.CreateLocal(0);
|
|
1814 |
FailIfError(r);
|
|
1815 |
|
|
1816 |
// Each test case of the suite has an identifyer for parsing purposes of the results
|
|
1817 |
gTestHarness = 1;
|
|
1818 |
gTestCase = 1;
|
|
1819 |
|
|
1820 |
PrintHeaders(1, _L("t_fsrdel. Deletion"));
|
|
1821 |
|
|
1822 |
RThread noisy;
|
|
1823 |
TBuf<20> buf = _L("Noisy");
|
|
1824 |
r = noisy.Create(buf, noise, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
|
|
1825 |
FailIfError(r);
|
|
1826 |
|
|
1827 |
noisy.Resume();
|
|
1828 |
|
|
1829 |
CSelectionBox* TheSelector = CSelectionBox::NewL(test.Console());
|
|
1830 |
|
|
1831 |
if(gMode == 0)
|
|
1832 |
{ // Manual
|
|
1833 |
gSessionPath=_L("?:\\");
|
|
1834 |
TCallBack createFiles(TestFileCreate,TheSelector);
|
|
1835 |
TCallBack delFile(TestDelEntry,TheSelector);
|
|
1836 |
TCallBack delAllFiles(TestDelAllFiles,TheSelector);
|
|
1837 |
TCallBack delMultSame(TestDelMultSame,TheSelector);
|
|
1838 |
TCallBack delMultDif(TestDelMultDif,TheSelector);
|
|
1839 |
TCallBack delAll(TestAll,TheSelector);
|
|
1840 |
TheSelector->AddDriveSelectorL(TheFs);
|
|
1841 |
TheSelector->AddLineL(_L("Create all files"),createFiles);
|
|
1842 |
TheSelector->AddLineL(_L("Delete one file from each dir"),delFile);
|
|
1843 |
TheSelector->AddLineL(_L("Delete all files"),delAllFiles);
|
|
1844 |
TheSelector->AddLineL(_L("Delete mult clients same dir"),delMultSame);
|
|
1845 |
TheSelector->AddLineL(_L("Delete mult clients dif dir"),delMultDif);
|
|
1846 |
TheSelector->AddLineL(_L("Execute all options"),delAll);
|
|
1847 |
TheSelector->Run();
|
|
1848 |
}
|
|
1849 |
else
|
|
1850 |
{ // Automatic
|
|
1851 |
TestAll(TheSelector);
|
|
1852 |
}
|
|
1853 |
|
|
1854 |
client.Close();
|
|
1855 |
delete TheSelector;
|
|
1856 |
|
|
1857 |
noisy.Kill(KErrNone);
|
|
1858 |
noisy.Close();
|
|
1859 |
|
|
1860 |
test.Printf(_L("#~TestEnd_%d\n"), gTestHarness);
|
|
1861 |
}
|