|
1 // Copyright (c) 2008-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\cfileman\t_cfileman.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 #define __E32TEST_EXTENSION__ |
|
19 #include <f32file.h> |
|
20 #include <e32test.h> |
|
21 |
|
22 #include "t_cfileman_cases.h" |
|
23 |
|
24 static RArray<TUint> gFailedTestCases; |
|
25 |
|
26 RTest test(_L("T_CFILEMAN")); |
|
27 |
|
28 /* |
|
29 * Prints failure notification for failed test cases during test running period |
|
30 */ |
|
31 void DoLogTestCaseFailure(const TTestParamAll& aParam) |
|
32 { |
|
33 const TUint testCaseId = aParam.iTestCaseID; |
|
34 test.Printf(_L("Test Failure: Case %d !\n"), testCaseId); |
|
35 gFailedTestCases.Append(testCaseId); |
|
36 test.Printf(_L("Print out directory contents:\n")); |
|
37 PrintDir(aParam.iSrcPrsPath, *aParam.iSrcDrvChar); |
|
38 PrintDir(aParam.iSrcCmpPath, *aParam.iSrcDrvChar); |
|
39 if (aParam.iAPI == ECFMMove || aParam.iAPI == ECFMRename || aParam.iAPI == ECFMCopy || aParam.iAPI == ECFMCopyHandle) |
|
40 { |
|
41 PrintDir(aParam.iTrgPrsPath, *aParam.iTrgDrvChar); |
|
42 PrintDir(aParam.iTrgCmpPath, *aParam.iTrgDrvChar); |
|
43 } |
|
44 } |
|
45 |
|
46 /* |
|
47 * Overall test results logging module, prints out the failing test cases with their ID |
|
48 */ |
|
49 void DoPrintTestResults() |
|
50 { |
|
51 // if no failure found |
|
52 if (gFailedTestCases.Count() == 0) |
|
53 { |
|
54 test.Printf(_L("All test cases have passed!\n")); |
|
55 return; |
|
56 } |
|
57 |
|
58 test.Printf(_L("Test failure(s) found in following case(s):\n")); |
|
59 for (TInt i = 0; i < gFailedTestCases.Count(); i++) |
|
60 { |
|
61 test.Printf(_L("Test Case: %u"), gFailedTestCases[i]); |
|
62 } |
|
63 test(EFalse); |
|
64 } |
|
65 |
|
66 /* |
|
67 * Presetting module, presets initial source, target and comparing direcotries. |
|
68 * @param aParam test param that contains all information about a test case |
|
69 */ |
|
70 void DoPresettings(const TTestParamAll& aParam) |
|
71 { |
|
72 |
|
73 // Setup source files |
|
74 TFileName path = aParam.iSrcPrsPath; |
|
75 path[0] = (TUint16)*aParam.iSrcDrvChar; |
|
76 |
|
77 if(path[0] == (TUint8)gDriveToTest || path[0] == (TUint8)gFixedDriveValid) |
|
78 { |
|
79 SetupDirFiles(path, aParam.iSrcPrsFiles); |
|
80 |
|
81 // setup source cmp files |
|
82 path = aParam.iSrcCmpPath; |
|
83 path[0] = (TUint16)*aParam.iSrcDrvChar; |
|
84 SetupDirFiles(path, aParam.iSrcCmpFiles); |
|
85 } |
|
86 |
|
87 if (aParam.iAPI == ECFMMove || aParam.iAPI == ECFMRename || aParam.iAPI == ECFMCopy || aParam.iAPI == ECFMCopyHandle) |
|
88 { |
|
89 // setup trg files |
|
90 path = aParam.iTrgPrsPath; |
|
91 path[0] = (TUint16)*aParam.iTrgDrvChar; |
|
92 |
|
93 if(path[0]== (TUint8)gDriveToTest) |
|
94 { |
|
95 SetupDirFiles(path, aParam.iTrgPrsFiles); |
|
96 |
|
97 // setup trg cmp files |
|
98 path = aParam.iTrgCmpPath; |
|
99 path[0] = (TUint16)*aParam.iTrgDrvChar; |
|
100 SetupDirFiles(path, aParam.iTrgCmpFiles); |
|
101 } |
|
102 } |
|
103 } |
|
104 |
|
105 /* |
|
106 * Test execution module |
|
107 * @param aParam test param that contains all information about a test case |
|
108 * @panic USER:84 if return codes do not match the expected values. |
|
109 */ |
|
110 |
|
111 typedef TBuf<350> TTestFileName; |
|
112 void DoCmdExecution(const TTestParamAll& aParam) |
|
113 { |
|
114 TTestFileName srcCmd = aParam.iSrcCmdPath; |
|
115 if (srcCmd.Length() > 0) |
|
116 { |
|
117 srcCmd[0] = (TUint16)*aParam.iSrcDrvChar; |
|
118 } |
|
119 else |
|
120 { |
|
121 srcCmd= gSessionPath; |
|
122 srcCmd[0] = (TUint16)*aParam.iSrcDrvChar; |
|
123 } |
|
124 TInt r = KErrNone; |
|
125 switch(aParam.iAPI) |
|
126 { |
|
127 case ECFMDelete: |
|
128 if (!gAsynch) |
|
129 { |
|
130 r = gFileMan->Delete(srcCmd, aParam.iSwitch); |
|
131 test_Equal(r, aParam.iSyncReturn); |
|
132 } |
|
133 else |
|
134 { |
|
135 r = gFileMan->Delete(srcCmd, aParam.iSwitch, gStat); |
|
136 User::WaitForRequest(gStat); |
|
137 test_Equal(r , aParam.iAsyncReturn); |
|
138 test(gStat == aParam.iAsyncStatus); |
|
139 } |
|
140 break; |
|
141 |
|
142 case ECFMRmDir: |
|
143 if (!gAsynch) |
|
144 { |
|
145 r = gFileMan->RmDir(srcCmd); |
|
146 test_Equal(r , aParam.iSyncReturn); |
|
147 } |
|
148 else |
|
149 { |
|
150 r = gFileMan->RmDir(srcCmd, gStat); |
|
151 User::WaitForRequest(gStat); |
|
152 test_Equal(r , aParam.iAsyncReturn); |
|
153 test(gStat == aParam.iAsyncStatus); |
|
154 } |
|
155 break; |
|
156 case ECFMAttribs: |
|
157 if (!gAsynch) |
|
158 { |
|
159 r = gFileMan->Attribs(srcCmd, aParam.iSetAttribs, aParam.iClearAttribs, aParam.iSetModified, aParam.iSwitch); |
|
160 test_Equal(r , aParam.iSyncReturn); |
|
161 } |
|
162 else |
|
163 { |
|
164 r = gFileMan->Attribs(srcCmd, aParam.iSetAttribs, aParam.iClearAttribs, aParam.iSetModified, aParam.iSwitch, gStat); |
|
165 User::WaitForRequest(gStat); |
|
166 test_Equal(r , aParam.iAsyncReturn); |
|
167 test(gStat == aParam.iAsyncStatus); |
|
168 } |
|
169 break; |
|
170 case ECFMMove: |
|
171 { |
|
172 TTestFileName trgCmd = aParam.iTrgCmdPath; |
|
173 if (trgCmd.Length() > 0) |
|
174 { |
|
175 trgCmd[0] = (TUint16)*aParam.iTrgDrvChar; |
|
176 } |
|
177 else |
|
178 { |
|
179 trgCmd= gSessionPath; |
|
180 } |
|
181 if (!gAsynch) |
|
182 { |
|
183 r = gFileMan->Move(srcCmd, trgCmd, aParam.iSwitch); |
|
184 test_Equal(r , aParam.iSyncReturn); |
|
185 } |
|
186 else |
|
187 { |
|
188 r = gFileMan->Move(srcCmd, trgCmd, aParam.iSwitch, gStat); |
|
189 User::WaitForRequest(gStat); |
|
190 test_Equal(r , aParam.iAsyncReturn); |
|
191 test(gStat == aParam.iAsyncStatus); |
|
192 } |
|
193 break; |
|
194 } |
|
195 case ECFMCopy: |
|
196 { |
|
197 TTestFileName trgCmd = aParam.iTrgCmdPath; |
|
198 if (trgCmd.Length() > 0) |
|
199 { |
|
200 trgCmd[0] = (TUint16)*aParam.iTrgDrvChar; |
|
201 } |
|
202 else |
|
203 { |
|
204 trgCmd= gSessionPath; |
|
205 } |
|
206 if (!gAsynch) |
|
207 { |
|
208 r = gFileMan->Copy(srcCmd, trgCmd, aParam.iSwitch); |
|
209 test_Equal(r , aParam.iSyncReturn); |
|
210 } |
|
211 else |
|
212 { |
|
213 r = gFileMan->Copy(srcCmd, trgCmd,aParam.iSwitch, gStat); |
|
214 User::WaitForRequest(gStat); |
|
215 test_Equal(r , aParam.iAsyncReturn); |
|
216 test(gStat == aParam.iAsyncStatus); |
|
217 } |
|
218 break; |
|
219 } |
|
220 case ECFMRename: |
|
221 { |
|
222 TTestFileName trgCmd = aParam.iTrgCmdPath; |
|
223 if (trgCmd.Length() > 0) |
|
224 { |
|
225 trgCmd[0] = (TUint16)*aParam.iTrgDrvChar; |
|
226 } |
|
227 else |
|
228 { |
|
229 trgCmd= gSessionPath; |
|
230 } |
|
231 if (!gAsynch) |
|
232 { |
|
233 r = gFileMan->Rename(srcCmd, trgCmd, aParam.iSwitch); |
|
234 test_Equal(r , aParam.iSyncReturn); |
|
235 } |
|
236 else |
|
237 { |
|
238 r = gFileMan->Rename(srcCmd, trgCmd, aParam.iSwitch, gStat); |
|
239 User::WaitForRequest(gStat); |
|
240 test_Equal(r , aParam.iAsyncReturn); |
|
241 test(gStat == aParam.iAsyncStatus); |
|
242 } |
|
243 break; |
|
244 } |
|
245 case ECFMCopyHandle: |
|
246 { |
|
247 TTestFileName trgCmd = aParam.iTrgCmdPath; |
|
248 if (trgCmd.Length() > 0) |
|
249 { |
|
250 trgCmd[0] = (TUint16)*aParam.iTrgDrvChar; |
|
251 } |
|
252 else |
|
253 { |
|
254 trgCmd= gSessionPath; |
|
255 } |
|
256 |
|
257 if (!gAsynch) |
|
258 { |
|
259 RFile tryfile; |
|
260 TInt ret = 0; |
|
261 ret = tryfile.Open(TheFs, srcCmd, EFileRead|EFileWrite); |
|
262 test_Equal(ret , KErrNone); |
|
263 r = gFileMan->Copy(tryfile, trgCmd, aParam.iSwitch); |
|
264 test_Equal(r , aParam.iSyncReturn); |
|
265 tryfile.Close(); |
|
266 } |
|
267 else |
|
268 { |
|
269 RFile tryfile; |
|
270 TInt ret = 0; |
|
271 ret = tryfile.Open(TheFs, srcCmd, EFileRead|EFileWrite); |
|
272 test(ret == KErrNone); |
|
273 r = gFileMan->Copy(tryfile, trgCmd, aParam.iSwitch, gStat); |
|
274 User::WaitForRequest(gStat); |
|
275 test_Equal(r , aParam.iAsyncReturn); |
|
276 test(gStat == aParam.iAsyncStatus); |
|
277 tryfile.Close(); |
|
278 } |
|
279 } |
|
280 default: |
|
281 break; |
|
282 |
|
283 } |
|
284 |
|
285 } |
|
286 |
|
287 /* |
|
288 * Result verification module. |
|
289 * @param aParam test param that contains all information about a test case |
|
290 * @return ETrue if test results in expected behaviour, i.e. test passes |
|
291 * EFalse if test results in unexpected behaviour, i.e. test fails |
|
292 */ |
|
293 TBool DoResultsVerification(const TTestParamAll& aParam) |
|
294 { |
|
295 TFileName srcPath = aParam.iSrcPrsPath; |
|
296 srcPath[0] = (TUint16)*aParam.iSrcDrvChar; |
|
297 TFileName srcCmpPath = aParam.iSrcCmpPath; |
|
298 srcCmpPath[0] = (TUint16)*aParam.iSrcDrvChar; |
|
299 |
|
300 if ((*aParam.iSrcDrvChar == gDriveToTest)) |
|
301 { |
|
302 TBool rel = CompareL(srcPath, srcCmpPath); |
|
303 if(!rel) |
|
304 return EFalse; |
|
305 } |
|
306 |
|
307 if (aParam.iAPI == ECFMMove || aParam.iAPI == ECFMRename || aParam.iAPI == ECFMCopy || aParam.iAPI == ECFMCopyHandle) |
|
308 { |
|
309 TFileName trgPath = aParam.iTrgPrsPath; |
|
310 trgPath[0] = (TUint16)*aParam.iTrgDrvChar; |
|
311 TFileName trgCmpPath = aParam.iTrgCmpPath; |
|
312 trgCmpPath[0] = (TUint16)*aParam.iTrgDrvChar; |
|
313 if ((*aParam.iTrgDrvChar == gDriveToTest)) |
|
314 { |
|
315 TBool rel = CompareL(trgPath, trgCmpPath); |
|
316 if(!rel) |
|
317 return rel; |
|
318 } |
|
319 |
|
320 } |
|
321 return ETrue; |
|
322 } |
|
323 |
|
324 /* |
|
325 * Search test cases by the index of the array of test case group, overloaded version for basic unitary cases. |
|
326 * @param aIdx the test case index in search |
|
327 * @param aBasicUnitaryTestCaseGroup the input test group, should always be gBasicUnitaryTestCases[] |
|
328 * @param aTestCaseFound contains params of the test case found by the test case Id. |
|
329 * @return KErrNone if only one test case on the id is found |
|
330 * KErrNotFound if no test case is found |
|
331 */ |
|
332 TInt SearchTestCaseByArrayIdx(TUint aIdx, const TTestCaseUnitaryBasic aBasicUnitaryTestCaseGroup[], TTestParamAll& aTestCaseFound) |
|
333 { |
|
334 if (aBasicUnitaryTestCaseGroup[aIdx].iBasic.iTestCaseID != 0) |
|
335 { |
|
336 aTestCaseFound.iTestCaseID = aBasicUnitaryTestCaseGroup[aIdx].iBasic.iTestCaseID; |
|
337 aTestCaseFound.iAPI = aBasicUnitaryTestCaseGroup[aIdx].iBasic.iAPI; |
|
338 aTestCaseFound.iSwitch = aBasicUnitaryTestCaseGroup[aIdx].iBasic.iSwitch; |
|
339 aTestCaseFound.iSyncReturn = aBasicUnitaryTestCaseGroup[aIdx].iBasic.iSyncReturn; |
|
340 aTestCaseFound.iAsyncReturn = aBasicUnitaryTestCaseGroup[aIdx].iBasic.iAsyncReturn; |
|
341 aTestCaseFound.iAsyncStatus = aBasicUnitaryTestCaseGroup[aIdx].iBasic.iAsyncStatus; |
|
342 |
|
343 aTestCaseFound.iSrcDrvChar = aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iDrvChar; |
|
344 aTestCaseFound.iSrcCmdPath.Set(aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iCmdPath); |
|
345 aTestCaseFound.iSrcPrsPath.Set(aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iPrsPath); |
|
346 aTestCaseFound.iSrcPrsFiles = aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iPrsFiles; |
|
347 aTestCaseFound.iSrcCmpPath.Set(aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iCmpPath); |
|
348 aTestCaseFound.iSrcCmpFiles = aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iCmpFiles; |
|
349 } |
|
350 else |
|
351 return KErrNotFound; |
|
352 return KErrNone; |
|
353 |
|
354 } |
|
355 |
|
356 /* |
|
357 * Search test cases by the index of the array of test case group, overloaded version for basic binary cases. |
|
358 * @param aIdx the test case index in search |
|
359 * @param aBasicUnitaryTestCaseGroup the input test group, should always be gBasicBinaryTestCases[] |
|
360 * @param aTestCaseFound contains params of the test case found by the test case Id. |
|
361 * @return KErrNone if only one test case on the id is found |
|
362 * KErrNotFound if no test case is found |
|
363 */ |
|
364 TInt SearchTestCaseByArrayIdx(TUint aIdx, const TTestCaseBinaryBasic aBasicBinaryTestCaseGroup[], TTestParamAll& aTestCaseFound) |
|
365 { |
|
366 if (aBasicBinaryTestCaseGroup[aIdx].iBasic.iTestCaseID != 0) |
|
367 { |
|
368 aTestCaseFound.iTestCaseID = aBasicBinaryTestCaseGroup[aIdx].iBasic.iTestCaseID; |
|
369 aTestCaseFound.iAPI = aBasicBinaryTestCaseGroup[aIdx].iBasic.iAPI; |
|
370 aTestCaseFound.iSwitch = aBasicBinaryTestCaseGroup[aIdx].iBasic.iSwitch; |
|
371 aTestCaseFound.iSyncReturn = aBasicBinaryTestCaseGroup[aIdx].iBasic.iSyncReturn; |
|
372 aTestCaseFound.iAsyncReturn = aBasicBinaryTestCaseGroup[aIdx].iBasic.iAsyncReturn; |
|
373 aTestCaseFound.iAsyncStatus = aBasicBinaryTestCaseGroup[aIdx].iBasic.iAsyncStatus; |
|
374 |
|
375 aTestCaseFound.iSrcDrvChar = aBasicBinaryTestCaseGroup[aIdx].iSrcPrsBasic.iDrvChar; |
|
376 aTestCaseFound.iSrcCmdPath.Set(aBasicBinaryTestCaseGroup[aIdx].iSrcPrsBasic.iCmdPath); |
|
377 aTestCaseFound.iSrcPrsPath.Set(aBasicBinaryTestCaseGroup[aIdx].iSrcPrsBasic.iPrsPath); |
|
378 aTestCaseFound.iSrcPrsFiles = aBasicBinaryTestCaseGroup[aIdx].iSrcPrsBasic.iPrsFiles; |
|
379 aTestCaseFound.iSrcCmpPath.Set(aBasicBinaryTestCaseGroup[aIdx].iSrcPrsBasic.iCmpPath); |
|
380 aTestCaseFound.iSrcCmpFiles = aBasicBinaryTestCaseGroup[aIdx].iSrcPrsBasic.iCmpFiles; |
|
381 |
|
382 aTestCaseFound.iTrgDrvChar = aBasicBinaryTestCaseGroup[aIdx].iTrgPrsBasic.iDrvChar; |
|
383 aTestCaseFound.iTrgCmdPath.Set(aBasicBinaryTestCaseGroup[aIdx].iTrgPrsBasic.iCmdPath); |
|
384 aTestCaseFound.iTrgPrsPath.Set(aBasicBinaryTestCaseGroup[aIdx].iTrgPrsBasic.iPrsPath); |
|
385 aTestCaseFound.iTrgPrsFiles = aBasicBinaryTestCaseGroup[aIdx].iTrgPrsBasic.iPrsFiles; |
|
386 aTestCaseFound.iTrgCmpPath.Set(aBasicBinaryTestCaseGroup[aIdx].iTrgPrsBasic.iCmpPath); |
|
387 aTestCaseFound.iTrgCmpFiles = aBasicBinaryTestCaseGroup[aIdx].iTrgPrsBasic.iCmpFiles; |
|
388 } |
|
389 else |
|
390 { |
|
391 return KErrNotFound; |
|
392 } |
|
393 return KErrNone; |
|
394 } |
|
395 |
|
396 /* |
|
397 * Search test cases by test case Id, overloaded version for Basic unitary cases. |
|
398 * @param aCaseId the test case Id in search |
|
399 * @param aBasicUnitaryTestCaseGroup the input test group, should always be gBasicUnitaryTestCases[] |
|
400 * @param aTestCaseFound contains params of the test case found by the test case Id. |
|
401 * @return KErrNone if only one test case on the id is found |
|
402 * KErrAlreadyExists if more than one test cases found by the test case Id |
|
403 * KErrNotFound if no test case is found |
|
404 */ |
|
405 TInt SearchTestCaseByTestCaseId(TUint aCaseId, const TTestCaseUnitaryBasic aBasicUnitaryTestCaseGroup[], TTestParamAll& aTestCaseFound) |
|
406 { |
|
407 TBool found = EFalse; |
|
408 TInt rel = KErrNone; |
|
409 |
|
410 // Scan through the test group by array index |
|
411 for(TInt i = 0; rel == KErrNone; i++) |
|
412 { |
|
413 rel = SearchTestCaseByArrayIdx(i, aBasicUnitaryTestCaseGroup, aTestCaseFound); |
|
414 if(aTestCaseFound.iTestCaseID == aCaseId) |
|
415 { |
|
416 // If more than one test cases found, return error |
|
417 if(found) |
|
418 { |
|
419 return KErrAlreadyExists; |
|
420 } |
|
421 found = ETrue; |
|
422 } |
|
423 } |
|
424 |
|
425 if (!found) |
|
426 { |
|
427 return KErrNotFound; |
|
428 } |
|
429 return KErrNone; |
|
430 } |
|
431 |
|
432 /* |
|
433 * Do all basic binary test cases defined in gBasicUnitaryTestCases[] |
|
434 */ |
|
435 void DoAllBasicUnitaryTests(const TTestCaseUnitaryBasic aBasicUnitaryTestCaseGroup[]) |
|
436 { |
|
437 TTestParamAll nextTestCase; |
|
438 TInt i = 0; |
|
439 |
|
440 while (SearchTestCaseByArrayIdx(i, aBasicUnitaryTestCaseGroup, nextTestCase) == KErrNone) |
|
441 { |
|
442 TTime startTime; |
|
443 TTime endTime; |
|
444 startTime.HomeTime(); |
|
445 DoPresettings(nextTestCase); |
|
446 DoCmdExecution(nextTestCase); |
|
447 if (!DoResultsVerification(nextTestCase)) |
|
448 { |
|
449 DoLogTestCaseFailure(nextTestCase); |
|
450 } |
|
451 else |
|
452 { |
|
453 test.Printf(_L("Test ID %d passed \n"),nextTestCase.iTestCaseID); |
|
454 } |
|
455 endTime.HomeTime(); |
|
456 TTimeIntervalMicroSeconds timeTaken(0); |
|
457 timeTaken = endTime.MicroSecondsFrom(startTime); |
|
458 TInt time2=0; |
|
459 time2=I64LOW(timeTaken.Int64()/1000); |
|
460 test.Printf(_L("Time Taken by testid %d = %d mS \n"),nextTestCase.iTestCaseID,time2); |
|
461 ++i; |
|
462 |
|
463 } |
|
464 } |
|
465 |
|
466 /* |
|
467 * Do all basic binary test cases defined in gBasicBinaryTestCases[] |
|
468 */ |
|
469 void DoAllBasicBinaryTests(const TTestCaseBinaryBasic aBasicBinaryTestCaseGroup[]) |
|
470 { |
|
471 TTestParamAll nextTestCase; |
|
472 TInt i = 0; |
|
473 while (SearchTestCaseByArrayIdx(i, aBasicBinaryTestCaseGroup, nextTestCase) == KErrNone) |
|
474 { |
|
475 TTime startTime; |
|
476 TTime endTime; |
|
477 startTime.HomeTime(); |
|
478 DoPresettings(nextTestCase); |
|
479 DoCmdExecution(nextTestCase); |
|
480 if (!DoResultsVerification(nextTestCase)) |
|
481 { |
|
482 DoLogTestCaseFailure(nextTestCase); |
|
483 } |
|
484 else |
|
485 { |
|
486 test.Printf(_L("Test ID %d passed \n"),nextTestCase.iTestCaseID); |
|
487 } |
|
488 endTime.HomeTime(); |
|
489 TTimeIntervalMicroSeconds timeTaken(0); |
|
490 timeTaken = endTime.MicroSecondsFrom(startTime); |
|
491 |
|
492 TInt time2=0; |
|
493 time2=I64LOW(timeTaken.Int64()/1000); |
|
494 test.Printf(_L("Time Taken by test id %d = %d mS \n"),nextTestCase.iTestCaseID,time2); |
|
495 ++i; |
|
496 } |
|
497 } |
|
498 |
|
499 // Future work: provide command arguement parsing faclity so that users |
|
500 // can choose specific test case(s) in ranges |
|
501 // can choose specific API(s), switches, configurations, etc. for testing |
|
502 /* |
|
503 * Main testing control unit |
|
504 */ |
|
505 void TestMain() |
|
506 { |
|
507 //The __PERFTEST__ macro is for future use when a tests are setup to run on a performance machine |
|
508 //which will be enabled to run for both WINSCW and ARMV5 |
|
509 #ifndef __PERFTEST__ |
|
510 //Tests are enabled to run for WINSCW only on the below specified drives due to the time constraint. |
|
511 if((gDriveToTest == 'C') || (gDriveToTest == 'X') || (gDriveToTest == 'Y')) |
|
512 { |
|
513 DoAllBasicUnitaryTests(gBasicUnitaryTestCases); |
|
514 DoAllBasicBinaryTests(gBasicBinaryTestCases); |
|
515 } |
|
516 else |
|
517 { |
|
518 test.Printf(_L("Drive %C: is not supported for this configuration, see test logs for supported configuration details"),gDriveToTest); |
|
519 } |
|
520 #endif |
|
521 |
|
522 #ifdef __PERFTEST__ |
|
523 DoAllBasicUnitaryTests(gBasicUnitaryTestCases); |
|
524 DoAllBasicBinaryTests(gBasicBinaryTestCases); |
|
525 #endif |
|
526 } |
|
527 |
|
528 |
|
529 /* |
|
530 * Initialise test, do all tests in both sync and async mode. |
|
531 */ |
|
532 void CallTestsL() |
|
533 { |
|
534 InitialiseL(); |
|
535 |
|
536 CreateTestDirectory(_L("\\F32-TST\\T_CFILEMAN\\")); |
|
537 |
|
538 gAsynch=EFalse; |
|
539 test.Next(_L("Synchronous tests ...")); |
|
540 TestMain(); |
|
541 |
|
542 DeleteTestDirectory(); |
|
543 |
|
544 CreateTestDirectory(_L("\\F32-TST\\T_CFILEMAN\\")); |
|
545 gAsynch=ETrue; |
|
546 test.Next(_L("Asynchronous tests ...")); |
|
547 TestMain(); |
|
548 |
|
549 DoPrintTestResults(); |
|
550 Cleanup(); |
|
551 DeleteTestDirectory(); |
|
552 } |