1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/cfileman/t_cfileman.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,552 @@
1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// f32test\cfileman\t_cfileman.cpp
1.18 +//
1.19 +//
1.20 +
1.21 +#define __E32TEST_EXTENSION__
1.22 +#include <f32file.h>
1.23 +#include <e32test.h>
1.24 +
1.25 +#include "t_cfileman_cases.h"
1.26 +
1.27 +static RArray<TUint> gFailedTestCases;
1.28 +
1.29 +RTest test(_L("T_CFILEMAN"));
1.30 +
1.31 +/*
1.32 + * Prints failure notification for failed test cases during test running period
1.33 + */
1.34 +void DoLogTestCaseFailure(const TTestParamAll& aParam)
1.35 + {
1.36 + const TUint testCaseId = aParam.iTestCaseID;
1.37 + test.Printf(_L("Test Failure: Case %d !\n"), testCaseId);
1.38 + gFailedTestCases.Append(testCaseId);
1.39 + test.Printf(_L("Print out directory contents:\n"));
1.40 + PrintDir(aParam.iSrcPrsPath, *aParam.iSrcDrvChar);
1.41 + PrintDir(aParam.iSrcCmpPath, *aParam.iSrcDrvChar);
1.42 + if (aParam.iAPI == ECFMMove || aParam.iAPI == ECFMRename || aParam.iAPI == ECFMCopy || aParam.iAPI == ECFMCopyHandle)
1.43 + {
1.44 + PrintDir(aParam.iTrgPrsPath, *aParam.iTrgDrvChar);
1.45 + PrintDir(aParam.iTrgCmpPath, *aParam.iTrgDrvChar);
1.46 + }
1.47 + }
1.48 +
1.49 +/*
1.50 + * Overall test results logging module, prints out the failing test cases with their ID
1.51 + */
1.52 +void DoPrintTestResults()
1.53 + {
1.54 + // if no failure found
1.55 + if (gFailedTestCases.Count() == 0)
1.56 + {
1.57 + test.Printf(_L("All test cases have passed!\n"));
1.58 + return;
1.59 + }
1.60 +
1.61 + test.Printf(_L("Test failure(s) found in following case(s):\n"));
1.62 + for (TInt i = 0; i < gFailedTestCases.Count(); i++)
1.63 + {
1.64 + test.Printf(_L("Test Case: %u"), gFailedTestCases[i]);
1.65 + }
1.66 + test(EFalse);
1.67 + }
1.68 +
1.69 +/*
1.70 + * Presetting module, presets initial source, target and comparing direcotries.
1.71 + * @param aParam test param that contains all information about a test case
1.72 + */
1.73 +void DoPresettings(const TTestParamAll& aParam)
1.74 + {
1.75 +
1.76 + // Setup source files
1.77 + TFileName path = aParam.iSrcPrsPath;
1.78 + path[0] = (TUint16)*aParam.iSrcDrvChar;
1.79 +
1.80 + if(path[0] == (TUint8)gDriveToTest || path[0] == (TUint8)gFixedDriveValid)
1.81 + {
1.82 + SetupDirFiles(path, aParam.iSrcPrsFiles);
1.83 +
1.84 + // setup source cmp files
1.85 + path = aParam.iSrcCmpPath;
1.86 + path[0] = (TUint16)*aParam.iSrcDrvChar;
1.87 + SetupDirFiles(path, aParam.iSrcCmpFiles);
1.88 + }
1.89 +
1.90 + if (aParam.iAPI == ECFMMove || aParam.iAPI == ECFMRename || aParam.iAPI == ECFMCopy || aParam.iAPI == ECFMCopyHandle)
1.91 + {
1.92 + // setup trg files
1.93 + path = aParam.iTrgPrsPath;
1.94 + path[0] = (TUint16)*aParam.iTrgDrvChar;
1.95 +
1.96 + if(path[0]== (TUint8)gDriveToTest)
1.97 + {
1.98 + SetupDirFiles(path, aParam.iTrgPrsFiles);
1.99 +
1.100 + // setup trg cmp files
1.101 + path = aParam.iTrgCmpPath;
1.102 + path[0] = (TUint16)*aParam.iTrgDrvChar;
1.103 + SetupDirFiles(path, aParam.iTrgCmpFiles);
1.104 + }
1.105 + }
1.106 + }
1.107 +
1.108 +/*
1.109 + * Test execution module
1.110 + * @param aParam test param that contains all information about a test case
1.111 + * @panic USER:84 if return codes do not match the expected values.
1.112 + */
1.113 +
1.114 +typedef TBuf<350> TTestFileName;
1.115 +void DoCmdExecution(const TTestParamAll& aParam)
1.116 + {
1.117 + TTestFileName srcCmd = aParam.iSrcCmdPath;
1.118 + if (srcCmd.Length() > 0)
1.119 + {
1.120 + srcCmd[0] = (TUint16)*aParam.iSrcDrvChar;
1.121 + }
1.122 + else
1.123 + {
1.124 + srcCmd= gSessionPath;
1.125 + srcCmd[0] = (TUint16)*aParam.iSrcDrvChar;
1.126 + }
1.127 + TInt r = KErrNone;
1.128 + switch(aParam.iAPI)
1.129 + {
1.130 + case ECFMDelete:
1.131 + if (!gAsynch)
1.132 + {
1.133 + r = gFileMan->Delete(srcCmd, aParam.iSwitch);
1.134 + test_Equal(r, aParam.iSyncReturn);
1.135 + }
1.136 + else
1.137 + {
1.138 + r = gFileMan->Delete(srcCmd, aParam.iSwitch, gStat);
1.139 + User::WaitForRequest(gStat);
1.140 + test_Equal(r , aParam.iAsyncReturn);
1.141 + test(gStat == aParam.iAsyncStatus);
1.142 + }
1.143 + break;
1.144 +
1.145 + case ECFMRmDir:
1.146 + if (!gAsynch)
1.147 + {
1.148 + r = gFileMan->RmDir(srcCmd);
1.149 + test_Equal(r , aParam.iSyncReturn);
1.150 + }
1.151 + else
1.152 + {
1.153 + r = gFileMan->RmDir(srcCmd, gStat);
1.154 + User::WaitForRequest(gStat);
1.155 + test_Equal(r , aParam.iAsyncReturn);
1.156 + test(gStat == aParam.iAsyncStatus);
1.157 + }
1.158 + break;
1.159 + case ECFMAttribs:
1.160 + if (!gAsynch)
1.161 + {
1.162 + r = gFileMan->Attribs(srcCmd, aParam.iSetAttribs, aParam.iClearAttribs, aParam.iSetModified, aParam.iSwitch);
1.163 + test_Equal(r , aParam.iSyncReturn);
1.164 + }
1.165 + else
1.166 + {
1.167 + r = gFileMan->Attribs(srcCmd, aParam.iSetAttribs, aParam.iClearAttribs, aParam.iSetModified, aParam.iSwitch, gStat);
1.168 + User::WaitForRequest(gStat);
1.169 + test_Equal(r , aParam.iAsyncReturn);
1.170 + test(gStat == aParam.iAsyncStatus);
1.171 + }
1.172 + break;
1.173 + case ECFMMove:
1.174 + {
1.175 + TTestFileName trgCmd = aParam.iTrgCmdPath;
1.176 + if (trgCmd.Length() > 0)
1.177 + {
1.178 + trgCmd[0] = (TUint16)*aParam.iTrgDrvChar;
1.179 + }
1.180 + else
1.181 + {
1.182 + trgCmd= gSessionPath;
1.183 + }
1.184 + if (!gAsynch)
1.185 + {
1.186 + r = gFileMan->Move(srcCmd, trgCmd, aParam.iSwitch);
1.187 + test_Equal(r , aParam.iSyncReturn);
1.188 + }
1.189 + else
1.190 + {
1.191 + r = gFileMan->Move(srcCmd, trgCmd, aParam.iSwitch, gStat);
1.192 + User::WaitForRequest(gStat);
1.193 + test_Equal(r , aParam.iAsyncReturn);
1.194 + test(gStat == aParam.iAsyncStatus);
1.195 + }
1.196 + break;
1.197 + }
1.198 + case ECFMCopy:
1.199 + {
1.200 + TTestFileName trgCmd = aParam.iTrgCmdPath;
1.201 + if (trgCmd.Length() > 0)
1.202 + {
1.203 + trgCmd[0] = (TUint16)*aParam.iTrgDrvChar;
1.204 + }
1.205 + else
1.206 + {
1.207 + trgCmd= gSessionPath;
1.208 + }
1.209 + if (!gAsynch)
1.210 + {
1.211 + r = gFileMan->Copy(srcCmd, trgCmd, aParam.iSwitch);
1.212 + test_Equal(r , aParam.iSyncReturn);
1.213 + }
1.214 + else
1.215 + {
1.216 + r = gFileMan->Copy(srcCmd, trgCmd,aParam.iSwitch, gStat);
1.217 + User::WaitForRequest(gStat);
1.218 + test_Equal(r , aParam.iAsyncReturn);
1.219 + test(gStat == aParam.iAsyncStatus);
1.220 + }
1.221 + break;
1.222 + }
1.223 + case ECFMRename:
1.224 + {
1.225 + TTestFileName trgCmd = aParam.iTrgCmdPath;
1.226 + if (trgCmd.Length() > 0)
1.227 + {
1.228 + trgCmd[0] = (TUint16)*aParam.iTrgDrvChar;
1.229 + }
1.230 + else
1.231 + {
1.232 + trgCmd= gSessionPath;
1.233 + }
1.234 + if (!gAsynch)
1.235 + {
1.236 + r = gFileMan->Rename(srcCmd, trgCmd, aParam.iSwitch);
1.237 + test_Equal(r , aParam.iSyncReturn);
1.238 + }
1.239 + else
1.240 + {
1.241 + r = gFileMan->Rename(srcCmd, trgCmd, aParam.iSwitch, gStat);
1.242 + User::WaitForRequest(gStat);
1.243 + test_Equal(r , aParam.iAsyncReturn);
1.244 + test(gStat == aParam.iAsyncStatus);
1.245 + }
1.246 + break;
1.247 + }
1.248 + case ECFMCopyHandle:
1.249 + {
1.250 + TTestFileName trgCmd = aParam.iTrgCmdPath;
1.251 + if (trgCmd.Length() > 0)
1.252 + {
1.253 + trgCmd[0] = (TUint16)*aParam.iTrgDrvChar;
1.254 + }
1.255 + else
1.256 + {
1.257 + trgCmd= gSessionPath;
1.258 + }
1.259 +
1.260 + if (!gAsynch)
1.261 + {
1.262 + RFile tryfile;
1.263 + TInt ret = 0;
1.264 + ret = tryfile.Open(TheFs, srcCmd, EFileRead|EFileWrite);
1.265 + test_Equal(ret , KErrNone);
1.266 + r = gFileMan->Copy(tryfile, trgCmd, aParam.iSwitch);
1.267 + test_Equal(r , aParam.iSyncReturn);
1.268 + tryfile.Close();
1.269 + }
1.270 + else
1.271 + {
1.272 + RFile tryfile;
1.273 + TInt ret = 0;
1.274 + ret = tryfile.Open(TheFs, srcCmd, EFileRead|EFileWrite);
1.275 + test(ret == KErrNone);
1.276 + r = gFileMan->Copy(tryfile, trgCmd, aParam.iSwitch, gStat);
1.277 + User::WaitForRequest(gStat);
1.278 + test_Equal(r , aParam.iAsyncReturn);
1.279 + test(gStat == aParam.iAsyncStatus);
1.280 + tryfile.Close();
1.281 + }
1.282 + }
1.283 + default:
1.284 + break;
1.285 +
1.286 + }
1.287 +
1.288 + }
1.289 +
1.290 +/*
1.291 + * Result verification module.
1.292 + * @param aParam test param that contains all information about a test case
1.293 + * @return ETrue if test results in expected behaviour, i.e. test passes
1.294 + * EFalse if test results in unexpected behaviour, i.e. test fails
1.295 + */
1.296 +TBool DoResultsVerification(const TTestParamAll& aParam)
1.297 + {
1.298 + TFileName srcPath = aParam.iSrcPrsPath;
1.299 + srcPath[0] = (TUint16)*aParam.iSrcDrvChar;
1.300 + TFileName srcCmpPath = aParam.iSrcCmpPath;
1.301 + srcCmpPath[0] = (TUint16)*aParam.iSrcDrvChar;
1.302 +
1.303 + if ((*aParam.iSrcDrvChar == gDriveToTest))
1.304 + {
1.305 + TBool rel = CompareL(srcPath, srcCmpPath);
1.306 + if(!rel)
1.307 + return EFalse;
1.308 + }
1.309 +
1.310 + if (aParam.iAPI == ECFMMove || aParam.iAPI == ECFMRename || aParam.iAPI == ECFMCopy || aParam.iAPI == ECFMCopyHandle)
1.311 + {
1.312 + TFileName trgPath = aParam.iTrgPrsPath;
1.313 + trgPath[0] = (TUint16)*aParam.iTrgDrvChar;
1.314 + TFileName trgCmpPath = aParam.iTrgCmpPath;
1.315 + trgCmpPath[0] = (TUint16)*aParam.iTrgDrvChar;
1.316 + if ((*aParam.iTrgDrvChar == gDriveToTest))
1.317 + {
1.318 + TBool rel = CompareL(trgPath, trgCmpPath);
1.319 + if(!rel)
1.320 + return rel;
1.321 + }
1.322 +
1.323 + }
1.324 + return ETrue;
1.325 + }
1.326 +
1.327 +/*
1.328 + * Search test cases by the index of the array of test case group, overloaded version for basic unitary cases.
1.329 + * @param aIdx the test case index in search
1.330 + * @param aBasicUnitaryTestCaseGroup the input test group, should always be gBasicUnitaryTestCases[]
1.331 + * @param aTestCaseFound contains params of the test case found by the test case Id.
1.332 + * @return KErrNone if only one test case on the id is found
1.333 + * KErrNotFound if no test case is found
1.334 + */
1.335 +TInt SearchTestCaseByArrayIdx(TUint aIdx, const TTestCaseUnitaryBasic aBasicUnitaryTestCaseGroup[], TTestParamAll& aTestCaseFound)
1.336 + {
1.337 + if (aBasicUnitaryTestCaseGroup[aIdx].iBasic.iTestCaseID != 0)
1.338 + {
1.339 + aTestCaseFound.iTestCaseID = aBasicUnitaryTestCaseGroup[aIdx].iBasic.iTestCaseID;
1.340 + aTestCaseFound.iAPI = aBasicUnitaryTestCaseGroup[aIdx].iBasic.iAPI;
1.341 + aTestCaseFound.iSwitch = aBasicUnitaryTestCaseGroup[aIdx].iBasic.iSwitch;
1.342 + aTestCaseFound.iSyncReturn = aBasicUnitaryTestCaseGroup[aIdx].iBasic.iSyncReturn;
1.343 + aTestCaseFound.iAsyncReturn = aBasicUnitaryTestCaseGroup[aIdx].iBasic.iAsyncReturn;
1.344 + aTestCaseFound.iAsyncStatus = aBasicUnitaryTestCaseGroup[aIdx].iBasic.iAsyncStatus;
1.345 +
1.346 + aTestCaseFound.iSrcDrvChar = aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iDrvChar;
1.347 + aTestCaseFound.iSrcCmdPath.Set(aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iCmdPath);
1.348 + aTestCaseFound.iSrcPrsPath.Set(aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iPrsPath);
1.349 + aTestCaseFound.iSrcPrsFiles = aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iPrsFiles;
1.350 + aTestCaseFound.iSrcCmpPath.Set(aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iCmpPath);
1.351 + aTestCaseFound.iSrcCmpFiles = aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iCmpFiles;
1.352 + }
1.353 + else
1.354 + return KErrNotFound;
1.355 + return KErrNone;
1.356 +
1.357 + }
1.358 +
1.359 +/*
1.360 + * Search test cases by the index of the array of test case group, overloaded version for basic binary cases.
1.361 + * @param aIdx the test case index in search
1.362 + * @param aBasicUnitaryTestCaseGroup the input test group, should always be gBasicBinaryTestCases[]
1.363 + * @param aTestCaseFound contains params of the test case found by the test case Id.
1.364 + * @return KErrNone if only one test case on the id is found
1.365 + * KErrNotFound if no test case is found
1.366 + */
1.367 +TInt SearchTestCaseByArrayIdx(TUint aIdx, const TTestCaseBinaryBasic aBasicBinaryTestCaseGroup[], TTestParamAll& aTestCaseFound)
1.368 + {
1.369 + if (aBasicBinaryTestCaseGroup[aIdx].iBasic.iTestCaseID != 0)
1.370 + {
1.371 + aTestCaseFound.iTestCaseID = aBasicBinaryTestCaseGroup[aIdx].iBasic.iTestCaseID;
1.372 + aTestCaseFound.iAPI = aBasicBinaryTestCaseGroup[aIdx].iBasic.iAPI;
1.373 + aTestCaseFound.iSwitch = aBasicBinaryTestCaseGroup[aIdx].iBasic.iSwitch;
1.374 + aTestCaseFound.iSyncReturn = aBasicBinaryTestCaseGroup[aIdx].iBasic.iSyncReturn;
1.375 + aTestCaseFound.iAsyncReturn = aBasicBinaryTestCaseGroup[aIdx].iBasic.iAsyncReturn;
1.376 + aTestCaseFound.iAsyncStatus = aBasicBinaryTestCaseGroup[aIdx].iBasic.iAsyncStatus;
1.377 +
1.378 + aTestCaseFound.iSrcDrvChar = aBasicBinaryTestCaseGroup[aIdx].iSrcPrsBasic.iDrvChar;
1.379 + aTestCaseFound.iSrcCmdPath.Set(aBasicBinaryTestCaseGroup[aIdx].iSrcPrsBasic.iCmdPath);
1.380 + aTestCaseFound.iSrcPrsPath.Set(aBasicBinaryTestCaseGroup[aIdx].iSrcPrsBasic.iPrsPath);
1.381 + aTestCaseFound.iSrcPrsFiles = aBasicBinaryTestCaseGroup[aIdx].iSrcPrsBasic.iPrsFiles;
1.382 + aTestCaseFound.iSrcCmpPath.Set(aBasicBinaryTestCaseGroup[aIdx].iSrcPrsBasic.iCmpPath);
1.383 + aTestCaseFound.iSrcCmpFiles = aBasicBinaryTestCaseGroup[aIdx].iSrcPrsBasic.iCmpFiles;
1.384 +
1.385 + aTestCaseFound.iTrgDrvChar = aBasicBinaryTestCaseGroup[aIdx].iTrgPrsBasic.iDrvChar;
1.386 + aTestCaseFound.iTrgCmdPath.Set(aBasicBinaryTestCaseGroup[aIdx].iTrgPrsBasic.iCmdPath);
1.387 + aTestCaseFound.iTrgPrsPath.Set(aBasicBinaryTestCaseGroup[aIdx].iTrgPrsBasic.iPrsPath);
1.388 + aTestCaseFound.iTrgPrsFiles = aBasicBinaryTestCaseGroup[aIdx].iTrgPrsBasic.iPrsFiles;
1.389 + aTestCaseFound.iTrgCmpPath.Set(aBasicBinaryTestCaseGroup[aIdx].iTrgPrsBasic.iCmpPath);
1.390 + aTestCaseFound.iTrgCmpFiles = aBasicBinaryTestCaseGroup[aIdx].iTrgPrsBasic.iCmpFiles;
1.391 + }
1.392 + else
1.393 + {
1.394 + return KErrNotFound;
1.395 + }
1.396 + return KErrNone;
1.397 + }
1.398 +
1.399 +/*
1.400 + * Search test cases by test case Id, overloaded version for Basic unitary cases.
1.401 + * @param aCaseId the test case Id in search
1.402 + * @param aBasicUnitaryTestCaseGroup the input test group, should always be gBasicUnitaryTestCases[]
1.403 + * @param aTestCaseFound contains params of the test case found by the test case Id.
1.404 + * @return KErrNone if only one test case on the id is found
1.405 + * KErrAlreadyExists if more than one test cases found by the test case Id
1.406 + * KErrNotFound if no test case is found
1.407 + */
1.408 +TInt SearchTestCaseByTestCaseId(TUint aCaseId, const TTestCaseUnitaryBasic aBasicUnitaryTestCaseGroup[], TTestParamAll& aTestCaseFound)
1.409 + {
1.410 + TBool found = EFalse;
1.411 + TInt rel = KErrNone;
1.412 +
1.413 + // Scan through the test group by array index
1.414 + for(TInt i = 0; rel == KErrNone; i++)
1.415 + {
1.416 + rel = SearchTestCaseByArrayIdx(i, aBasicUnitaryTestCaseGroup, aTestCaseFound);
1.417 + if(aTestCaseFound.iTestCaseID == aCaseId)
1.418 + {
1.419 + // If more than one test cases found, return error
1.420 + if(found)
1.421 + {
1.422 + return KErrAlreadyExists;
1.423 + }
1.424 + found = ETrue;
1.425 + }
1.426 + }
1.427 +
1.428 + if (!found)
1.429 + {
1.430 + return KErrNotFound;
1.431 + }
1.432 + return KErrNone;
1.433 + }
1.434 +
1.435 +/*
1.436 + * Do all basic binary test cases defined in gBasicUnitaryTestCases[]
1.437 + */
1.438 +void DoAllBasicUnitaryTests(const TTestCaseUnitaryBasic aBasicUnitaryTestCaseGroup[])
1.439 + {
1.440 + TTestParamAll nextTestCase;
1.441 + TInt i = 0;
1.442 +
1.443 + while (SearchTestCaseByArrayIdx(i, aBasicUnitaryTestCaseGroup, nextTestCase) == KErrNone)
1.444 + {
1.445 + TTime startTime;
1.446 + TTime endTime;
1.447 + startTime.HomeTime();
1.448 + DoPresettings(nextTestCase);
1.449 + DoCmdExecution(nextTestCase);
1.450 + if (!DoResultsVerification(nextTestCase))
1.451 + {
1.452 + DoLogTestCaseFailure(nextTestCase);
1.453 + }
1.454 + else
1.455 + {
1.456 + test.Printf(_L("Test ID %d passed \n"),nextTestCase.iTestCaseID);
1.457 + }
1.458 + endTime.HomeTime();
1.459 + TTimeIntervalMicroSeconds timeTaken(0);
1.460 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.461 + TInt time2=0;
1.462 + time2=I64LOW(timeTaken.Int64()/1000);
1.463 + test.Printf(_L("Time Taken by testid %d = %d mS \n"),nextTestCase.iTestCaseID,time2);
1.464 + ++i;
1.465 +
1.466 + }
1.467 + }
1.468 +
1.469 +/*
1.470 + * Do all basic binary test cases defined in gBasicBinaryTestCases[]
1.471 + */
1.472 +void DoAllBasicBinaryTests(const TTestCaseBinaryBasic aBasicBinaryTestCaseGroup[])
1.473 + {
1.474 + TTestParamAll nextTestCase;
1.475 + TInt i = 0;
1.476 + while (SearchTestCaseByArrayIdx(i, aBasicBinaryTestCaseGroup, nextTestCase) == KErrNone)
1.477 + {
1.478 + TTime startTime;
1.479 + TTime endTime;
1.480 + startTime.HomeTime();
1.481 + DoPresettings(nextTestCase);
1.482 + DoCmdExecution(nextTestCase);
1.483 + if (!DoResultsVerification(nextTestCase))
1.484 + {
1.485 + DoLogTestCaseFailure(nextTestCase);
1.486 + }
1.487 + else
1.488 + {
1.489 + test.Printf(_L("Test ID %d passed \n"),nextTestCase.iTestCaseID);
1.490 + }
1.491 + endTime.HomeTime();
1.492 + TTimeIntervalMicroSeconds timeTaken(0);
1.493 + timeTaken = endTime.MicroSecondsFrom(startTime);
1.494 +
1.495 + TInt time2=0;
1.496 + time2=I64LOW(timeTaken.Int64()/1000);
1.497 + test.Printf(_L("Time Taken by test id %d = %d mS \n"),nextTestCase.iTestCaseID,time2);
1.498 + ++i;
1.499 + }
1.500 + }
1.501 +
1.502 +// Future work: provide command arguement parsing faclity so that users
1.503 +// can choose specific test case(s) in ranges
1.504 +// can choose specific API(s), switches, configurations, etc. for testing
1.505 +/*
1.506 + * Main testing control unit
1.507 + */
1.508 +void TestMain()
1.509 + {
1.510 +//The __PERFTEST__ macro is for future use when a tests are setup to run on a performance machine
1.511 +//which will be enabled to run for both WINSCW and ARMV5
1.512 +#ifndef __PERFTEST__
1.513 + //Tests are enabled to run for WINSCW only on the below specified drives due to the time constraint.
1.514 + if((gDriveToTest == 'C') || (gDriveToTest == 'X') || (gDriveToTest == 'Y'))
1.515 + {
1.516 + DoAllBasicUnitaryTests(gBasicUnitaryTestCases);
1.517 + DoAllBasicBinaryTests(gBasicBinaryTestCases);
1.518 + }
1.519 + else
1.520 + {
1.521 + test.Printf(_L("Drive %C: is not supported for this configuration, see test logs for supported configuration details"),gDriveToTest);
1.522 + }
1.523 +#endif
1.524 +
1.525 +#ifdef __PERFTEST__
1.526 + DoAllBasicUnitaryTests(gBasicUnitaryTestCases);
1.527 + DoAllBasicBinaryTests(gBasicBinaryTestCases);
1.528 +#endif
1.529 + }
1.530 +
1.531 +
1.532 +/*
1.533 + * Initialise test, do all tests in both sync and async mode.
1.534 +*/
1.535 +void CallTestsL()
1.536 + {
1.537 + InitialiseL();
1.538 +
1.539 + CreateTestDirectory(_L("\\F32-TST\\T_CFILEMAN\\"));
1.540 +
1.541 + gAsynch=EFalse;
1.542 + test.Next(_L("Synchronous tests ..."));
1.543 + TestMain();
1.544 +
1.545 + DeleteTestDirectory();
1.546 +
1.547 + CreateTestDirectory(_L("\\F32-TST\\T_CFILEMAN\\"));
1.548 + gAsynch=ETrue;
1.549 + test.Next(_L("Asynchronous tests ..."));
1.550 + TestMain();
1.551 +
1.552 + DoPrintTestResults();
1.553 + Cleanup();
1.554 + DeleteTestDirectory();
1.555 + }