kerneltest/f32test/server/t_pwstr.cpp
branchRCL_3
changeset 257 3e88ff8f41d5
parent 256 c1f20ce4abcf
--- a/kerneltest/f32test/server/t_pwstr.cpp	Tue Aug 31 16:34:26 2010 +0300
+++ b/kerneltest/f32test/server/t_pwstr.cpp	Wed Sep 01 12:34:56 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -18,7 +18,6 @@
 
 //#include <p32mmc.h>
 
-#define __E32TEST_EXTENSION__
 #include <e32test.h>
 #include <f32fsys.h>
 #include <e32def.h>
@@ -101,7 +100,6 @@
 							// integrator, TBLDNum should be set to 3.
 
 LOCAL_D TInt RFsDNum = -1;	// File Server Drive number
-LOCAL_D TBool gManual = EFalse; // Manual Tests enabled
 
 struct TTestMapping
 	{
@@ -391,13 +389,9 @@
 		wStore.SetLength(i);
 		TInt r(TBLD.WritePasswordData(wStore));
 		if (i == 0 || i == mapSizes[0][0] || i == mapSizes[0][0] + mapSizes[1][1])
-			{
-			test_KErrNone(r);
-			}
+			test(r == KErrNone);
 		else
-			{
-			test_Value(r, r == KErrCorrupt && TBLD.PasswordStoreLengthInBytes() == 0);
-			}
+			test(r == KErrCorrupt && TBLD.PasswordStoreLengthInBytes() == 0);
 		}
 
 	test.Next(_L("Exceeding password store size"));	
@@ -415,13 +409,9 @@
 		const TInt r = TBLD.WritePasswordData(wStore);
 		test.Printf(_L("WritePasswordData() --> ret=%d\n"), r);
 	 	if(n==KMaxNumOfStoreEntries)
-			{
-	 		test_Value(r, r == KErrOverflow);
-			}
+	 		test(r == KErrOverflow);
 	 	else
-			{
-	 		test_KErrNone(r);
-			}
+	 		test(r == KErrNone);	
 		}
 
 
@@ -471,7 +461,7 @@
 
 				if ((r = TBLD.WritePasswordData(wStore)) != KErrNone)
 					{
-					test_Value(r, r == KErrNoMemory);
+					test(r == KErrNoMemory);
 					test(TBLD.PasswordStoreLengthInBytes() == 0);
 					}
 				else
@@ -610,7 +600,7 @@
 		mp.iCIDIdx = cidIdx;
 		mp.iPWDIdx = pwdIdx;
 		TRAP(r, aMP->InsertL(0, mp));
-		test_KErrNone(r);
+		test(r == KErrNone);
 
 		iBIdx += KMMCCIDLength + sizeof(TInt32) + pwd_len;
 		}
@@ -753,7 +743,7 @@
 	TInt r = AccessDisk();
 	if (r != KErrLocked)
 		test.Printf(_L("AccessDisk() returned %d\n"), r);
-	test_Value(r, r == KErrLocked);
+	test(r == KErrLocked);
 	test(TBLD.Unlock(aPWD, aStore) == KErrNone);
 	}
 
@@ -1232,41 +1222,25 @@
 	test.Next(_L("open connection"));
 	RFs theFs;
 	test(theFs.Connect() == KErrNone);
+
 	
-	// So that we are in a consistant state lets
-	// Remove the password file first. i.e. could be passwords left over from previous test failures
-    test.Next(_L("tidy up"));
-    TEntry theEntry;
-    TBuf<sizeof(KMediaPWrdFile)> mediaPWrdFile(KMediaPWrdFile);
-    mediaPWrdFile[0] = (TUint8) RFs::GetSystemDriveChar();
-    test.Printf(_L("password file : %S\n"),&mediaPWrdFile);
-    error = theFs.Delete(mediaPWrdFile);
-    // Should be either KErrNone, KErrPathNotFound or KErrNotFound
-    test.Printf(_L("password file deleted: %d\n"),error);
 	
 	// Now set the first password that we will use
 	test.Next(_L("lock the media card"));	
 	TMediaPassword& nulPWrd = *PWDs[0];
 	TMediaPassword& oldPWrd = *PWDs[1];
 	error = theFs.LockDrive(KDriveNum, nulPWrd, oldPWrd, ETrue);
