|
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\fsstress\t_ramstr.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 #include <f32file.h> |
|
19 #include <e32test.h> |
|
20 #include <e32math.h> |
|
21 #include <e32hal.h> |
|
22 #include "t_stress.h" |
|
23 |
|
24 GLDEF_D RTest test(_L("T_RAMSTR")); |
|
25 |
|
26 LOCAL_D TBuf8<512> testBuf(512); |
|
27 LOCAL_D TInt64 TheSeed=917824; |
|
28 LOCAL_D TInt KMaxIteration; |
|
29 LOCAL_D const TInt KMaxFiles=4; |
|
30 LOCAL_D const TInt KMaxLengthIncrement=7770; |
|
31 LOCAL_D const TInt mult[] = { 1, 5, 13, 37}; |
|
32 LOCAL_D const TInt KReduceSizeFrequency=20; // 1 reduce in ?? iterations |
|
33 LOCAL_D const TInt KCheckFileFrequency=20000; // 1 check in ?? iterations |
|
34 LOCAL_D const TInt KMaxBufferLength=0x8000; |
|
35 |
|
36 LOCAL_C TInt CreateFileEx(const TDesC& aBaseName,TInt aX, TInt anInitialSize) |
|
37 // |
|
38 // Create a single cluster file |
|
39 // |
|
40 { |
|
41 TBuf<128> fileName=aBaseName; |
|
42 fileName.AppendNum(aX); |
|
43 RFile file; |
|
44 TInt r=file.Replace(TheFs,fileName,EFileWrite); |
|
45 if (r==KErrDiskFull) |
|
46 return(r); |
|
47 if (r!=KErrNone) |
|
48 { |
|
49 test.Printf(_L("ERROR:: Replace returned %d\n"),r); |
|
50 test.Getch(); |
|
51 return(r); |
|
52 } |
|
53 |
|
54 r=file.SetSize(anInitialSize); |
|
55 file.Close(); |
|
56 if (r==KErrDiskFull) |
|
57 return(r); |
|
58 |
|
59 if (r!=KErrNone) |
|
60 { |
|
61 test.Printf(_L("ERROR:: SetSize returned %d\n"),r); |
|
62 test.Getch(); |
|
63 return(r); |
|
64 } |
|
65 |
|
66 // r=TheFs.CheckDisk(fileName); |
|
67 // if (r!=KErrNone && r!=KErrNotSupported) |
|
68 // { |
|
69 // test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r); |
|
70 // test.Getch(); |
|
71 // return(KErrDiskFull); |
|
72 // } |
|
73 test.Printf(_L("Created file %d size %d\n"),aX, anInitialSize); |
|
74 return(KErrNone); |
|
75 } |
|
76 |
|
77 LOCAL_C TInt DeleteFileEx(TBuf<128>& aBaseName,TInt aX) |
|
78 // |
|
79 // Delete a file. |
|
80 // |
|
81 { |
|
82 |
|
83 TBuf<128> fileName=aBaseName; |
|
84 fileName.AppendNum(aX); |
|
85 TInt r=TheFs.Delete(fileName); |
|
86 test(r==KErrNone); |
|
87 // r=TheFs.CheckDisk(fileName); |
|
88 // if (r!=KErrNone && r!=KErrNotSupported) |
|
89 // { |
|
90 // test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r); |
|
91 // test(r==KErrNone); |
|
92 // } |
|
93 test.Printf(_L("Deleted File %d\n"),aX); |
|
94 return(KErrNone); |
|
95 } |
|
96 |
|
97 LOCAL_C void WriteCluster(RFile& aFile,TInt aCluster) |
|
98 // |
|
99 // Extend aFile by 1 cluster |
|
100 // |
|
101 { |
|
102 TUint8* bufPtr=(TUint8*)testBuf.Ptr(); |
|
103 testBuf.SetLength(testBuf.MaxSize()); |
|
104 Mem::Fill(bufPtr,testBuf.MaxSize(),aCluster); |
|
105 TInt r=aFile.Write(testBuf); |
|
106 test(r==KErrNone); |
|
107 } |
|
108 |
|
109 LOCAL_C void SeekToCluster(RFile& aFile,TInt aCluster) |
|
110 // |
|
111 // Seek to aCluster and check it is found correctly |
|
112 // |
|
113 { |
|
114 TBuf8<508> seekBuf(508); |
|
115 TInt r=aFile.Read(aCluster*testBuf.MaxSize(),seekBuf); |
|
116 test(r==KErrNone); |
|
117 test(seekBuf[0]==(TUint8)aCluster && seekBuf[507]==(TUint8)aCluster); |
|
118 } |
|
119 |
|
120 LOCAL_C void SeekToCluster(RFile& aFile,TInt aCluster1,TInt aCluster2) |
|
121 // |
|
122 // Seek to aCluster and check it is found correctly |
|
123 // |
|
124 { |
|
125 TBuf8<508> seekBuf(508); |
|
126 TInt r=aFile.Read(aCluster1*testBuf.MaxSize(),seekBuf); |
|
127 test(r==KErrNone); |
|
128 test(seekBuf[0]==(TUint8)aCluster1 && seekBuf[507]==(TUint8)aCluster1); |
|
129 r=aFile.Read(aCluster2*testBuf.MaxSize(),seekBuf); |
|
130 test(r==KErrNone); |
|
131 test(seekBuf[0]==(TUint8)aCluster2 && seekBuf[507]==(TUint8)aCluster2); |
|
132 } |
|
133 |
|
134 LOCAL_C void ExhaustiveTest(RFile& aFile,TInt aCount1) |
|
135 // |
|
136 // Test every possible seeking combination |
|
137 // |
|
138 { |
|
139 TInt i=0,k=0; |
|
140 for(k=0;k<aCount1;k++) |
|
141 { |
|
142 for(i=aCount1-1;i>0;i--) |
|
143 { |
|
144 SeekToCluster(aFile,i); |
|
145 SeekToCluster(aFile,k); |
|
146 } |
|
147 test.Printf(_L("Seek from %d \r"),k); |
|
148 } |
|
149 test.Printf(_L("\n")); |
|
150 } |
|
151 |
|
152 LOCAL_C void Test1() |
|
153 // |
|
154 // Test opening a large file |
|
155 // |
|
156 { |
|
157 test.Next(_L("Create interleaved files")); |
|
158 RFile f1,f2; |
|
159 |
|
160 TInt r=f1.Replace(TheFs,_L("BIGFILE1.TST"),EFileWrite); |
|
161 test(r==KErrNone); |
|
162 r=f2.Replace(TheFs,_L("BIGFILE2.TST"),EFileWrite); |
|
163 test(r==KErrNone); |
|
164 |
|
165 TInt maxListLength=4; |
|
166 TInt i=0,k=0; |
|
167 TInt countf1=0; |
|
168 TInt countf2=0; |
|
169 for (k=0;k<maxListLength;k++) |
|
170 { |
|
171 for (i=0;i<maxListLength;i++) |
|
172 { |
|
173 TInt j; |
|
174 for (j=0;j<=i;j++) |
|
175 WriteCluster(f1,countf1++); |
|
176 for (j=0;j<=k;j++) |
|
177 WriteCluster(f2,countf2++); |
|
178 test.Printf(_L("Written %d to file1 %d to file2\n"),i+1,k+1); |
|
179 } |
|
180 } |
|
181 |
|
182 ExhaustiveTest(f1,countf1); |
|
183 ExhaustiveTest(f2,countf2); |
|
184 |
|
185 SeekToCluster(f1,1,10); |
|
186 SeekToCluster(f1,6,3); |
|
187 SeekToCluster(f1,8,4); |
|
188 SeekToCluster(f1,12,3); |
|
189 SeekToCluster(f1,23,32); |
|
190 SeekToCluster(f1,5,8); |
|
191 SeekToCluster(f1,7,9); |
|
192 SeekToCluster(f1,12,1); |
|
193 SeekToCluster(f1,2,32); |
|
194 SeekToCluster(f1,16,8); |
|
195 SeekToCluster(f1,9,5); |
|
196 SeekToCluster(f1,33,6); |
|
197 SeekToCluster(f1,13,7); |
|
198 SeekToCluster(f1,9,17); |
|
199 SeekToCluster(f1,4,5); |
|
200 SeekToCluster(f1,5,31); |
|
201 SeekToCluster(f1,11,10); |
|
202 SeekToCluster(f1,1,2); |
|
203 SeekToCluster(f1,5,5); |
|
204 |
|
205 f1.Close(); |
|
206 f2.Close(); |
|
207 r=TheFs.Delete(_L("BIGFile1.tst")); |
|
208 test(r==KErrNone); |
|
209 r=TheFs.Delete(_L("BIGFile2.tst")); |
|
210 test(r==KErrNone); |
|
211 CheckDisk(); |
|
212 } |
|
213 |
|
214 LOCAL_C void Test2() |
|
215 // |
|
216 // Reproduce old bugs |
|
217 // |
|
218 { |
|
219 test.Next(_L("Regression Protection")); |
|
220 RFile f1,f2; |
|
221 |
|
222 TInt r=f1.Replace(TheFs,_L("BIGFILE1.TST"),EFileWrite); |
|
223 test(r==KErrNone); |
|
224 r=f2.Replace(TheFs,_L("BIGFILE2.TST"),EFileWrite); |
|
225 test(r==KErrNone); |
|
226 |
|
227 WriteCluster(f1,0); |
|
228 WriteCluster(f1,1); |
|
229 WriteCluster(f1,2); |
|
230 WriteCluster(f1,3); |
|
231 WriteCluster(f1,4); |
|
232 WriteCluster(f1,5); |
|
233 WriteCluster(f2,0); |
|
234 WriteCluster(f1,6); |
|
235 |
|
236 SeekToCluster(f1,6); |
|
237 SeekToCluster(f1,4); |
|
238 |
|
239 f1.Close(); |
|
240 f2.Close(); |
|
241 r=TheFs.Delete(_L("BIGFile1.tst")); |
|
242 test(r==KErrNone); |
|
243 r=TheFs.Delete(_L("BIGFile2.tst")); |
|
244 test(r==KErrNone); |
|
245 CheckDisk(); |
|
246 } |
|
247 |
|
248 LOCAL_C void Test3() |
|
249 // |
|
250 // Change file size while seeking |
|
251 // |
|
252 { |
|
253 |
|
254 test.Next(_L("Alter filesize")); |
|
255 RFile f1; |
|
256 TheSeed=917824; |
|
257 TInt i=0,j=0; |
|
258 TInt r=f1.Replace(TheFs,_L("BIGFILE1.TST"),EFileWrite); |
|
259 test(r==KErrNone); |
|
260 |
|
261 r=f1.SetSize(65534); |
|
262 test(r==KErrNone); |
|
263 |
|
264 for(i=0;i<=15;i++) |
|
265 WriteCluster(f1,i); |
|
266 |
|
267 for (j=0;j<100;j++) |
|
268 { |
|
269 TInt cluster1=Math::Rand(TheSeed)%15; |
|
270 TInt cluster2=Math::Rand(TheSeed)%15; |
|
271 SeekToCluster(f1,cluster2,cluster1); |
|
272 } |
|
273 |
|
274 test.Next(_L("Increase Size")); |
|
275 r=f1.SetSize(1048577); |
|
276 test(r==KErrNone || r==KErrDiskFull); |
|
277 if (r==KErrDiskFull) |
|
278 { |
|
279 test.Printf(_L("File too big\n")); |
|
280 f1.Close(); |
|
281 return; |
|
282 } |
|
283 |
|
284 test.Next(_L("Test data still present")); |
|
285 for (j=0;j<200;j++) |
|
286 { |
|
287 TInt cluster1=Math::Rand(TheSeed)%15; |
|
288 TInt cluster2=Math::Rand(TheSeed)%15; |
|
289 SeekToCluster(f1,cluster2,cluster1); |
|
290 } |
|
291 |
|
292 TInt newPos=8192; |
|
293 r=f1.Seek(ESeekStart,newPos); |
|
294 test(r==KErrNone); |
|
295 |
|
296 test.Next(_L("Write more data")); |
|
297 for(i=16;i<83;i++) |
|
298 WriteCluster(f1,i); |
|
299 |
|
300 test.Next(_L("Seek to new data")); |
|
301 for (j=0;j<200;j++) |
|
302 { |
|
303 TInt cluster1=Math::Rand(TheSeed)%83; |
|
304 TInt cluster2=Math::Rand(TheSeed)%83; |
|
305 SeekToCluster(f1,cluster2,cluster1); |
|
306 } |
|
307 |
|
308 test.Next(_L("Reduce file size")); |
|
309 r=f1.SetSize(135000); |
|
310 test(r==KErrNone); |
|
311 |
|
312 test.Next(_L("Test data still present")); |
|
313 for (j=0;j<200;j++) |
|
314 { |
|
315 TInt cluster1=Math::Rand(TheSeed)%31; |
|
316 TInt cluster2=Math::Rand(TheSeed)%31; |
|
317 SeekToCluster(f1,cluster2,cluster1); |
|
318 } |
|
319 |
|
320 f1.Close(); |
|
321 } |
|
322 |
|
323 class TFileReader |
|
324 { |
|
325 public: |
|
326 TFileReader(RFile* aFile); |
|
327 void Next(TUint8& aVal,TInt& aLength); |
|
328 TBool Compare(TUint8 aVal,TInt aLength); |
|
329 private: |
|
330 RFile iFile; |
|
331 TBuf8<512> iData; |
|
332 TInt iPos; |
|
333 }; |
|
334 |
|
335 TFileReader::TFileReader(RFile* aFile) |
|
336 // |
|
337 // Constructor |
|
338 // |
|
339 : iFile(*aFile), iPos(0) |
|
340 { |
|
341 |
|
342 TInt r=iFile.Read(0,iData); |
|
343 test(r==KErrNone); |
|
344 } |
|
345 |
|
346 void TFileReader::Next(TUint8& aVal,TInt& aLength) |
|
347 // |
|
348 // Read aLength contiguous bytes with aVal |
|
349 // |
|
350 { |
|
351 |
|
352 if (iPos==iData.Length()) |
|
353 { |
|
354 TInt r=iFile.Read(iData); |
|
355 test(r==KErrNone); |
|
356 iPos=0; |
|
357 if (iData.Length()==0) |
|
358 { |
|
359 aLength=0; |
|
360 return; |
|
361 } |
|
362 } |
|
363 |
|
364 aVal=iData[iPos]; |
|
365 aLength=0; |
|
366 while(iPos<iData.Length()) |
|
367 { |
|
368 if (iData[iPos]!=aVal) |
|
369 break; |
|
370 iPos++; |
|
371 aLength++; |
|
372 } |
|
373 } |
|
374 |
|
375 TBool TFileReader::Compare(TUint8 aVal, TInt aLength) |
|
376 // |
|
377 // Compare file contents == aVal for aLength bytes |
|
378 // |
|
379 { |
|
380 |
|
381 FOREVER |
|
382 { |
|
383 if(iPos==iData.Length()) |
|
384 { |
|
385 TInt r=iFile.Read(iData); |
|
386 if (r!=KErrNone) |
|
387 { |
|
388 test.Printf(_L("READ error %d\n"),r); |
|
389 test.Getch(); |
|
390 RFs fs; |
|
391 r=fs.Connect(); |
|
392 test.Printf(_L("connect returned %d\n"),r); |
|
393 test.Getch(); |
|
394 fs.Close(); |
|
395 return(EFalse); |
|
396 } |
|
397 iPos=0; |
|
398 if (iData.Length()==0) |
|
399 { |
|
400 test.Printf(_L("\nFound Error\n")); |
|
401 test.Getch(); |
|
402 return(EFalse); |
|
403 } |
|
404 } |
|
405 while(iPos<iData.Length()) |
|
406 { |
|
407 if (iData[iPos]!=aVal) |
|
408 { |
|
409 test.Printf(_L("\nFound Error\n")); |
|
410 test.Getch(); |
|
411 return(EFalse); |
|
412 } |
|
413 iPos++; |
|
414 aLength--; |
|
415 if (aLength==0) |
|
416 return(ETrue); |
|
417 } |
|
418 } |
|
419 } |
|
420 |
|
421 LOCAL_C void CheckFileContents(RFile* aFile) |
|
422 // |
|
423 // Check all files have consistent contents |
|
424 // |
|
425 { |
|
426 |
|
427 TFileReader f0(aFile); |
|
428 TFileReader f1(aFile+1); |
|
429 TFileReader f2(aFile+2); |
|
430 TFileReader f3(aFile+3); |
|
431 |
|
432 FOREVER |
|
433 { |
|
434 TUint8 val; |
|
435 TInt length; |
|
436 f0.Next(val,length); |
|
437 if (length==0) |
|
438 break; |
|
439 test(f1.Compare(val,length*mult[1])); |
|
440 test(f2.Compare(val,length*mult[2])); |
|
441 test(f3.Compare(val,length*mult[3])); |
|
442 } |
|
443 |
|
444 TUint8 val; |
|
445 TInt length; |
|
446 f1.Next(val,length); |
|
447 if (length!=0) |
|
448 { |
|
449 test.Printf(_L("\nFound Error\n")); |
|
450 test.Getch(); |
|
451 } |
|
452 test(length==0); |
|
453 f2.Next(val,length); |
|
454 if (length!=0) |
|
455 { |
|
456 test.Printf(_L("\nFound Error\n")); |
|
457 test.Getch(); |
|
458 } |
|
459 test(length==0); |
|
460 f3.Next(val,length); |
|
461 if (length!=0) |
|
462 { |
|
463 test.Printf(_L("\nFound Error\n")); |
|
464 test.Getch(); |
|
465 } |
|
466 test(length==0); |
|
467 } |
|
468 |
|
469 LOCAL_C void Test4() |
|
470 // |
|
471 // Read, write and resize 4 interleaved files |
|
472 // |
|
473 { |
|
474 |
|
475 RFile f[KMaxFiles]; |
|
476 HBufC8* dataBuf=HBufC8::NewL(KMaxBufferLength); |
|
477 |
|
478 TInt r=f[0].Replace(TheFs,_L("TEST1.DAT"),EFileWrite); |
|
479 test(r==KErrNone); |
|
480 r=f[1].Replace(TheFs,_L("TEST2.DAT"),EFileWrite); |
|
481 test(r==KErrNone); |
|
482 r=f[2].Replace(TheFs,_L("TEST3.DAT"),EFileWrite); |
|
483 test(r==KErrNone); |
|
484 r=f[3].Replace(TheFs,_L("TEST4.DAT"),EFileWrite); |
|
485 test(r==KErrNone); |
|
486 |
|
487 TInt size=0; |
|
488 TInt iteration=0; |
|
489 |
|
490 FOREVER |
|
491 { |
|
492 iteration++; |
|
493 TInt pos=(size) ? Math::Rand(TheSeed)%size : 0; |
|
494 TInt len=Math::Rand(TheSeed)%KMaxLengthIncrement; |
|
495 TInt order=Math::Rand(TheSeed)%KMaxFiles; |
|
496 TInt value=Math::Rand(TheSeed)%KMaxTUint8; |
|
497 |
|
498 TUint8* data=(TUint8*)dataBuf->Ptr(); |
|
499 Mem::Fill(data,KMaxBufferLength,value); |
|
500 |
|
501 if (pos+len>size) |
|
502 size=pos+len; |
|
503 |
|
504 for (TInt i=0;i<KMaxFiles;i++) |
|
505 { |
|
506 TInt fileNum=(order+i)%KMaxFiles; |
|
507 TInt s=len*mult[fileNum]; |
|
508 TInt filePos=pos*mult[fileNum]; |
|
509 r=f[fileNum].Seek(ESeekStart,filePos); |
|
510 test(r==KErrNone); |
|
511 |
|
512 while(s>0) |
|
513 { |
|
514 TInt l=(s>KMaxBufferLength) ? KMaxBufferLength : s; |
|
515 dataBuf->Des().SetLength(l); |
|
516 r=f[fileNum].Write(*dataBuf); |
|
517 if (r==KErrDiskFull) |
|
518 goto End; |
|
519 test(r==KErrNone); |
|
520 s-=l; |
|
521 } |
|
522 |
|
523 } |
|
524 |
|
525 if ((iteration%KCheckFileFrequency)==0) |
|
526 CheckFileContents(&f[0]); |
|
527 |
|
528 test.Printf(_L("Iteration %d, size %d \r"),iteration,size); |
|
529 if (iteration==KMaxIteration) |
|
530 break; |
|
531 |
|
532 if ((iteration%KReduceSizeFrequency)==0) |
|
533 { |
|
534 size=(size) ? Math::Rand(TheSeed)%size : 0; |
|
535 test.Printf(_L("\nReduceSize newsize=%d\n"),size); |
|
536 for (TInt i=0;i<KMaxFiles;i++) |
|
537 { |
|
538 TInt fileNum=(order+i)%KMaxFiles; |
|
539 r=f[fileNum].SetSize(size*mult[fileNum]); |
|
540 test(r==KErrNone); |
|
541 } |
|
542 CheckFileContents(&f[0]); |
|
543 } |
|
544 } |
|
545 End: |
|
546 delete dataBuf; |
|
547 for (TInt i=0;i<KMaxFiles;i++) |
|
548 f[i].Close(); |
|
549 test.Printf(_L("\n")); |
|
550 } |
|
551 |
|
552 LOCAL_C void MultipleFiles(TInt numberOfFiles,TInt anInitialSize) |
|
553 // |
|
554 // Test filling the disk with files, and various manipulations thereof |
|
555 // |
|
556 { |
|
557 test.Start(_L("Test multiple file creation, deletion and resize operations")); |
|
558 TInt r=TheFs.MkDirAll(_L("\\F32-TST\\BIGDIRECTORY\\")); |
|
559 test(r==KErrNone || r==KErrAlreadyExists); |
|
560 TFileName sessionPath; |
|
561 r=TheFs.SessionPath(sessionPath); |
|
562 test(r==KErrNone); |
|
563 |
|
564 TInt index=0; |
|
565 TBuf<128> fileName=_L("\\F32-TST\\BIGDIRECTORY\\FILE"); |
|
566 |
|
567 for (;index<numberOfFiles;index++) |
|
568 { |
|
569 r=CreateFileEx(fileName,index,anInitialSize); |
|
570 if (r!=KErrNone) |
|
571 break; |
|
572 |
|
573 test(r==KErrNone); |
|
574 |
|
575 #if defined(__WINS__) |
|
576 if (index==32 && sessionPath[0]=='C') |
|
577 break; |
|
578 #endif |
|
579 } |
|
580 |
|
581 if ((r==KErrNone)||(r==KErrDiskFull)) |
|
582 r=TheFs.CheckDisk(fileName); |
|
583 |
|
584 if (r!=KErrNone && r!=KErrNotSupported) |
|
585 { |
|
586 test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r); |
|
587 // test.Getch(); |
|
588 } |
|
589 |
|
590 // Delete half of the files |
|
591 TInt halfCount=index/2; |
|
592 index--; |
|
593 for (; index>halfCount; index--) |
|
594 DeleteFileEx(fileName,index); |
|
595 |
|
596 TBuf<128> baseName; |
|
597 RFile file; |
|
598 // Double the size of those files remaining |
|
599 for (index=0; index<halfCount; index++) |
|
600 { |
|
601 baseName=fileName; |
|
602 baseName.AppendNum(index); |
|
603 r=file.Open(TheFs,baseName,EFileRead|EFileWrite); |
|
604 test(r==KErrNone); |
|
605 test.Printf(_L("Resized %S from %d to %d\n"),&baseName,anInitialSize,anInitialSize*2); |
|
606 r=file.SetSize(2*anInitialSize); |
|
607 test((r==KErrNone)||(r==KErrDiskFull)); |
|
608 file.Close(); |
|
609 } |
|
610 |
|
611 r=TheFs.CheckDisk(fileName); |
|
612 |
|
613 if (r!=KErrNone && r!=KErrNotSupported) |
|
614 { |
|
615 test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r); |
|
616 // test.Getch(); |
|
617 } |
|
618 |
|
619 // Delete the files |
|
620 for (index=0; index<halfCount; index++) |
|
621 { |
|
622 baseName=fileName; |
|
623 baseName.AppendNum(index); |
|
624 test.Printf(_L("Deleted %S\n"),&baseName); |
|
625 r=TheFs.Delete(baseName); |
|
626 test((r==KErrNone)||(r==KErrNotFound)); |
|
627 } |
|
628 |
|
629 r=TheFs.CheckDisk(fileName); |
|
630 |
|
631 if (r!=KErrNone && r!=KErrNotSupported) |
|
632 { |
|
633 test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r); |
|
634 // test.Getch(); |
|
635 } |
|
636 |
|
637 test.End(); |
|
638 } |
|
639 |
|
640 |
|
641 GLDEF_C void CallTestsL() |
|
642 // |
|
643 // Call all tests |
|
644 // |
|
645 { |
|
646 |
|
647 #if defined(__WINS__) |
|
648 if (gSessionPath[0]=='C') |
|
649 return; |
|
650 #endif |
|
651 if (gSessionPath[0]=='C' || gSessionPath[0]=='Y') |
|
652 KMaxIteration=100; |
|
653 else |
|
654 KMaxIteration=100; |
|
655 CreateTestDirectory(_L("\\TRAND\\")); |
|
656 test.Printf(_L("\nThis test never stops. It is designed to create, delete and resize \n")); |
|
657 test.Printf(_L("multiple small files on the EPOC machine whilst testing that soft reset\n")); |
|
658 test.Printf(_L("events are not catastrophic to the filesystem. Once the test is running, \n")); |
|
659 test.Printf(_L("push the grey button to reset the machine at random intervals and then\n")); |
|
660 test.Printf(_L("restart the test. \n")); |
|
661 test.Printf(_L("\nPress any key to continue... \n")); |
|
662 test.Getch(); |
|
663 FOREVER |
|
664 { |
|
665 MultipleFiles(50,0x200); |
|
666 MultipleFiles(50,0x400); |
|
667 MultipleFiles(50,0x1FF); |
|
668 MultipleFiles(50,0x201); |
|
669 Test1(); |
|
670 Test2(); |
|
671 Test3(); |
|
672 Test4(); |
|
673 } |
|
674 //DeleteTestDirectory(); |
|
675 } |