kerneltest/f32test/server/t_fatcharsetconv_main.cpp
changeset 109 b3a1d9898418
parent 33 0173bcd7697c
child 206 ced41fd9a298
child 257 3e88ff8f41d5
child 269 d57b86b1867a
equal deleted inserted replaced
102:ef2a444a7410 109:b3a1d9898418
  1186  */
  1186  */
  1187 void TestMainWithDLLL(TTestSwitches& aSwitches)
  1187 void TestMainWithDLLL(TTestSwitches& aSwitches)
  1188 	{
  1188 	{
  1189 	// Enables codepage dll implementation of LocaleUtils functions for this test only
  1189 	// Enables codepage dll implementation of LocaleUtils functions for this test only
  1190 	TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);
  1190 	TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);
  1191 	test(r == KErrNone);
  1191 	test_KErrNone(r);
  1192 		
  1192 		
  1193 	test.Printf(_L("Load the Code Page DLL"));
  1193 	test.Printf(_L("Load the Code Page DLL"));
  1194 	r = UserSvr::ChangeLocale(KTestLocale);
  1194 	r = UserSvr::ChangeLocale(KTestLocale);
  1195 	test(r == KErrNone);
  1195 	test_KErrNone(r);
  1196 			
  1196 			
  1197 	test.Next(_L("Test Unitary APIs with only Sync Variant with DLL"));
  1197 	test.Next(_L("Test Unitary APIs with only Sync Variant with DLL"));
  1198 	gLogFailureData.iFuncName = KDoAllBasicUnitaryTestsL;
  1198 	gLogFailureData.iFuncName = KDoAllBasicUnitaryTestsL;
  1199 	DoAllBasicUnitaryTestsL(gBasicUnitaryTestCases, aSwitches, ETrue);
  1199 	DoAllBasicUnitaryTestsL(gBasicUnitaryTestCases, aSwitches, ETrue);
  1200 	
  1200 	
  1202 	gLogFailureData.iFuncName = KDoAllBasicBinaryTestsL;
  1202 	gLogFailureData.iFuncName = KDoAllBasicBinaryTestsL;
  1203 	DoAllBasicBinaryTestsL(gBasicBinaryTestCases, aSwitches, ETrue);
  1203 	DoAllBasicBinaryTestsL(gBasicBinaryTestCases, aSwitches, ETrue);
  1204 	
  1204 	
  1205 	// Disables codepage dll implementation of LocaleUtils functions for other base tests
  1205 	// Disables codepage dll implementation of LocaleUtils functions for other base tests
  1206 	r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
  1206 	r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
  1207 	test(r == KErrNone);
  1207 	test_KErrNone(r);
  1208 	}
  1208 	}
  1209 	
  1209 	
  1210 void TestMainWithoutDLLL(TTestSwitches& aSwitches)
  1210 void TestMainWithoutDLLL(TTestSwitches& aSwitches)
  1211 	{
  1211 	{
  1212 	test.Next(_L("Test Unitary APIs with only Sync Variant without DLL"));
  1212 	test.Next(_L("Test Unitary APIs with only Sync Variant without DLL"));
  1213 
  1213 
  1214 	// Disables codepage dll implementation of LocaleUtils functions
  1214 	// Disables codepage dll implementation of LocaleUtils functions
  1215 	TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
  1215 	TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
  1216 	test(r == KErrNone);
  1216 	test_KErrNone(r);
  1217 
  1217 
  1218 	gLogFailureData.iFuncName = KDoAllBasicUnitaryTestsL;
  1218 	gLogFailureData.iFuncName = KDoAllBasicUnitaryTestsL;
  1219 	DoAllBasicUnitaryTestsL(gBasicUnitaryTestCases, aSwitches, EFalse);
  1219 	DoAllBasicUnitaryTestsL(gBasicUnitaryTestCases, aSwitches, EFalse);
  1220 	
  1220 	
  1221 	test.Next(_L("Test Binary Tests without DLL"));
  1221 	test.Next(_L("Test Binary Tests without DLL"));
  1408 //
  1408 //
  1409 	{
  1409 	{
  1410 	gSessionPath=_L("?:\\F32-TST\\");
  1410 	gSessionPath=_L("?:\\F32-TST\\");
  1411 	TChar driveLetter;
  1411 	TChar driveLetter;
  1412 	TInt r=TheFs.DriveToChar(aDrive,driveLetter);
  1412 	TInt r=TheFs.DriveToChar(aDrive,driveLetter);
  1413 	test(r==KErrNone);
  1413 	test_KErrNone(r);
  1414 	gSessionPath[0]=(TText)driveLetter;
  1414 	gSessionPath[0]=(TText)driveLetter;
  1415 	r=TheFs.SetSessionPath(gSessionPath);
  1415 	r=TheFs.SetSessionPath(gSessionPath);
  1416 	test(r==KErrNone);
  1416 	test_KErrNone(r);
  1417 	test.Printf(_L("gSessionPath = \"%S\"\n"), &gSessionPath);
  1417 	test.Printf(_L("gSessionPath = \"%S\"\n"), &gSessionPath);
  1418 
  1418 
  1419 // !!! Disable platform security tests until we get the new APIs
  1419 // !!! Disable platform security tests until we get the new APIs
  1420 //	if(User::Capability() & KCapabilityRoot)
  1420 //	if(User::Capability() & KCapabilityRoot)
  1421 		CheckMountLFFS(TheFs,driveLetter);
  1421 		CheckMountLFFS(TheFs,driveLetter);
  1427 	r=TheFs.MkDirAll(gSessionPath);
  1427 	r=TheFs.MkDirAll(gSessionPath);
  1428 	if(r == KErrCorrupt)
  1428 	if(r == KErrCorrupt)
  1429 		{
  1429 		{
  1430 		Format(aDrive);
  1430 		Format(aDrive);
  1431 		r=TheFs.MkDirAll(gSessionPath);
  1431 		r=TheFs.MkDirAll(gSessionPath);
  1432 		test(r==KErrNone);
  1432 		test_KErrNone(r);
  1433 		}
  1433 		}
  1434 	if (r!=KErrNone && r!=KErrAlreadyExists)
  1434 	if (r!=KErrNone && r!=KErrAlreadyExists)
  1435 		{
  1435 		{
  1436 		test.Printf(_L("MkDirAll() r %d\n"),r);
  1436 		test.Printf(_L("MkDirAll() r %d\n"),r);
  1437 		test(EFalse);
  1437 		test(EFalse);
  1467 	gSessionPath=_L("?:\\F32-TST\\");
  1467 	gSessionPath=_L("?:\\F32-TST\\");
  1468 	TTestSwitches testSwitches;
  1468 	TTestSwitches testSwitches;
  1469 	ParseCommandArguments(testSwitches);
  1469 	ParseCommandArguments(testSwitches);
  1470 
  1470 
  1471 	r=TheFs.Connect();
  1471 	r=TheFs.Connect();
  1472 	test(r==KErrNone);
  1472 	test_KErrNone(r);
  1473 	TheFs.SetAllocFailure(gAllocFailOn);
  1473 	TheFs.SetAllocFailure(gAllocFailOn);
  1474 
  1474 
  1475 	TTime timerC;
  1475 	TTime timerC;
  1476 	timerC.HomeTime();
  1476 	timerC.HomeTime();
  1477 
  1477 
  1478 	TInt theDrive;
  1478 	TInt theDrive;
  1479 	r=TheFs.CharToDrive(gDriveToTest,theDrive);
  1479 	r=TheFs.CharToDrive(gDriveToTest,theDrive);
  1480 	test(r==KErrNone);
  1480 	test_KErrNone(r);
  1481 	
  1481 	
  1482 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
  1482 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
  1483 	TPckgBuf<TIOCacheValues> pkgOrgValues;
  1483 	TPckgBuf<TIOCacheValues> pkgOrgValues;
  1484 	TIOCacheValues& orgValues=pkgOrgValues();
  1484 	TIOCacheValues& orgValues=pkgOrgValues();
  1485 	r = controlIo(TheFs,theDrive, KControlIoCacheCount, orgValues);
  1485 	r = controlIo(TheFs,theDrive, KControlIoCacheCount, orgValues);
  1486 	test(r==KErrNone);
  1486 	test_KErrNone(r);
  1487 
  1487 
  1488 	test.Printf(_L("\n"));
  1488 	test.Printf(_L("\n"));
  1489 	test.Printf(_L("Requests on close queue at start=%d\n"),orgValues.iCloseCount);
  1489 	test.Printf(_L("Requests on close queue at start=%d\n"),orgValues.iCloseCount);
  1490 	test.Printf(_L("Requests on free queue at start=%d\n"),orgValues.iFreeCount);
  1490 	test.Printf(_L("Requests on free queue at start=%d\n"),orgValues.iFreeCount);
  1491 	test.Printf(_L("Requests dynamically allocated at start=%d\n"),orgValues.iAllocated);
  1491 	test.Printf(_L("Requests dynamically allocated at start=%d\n"),orgValues.iAllocated);
  1496 
  1496 
  1497 	TTime endTimeC;
  1497 	TTime endTimeC;
  1498 	endTimeC.HomeTime();
  1498 	endTimeC.HomeTime();
  1499 	TTimeIntervalSeconds timeTakenC;
  1499 	TTimeIntervalSeconds timeTakenC;
  1500 	r=endTimeC.SecondsFrom(timerC,timeTakenC);
  1500 	r=endTimeC.SecondsFrom(timerC,timeTakenC);
  1501 	test(r==KErrNone);
  1501 	test_KErrNone(r);
  1502 
  1502 
  1503 	test.Printf(_L("Time taken for test = %d seconds\n"),timeTakenC.Int());
  1503 	test.Printf(_L("Time taken for test = %d seconds\n"),timeTakenC.Int());
  1504 	TheFs.SetAllocFailure(gAllocFailOff);
  1504 	TheFs.SetAllocFailure(gAllocFailOff);
  1505 	
  1505 	
  1506 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
  1506 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
  1507 	TPckgBuf<TIOCacheValues> pkgValues;
  1507 	TPckgBuf<TIOCacheValues> pkgValues;
  1508 	TIOCacheValues& values=pkgValues();
  1508 	TIOCacheValues& values=pkgValues();
  1509 	r = controlIo(TheFs,theDrive, KControlIoCacheCount, values);
  1509 	r = controlIo(TheFs,theDrive, KControlIoCacheCount, values);
  1510 	test(r==KErrNone);
  1510 	test_KErrNone(r);
  1511 	
  1511 	
  1512 	test.Printf(_L("Requests on close queue at end=%d\n"),values.iCloseCount);
  1512 	test.Printf(_L("Requests on close queue at end=%d\n"),values.iCloseCount);
  1513 	test.Printf(_L("Requests on free queue at end=%d\n"),values.iFreeCount);
  1513 	test.Printf(_L("Requests on free queue at end=%d\n"),values.iFreeCount);
  1514 	test.Printf(_L("Requests dynamically allocated at end=%d\n"),values.iAllocated);
  1514 	test.Printf(_L("Requests dynamically allocated at end=%d\n"),values.iAllocated);
  1515 	test.Printf(_L("Requests in total at end=%d\n"),values.iTotalCount);
  1515 	test.Printf(_L("Requests in total at end=%d\n"),values.iTotalCount);