+	test(KErrNone == error);
 
-	if (KErrNotSupported == error)
-	    {
-        // Appears that passwords aren't supported on this drive config (i.e. NFE)
-        theFs.Close();
-        test.End();
-        return;
-	    }
-	test_KErrNone(error);
 
 	// Verify that the password file does exist and is in the correct place
 	test.Next(_L("check password file exists"));
+	TEntry theEntry;
+	TBuf<sizeof(KMediaPWrdFile)> mediaPWrdFile(KMediaPWrdFile);
+	mediaPWrdFile[0] = (TUint8) RFs::GetSystemDriveChar();
 	error = theFs.Entry(mediaPWrdFile, theEntry);
-	test.Printf(_L("password file exists: %d\n"),error);
-	if (error != KErrNone && error != KErrNotFound)
-	    {
-        test(0);
-	    }	
+	test (KErrNone == error);
+
 	
 	// Attempt to set a new password without specifying the current one
 	test.Next(_L("change password failure"));	
@@ -1278,44 +1252,27 @@
 	// Change the password for a new one...
 	test.Next(_L("change password success"));	
 	error = theFs.LockDrive(KDriveNum, oldPWrd, newPWrd, ETrue);
-	test_KErrNone(error);
+	test(KErrNone == error);
 
 	
 	// Clear the password
-	// NB The file server uses a separate thread to write to the password file,
-	// so we may need to wait a short while to see any change...
 	test.Next(_L("clear the password"));	
 	error = theFs.ClearPassword(KDriveNum, newPWrd);
-	test_KErrNone(error);
+	test(KErrNone == error);
 
 
 	// Check that the password has been removed from the file
 	// (KMediaPWrdFile should now be zero bytes in size)
 	test.Next(_L("check password removal"));
-	theEntry.iSize = KMaxTInt;
-	TInt n;
-	for (n=0; theEntry.iSize > 0 && n<10; n++)
-		{
-		error = theFs.Entry(mediaPWrdFile, theEntry);
-	test_KErrNone(error);
-		test.Printf(_L("Password file size is %d\n"), theEntry.iSize);
-		if (theEntry.iSize > 0)
-			User::After(1000000);
-		}
-	test (theEntry.iSize == 0);
+	error = theFs.Entry(mediaPWrdFile, theEntry);
+	test (KErrNone == error);
+	test (0 == theEntry.iSize);
 
 	
 	// Remove the password file
 	test.Next(_L("tidy up"));
-	error = KErrInUse;
-	for (n=0; error == KErrInUse && n<10; n++)
-		{
-		error = theFs.Delete(mediaPWrdFile);
-		test.Printf(_L("Deleting %S, Iter %d, r %d\n"), &mediaPWrdFile, n, error);
-		if (error == KErrInUse)
-			User::After(1000000);
-		}
-	test_KErrNone(error);
+	error = theFs.Delete(mediaPWrdFile);
+	test (KErrNone == error);
 
 
 	theFs.Close();
@@ -1359,7 +1316,7 @@
 	r = fs.LockDrive(RFsDNum, nulPWrd, oldPWrd, EFalse);
 	if (r != KErrNone)
 		test.Printf(_L("RFs::LockDrive() returned %d\n"), r);
-	test_KErrNone(r);
+	test(r == KErrNone);
 
 	RemountMedia();		// card is now locked
 
@@ -1372,7 +1329,7 @@
 	r = fmt.Open(fs, driveName, EHighDensity, stepPkg());
 	if (r != KErrLocked)
 		test.Printf(_L("RFormat::Next() returned %d\n"), r);
-	test_Value(r, r == KErrLocked);
+	test(r == KErrLocked);
 
 	test.Printf(_L("\n"));
 	fmt.Close();
@@ -1382,7 +1339,7 @@
 	r = fmt.Open(fs, driveName, EHighDensity | EForceErase, stepPkg());
 	if (r != KErrNone)
 		test.Printf(_L("RFormat::Open() returned %d\n"), r);
