|
1 // Copyright (c) 1997-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 // Based on t_main.cpp as used for other tests. |
|
15 // |
|
16 // |
|
17 |
|
18 //! @file f32test\concur\t_cfsmain.cpp |
|
19 |
|
20 #include <f32file.h> |
|
21 #include <e32test.h> |
|
22 #include <e32hal.h> |
|
23 #include <e32math.h> |
|
24 #include <f32dbg.h> |
|
25 |
|
26 #include "t_server.h" |
|
27 #include "cfafsdlyif.h" |
|
28 |
|
29 GLDEF_D RFs TheFs; |
|
30 GLDEF_D TFileName gSessionPath; |
|
31 GLDEF_D TInt gAllocFailOff=KAllocFailureOff; |
|
32 GLDEF_D TInt gAllocFailOn=KAllocFailureOff; |
|
33 GLDEF_D TInt64 gSeed=51703; |
|
34 |
|
35 GLDEF_D TChar gDriveToTest; |
|
36 GLDEF_D TUint32 gDebugFlags = 0; |
|
37 |
|
38 GLDEF_D TPtrC gArgV[128]; |
|
39 GLDEF_D TInt gArgC = 0; |
|
40 |
|
41 LOCAL_D TTestType TheTestType=ENotifierNone; |
|
42 LOCAL_D RSemaphore ControlIoSem; |
|
43 |
|
44 TMediaPassword thePassword=_L8("abc"); |
|
45 |
|
46 enum TTestCode {ESimLockRemMed, EClearSimLockRemMed}; |
|
47 |
|
48 const TInt KControlIoRemMedLock=5; //setflag |
|
49 const TInt KControlClearMedLock=6; //clears flag |
|
50 const TInt KControIoRemMedRepeat=9; |
|
51 |
|
52 _LIT(KNotifierHang,"Hang"); |
|
53 _LIT(KNotifierRepeat,"Repeat"); |
|
54 _LIT(KNotifierWithRepeat,"WithRepeat"); |
|
55 _LIT(KPrivate, "\\Private\\"); |
|
56 |
|
57 GLDEF_C TBool IsTestTypeNotifyHang() |
|
58 // |
|
59 // |
|
60 // |
|
61 { |
|
62 return(TheTestType==ENotifierHang); |
|
63 } |
|
64 |
|
65 GLDEF_C TBool IsTestTypeNotifyRepeat() |
|
66 // |
|
67 // |
|
68 // |
|
69 { |
|
70 return(TheTestType==ENotifierRepeat); |
|
71 } |
|
72 |
|
73 GLDEF_C TBool IsTestTypeNotifyWithRepeat() |
|
74 // |
|
75 // |
|
76 // |
|
77 { |
|
78 return(TheTestType==ENotifierWithRepeat); |
|
79 } |
|
80 |
|
81 |
|
82 GLDEF_C TBool IsTestTypeStandard() |
|
83 // |
|
84 // |
|
85 // |
|
86 { |
|
87 return(TheTestType==ENotifierNone); |
|
88 } |
|
89 |
|
90 GLDEF_C TTestType TestType() |
|
91 // |
|
92 // |
|
93 // |
|
94 { |
|
95 return(TheTestType); |
|
96 } |
|
97 |
|
98 GLDEF_C void CreateShortName(TDes& aFileName,TInt64& aSeed) |
|
99 // |
|
100 // Create a random, dos legal 8.3 char name |
|
101 // |
|
102 { |
|
103 |
|
104 TInt length=Math::Rand(aSeed)%11; |
|
105 if (length==0) |
|
106 length=1; |
|
107 else if (length==3) // don't create three letter names like 'AUX' or 'PRN' |
|
108 length++; |
|
109 else if (length>8) // end in '.' if no extension |
|
110 length++; |
|
111 |
|
112 aFileName.SetLength(length); |
|
113 for(TInt i=0;i<length;i++) |
|
114 { |
|
115 if (i==9) |
|
116 { |
|
117 aFileName[i]='.'; |
|
118 continue; |
|
119 } |
|
120 TInt letter=Math::Rand(aSeed)%26; |
|
121 aFileName[i]=(TText)('A'+letter); |
|
122 } |
|
123 } |
|
124 |
|
125 _LIT(KFatName,"Fat"); |
|
126 GLDEF_C TBool IsFileSystemFAT(RFs &aFsSession,TInt aDrive) |
|
127 // |
|
128 // return true if fat on aDrive |
|
129 // |
|
130 { |
|
131 TFileName f; |
|
132 TInt r=aFsSession.FileSystemName(f,aDrive); |
|
133 test(r==KErrNone || r==KErrNotFound); |
|
134 return (f.CompareF(KFatName)==0); |
|
135 } |
|
136 |
|
137 GLDEF_C void CreateLongName(TDes& aFileName,TInt64& aSeed,TInt aLength) |
|
138 // |
|
139 // Create a random, dos legal 8.3 char name |
|
140 // |
|
141 { |
|
142 |
|
143 TInt length; |
|
144 if (aLength>0) |
|
145 length=aLength; |
|
146 else |
|
147 { |
|
148 length=Math::Rand(aSeed)%128; |
|
149 length+=Math::Rand(aSeed)%128; |
|
150 length+=Math::Rand(aSeed)%128; |
|
151 length+=Math::Rand(aSeed)%128; |
|
152 length-=256; |
|
153 length=Abs(length); |
|
154 if (length==0) |
|
155 length=1; |
|
156 if (length>220) |
|
157 length=31; |
|
158 } |
|
159 if (length==3) // don't create three letter names like 'AUX' or 'PRN' |
|
160 length++; |
|
161 |
|
162 aFileName.SetLength(length); |
|
163 TInt spaceChar=-1; |
|
164 TInt i; |
|
165 for(i=0;i<length;i++) |
|
166 { |
|
167 StartAgain: |
|
168 TChar letter=0; |
|
169 TBool illegalChar=ETrue; |
|
170 |
|
171 while(illegalChar) |
|
172 { |
|
173 #if defined(__WINS__) |
|
174 if (gSessionPath[0]=='C') |
|
175 letter=(TChar)('A'+Math::Rand(aSeed)%26); |
|
176 else |
|
177 letter=(TChar)Math::Rand(aSeed)%256; |
|
178 #else |
|
179 letter=(TChar)Math::Rand(aSeed)%256; |
|
180 #endif |
|
181 TBool space=letter.IsSpace(); |
|
182 if (space && spaceChar==-1) |
|
183 spaceChar=i; |
|
184 else if (!space && spaceChar!=-1) |
|
185 spaceChar=-1; |
|
186 |
|
187 switch(letter) |
|
188 { |
|
189 case '<': |
|
190 case '>': |
|
191 case ':': |
|
192 case '"': |
|
193 case '/': |
|
194 case '|': |
|
195 case '*': |
|
196 case '?': |
|
197 case '\\': |
|
198 case '\0': |
|
199 break; |
|
200 default: |
|
201 illegalChar=EFalse; |
|
202 }; |
|
203 } |
|
204 aFileName[i]=(TText)letter; |
|
205 } |
|
206 |
|
207 if (spaceChar!=-1) |
|
208 { |
|
209 i=spaceChar; |
|
210 goto StartAgain; |
|
211 } |
|
212 } |
|
213 |
|
214 GLDEF_C void CheckEntry(const TDesC& aName,TUint anAttributes,const TTime& aModified) |
|
215 // |
|
216 // Checks the values associated with an entry |
|
217 // |
|
218 { |
|
219 |
|
220 TEntry entry; |
|
221 TInt r=TheFs.Entry(aName,entry); |
|
222 test(r==KErrNone); |
|
223 test(entry.iAtt==anAttributes); |
|
224 if (aModified!=TTime(0)) |
|
225 test(entry.iModified==aModified); |
|
226 } |
|
227 |
|
228 GLDEF_C void CheckDisk() |
|
229 // |
|
230 // Do a checkdisk and report failure |
|
231 // |
|
232 { |
|
233 test.Next(_L("Check Disk")); |
|
234 TInt r=TheFs.CheckDisk(gSessionPath); |
|
235 if (r!=KErrNone && r!=KErrNotSupported && r!=KErrPermissionDenied) |
|
236 ReportCheckDiskFailure(r); |
|
237 } |
|
238 |
|
239 GLDEF_C void ReportCheckDiskFailure(TInt aRet) |
|
240 // |
|
241 // Report the failure of checkdisk |
|
242 // |
|
243 { |
|
244 |
|
245 test.Printf(_L("CHECKDISK FAILED: ")); |
|
246 switch(aRet) |
|
247 { |
|
248 case 1: test.Printf(_L("File cluster chain contains a bad value (<2 or >maxCluster)\n")); break; |
|
249 case 2: test.Printf(_L("Two files are linked to the same cluster\n")); break; |
|
250 case 3: test.Printf(_L("Unallocated cluster contains a value != 0\n")); break; |
|
251 case 4: test.Printf(_L("Size of file != number of clusters in chain\n")); break; |
|
252 default: test.Printf(_L("Undefined Error value %d\n"),aRet); |
|
253 } |
|
254 test(EFalse); |
|
255 } |
|
256 |
|
257 GLDEF_C void TurnAllocFailureOff() |
|
258 // |
|
259 // Switch off all allocFailure |
|
260 // |
|
261 { |
|
262 |
|
263 test.Printf(_L("Disable Alloc Failure\n")); |
|
264 TheFs.SetAllocFailure(gAllocFailOff); |
|
265 gAllocFailOn=KAllocFailureOff; // Disable gAllocFailOn |
|
266 } |
|
267 |
|
268 GLDEF_C void TurnAllocFailureOn() |
|
269 // |
|
270 // Switch off all allocFailure |
|
271 // |
|
272 { |
|
273 |
|
274 test.Printf(_L("Enable Alloc Failure\n")); |
|
275 gAllocFailOn=KAllocFailureOn; // Enable gAllocFailOn |
|
276 TheFs.SetAllocFailure(gAllocFailOn); |
|
277 } |
|
278 |
|
279 GLDEF_C void MakeFile(const TDesC& aFileName,const TUidType& aUidType,const TDesC8& aFileContents) |
|
280 // |
|
281 // Make a file and write uid and data |
|
282 // |
|
283 { |
|
284 |
|
285 RFile file; |
|
286 TInt r=file.Replace(TheFs,aFileName,0); |
|
287 test(r==KErrNone || r==KErrPathNotFound); |
|
288 if (r==KErrPathNotFound) |
|
289 { |
|
290 r=TheFs.MkDirAll(aFileName); |
|
291 test(r==KErrNone); |
|
292 r=file.Replace(TheFs,aFileName,0); |
|
293 test(r==KErrNone); |
|
294 } |
|
295 TCheckedUid checkedUid(aUidType); |
|
296 TPtrC8 uidData((TUint8*)&checkedUid,sizeof(TCheckedUid)); |
|
297 r=file.Write(uidData); |
|
298 test(r==KErrNone); |
|
299 r=file.Write(aFileContents); |
|
300 test(r==KErrNone); |
|
301 file.Close(); |
|
302 } |
|
303 |
|
304 GLDEF_C void MakeFile(const TDesC& aFileName,const TDesC8& aFileContents) |
|
305 // |
|
306 // Make a file and write something in it |
|
307 // |
|
308 { |
|
309 |
|
310 RFile file; |
|
311 TInt r=file.Replace(TheFs,aFileName,0); |
|
312 if(r!=KErrNone && r!=KErrPathNotFound) |
|
313 { |
|
314 test.Printf(_L("ERROR: r=%d"),r); |
|
315 test(EFalse); |
|
316 } |
|
317 test(r==KErrNone || r==KErrPathNotFound); |
|
318 if (r==KErrPathNotFound) |
|
319 { |
|
320 r=TheFs.MkDirAll(aFileName); |
|
321 test(r==KErrNone); |
|
322 r=file.Replace(TheFs,aFileName,0); |
|
323 test(r==KErrNone); |
|
324 } |
|
325 r=file.Write(aFileContents); |
|
326 test(r==KErrNone); |
|
327 file.Close(); |
|
328 } |
|
329 |
|
330 GLDEF_C void MakeFile(const TDesC& aFileName,TInt anAttributes) |
|
331 // |
|
332 // Make a file and write something in it |
|
333 // |
|
334 { |
|
335 |
|
336 RFile file; |
|
337 TInt r=file.Replace(TheFs,aFileName,0); |
|
338 test(r==KErrNone || r==KErrPathNotFound); |
|
339 if (r==KErrPathNotFound) |
|
340 { |
|
341 r=TheFs.MkDirAll(aFileName); |
|
342 test(r==KErrNone); |
|
343 r=file.Replace(TheFs,aFileName,0); |
|
344 test(r==KErrNone); |
|
345 } |
|
346 file.Close(); |
|
347 r=TheFs.SetAtt(aFileName,anAttributes,0); |
|
348 test(r==KErrNone); |
|
349 } |
|
350 |
|
351 GLDEF_C void SetSessionPath(const TDesC& aPathName) |
|
352 // |
|
353 // Set the session path and update gSessionPath |
|
354 // |
|
355 { |
|
356 |
|
357 TInt r=TheFs.SetSessionPath(aPathName); |
|
358 test(r==KErrNone); |
|
359 r=TheFs.SessionPath(gSessionPath); |
|
360 test(r==KErrNone); |
|
361 } |
|
362 |
|
363 GLDEF_C void MakeFile(const TDesC& aFileName) |
|
364 // |
|
365 // Make a file |
|
366 // |
|
367 { |
|
368 |
|
369 MakeFile(aFileName,_L8("")); |
|
370 } |
|
371 |
|
372 GLDEF_C void MakeDir(const TDesC& aDirName) |
|
373 // |
|
374 // Make a directory |
|
375 // |
|
376 { |
|
377 |
|
378 TInt r=TheFs.MkDirAll(aDirName); |
|
379 test(r==KErrNone || r==KErrAlreadyExists); |
|
380 } |
|
381 |
|
382 GLDEF_C TInt CheckFileExists(const TDesC& aName,TInt aResult,TBool aCompRes/*=ETrue*/) |
|
383 // |
|
384 // Check aName exists |
|
385 // |
|
386 { |
|
387 |
|
388 TEntry entry; |
|
389 TInt r=TheFs.Entry(aName,entry); |
|
390 test(r==aResult); |
|
391 if (aResult!=KErrNone) |
|
392 return(0); |
|
393 TParsePtrC nameParse(aName); |
|
394 TParsePtrC entryParse(entry.iName); |
|
395 TBool nameMatch=(entryParse.Name()==nameParse.Name()); |
|
396 TBool extMatch=(entryParse.Ext()==nameParse.Ext()) || (entryParse.Ext().Length()<=1 && nameParse.Ext().Length()<=1); |
|
397 test((nameMatch && extMatch)==aCompRes); |
|
398 return(entry.iSize); |
|
399 } |
|
400 |
|
401 GLDEF_C void CheckFileContents(const TDesC& aName,const TDesC8& aContents) |
|
402 // |
|
403 // Check contents of file |
|
404 // |
|
405 { |
|
406 |
|
407 RFile f; |
|
408 TInt r=f.Open(TheFs,aName,EFileRead); |
|
409 test(r==KErrNone); |
|
410 HBufC8* testBuf=HBufC8::NewL(aContents.Length()); |
|
411 test(testBuf!=NULL); |
|
412 TPtr8 bufPtr(testBuf->Des()); |
|
413 r=f.Read(bufPtr); |
|
414 test(r==KErrNone); |
|
415 test(bufPtr==aContents); |
|
416 r=f.Read(bufPtr); |
|
417 test(r==KErrNone); |
|
418 test(bufPtr.Length()==0); |
|
419 f.Close(); |
|
420 User::Free(testBuf); |
|
421 } |
|
422 |
|
423 GLDEF_C void DeleteTestDirectory() |
|
424 // |
|
425 // Delete the leaf session path directory |
|
426 // |
|
427 { |
|
428 |
|
429 TheFs.SetAtt(_L("\\F32-TST\\SCANTEST\\Left\\Dir3\\Dir4\\Hidden"), 0, KEntryAttHidden); |
|
430 TheFs.SetAtt(_L("\\F32-TST\\SCANTEST\\Left\\Dir3\\Dir4\\Hidden\\HiddenFile"), 0, KEntryAttHidden); |
|
431 TheFs.SetAtt(_L("\\F32-TST\\SCANTEST\\Left\\Dir3\\Dir4\\Hidden\\System"), 0, KEntryAttSystem); |
|
432 test.Next(_L("Delete test directory")); |
|
433 CFileMan* fMan=CFileMan::NewL(TheFs); |
|
434 test(fMan!=NULL); |
|
435 TInt r=TheFs.SessionPath(gSessionPath); |
|
436 test(r==KErrNone); |
|
437 r=TheFs.CheckDisk(gSessionPath); |
|
438 if (r!=KErrNone && r!=KErrNotSupported) |
|
439 ReportCheckDiskFailure(r); |
|
440 r=fMan->RmDir(gSessionPath); |
|
441 test(r==KErrNone); |
|
442 delete fMan; |
|
443 } |
|
444 |
|
445 GLDEF_C void CreateTestDirectory(const TDesC& aSessionPath) |
|
446 // |
|
447 // Create directory for test |
|
448 // |
|
449 { |
|
450 TParsePtrC path(aSessionPath); |
|
451 test(path.DrivePresent()==EFalse); |
|
452 |
|
453 TInt r=TheFs.SetSessionPath(aSessionPath); |
|
454 test(r==KErrNone); |
|
455 r=TheFs.SessionPath(gSessionPath); |
|
456 test(r==KErrNone); |
|
457 r=TheFs.MkDirAll(gSessionPath); |
|
458 test(r==KErrNone || r==KErrAlreadyExists); |
|
459 } |
|
460 |
|
461 GLDEF_C TInt CurrentDrive() |
|
462 // |
|
463 // Return the current drive number |
|
464 // |
|
465 { |
|
466 |
|
467 TInt driveNum; |
|
468 TInt r=TheFs.CharToDrive(gSessionPath[0],driveNum); |
|
469 test(r==KErrNone); |
|
470 return(driveNum); |
|
471 } |
|
472 |
|
473 GLDEF_C void Format(TInt aDrive) |
|
474 // |
|
475 // Format current drive |
|
476 // |
|
477 { |
|
478 |
|
479 test.Next(_L("Format")); |
|
480 TBuf<4> driveBuf=_L("?:\\"); |
|
481 driveBuf[0]=(TText)(aDrive+'A'); |
|
482 RFormat format; |
|
483 TInt count; |
|
484 TInt r=format.Open(TheFs,driveBuf,EHighDensity,count); |
|
485 test(r==KErrNone); |
|
486 while(count) |
|
487 { |
|
488 TInt r=format.Next(count); |
|
489 test(r==KErrNone); |
|
490 } |
|
491 format.Close(); |
|
492 } |
|
493 |
|
494 LOCAL_C void PushLotsL() |
|
495 // |
|
496 // Expand the cleanup stack |
|
497 // |
|
498 { |
|
499 TInt i; |
|
500 for(i=0;i<1000;i++) |
|
501 CleanupStack::PushL((CBase*)NULL); |
|
502 CleanupStack::Pop(1000); |
|
503 } |
|
504 |
|
505 |
|
506 LOCAL_C void DoTests(TInt aDrive) |
|
507 // |
|
508 // Do testing on aDrive |
|
509 // |
|
510 { |
|
511 |
|
512 gSessionPath=_L("?:\\F32-TST\\"); |
|
513 TChar driveLetter; |
|
514 TInt r=TheFs.DriveToChar(aDrive,driveLetter); |
|
515 test(r==KErrNone); |
|
516 gSessionPath[0]=(TText)driveLetter; |
|
517 r=TheFs.SetSessionPath(gSessionPath); |
|
518 test(r==KErrNone); |
|
519 |
|
520 // !!! Disable platform security tests until we get the new APIs |
|
521 // if(User::Capability() & KCapabilityRoot) |
|
522 // CheckMountLFFS(TheFs,driveLetter); |
|
523 |
|
524 r=TheFs.MkDirAll(gSessionPath); |
|
525 TheFs.ResourceCountMarkStart(); |
|
526 |
|
527 TRAP(r,CallTestsL()); |
|
528 |
|
529 if (r==KErrNone) |
|
530 TheFs.ResourceCountMarkEnd(); |
|
531 else |
|
532 { |
|
533 test.Printf(_L("Error: Leave %d\n"),r); |
|
534 test(EFalse); |
|
535 } |
|
536 |
|
537 TestingLFFS(EFalse); |
|
538 } |
|
539 |
|
540 void ParseCommandArguments() |
|
541 // |
|
542 // Parse command line. Put the parameters into global array gArgv for |
|
543 // use by the tests, strip out flags starting with / or - and interpret |
|
544 // them to set debug flags. |
|
545 // |
|
546 { |
|
547 LOCAL_D TBuf<0x100> cmd; |
|
548 User::CommandLine(cmd); |
|
549 TLex lex(cmd); |
|
550 TPtrC token=lex.NextToken(); |
|
551 TFileName thisfile=RProcess().FileName(); |
|
552 if (token.MatchF(thisfile)==0) |
|
553 { |
|
554 token.Set(lex.NextToken()); |
|
555 } |
|
556 // set up parameter list (offset zero is the filename) |
|
557 gArgC = 0; |
|
558 gArgV[gArgC++].Set(thisfile); |
|
559 while (token.Length() != 0) |
|
560 { |
|
561 TChar ch = token[0]; |
|
562 // strip out (and interpret) flags starting with - or / |
|
563 if (ch == '-' || ch == '/') |
|
564 { |
|
565 for (TInt i = 1; i < token.Length(); i++) |
|
566 { |
|
567 switch (User::UpperCase(token[i])) |
|
568 { |
|
569 case 'D': |
|
570 gDebugFlags |= KDLYFAST; |
|
571 break; |
|
572 case 'F': |
|
573 gDebugFlags |= KFSYS; |
|
574 break; |
|
575 case 'I': |
|
576 gDebugFlags |= KISO9660; |
|
577 break; |
|
578 case 'L': |
|
579 gDebugFlags |= KFLDR; |
|
580 break; |
|
581 #ifdef __CONCURRENT_FILE_ACCESS__ |
|
582 case 'M': |
|
583 gDebugFlags |= KTHRD; |
|
584 break; |
|
585 #endif |
|
586 case 'N': |
|
587 gDebugFlags |= KNTFS; |
|
588 break; |
|
589 case 'S': |
|
590 gDebugFlags |= KFSERV; |
|
591 break; |
|
592 case 'T': |
|
593 gDebugFlags |= KLFFS; |
|
594 break; |
|
595 case 'Y': |
|
596 gDebugFlags |= KDLYTRC; |
|
597 break; |
|
598 } |
|
599 } |
|
600 } |
|
601 else |
|
602 gArgV[gArgC++].Set(token); |
|
603 token.Set(lex.NextToken()); |
|
604 } |
|
605 |
|
606 // set up drive to test |
|
607 gDriveToTest = 'C'; |
|
608 if (gArgC > 1) |
|
609 { |
|
610 gDriveToTest = gArgV[1][0]; |
|
611 gDriveToTest.UpperCase(); |
|
612 } |
|
613 } |
|
614 |
|
615 |
|
616 GLDEF_C TInt E32Main() |
|
617 { |
|
618 CTrapCleanup* cleanup; |
|
619 cleanup=CTrapCleanup::New(); |
|
620 TRAPD(r,PushLotsL()); |
|
621 __UHEAP_MARK; |
|
622 |
|
623 test.Title(); |
|
624 test.Start(_L("Starting tests...")); |
|
625 |
|
626 r=TheFs.Connect(); |
|
627 test(r==KErrNone); |
|
628 |
|
629 ParseCommandArguments(); //need this for drive letter to test |
|
630 |
|
631 TheFs.SetAllocFailure(gAllocFailOn); |
|
632 TTime timerC; |
|
633 timerC.HomeTime(); |
|
634 TFileName sessionp; |
|
635 TheFs.SessionPath(sessionp); |
|
636 |
|
637 TBuf<30> privatedir; |
|
638 privatedir = KPrivate; |
|
639 |
|
640 TUid thisUID = RProcess().Identity(); |
|
641 privatedir.AppendFormat(_L("%08x"),thisUID.iUid); |
|
642 privatedir.Append(_L("\\")); |
|
643 |
|
644 test(privatedir == sessionp.Mid(2,sessionp.Length()-2)); |
|
645 |
|
646 test.Printf(_L("sp=%S"),&sessionp); |
|
647 sessionp[0]=(TText)gDriveToTest; |
|
648 test.Printf(_L("sp1=%S"),&sessionp); |
|
649 |
|
650 TInt theDrive; |
|
651 r=TheFs.CharToDrive(gDriveToTest,theDrive); |
|
652 test(r==KErrNone); |
|
653 |
|
654 // set up debug register |
|
655 test.Printf(_L("debug register = 0x%X"), gDebugFlags); |
|
656 TheFs.SetDebugRegister(gDebugFlags); |
|
657 |
|
658 // actually do the tests! |
|
659 DoTests(theDrive); |
|
660 |
|
661 // reset the debug register |
|
662 TheFs.SetDebugRegister(0); |
|
663 |
|
664 TTime endTimeC; |
|
665 endTimeC.HomeTime(); |
|
666 TTimeIntervalSeconds timeTakenC; |
|
667 r=endTimeC.SecondsFrom(timerC,timeTakenC); |
|
668 test(r==KErrNone); |
|
669 test.Printf(_L("Time taken for test = %d seconds\n"),timeTakenC); |
|
670 TheFs.SetAllocFailure(gAllocFailOff); |
|
671 TheFs.Close(); |
|
672 test.End(); |
|
673 test.Close(); |
|
674 __UHEAP_MARKEND; |
|
675 delete cleanup; |
|
676 return(KErrNone); |
|
677 } |