sl@0
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// f32test\bench\t_fsrmkdir.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <f32file.h>
|
sl@0
|
19 |
#include <e32test.h>
|
sl@0
|
20 |
#include "t_select.h"
|
sl@0
|
21 |
#include "t_benchmain.h"
|
sl@0
|
22 |
|
sl@0
|
23 |
|
sl@0
|
24 |
GLDEF_D RTest test(_L("FS Benchmarks, mkdir"));
|
sl@0
|
25 |
|
sl@0
|
26 |
//----------------------------------------------------------------------------------------------
|
sl@0
|
27 |
//! @SYMTestCaseID PBASE-T_FSRMKDIR-0277
|
sl@0
|
28 |
//! @SYMTestType CIT
|
sl@0
|
29 |
//! @SYMPREQ PREQ000
|
sl@0
|
30 |
//! @SYMTestCaseDesc This test case is measuring performance of the FAT implementation
|
sl@0
|
31 |
//! @SYMTestActions 0. Expects the files to exist in order to successful execution
|
sl@0
|
32 |
//! 1. Time the creation of a directory in each directory with RFs::MkDir
|
sl@0
|
33 |
//! 2. Time the creation of a directory (with RFs::MkDir) in each directory
|
sl@0
|
34 |
//! with different clients accessing the directory
|
sl@0
|
35 |
//! 3. Time the creation of a directory (with RFs::MkDir) in each directory
|
sl@0
|
36 |
//! with different clients accessing different directories
|
sl@0
|
37 |
//!
|
sl@0
|
38 |
//! @SYMTestExpectedResults Finishes if the system behaves as expected, panics otherwise
|
sl@0
|
39 |
//! @SYMTestPriority High
|
sl@0
|
40 |
//! @SYMTestStatus Implemented
|
sl@0
|
41 |
//----------------------------------------------------------------------------------------------
|
sl@0
|
42 |
|
sl@0
|
43 |
LOCAL_D RSemaphore client,write_screen;
|
sl@0
|
44 |
LOCAL_D const TInt KHeapSize = 0x4000;
|
sl@0
|
45 |
LOCAL_D TBuf8<4096> buf;
|
sl@0
|
46 |
|
sl@0
|
47 |
LOCAL_D TDriveList gDriveList;
|
sl@0
|
48 |
|
sl@0
|
49 |
LOCAL_D TFileName gDelEntryDir;
|
sl@0
|
50 |
LOCAL_D TFileName gDelEntryDir2;
|
sl@0
|
51 |
|
sl@0
|
52 |
// Concurrent thread
|
sl@0
|
53 |
RThread gSpeedy;
|
sl@0
|
54 |
RThread gSpeedyII;
|
sl@0
|
55 |
TInt gT1;
|
sl@0
|
56 |
TInt gT2;
|
sl@0
|
57 |
TBool gKillMe=EFalse;
|
sl@0
|
58 |
|
sl@0
|
59 |
LOCAL_D TInt ThreadCount=0;
|
sl@0
|
60 |
|
sl@0
|
61 |
_LIT(KDirMultipleName2, "dir%d_%d\\");
|
sl@0
|
62 |
_LIT(KNewDir, "new_dir\\");
|
sl@0
|
63 |
|
sl@0
|
64 |
_LIT(KDeleteMe,"delete%d.me");
|
sl@0
|
65 |
_LIT(KDeleteMe2,"blabla%d.rhd");
|
sl@0
|
66 |
|
sl@0
|
67 |
/** Delete entry in directory
|
sl@0
|
68 |
|
sl@0
|
69 |
*/
|
sl@0
|
70 |
LOCAL_C TInt DeleteEntryAccess2(TAny* )
|
sl@0
|
71 |
{
|
sl@0
|
72 |
RFs fs;
|
sl@0
|
73 |
TInt r = fs.Connect();
|
sl@0
|
74 |
TBuf<100> dirfile;
|
sl@0
|
75 |
TBuf<50> filename;
|
sl@0
|
76 |
RFile file;
|
sl@0
|
77 |
RTest test(_L("test 2"));
|
sl@0
|
78 |
|
sl@0
|
79 |
fs.SetSessionPath(gSessionPath);
|
sl@0
|
80 |
filename.Format(KDeleteMe2, gT2);
|
sl@0
|
81 |
|
sl@0
|
82 |
dirfile = gDelEntryDir2;
|
sl@0
|
83 |
dirfile.Append(filename);
|
sl@0
|
84 |
|
sl@0
|
85 |
client.Signal();
|
sl@0
|
86 |
|
sl@0
|
87 |
FOREVER
|
sl@0
|
88 |
{
|
sl@0
|
89 |
if(!gKillMe)
|
sl@0
|
90 |
{
|
sl@0
|
91 |
r = file.Create(fs, dirfile, EFileShareAny|EFileWrite);
|
sl@0
|
92 |
if(r == KErrAlreadyExists)
|
sl@0
|
93 |
r=file.Open(fs, dirfile, EFileShareAny|EFileWrite);
|
sl@0
|
94 |
file.Close();
|
sl@0
|
95 |
FailIfError(r);
|
sl@0
|
96 |
|
sl@0
|
97 |
r = fs.Delete(dirfile);
|
sl@0
|
98 |
if((r != KErrNone) && (r != KErrInUse))
|
sl@0
|
99 |
{
|
sl@0
|
100 |
test.Printf(_L("error = %d\n"), r);
|
sl@0
|
101 |
}
|
sl@0
|
102 |
test(r == KErrNone || r == KErrInUse);
|
sl@0
|
103 |
}
|
sl@0
|
104 |
}
|
sl@0
|
105 |
}
|
sl@0
|
106 |
|
sl@0
|
107 |
/** Delete entry in directory
|
sl@0
|
108 |
|
sl@0
|
109 |
*/
|
sl@0
|
110 |
LOCAL_C TInt DeleteEntryAccess(TAny*)
|
sl@0
|
111 |
{
|
sl@0
|
112 |
RFs fs2;
|
sl@0
|
113 |
TInt r = fs2.Connect();
|
sl@0
|
114 |
TBuf<100> dirfile;
|
sl@0
|
115 |
TBuf<50> filename;
|
sl@0
|
116 |
RFile file2;
|
sl@0
|
117 |
RTest test(_L("test 2"));
|
sl@0
|
118 |
|
sl@0
|
119 |
r = fs2.SetSessionPath(gSessionPath);
|
sl@0
|
120 |
filename.Format(KDeleteMe, gT1);
|
sl@0
|
121 |
|
sl@0
|
122 |
dirfile = gDelEntryDir;
|
sl@0
|
123 |
dirfile.Append(filename);
|
sl@0
|
124 |
|
sl@0
|
125 |
client.Signal();
|
sl@0
|
126 |
|
sl@0
|
127 |
FOREVER
|
sl@0
|
128 |
{
|
sl@0
|
129 |
if(!gKillMe)
|
sl@0
|
130 |
{
|
sl@0
|
131 |
r = file2.Create(fs2, dirfile, EFileShareAny|EFileWrite);
|
sl@0
|
132 |
if(r == KErrAlreadyExists)
|
sl@0
|
133 |
r = file2.Open(fs2, dirfile, EFileShareAny|EFileWrite);
|
sl@0
|
134 |
file2.Close();
|
sl@0
|
135 |
FailIfError(r);
|
sl@0
|
136 |
r = fs2.Delete(dirfile);
|
sl@0
|
137 |
|
sl@0
|
138 |
if((r != KErrNone) && (r != KErrInUse))
|
sl@0
|
139 |
{
|
sl@0
|
140 |
test.Printf(_L("error = %d\n"), r);
|
sl@0
|
141 |
}
|
sl@0
|
142 |
|
sl@0
|
143 |
test(r == KErrNone || r == KErrInUse);
|
sl@0
|
144 |
}
|
sl@0
|
145 |
}
|
sl@0
|
146 |
}
|
sl@0
|
147 |
|
sl@0
|
148 |
|
sl@0
|
149 |
/** Starts two concurrent client sessions in different directories
|
sl@0
|
150 |
|
sl@0
|
151 |
*/
|
sl@0
|
152 |
LOCAL_C void DoTest2(TThreadFunction aFunction)
|
sl@0
|
153 |
{
|
sl@0
|
154 |
gKillMe = EFalse;
|
sl@0
|
155 |
|
sl@0
|
156 |
TBuf<20> buf = _L("Speedy");
|
sl@0
|
157 |
buf.AppendNum(ThreadCount++);
|
sl@0
|
158 |
gT1 = ThreadCount;
|
sl@0
|
159 |
TInt r = gSpeedy.Create(buf, aFunction, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
|
sl@0
|
160 |
FailIfError(r);
|
sl@0
|
161 |
|
sl@0
|
162 |
buf = _L("Speedy");
|
sl@0
|
163 |
buf.AppendNum(ThreadCount++);
|
sl@0
|
164 |
gT2 = ThreadCount;
|
sl@0
|
165 |
r = gSpeedyII.Create(buf, DeleteEntryAccess2, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
|
sl@0
|
166 |
FailIfError(r);
|
sl@0
|
167 |
|
sl@0
|
168 |
gSpeedy.SetPriority(EPriorityLess);
|
sl@0
|
169 |
gSpeedyII.SetPriority(EPriorityLess);
|
sl@0
|
170 |
|
sl@0
|
171 |
gSpeedy.Resume();
|
sl@0
|
172 |
gSpeedyII.Resume();
|
sl@0
|
173 |
|
sl@0
|
174 |
client.Wait();
|
sl@0
|
175 |
client.Wait();
|
sl@0
|
176 |
}
|
sl@0
|
177 |
|
sl@0
|
178 |
|
sl@0
|
179 |
/** Kills the concurrent session
|
sl@0
|
180 |
|
sl@0
|
181 |
*/
|
sl@0
|
182 |
LOCAL_C void DoTestKill()
|
sl@0
|
183 |
{
|
sl@0
|
184 |
gKillMe = ETrue;
|
sl@0
|
185 |
User::After(10000000);
|
sl@0
|
186 |
|
sl@0
|
187 |
gSpeedy.Kill(KErrNone);
|
sl@0
|
188 |
gSpeedy.Close();
|
sl@0
|
189 |
|
sl@0
|
190 |
gSpeedyII.Kill(KErrNone);
|
sl@0
|
191 |
gSpeedyII.Close();
|
sl@0
|
192 |
}
|
sl@0
|
193 |
|
sl@0
|
194 |
/** Time the creation of a directory inside each type of directory
|
sl@0
|
195 |
|
sl@0
|
196 |
@param aN Number of files in the directory
|
sl@0
|
197 |
@param aStep Test step
|
sl@0
|
198 |
*/
|
sl@0
|
199 |
LOCAL_C void MakeDir(TInt aN, TInt aStep)
|
sl@0
|
200 |
{
|
sl@0
|
201 |
TBuf16<100> dir1;
|
sl@0
|
202 |
TBuf16<100> dir2;
|
sl@0
|
203 |
TBuf16<100> dir3;
|
sl@0
|
204 |
TBuf16<100> dir4;
|
sl@0
|
205 |
|
sl@0
|
206 |
TInt r=0;
|
sl@0
|
207 |
TTime startTime;
|
sl@0
|
208 |
TTime endTime;
|
sl@0
|
209 |
TTimeIntervalMicroSeconds timeTaken(0);
|
sl@0
|
210 |
TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
|
sl@0
|
211 |
|
sl@0
|
212 |
if(aN <= gFilesLimit)
|
sl@0
|
213 |
{
|
sl@0
|
214 |
dir1 = gSessionPath;
|
sl@0
|
215 |
dir2 = gSessionPath;
|
sl@0
|
216 |
dir3 = gSessionPath;
|
sl@0
|
217 |
|
sl@0
|
218 |
dir4.Format(KDirMultipleName2, 1, aN);
|
sl@0
|
219 |
dir1.Append(dir4);
|
sl@0
|
220 |
dir4.Format(KDirMultipleName2, 2, aN);
|
sl@0
|
221 |
dir2.Append(dir4);
|
sl@0
|
222 |
dir4.Format(KDirMultipleName2, 3, aN);
|
sl@0
|
223 |
dir3.Append(dir4);
|
sl@0
|
224 |
|
sl@0
|
225 |
dir1.Append(KNewDir);
|
sl@0
|
226 |
dir2.Append(KNewDir);
|
sl@0
|
227 |
dir3.Append(KNewDir);
|
sl@0
|
228 |
|
sl@0
|
229 |
if(gTypes >= 1)
|
sl@0
|
230 |
{
|
sl@0
|
231 |
dir4.Format(KDirMultipleName, 1, aN);
|
sl@0
|
232 |
startTime.HomeTime();
|
sl@0
|
233 |
|
sl@0
|
234 |
r = TheFs.MkDir(dir1);
|
sl@0
|
235 |
FailIfError(r);
|
sl@0
|
236 |
|
sl@0
|
237 |
endTime.HomeTime();
|
sl@0
|
238 |
|
sl@0
|
239 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
sl@0
|
240 |
timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
|
sl@0
|
241 |
TheFs.RmDir(dir1);
|
sl@0
|
242 |
}
|
sl@0
|
243 |
|
sl@0
|
244 |
if(gTypes >= 2)
|
sl@0
|
245 |
{
|
sl@0
|
246 |
startTime.HomeTime();
|
sl@0
|
247 |
|
sl@0
|
248 |
r = TheFs.MkDir(dir2);
|
sl@0
|
249 |
FailIfError(r);
|
sl@0
|
250 |
|
sl@0
|
251 |
endTime.HomeTime();
|
sl@0
|
252 |
|
sl@0
|
253 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
sl@0
|
254 |
timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
|
sl@0
|
255 |
TheFs.RmDir(dir2);
|
sl@0
|
256 |
}
|
sl@0
|
257 |
|
sl@0
|
258 |
if(gTypes>=3)
|
sl@0
|
259 |
{
|
sl@0
|
260 |
startTime.HomeTime();
|
sl@0
|
261 |
|
sl@0
|
262 |
r = TheFs.MkDir(dir3);
|
sl@0
|
263 |
FailIfError(r);
|
sl@0
|
264 |
|
sl@0
|
265 |
endTime.HomeTime();
|
sl@0
|
266 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
sl@0
|
267 |
timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
|
sl@0
|
268 |
|
sl@0
|
269 |
TheFs.RmDir(dir3);
|
sl@0
|
270 |
}
|
sl@0
|
271 |
}
|
sl@0
|
272 |
|
sl@0
|
273 |
PrintResult(aStep, 1, aN);
|
sl@0
|
274 |
PrintResultTime(aStep, 2, timeTaken1);
|
sl@0
|
275 |
PrintResultTime(aStep, 3, timeTaken2);
|
sl@0
|
276 |
PrintResultTime(aStep, 4, timeTaken3);
|
sl@0
|
277 |
}
|
sl@0
|
278 |
|
sl@0
|
279 |
/** Time the creation of a directory inside each type of directory with multiple threads ongoing
|
sl@0
|
280 |
|
sl@0
|
281 |
@param aN Number of files in the directory
|
sl@0
|
282 |
@param aStep Test step
|
sl@0
|
283 |
*/
|
sl@0
|
284 |
LOCAL_C void MakeDirM(TInt aN, TInt aStep)
|
sl@0
|
285 |
{
|
sl@0
|
286 |
TBuf16<100> dir1;
|
sl@0
|
287 |
TBuf16<100> dir2;
|
sl@0
|
288 |
TBuf16<100> dir3;
|
sl@0
|
289 |
TBuf16<100> dir4;
|
sl@0
|
290 |
|
sl@0
|
291 |
TInt r = 0;
|
sl@0
|
292 |
TTime startTime;
|
sl@0
|
293 |
TTime endTime;
|
sl@0
|
294 |
TTimeIntervalMicroSeconds timeTaken(0);
|
sl@0
|
295 |
TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
|
sl@0
|
296 |
|
sl@0
|
297 |
if(aN <= gFilesLimit)
|
sl@0
|
298 |
{
|
sl@0
|
299 |
dir1 = gSessionPath;
|
sl@0
|
300 |
dir2 = gSessionPath;
|
sl@0
|
301 |
dir3 = gSessionPath;
|
sl@0
|
302 |
|
sl@0
|
303 |
dir4.Format(KDirMultipleName2, 1, aN);
|
sl@0
|
304 |
dir1.Append(dir4);
|
sl@0
|
305 |
dir4.Format(KDirMultipleName2, 2, aN);
|
sl@0
|
306 |
dir2.Append(dir4);
|
sl@0
|
307 |
dir4.Format(KDirMultipleName2, 3, aN);
|
sl@0
|
308 |
dir3.Append(dir4);
|
sl@0
|
309 |
|
sl@0
|
310 |
if(gTypes >= 1)
|
sl@0
|
311 |
{
|
sl@0
|
312 |
gDelEntryDir = dir1;
|
sl@0
|
313 |
gDelEntryDir2 = dir1;
|
sl@0
|
314 |
|
sl@0
|
315 |
dir1.Append(KNewDir);
|
sl@0
|
316 |
DoTest2(DeleteEntryAccess);
|
sl@0
|
317 |
|
sl@0
|
318 |
startTime.HomeTime();
|
sl@0
|
319 |
|
sl@0
|
320 |
r = TheFs.MkDir(dir1);
|
sl@0
|
321 |
FailIfError(r);
|
sl@0
|
322 |
|
sl@0
|
323 |
endTime.HomeTime();
|
sl@0
|
324 |
|
sl@0
|
325 |
DoTestKill();
|
sl@0
|
326 |
|
sl@0
|
327 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
sl@0
|
328 |
timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
|
sl@0
|
329 |
|
sl@0
|
330 |
TheFs.RmDir(dir1);
|
sl@0
|
331 |
}
|
sl@0
|
332 |
|
sl@0
|
333 |
if(gTypes >= 2)
|
sl@0
|
334 |
{
|
sl@0
|
335 |
gDelEntryDir = dir2;
|
sl@0
|
336 |
gDelEntryDir2 = dir2;
|
sl@0
|
337 |
dir2.Append(KNewDir);
|
sl@0
|
338 |
|
sl@0
|
339 |
DoTest2(DeleteEntryAccess);
|
sl@0
|
340 |
|
sl@0
|
341 |
startTime.HomeTime();
|
sl@0
|
342 |
|
sl@0
|
343 |
r = TheFs.MkDir(dir2);
|
sl@0
|
344 |
FailIfError(r);
|
sl@0
|
345 |
|
sl@0
|
346 |
endTime.HomeTime();
|
sl@0
|
347 |
DoTestKill();
|
sl@0
|
348 |
|
sl@0
|
349 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
sl@0
|
350 |
timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
|
sl@0
|
351 |
|
sl@0
|
352 |
TheFs.RmDir(dir2);
|
sl@0
|
353 |
}
|
sl@0
|
354 |
|
sl@0
|
355 |
if(gTypes >= 3)
|
sl@0
|
356 |
{
|
sl@0
|
357 |
gDelEntryDir = dir3;
|
sl@0
|
358 |
gDelEntryDir2 = dir3;
|
sl@0
|
359 |
dir3.Append(KNewDir);
|
sl@0
|
360 |
DoTest2(DeleteEntryAccess);
|
sl@0
|
361 |
|
sl@0
|
362 |
startTime.HomeTime();
|
sl@0
|
363 |
|
sl@0
|
364 |
r = TheFs.MkDir(dir3);
|
sl@0
|
365 |
FailIfError(r);
|
sl@0
|
366 |
|
sl@0
|
367 |
endTime.HomeTime();
|
sl@0
|
368 |
DoTestKill();
|
sl@0
|
369 |
|
sl@0
|
370 |
timeTaken = endTime.MicroSecondsFrom(startTime);
|
sl@0
|
371 |
timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
|
sl@0
|
372 |
|
sl@0
|
373 |
TheFs.RmDir(dir3);
|
sl@0
|
374 |
}
|
sl@0
|
375 |
}
|
sl@0
|
376 |
|
sl@0
|
377 |
PrintResult(aStep, 1, aN);
|
sl@0
|
378 |
PrintResultTime(aStep, 2, timeTaken1);
|
sl@0
|
379 |
PrintResultTime(aStep, 3, timeTaken2);
|
sl@0
|
380 |
PrintResultTime(aStep, 4, timeTaken3);
|
sl@0
|
381 |
|
sl@0
|
382 |
}
|
sl@0
|
383 |
|
sl@0
|
384 |
/** Times the creation of a directory
|
sl@0
|
385 |
Precondition: This test expectsthe drive already filled with the right files
|
sl@0
|
386 |
|
sl@0
|
387 |
@param aSelector Configuration in case of manual execution
|
sl@0
|
388 |
*/
|
sl@0
|
389 |
LOCAL_C TInt TestMake(TAny* aSelector)
|
sl@0
|
390 |
{
|
sl@0
|
391 |
TInt i = 100;
|
sl@0
|
392 |
TInt testStep;
|
sl@0
|
393 |
|
sl@0
|
394 |
Validate(aSelector);
|
sl@0
|
395 |
|
sl@0
|
396 |
test.Printf(_L("#~TS_Title_%d,%d: MkDir, RFs::MkDir\n"), gTestHarness, gTestCase);
|
sl@0
|
397 |
|
sl@0
|
398 |
i = 100;
|
sl@0
|
399 |
testStep = 1;
|
sl@0
|
400 |
while(i <= KMaxFiles)
|
sl@0
|
401 |
{
|
sl@0
|
402 |
if(i == 100 || i == 1000 || i == 5000 || i == 10000)
|
sl@0
|
403 |
{
|
sl@0
|
404 |
MakeDir(i, testStep++);
|
sl@0
|
405 |
}
|
sl@0
|
406 |
i += 100;
|
sl@0
|
407 |
}
|
sl@0
|
408 |
|
sl@0
|
409 |
gTestCase++;
|
sl@0
|
410 |
return(KErrNone);
|
sl@0
|
411 |
}
|
sl@0
|
412 |
|
sl@0
|
413 |
/** Tests the creation of a directory with 2 threads accessing the directory
|
sl@0
|
414 |
|
sl@0
|
415 |
@param aSelector Configuration in case of manual execution
|
sl@0
|
416 |
*/
|
sl@0
|
417 |
LOCAL_C TInt TestMakeMultSame(TAny* aSelector)
|
sl@0
|
418 |
{
|
sl@0
|
419 |
TInt i;
|
sl@0
|
420 |
TInt testStep;
|
sl@0
|
421 |
|
sl@0
|
422 |
Validate(aSelector);
|
sl@0
|
423 |
|
sl@0
|
424 |
test.Printf(_L("#~TS_Title_%d,%d: MkDir with mult clients accessing same dir, RFs::MkDir\n"), gTestHarness, gTestCase);
|
sl@0
|
425 |
|
sl@0
|
426 |
i = 100;
|
sl@0
|
427 |
testStep = 1;
|
sl@0
|
428 |
while(i <= KMaxFiles)
|
sl@0
|
429 |
{
|
sl@0
|
430 |
if(i == 100 || i == 1000 || i == 5000 || i == 10000)
|
sl@0
|
431 |
{
|
sl@0
|
432 |
MakeDirM(i, testStep++);
|
sl@0
|
433 |
}
|
sl@0
|
434 |
i += 100;
|
sl@0
|
435 |
}
|
sl@0
|
436 |
|
sl@0
|
437 |
gTestCase++;
|
sl@0
|
438 |
return(KErrNone);
|
sl@0
|
439 |
}
|
sl@0
|
440 |
|
sl@0
|
441 |
/** Tests the creation of a directory with 2 threads accessing different directories
|
sl@0
|
442 |
(the current and one with 300 files)
|
sl@0
|
443 |
|
sl@0
|
444 |
@param aSelector Configuration in case of manual execution
|
sl@0
|
445 |
*/
|
sl@0
|
446 |
LOCAL_C TInt TestMakeMultDif(TAny* aSelector)
|
sl@0
|
447 |
{
|
sl@0
|
448 |
TInt i = 100;
|
sl@0
|
449 |
TBuf16<50> directory;
|
sl@0
|
450 |
TBuf16<50> dirtemp;
|
sl@0
|
451 |
TInt testStep;
|
sl@0
|
452 |
|
sl@0
|
453 |
Validate(aSelector);
|
sl@0
|
454 |
|
sl@0
|
455 |
CreateDirWithNFiles(300,3);
|
sl@0
|
456 |
|
sl@0
|
457 |
directory = gSessionPath;
|
sl@0
|
458 |
dirtemp.Format(KDirMultipleName2, 3, 300);
|
sl@0
|
459 |
directory.Append(dirtemp);
|
sl@0
|
460 |
gDelEntryDir2 = directory;
|
sl@0
|
461 |
|
sl@0
|
462 |
test.Printf(_L("#~TS_Title_%d,%d: MkDir with mult clients accessing dif dirs, RFs::MkDir\n"), gTestHarness, gTestCase);
|
sl@0
|
463 |
|
sl@0
|
464 |
i = 100;
|
sl@0
|
465 |
testStep = 1;
|
sl@0
|
466 |
while(i <= KMaxFiles)
|
sl@0
|
467 |
{
|
sl@0
|
468 |
if(i == 100 || i == 1000 || i == 5000 || i == 10000)
|
sl@0
|
469 |
{
|
sl@0
|
470 |
directory = gSessionPath;
|
sl@0
|
471 |
dirtemp.Format(KDirMultipleName2, 2, i);
|
sl@0
|
472 |
directory.Append(dirtemp);
|
sl@0
|
473 |
gDelEntryDir = directory;
|
sl@0
|
474 |
|
sl@0
|
475 |
DoTest2(DeleteEntryAccess);
|
sl@0
|
476 |
|
sl@0
|
477 |
MakeDir(i, testStep++);
|
sl@0
|
478 |
|
sl@0
|
479 |
DoTestKill();
|
sl@0
|
480 |
}
|
sl@0
|
481 |
i += 100;
|
sl@0
|
482 |
}
|
sl@0
|
483 |
|
sl@0
|
484 |
gTestCase++;
|
sl@0
|
485 |
return(KErrNone);
|
sl@0
|
486 |
}
|
sl@0
|
487 |
|
sl@0
|
488 |
/** Goes automatically through all the options
|
sl@0
|
489 |
|
sl@0
|
490 |
@param aSelector Configuration in case of manual execution
|
sl@0
|
491 |
*/
|
sl@0
|
492 |
LOCAL_C TInt TestAll(TAny* aSelector)
|
sl@0
|
493 |
{
|
sl@0
|
494 |
Validate(aSelector);
|
sl@0
|
495 |
|
sl@0
|
496 |
TestMake(aSelector);
|
sl@0
|
497 |
TestMakeMultSame(aSelector);
|
sl@0
|
498 |
TestMakeMultDif(aSelector);
|
sl@0
|
499 |
|
sl@0
|
500 |
return(KErrNone);
|
sl@0
|
501 |
}
|
sl@0
|
502 |
|
sl@0
|
503 |
/** Call all tests
|
sl@0
|
504 |
|
sl@0
|
505 |
*/
|
sl@0
|
506 |
GLDEF_C void CallTestsL()
|
sl@0
|
507 |
{
|
sl@0
|
508 |
TInt r = client.CreateLocal(0);
|
sl@0
|
509 |
FailIfError(r);
|
sl@0
|
510 |
|
sl@0
|
511 |
gFileSize = 8;
|
sl@0
|
512 |
|
sl@0
|
513 |
CSelectionBox* TheSelector = CSelectionBox::NewL(test.Console());
|
sl@0
|
514 |
|
sl@0
|
515 |
// Each test case of the suite has an identifyer for parsing purposes of the results
|
sl@0
|
516 |
gTestHarness = 6;
|
sl@0
|
517 |
gTestCase = 1;
|
sl@0
|
518 |
|
sl@0
|
519 |
PrintHeaders(1, _L("t_fsrmkdir. Mkdir"));
|
sl@0
|
520 |
|
sl@0
|
521 |
if(gMode == 0)
|
sl@0
|
522 |
{ // Manual
|
sl@0
|
523 |
gSessionPath=_L("?:\\");
|
sl@0
|
524 |
TCallBack createFiles(TestFileCreate, TheSelector);
|
sl@0
|
525 |
TCallBack MkDir(TestMake, TheSelector);
|
sl@0
|
526 |
TCallBack makeMultSame(TestMakeMultSame, TheSelector);
|
sl@0
|
527 |
TCallBack makeMultDif(TestMakeMultDif, TheSelector);
|
sl@0
|
528 |
TCallBack makeAll(TestAll, TheSelector);
|
sl@0
|
529 |
TheSelector->AddDriveSelectorL(TheFs);
|
sl@0
|
530 |
TheSelector->AddLineL(_L("Create all files"), createFiles);
|
sl@0
|
531 |
TheSelector->AddLineL(_L("Mkdir "), MkDir);
|
sl@0
|
532 |
TheSelector->AddLineL(_L("Mkdir mult clients same dir "), makeMultSame);
|
sl@0
|
533 |
TheSelector->AddLineL(_L("Mkdir mult clients dif dir"), makeMultDif);
|
sl@0
|
534 |
TheSelector->AddLineL(_L("Execute all options"), makeAll);
|
sl@0
|
535 |
TheSelector->Run();
|
sl@0
|
536 |
}
|
sl@0
|
537 |
else
|
sl@0
|
538 |
{ // Automatic
|
sl@0
|
539 |
TestAll(TheSelector);
|
sl@0
|
540 |
}
|
sl@0
|
541 |
|
sl@0
|
542 |
client.Close();
|
sl@0
|
543 |
test.Printf(_L("#~TestEnd_%d\n"), gTestHarness);
|
sl@0
|
544 |
delete TheSelector;
|
sl@0
|
545 |
}
|