-	test_KErrNone(r);
+	test (r == KErrNone);
 	
 	while (stepPkg() > 0)
 		{
@@ -1431,7 +1388,7 @@
 	test.Next(_L("lock card"));
 	test.Next(_L("assign test password"));
 	r = TBLD.SetPassword(nulPWrd, testPassword, EFalse);
-	test_KErrNone(r);
+	test(r == KErrNone);
 
 	RemountMedia();		// card is now locked
 
@@ -1442,7 +1399,7 @@
 	r = TBLD.Caps(driveCapsPkg);
 	test.Printf(_L("Caps() returned %d , iMediaAtt %08x\n"), r, driveCaps.iMediaAtt);
 
-	test_KErrNone(r);
+	test (r == KErrNone);
 	test ((driveCaps.iMediaAtt & KMediaAttLocked) != 0);
 
 	// Write correct password to store
@@ -1456,14 +1413,14 @@
 
 	test.Printf(_L("WritePasswordData() returned %d\n"), r);
 	
-	test_KErrNone(r);
+	test(r == KErrNone);
 
 	// test Caps() reports that card is unlocked
 	test.Next(_L("test card is unlocked"));
 	r = TBLD.Caps(driveCapsPkg);
 	test.Printf(_L("Caps() returned %d , iMediaAtt %08x\n"), r, driveCaps.iMediaAtt);
 
-	test_KErrNone(r);
+	test (r == KErrNone);
 	test ((driveCaps.iMediaAtt & KMediaAttLocked) == 0);
 
 	// Clear the password, remount and test card is unlocked
@@ -1476,7 +1433,7 @@
 	r = TBLD.Caps(driveCapsPkg);
 	test.Printf(_L("Caps() returned %d , iMediaAtt %08x\n"), r, driveCaps.iMediaAtt);
 
-	test_KErrNone(r);
+	test (r == KErrNone);
 	test ((driveCaps.iMediaAtt & KMediaAttLocked) == 0);
 
 
@@ -1500,18 +1457,15 @@
 	UserHal::DriveInfo(diBuf);
 	TDriveInfoV1 &di=diBuf();
 
-	test.Printf(_L(" iRegisteredDriveBitmask 0x%08X\n"), di.iRegisteredDriveBitmask);
+	test.Printf(_L(" iRegisteredDriveBitmask 0x%08X"), di.iRegisteredDriveBitmask);
 
 	aDrive  = -1;
 	
 	TLocalDriveCapsV5Buf capsBuf;
 	TBusLocalDrive TBLD;
 	TLocalDriveCapsV5& caps = capsBuf();
-	
 	TPtrC8 localSerialNum;
 	TInt registeredDriveNum = 0;
-		
-	// Find a Drive that has Password support.
 	for(aDrive=0; aDrive < KMaxLocalDrives; aDrive++)
 		{
 		TInt driveNumberMask = 1 << aDrive;
@@ -1520,29 +1474,27 @@
 
 		test.Printf(_L(" Drive %d -  %S\r\n"), aDrive, &di.iDriveName[registeredDriveNum]);
 
-        TBool TBLDChangedFlag;
-        TInt r = TBLD.Connect(aDrive, TBLDChangedFlag);
+		// check that the card is readable (so we can ignore for empty card slots)
+		if ((di.iDriveName[registeredDriveNum].MatchF(_L("MultiMediaCard0")) == KErrNone) ||
+		    (di.iDriveName[registeredDriveNum].MatchF(_L("SDIOCard0")) == KErrNone))
+			{
+			
+			TBool TBLDChangedFlag;
+			TInt r = TBLD.Connect(aDrive, TBLDChangedFlag);
 //test.Printf(_L(" Connect returned %d\n"), r);
-        if (r == KErrNone)
-            {
-            r = TBLD.Caps(capsBuf);
-            
-            //Check media is lockable if not carry on			
-            if (caps.iMediaAtt & KMediaAttLockable)
-                {
-                test.Printf(_L("Drive %d is Lockable\n"),aDrive);
-                localSerialNum.Set(caps.iSerialNum, caps.iSerialNumLength);
-                const TInt KSectSize = 512;
-                TBuf8<KSectSize> sect;
-                r = TBLD.Read(0, KSectSize, sect);
+			if (r == KErrNone)
+				{
+				r = TBLD.Caps(capsBuf);
+				localSerialNum.Set(caps.iSerialNum, caps.iSerialNumLength);
+				const TInt KSectSize = 512;
+				TBuf8<KSectSize> sect;
+				r = TBLD.Read(0, KSectSize, sect);
 //test.Printf(_L(" Read returned %d\n"), r);
 				
 				TBLD.Disconnect();
 				if (r == KErrNone)
 					break;
 				}
-
-			TBLD.Disconnect();				
 			}
 		registeredDriveNum++;
 		}
@@ -1652,7 +1604,7 @@
     TDriveInfo info;
 
 	TInt r = aFs.Drive(info, aTheMemoryCardDrive);
-	test_KErrNone(r);
+	test (r == KErrNone);
 
 	return (info.iMediaAtt & KMediaAttLocked)?(TBool)ETrue:(TBool)EFalse;
 	}
@@ -1664,9 +1616,7 @@
 	for (n=0; n<30 && !TestLocked(aFs, aTheMemoryCardDrive); n++)
 		{
 		User::After(1000000);
-		test.Printf(_L("."));
 		}
-	test.Printf(_L("\n"));
 	test(n < 30);
 	test(TestLocked(aFs, aTheMemoryCardDrive));	// should now be locked
 	}
@@ -1707,7 +1657,7 @@
 
 	test.Next(_L("Locking card (Successful)"))	;
 	r = TestLockCard(fs, RFsDNum, oldpassword, password, ETrue);
-	test_KErrNone(r); 
+	test(r == KErrNone); 
 		
 	test(!TestLocked(fs, RFsDNum));	// not locked yet as stack hasn't powered down
 
@@ -1715,7 +1665,7 @@
 	r = TBLD.Caps(driveCapsPkg);
 	test.Printf(_L("\tCaps() returned %d , iMediaAtt %08x\n"), r, driveCaps.iMediaAtt);
 
-	test_KErrNone(r);
+	test (r == KErrNone);
 	test ((driveCaps.iMediaAtt & KMediaAttLocked) == 0);
 
 	WaitForPowerDownUnlock(fs, RFsDNum);
@@ -1724,19 +1674,19 @@
 	r = TBLD.Caps(driveCapsPkg);
 	test.Printf(_L("\tCaps() returned %d , iMediaAtt %08x\n"), r, driveCaps.iMediaAtt);
 
-	test_KErrNone(r);
+	test (r == KErrNone);
 	test ((driveCaps.iMediaAtt & KMediaAttLocked) == 0);
 	
 	test.Next(_L("Clear password (Successful)"));
 	r = TestClearPassword(fs, RFsDNum, password);
-	test_KErrNone(r);
+	test(r == KErrNone);
 	
 // Lock card (without password in store)
 	test.Next(_L("Locking card - Password NOT Stored"));
 
 	test.Next(_L("Locking card (Successful)"));
 	r = TestLockCard(fs, RFsDNum, oldpassword, password, EFalse);
-	test_KErrNone(r); 
+	test(r == KErrNone); 
 		
 	test(!TestLocked(fs, RFsDNum));	// not locked yet as stack hasn't powered down
 	
@@ -1744,7 +1694,7 @@
 	r = TBLD.Caps(driveCapsPkg);
 	test.Printf(_L("\tCaps() returned %d , iMediaAtt %08x\n"), r, driveCaps.iMediaAtt);
 
-	test_KErrNone(r);
+	test (r == KErrNone);
 	test ((driveCaps.iMediaAtt & KMediaAttLocked) == 0);
 
 	WaitForPowerDownLock(fs, RFsDNum);
@@ -1753,7 +1703,7 @@
 	r = TBLD.Caps(driveCapsPkg);
 	test.Printf(_L("\tCaps() returned %d , iMediaAtt %08x\n"), r, driveCaps.iMediaAtt);
 
-	test_KErrNone(r);
+	test (r == KErrNone);
 	test ((driveCaps.iMediaAtt & KMediaAttLocked) != 0);
 	
 // Unlock card
@@ -1761,14 +1711,14 @@
 	
 	test.Next(_L("Unlocking card (Successful)"))	;
 	r = TestUnlockCard(fs, RFsDNum, password, ETrue);
-	test_KErrNone(r);
+	test(r == KErrNone);
 	test (!TestLocked(fs, RFsDNum)); // not locked as stack hasn't powered down
 	
 	test.Next(_L("Card reports unlocked - before PowerDown"));
 	r = TBLD.Caps(driveCapsPkg);
 	test.Printf(_L("\tCaps() returned %d , iMediaAtt %08x\n"), r, driveCaps.iMediaAtt);
 
-	test_KErrNone(r);
+	test (r == KErrNone);
 	test ((driveCaps.iMediaAtt & KMediaAttLocked) == 0);
 
 	WaitForPowerDownUnlock(fs, RFsDNum);
@@ -1777,12 +1727,12 @@
 	r = TBLD.Caps(driveCapsPkg);
 	test.Printf(_L("\tCaps() returned %d , iMediaAtt %08x\n"), r, driveCaps.iMediaAtt);
 
-	test_KErrNone(r);
+	test (r == KErrNone);
 	test ((driveCaps.iMediaAtt & KMediaAttLocked) == 0);
 	
 	test.Next(_L("Clearing Password (Successful)"));
 	r = TestClearPassword(fs, RFsDNum, password);
-	test_KErrNone(r);
+	test(r == KErrNone);
 	
 	fs.Close();
 	
@@ -1807,22 +1757,22 @@
 	TMediaPassword wrongpwd = (TUint8*) "failtest";
 
 	r = TestLockCard(fs, RFsDNum, oldpassword, newpassword, EFalse);
-	test_KErrNone(r);
+	test(r == KErrNone);
 	test(!TestLocked(fs, RFsDNum));	// not locked yet as stack hasn't powered down
 
 	test.Next(_L("test unlocking fails if still powered up"));
 	r = TestUnlockCard(fs, RFsDNum, newpassword, EFalse);
-	test_Value(r, r == KErrAlreadyExists);		// already unlocked (as stack won't have powered down yet)
+	test(r == KErrAlreadyExists);		// already unlocked (as stack won't have powered down yet)
 	test (!TestLocked(fs, RFsDNum));
 
 	test.Next(_L("test clearing succeeds if still powered up"));
 	r = TestClearPassword(fs, RFsDNum, newpassword);
-	test_KErrNone(r);
+	test(r == KErrNone);
 	test(!TestLocked(fs, RFsDNum));
 	
 	test.Next(_L("test locking card again"));
 	r = TestLockCard(fs, RFsDNum, oldpassword, newpassword, EFalse);
-	test_KErrNone(r);
+	test(r == KErrNone);
 	test(!TestLocked(fs, RFsDNum));	// not locked yet as stack hasn't powered down
 
 	WaitForPowerDownLock(fs, RFsDNum);
@@ -1838,17 +1788,17 @@
 	sessionPath=_L("?:\\");
 	TChar driveLetter;
 	r = fs.DriveToChar(RFsDNum,driveLetter);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	sessionPath[0]=(TText)driveLetter;
 	r = fs.CheckDisk(sessionPath);
-	test_Value(r, r == KErrNone || r == KErrLocked);
+	test(r == KErrNone || r == KErrLocked);
 	WaitForPowerDownLock(fs, RFsDNum);
 
 
 	// DEF111700: Formatting a locked SD/MMC leaves it in a bad state (causes panics later)
 	// This was caused by format calling TDrive::MountMedia(ETrue) and then not dismounting
 	r = fs.RemountDrive(RFsDNum);
-	test_KErrNone(r);
+	test (r == KErrNone);
 	RFormat fmt;
 	TPckgBuf<TInt> stepPkg;
 	TDriveUnit driveUnit(RFsDNum);
@@ -1857,63 +1807,63 @@
 	r = fmt.Open(fs, driveName, EHighDensity, stepPkg());
 	if (r != KErrLocked)
 		test.Printf(_L("RFormat::Next() returned %d\n"), r);
-	test_Value(r, r == KErrLocked);
+	test(r == KErrLocked);
 	test.Printf(_L("\n"));
 	fmt.Close();
 	r = fs.CheckDisk(sessionPath);
-	test_Value(r, r == KErrLocked);
+	test(r == KErrLocked);
 
 
 	test.Next(_L("test unlocking fails after powered down & unlocked with wrong password"));
 	r = TestUnlockCard(fs, RFsDNum, wrongpwd, EFalse);
-	test_Value(r, r == KErrAccessDenied);		// unlocked should now fail
+	test(r == KErrAccessDenied);		// unlocked should now fail
 
 	test.Next(_L("test unlocking succeeds for correct password after powered down & locked"));
 	r = TestUnlockCard(fs, RFsDNum, newpassword, EFalse);
-	test_KErrNone(r);		// unlocked should now succeed
+	test(r == KErrNone);		// unlocked should now succeed
 
 	test.Next(_L("test unlocking fails after successful unlock"));
 	r = TestUnlockCard(fs, RFsDNum, wrongpwd, EFalse);
-	test_Value(r, r == KErrAlreadyExists);		// unlocked should now succeed
+	test(r == KErrAlreadyExists);		// unlocked should now succeed
 	test(!TestLocked(fs, RFsDNum));	// not locked yet as stack hasn't powered down
 
 	test.Next(_L("test locking card with new password (with wrong password as old password)"));
 	r = TestLockCard(fs, RFsDNum, wrongpwd, newpassword, EFalse);
-	test_Value(r, r == KErrAccessDenied);
+	test(r == KErrAccessDenied);
 	test(!TestLocked(fs, RFsDNum));	// not locked yet as stack hasn't powered down
 
 	test.Next(_L("test locking card with new password (with right password as old password)"));
 	r = TestLockCard(fs, RFsDNum, newpassword, wrongpwd, EFalse);
-	test_KErrNone(r);
+	test(r == KErrNone);
 	test(!TestLocked(fs, RFsDNum));	// not locked yet as stack hasn't powered down
 
 	WaitForPowerDownLock(fs, RFsDNum);
 	
 	test.Next(_L("test clearing fails with wrong password if powered down & locked"));
 	r = TestClearPassword(fs, RFsDNum, newpassword); // Note: we have set the wrong password as the new password
-	test_Value(r, r == KErrAccessDenied);
+	test(r == KErrAccessDenied);
 	test(TestLocked(fs, RFsDNum));
 
 	test.Next(_L("test clearing succeeds with right password if powered down & locked"));
 	r = TestClearPassword(fs, RFsDNum, wrongpwd);
-	test_KErrNone(r);
+	test(r == KErrNone);
 	test(!TestLocked(fs, RFsDNum));
 
 	test.Next(_L("test locking card again"));
 	r = TestLockCard(fs, RFsDNum, oldpassword, newpassword, EFalse);
-	test_KErrNone(r);
+	test(r == KErrNone);
 	test(!TestLocked(fs, RFsDNum));		// not locked yet as stack hasn't powered down
 
 	test.Next(_L("test forced erase fails if still powered up"));
 	r = ExecuteForcedEraseTestL(fs, RFsDNum);
-	test_Value(r, r == KErrAccessDenied);		// fails because card is not yet locked
+	test(r == KErrAccessDenied);		// fails because card is not yet locked
 
 	WaitForPowerDownLock(fs, RFsDNum);
 
 
 	test.Next(_L("test forced erase succeeds if powered down & locked"));
 	r = ExecuteForcedEraseTestL(fs, RFsDNum);
-	test_KErrNone(r);
+	test(r == KErrNone);
 
 	fs.Close();
 	test.End();
@@ -1934,16 +1884,16 @@
 	sessionPath=_L("?:\\");
 	TChar driveLetter;
 	TInt r=fs.DriveToChar(RFsDNum,driveLetter);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	sessionPath[0]=(TText)driveLetter;
 	r=fs.SetSessionPath(sessionPath);
-	test_KErrNone(r);
+	test(r==KErrNone);
     
 	TInt nRes;
     TDriveInfo dInfo;
 
     nRes = fs.Drive(dInfo, RFsDNum);
-	test_KErrNone(nRes);
+	test(nRes == KErrNone);
 	if (!(dInfo.iMediaAtt & KMediaAttLockable))
 		{
 		test.Printf(_L("Drive %d is not lockable %d\n"), RFsDNum);
@@ -1955,7 +1905,7 @@
 	TMediaPassword oldPassword;
 	TMediaPassword newPassword = (TUint8*) "salasana";
     nRes = fs.LockDrive(RFsDNum, oldPassword, newPassword, EFalse );
-	test_KErrNone(nRes);
+	test(nRes == KErrNone);
 
 	WaitForPowerDownLock(fs, RFsDNum);
 
@@ -1974,7 +1924,7 @@
     test(reqStatNotify1.Int() == KErrNone);
 
 	r = TestClearPassword(fs, RFsDNum, newPassword);
-	test_KErrNone(r);
+	test(r == KErrNone);
 	test(!TestLocked(fs, RFsDNum));
 	
 	
@@ -1982,6 +1932,7 @@
 	fs.Close();
 	}
 
+
 LOCAL_C void RunTests()
 //
 // Main test routine.  Calls other test functions.
@@ -2004,47 +1955,34 @@
 	test.Next(_L("Allocating test data"));
 	AllocateTestData();
 
-    if (gManual)
-        {
-		test.Next(_L("Testing locking / unlocking using file server APIs"));
-		TestFsLockUnlock();
+	test.Next(_L("Testing locking / unlocking using file server APIs"));
+	TestFsLockUnlock();
 	
-		test.Next(_L("Testing Power Down Status Reporting using file server APIs"));
-		TestPowerDownStatus();
+	test.Next(_L("Testing Power Down Status Reporting using file server APIs"));
+	TestPowerDownStatus();
 
-	    test.Next(_L("Testing RFs::NotifyChange() with RFs::UnlockDrive()"));
-		TestUnlockDriveNotifyChange();
+    test.Next(_L("Testing RFs::NotifyChange() with RFs::UnlockDrive()"));
+	TestUnlockDriveNotifyChange();
 
-		test.Next(_L("Forced Erase"));
-		TestFormatErase();
-		}
-		
+	test.Next(_L("Forced Erase"));
+	TestFormatErase();
 	test.Next(_L("Testing store management"));
 	TestStaticStore();
-
-    if (gManual)
-        {		
-		test.Next(_L("Testing locking functions"));
-		TestLockUnlock();
-		test.Next(_L("Testing Elide Passwords"));
-		TestElidePasswords();		
-		test.Next(_L("Testing Null Passwords"));
-		TestNullPasswords();
-		test.Next(_L("Testing controller store"));
-		TestControllerStore();
-		test.Next(_L("Testing auto unlock"));
-		TestAutoUnlock();
-		}
-		
+	test.Next(_L("Testing locking functions"));
+	TestLockUnlock();
+	test.Next(_L("Testing Elide Passwords"));
+	TestElidePasswords();
+	test.Next(_L("Testing Null Passwords"));
+	TestNullPasswords();
+	test.Next(_L("Testing controller store"));
+	TestControllerStore();
+	test.Next(_L("Testing auto unlock"));
+	TestAutoUnlock();
 	test.Next(_L("Testing password file"));
 	TestPasswordFile();
-	
-    if (gManual)
-        {		
-		test.Next(_L("Testing writing a valid password to store unlocks card"));
-		TestWriteToPasswordStoreUnlocksCard();
-		}
-    
+	test.Next(_L("Testing writing a valid password to store unlocks card"));
+	TestWriteToPasswordStoreUnlocksCard();
+
 	test.Next(_L("Disconnecting TBLD"));
 	TBLD.Disconnect();
 
@@ -2054,43 +1992,15 @@
 	__UHEAP_MARKEND;
 	}
 
-LOCAL_D void ParseCommandLineArgs()
-    {
-    
-    TBuf<0x100> cmd;
-    User::CommandLine(cmd);
-    TLex lex(cmd);
-
-    for (TPtrC token=lex.NextToken(); token.Length() != 0;token.Set(lex.NextToken()))
-        {
-        if (token.CompareF(_L("-m"))== 0)
-            {
-            gManual = ETrue;
-            continue;
-            }
-        }
-    }
 
 TInt E32Main()
 	{
 	
 	test.Title();
-	test.Start(_L("T_PWSTR"));
+	test.Start(_L("E32Main"));
+	
+	RunTests();
 
-#if defined(__WINS__)
-	if (!gManual)
-	    {
-        test.Printf(_L("Automated T_PWSTR not supported on emulated devices\n"));
-	    }
-	else
-#endif
-	    {
-        ParseCommandLineArgs();	
-        
-        RunTests();
-	    }
-
-	
 	test.End();
 	test.Close();