kerneltest/f32test/server/t_dspace.cpp
changeset 189 a5496987b1da
parent 33 0173bcd7697c
child 220 14267bc009a6
--- a/kerneltest/f32test/server/t_dspace.cpp	Wed Jun 23 12:58:21 2010 +0100
+++ b/kerneltest/f32test/server/t_dspace.cpp	Thu Jul 01 17:57:33 2010 +0100
@@ -15,6 +15,7 @@
 //
 //
 
+#define __E32TEST_EXTENSION__
 #include <f32file.h>
 #include <e32test.h>
 #include "t_server.h"
@@ -104,7 +105,7 @@
 	{
 	TVolumeInfo v;
 	TInt r=TheFs.Volume(v,aDrive);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	return(v.iFree);
 	}
 
@@ -115,7 +116,7 @@
 	{
 	TVolumeInfo v;
 	TInt r=TheFs.Volume(v,aDrive);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	return(v.iSize);
 	}
 
@@ -126,7 +127,7 @@
 LOCAL_C TInt MinimumFileSize(TInt aDrive)
 	{
 	TInt r = TheFs.Delete(KTestFile1);
-	test(r==KErrNone || r==KErrNotFound);
+	test_Value(r, r == KErrNone || r==KErrNotFound);
 
 	TInt64 freeSpace = FreeDiskSpace(aDrive);
 
@@ -134,15 +135,15 @@
 
 
 	r=file.Create(TheFs,KTestFile1,EFileShareAny|EFileWrite);
-	test(r==KErrNone);
+	test_KErrNone(r);
 
 	r = file.Write(TheBuffer,1);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	file.Close();
 	TInt64 newSpace = FreeDiskSpace(aDrive);
 
 	r = TheFs.Delete(KTestFile1);
-	test(r==KErrNone);
+	test_KErrNone(r);
 
 
 	TInt64 minFileSize = freeSpace - newSpace;
@@ -216,7 +217,7 @@
 	// initialise removable drive descriptor
 	TChar c;
 	TInt r=RFs::DriveToChar(RemovableDrive,c);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	RemovableDriveBuf[0]=(TText)c;
 
 	if( !LffsDrive )
@@ -230,7 +231,7 @@
 	// better format the default drive as long as not WINS c drive
 	TInt drive;
 	r= RFs::CharToDrive(gSessionPath[0],drive);
-	test(r==KErrNone);
+	test_KErrNone(r);
 #if defined(__WINS__)
 	if(drive!=EDriveC)
 		Format(drive);
@@ -242,18 +243,18 @@
 	TheDiskSize=DiskSize(KDefaultDrive);
 	// and set the default directory
 	r=TheFs.MkDirAll(gSessionPath);
-	test(r==KErrNone || r==KErrAlreadyExists);
+	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
 
 	r=TheFs.Delete(KFileFiller);
-	test(r==KErrNone || r==KErrNotFound);
+	test_Value(r, r == KErrNone || r==KErrNotFound);
 	r=TheFs.Delete(KTestFile1);
-	test(r==KErrNone || r==KErrNotFound);
+	test_Value(r, r == KErrNone || r==KErrNotFound);
 	r=TheFs.Delete(KTestFile2);
-	test(r==KErrNone || r==KErrNotFound);
+	test_Value(r, r == KErrNone || r==KErrNotFound);
 	r=TheFs.RmDir(KTestDir1);
-	test(r==KErrNone || r==KErrNotFound);
+	test_Value(r, r == KErrNone || r==KErrNotFound);
 	r=TheFs.RmDir(KTestDir2);
-	test(r==KErrNone || r==KErrNotFound);
+	test_Value(r, r == KErrNone || r==KErrNotFound);
 
 	gMinFileSize = MinimumFileSize(drive);
 	}
@@ -271,7 +272,7 @@
 		TInt r=aFile.Write(TheBuffer,s);
 		if( !LffsDrive )
 			{
-			test(r==KErrNone);
+			test_KErrNone(r);
 			}
 		else
 			{
@@ -326,7 +327,7 @@
 
 		if( !LffsDrive )
 			{
-			test(r==KErrNone);
+			test_KErrNone(r);
 			}
 		else
 			{
@@ -353,17 +354,17 @@
 		{
 		case ETaskMkDir:
 			r=TheFs.RmDir(KTestDir1);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			break;
 		case ETaskRmDir: break;
 		case ETaskDelete: break;
 		case ETaskReplace:
 			r=TheFs.Delete(KTestFile2);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			break;
 		case ETaskFileReplace:
 			r=TheFs.Delete(KTestFile1);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			break;
 		case ETaskFileWrite:
 		case ETaskFileWrite4KB:
@@ -396,15 +397,15 @@
 		case ETaskMkDir:	break;
 		case ETaskRmDir:
 			r=TheFs.MkDir(KTestDir1);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			break;
 		case ETaskDelete:
 			r=file.Create(TheFs,KTestFile1,EFileShareAny|EFileWrite);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			if( !LffsDrive )
 				{
 				r=file.SetSize(KFileSize1);
-				test(r==KErrNone);
+				test_KErrNone(r);
 				}
 			else
 				{
@@ -416,11 +417,11 @@
 			break;
 		case ETaskReplace:
 			r=file.Create(TheFs,KTestFile1,EFileShareAny|EFileWrite);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			if( !LffsDrive )
 				{
 				r=file.SetSize(KFileSize1);
-				test(r==KErrNone);
+				test_KErrNone(r);
 				}
 			else
 				{
@@ -428,11 +429,11 @@
 				}
 			file.Close();
 			r=file2.Create(TheFs,KTestFile2,EFileShareAny|EFileWrite);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			if( !LffsDrive )
 				{
 				r=file2.SetSize(KFileSize3);
-				test(r==KErrNone);
+				test_KErrNone(r);
 				}
 			else
 				{
@@ -442,7 +443,7 @@
 			break;
 		case ETaskFileReplace:
 			r=file.Create(TheFs,KTestFile1,EFileShareAny|EFileWrite);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			if( !LffsDrive )
 				{
 				r=file.SetSize(KFileSize3*2);
@@ -451,7 +452,7 @@
 				{
 				WriteToFile( file, KFileSize3 );
 				}
-			test(r==KErrNone);
+			test_KErrNone(r);
 			file.Close();
 			break;
 		case ETaskFileWrite:
@@ -459,16 +460,16 @@
 		case ETaskFileWrite64KB:
 		case ETaskFileSetSize:
 			r=file.Create(TheFs,KTestFile1,EFileShareAny|EFileWrite);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			file.Close();
 			break;
 		case ETaskNoChange1:
 			r=file.Create(TheFs,KTestFile1,EFileShareAny|EFileWrite);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			if( !LffsDrive )
 				{
 				r=file.SetSize(KFileSize1);
-				test(r==KErrNone);
+				test_KErrNone(r);
 				}
 			else
 				{
@@ -478,7 +479,7 @@
 			break;
 		case ETaskNoChange2:
 			r=file.Create(TheFs,KTestFile1,EFileShareAny|EFileWrite);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			file.Close();
 			break;
 		case ETaskFileCreateLffs:
@@ -497,37 +498,37 @@
 	RTest test(_L("T_DSPACE_ThreadFunction"));
 	RFs fs;
 	TInt r=fs.Connect();
-	test(r==KErrNone);
+	test_KErrNone(r);
 	r=fs.SetSessionPath(gSessionPath);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	TThreadTask task=*(TThreadTask*)&aThreadTask;
 	RFile file;
 	switch(task)
 		{
 		case ETaskMkDir:
 			r=fs.MkDir(KTestDir1);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			break;
 		case ETaskRmDir:
 			r=fs.RmDir(KTestDir1);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			break;
 		case ETaskDelete:
 			r=fs.Delete(KTestFile1);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			break;
 		case ETaskReplace:
 			r=fs.Replace(KTestFile1,KTestFile2);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			break;
 		case ETaskFileReplace:
 			r=file.Replace(fs,KTestFile1,EFileShareAny|EFileWrite);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			file.Close();
 			break;
 		case ETaskFileWrite:
 			r=file.Open(fs,KTestFile1,EFileShareAny|EFileWrite);
-			test(r==KErrNone);
+			test_KErrNone(r);
 #if defined(__WINS__)
 			WriteToFile( file, gMinFileSize << 4);	// 512 * 16 = 8K
 #else
@@ -537,35 +538,35 @@
 			break;
 		case ETaskFileWrite4KB:
 			r=file.Open(fs,KTestFile1,EFileShareAny|EFileWrite);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			WriteToFile(file,gMinFileSize << 3);	// 512 * 2^3 = 512 * 8 = 4K
 			file.Close();
 			break;
 		case ETaskFileWrite64KB:
 			r=file.Open(fs,KTestFile1,EFileShareAny|EFileWrite);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			WriteToFile(file,gMinFileSize<<7);	// 512 * 2^7 = 512 * 128 = 64K
 			file.Close();
 			break;
 		case ETaskFileSetSize:
 			r=file.Open(fs,KTestFile1,EFileShareAny|EFileWrite);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			r=file.SetSize(KFileSize3);
 			file.Close();
 			break;
 		case ETaskFileCreateLffs:
 			r=file.Create(fs,KTestFile1,EFileShareAny|EFileWrite);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			file.Close();
 			break;
 		case ETaskNoChange1:
 			{
 			r=file.Open(fs,KTestFile1,EFileShareAny|EFileWrite);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			TTime time;
 			time.HomeTime();
 			r=file.SetModified(time);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			file.Close();
 			break;
 			}
@@ -573,7 +574,7 @@
 			{
 			TEntry e;
 			r=fs.Entry(KTestFile1,e);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			break;
 			}
 		case ETaskSpin:
@@ -732,13 +733,13 @@
 	// make default directory
 	_LIT(defaultDir,"C:\\F32-TST\\");
 	TInt r=TheFs.MkDirAll(defaultDir);
-	test(r==KErrNone||r==KErrAlreadyExists);
+	test_Value(r, r == KErrNone||r==KErrAlreadyExists);
 	// create the filler file
 	RFile file;
 	TFileName fileName=_L("C:");
 	fileName+=KFileFiller;
 	r=file.Create(TheFs,fileName,EFileShareAny|EFileWrite);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	TInt64 free=FreeDiskSpace(EDriveC);
 	// use up 16KB
 	FillDisk(file,free-16384,EDriveC);
@@ -754,11 +755,11 @@
 	RFormat f;
 	TInt count;
 	r=f.Open(TheFs,RemovableDriveBuf,EQuickFormat,count);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	while(count)
 		{
 		r=f.Next(count);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		}
 	f.Close();
 	User::After(1000000);
@@ -772,7 +773,7 @@
 	fName+=RemovableDriveBuf;
 	fName+=_L("F32-TST\\");
 	r=TheFs.MkDirAll(fName);
-	test(r==KErrNone);
+	test_KErrNone(r);
 
 	// test that a media change notifies clients on all drives
 	test.Next(_L("media change"));
@@ -806,7 +807,7 @@
 	test.Next(_L("scandrive"));
 	// first test that scandrive does not find any problems on the removable media
 	r=TheFs.ScanDrive(RemovableDriveBuf);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	// now set up disk space notification
 	freeC=FreeDiskSpace(EDriveC);
 	freeD=FreeDiskSpace(RemovableDrive);
@@ -816,7 +817,7 @@
 	TheFs.NotifyDiskSpace(freeD-8192,RemovableDrive,stat2);
 	test(stat1==KRequestPending && stat2==KRequestPending);
 	r=TheFs.ScanDrive(RemovableDriveBuf);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	User::After(1000000);
 	User::WaitForRequest(stat2);
 	test(stat1==KRequestPending && stat2==KErrNone);
@@ -825,11 +826,11 @@
 
 	file.Close();
 	r=TheFs.Delete(fileName);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	if(gSessionPath[0]!=(TText)'C')
 		{
 		r=TheFs.RmDir(defaultDir);
-		test(r==KErrNone||r==KErrInUse);
+		test_Value(r, r == KErrNone||r==KErrInUse);
 		}
 
 	}
@@ -845,7 +846,7 @@
 	// create the filler file
 	RFile file;
 	TInt r=file.Create(TheFs,KFileFiller,EFileShareAny|EFileWrite|EFileWriteDirectIO);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	TInt64 newSpace = FreeDiskSpace(KDefaultDrive)-8192;
 	FillDisk(file,newSpace,KDefaultDrive);
 
@@ -860,7 +861,7 @@
 	test(stat1==KRequestPending);
 	RThread thread;
 	r=thread.Create(_L("thread1"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	thread.Resume();
 	User::WaitForRequest(stat1);
 	test(stat1==KErrNone);
@@ -885,7 +886,7 @@
 		TheFs.NotifyDiskSpace(threshold,KDefaultDrive,stat1);
 		test(stat1==KRequestPending);
 		r=thread.Create(_L("thread2"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		TRequestStatus deathStat;
 		thread.Logon( deathStat );
 		thread.Resume();
@@ -911,7 +912,7 @@
 	TheFs.NotifyDiskSpace(threshold,KDefaultDrive,stat1);
 	test(stat1==KRequestPending);
 	r=thread.Create(_L("thread3"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	thread.Logon( deathStat );
 	thread.Resume();
 
@@ -944,7 +945,7 @@
 	TheFs.NotifyDiskSpace(threshold,KDefaultDrive,stat1);
 	test(stat1==KRequestPending);
 	r=thread.Create(_L("thread4"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	thread.Logon( deathStat );
 	thread.Resume();
 	User::WaitForRequest(stat1);
@@ -980,7 +981,7 @@
 	    test(stat1==KRequestPending);
 
 	    r=thread.Create(_L("thread5"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-	    test(r==KErrNone);
+	    test_KErrNone(r);
 	    thread.Logon( deathStat );
 	    thread.Resume();
 
@@ -1004,7 +1005,7 @@
 	    TheFs.NotifyDiskSpace(threshold,KDefaultDrive,stat1);
 	    test(stat1==KRequestPending);
 	    r=thread.Create(_L("thread6"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-	    test(r==KErrNone);
+	    test_KErrNone(r);
 	    thread.Logon( deathStat );
 	    thread.Resume();
 	    User::WaitForRequest(stat1);
@@ -1033,15 +1034,15 @@
 		TBuf<10> someFile=_L("?:\\abcdef");
 		TChar c;
 		TInt r=RFs::DriveToChar(RemovableDrive,c);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		someFile[0]=(TText)c;
 #endif
 		_LIT(someDir,"C:\\1234\\");
 
 		r=f2.Create(TheFs,someFile,EFileShareAny|EFileWrite);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		r=TheFs.MkDir(someDir);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		TRequestStatus stat2;
 		TInt64 freeC=FreeDiskSpace(EDriveC);
 		TInt64 freeD=FreeDiskSpace(RemovableDrive);
@@ -1051,7 +1052,7 @@
 		// before fix this would result in iTheDrive not being updated in next subsession call
 		// therefore this could would not result in a disk space notification
 		r=f2.SetSize(8192);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		User::After(1000000);
 		User::WaitForRequest(stat2);
 
@@ -1066,14 +1067,14 @@
 		TheFs.NotifyDiskSpaceCancel();
 		test(stat1==KErrCancel);
 		r=TheFs.Delete(someFile);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		r=TheFs.RmDir(someDir);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		}
 
 	file.Close();
 	r=TheFs.Delete(KFileFiller);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	}
 
 
@@ -1089,7 +1090,7 @@
 	// create the filler file
 	RFile file;
 	TInt r=file.Create(TheFs,KFileFiller,EFileShareAny|EFileWrite|EFileWriteDirectIO);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	TInt64 newSpace = FreeDiskSpace(KDefaultDrive)-8192;
 	FillDisk(file,newSpace,KDefaultDrive);
 
@@ -1108,7 +1109,7 @@
 	test(stat1==KRequestPending && stat2==KRequestPending);
 	RThread thread;
 	r=thread.Create(_L("thread7"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	TRequestStatus deathStat;
 	thread.Logon( deathStat );
 	thread.Resume();
@@ -1143,7 +1144,7 @@
 	TheFs.NotifyDiskSpace(threshold3,KDefaultDrive,stat3);
 	test(stat1==KRequestPending && stat2==KRequestPending && stat3==KRequestPending);
 	r=thread.Create(_L("thread8"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	thread.Logon( deathStat );
 	thread.SetPriority( EPriorityLess );
 	thread.Resume();	// start spinning, blocks background thread
@@ -1158,7 +1159,7 @@
 	test( KErrNone==r );
 	// create a  file to force some roll-forward
 	r=file2.Create(TheFs,KTestFile1,EFileShareAny|EFileWrite);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	User::WaitForRequest(stat1);
 	test(stat1==KErrNone);
 	test(stat2==KRequestPending);
@@ -1193,13 +1194,13 @@
 	TheFs.NotifyDiskSpace(threshold3,KDefaultDrive,stat3);
 	test(stat1==KRequestPending && stat2==KRequestPending && stat3==KRequestPending);
 	r=thread.Create(_L("thread9"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	thread.Logon( deathStat );
 	thread.SetPriority( EPriorityLess );
 	thread.Resume();	// start spinning, blocks background thread
 	// create a  file to force some roll-forward
 	r=file2.Create(TheFs,KTestFile1,EFileShareAny|EFileWrite);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	User::WaitForRequest(stat1);
 	test(stat1==KErrNone);
 	test(stat2==KRequestPending);
@@ -1224,7 +1225,7 @@
 
 	file.Close();
 	r=TheFs.Delete(KFileFiller);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	}
 
 
@@ -1236,13 +1237,13 @@
 	// create the filler file
 	RFile file;
 	TInt r=file.Create(TheFs,KFileFiller,EFileShareAny|EFileWrite|EFileWriteDirectIO);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	TInt64 free=FreeDiskSpace(KDefaultDrive);
 	TInt64 freeSpaceLeft = gMinFileSize << 4;	// 512 * 2^4 = 512 * 16 = 8K
 	FillDisk(file,free-freeSpaceLeft,KDefaultDrive);
 	TInt size;
 	r=file.Size(size);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	test(size>1024);
 	test.Printf(_L("filler file size=0x%x\n"),size);
 
@@ -1265,7 +1266,7 @@
 	test(stat1==KRequestPending&&stat2==KRequestPending&&stat3==KRequestPending);
 	RThread thread;
 	r=thread.Create(_L("thread1"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	TRequestStatus deathStat;
 	thread.Logon( deathStat );
 	thread.Resume();
@@ -1302,7 +1303,7 @@
 		TheFs.NotifyDiskSpace(threshold3,KDefaultDrive,stat3);
 		test(stat1==KRequestPending&&stat2==KRequestPending&&stat3==KRequestPending);
 		r=thread.Create(_L("thread2"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		thread.Logon( deathStat );
 		thread.Resume();
 		User::After(10000);
@@ -1339,13 +1340,13 @@
 	test.Next(_L("test multiple sessions on same drive"));
 	RFs ses2,ses3;
 	r=ses2.Connect();
-	test(r==KErrNone);
+	test_KErrNone(r);
 	r=ses3.Connect();
-	test(r==KErrNone);
+	test_KErrNone(r);
 	r=ses2.SetSessionPath(gSessionPath);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	r=ses3.SetSessionPath(gSessionPath);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	task=ETaskFileReplace;
 	InitialiseForThread(task);
 	free=FreeDiskSpace(KDefaultDrive);
@@ -1358,7 +1359,7 @@
 	ses3.NotifyDiskSpace(threshold3,KDefaultDrive,stat3);
 	test(stat1==KRequestPending&&stat2==KRequestPending&&stat3==KRequestPending);
 	r=thread.Create(_L("thread3"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	thread.Logon( deathStat );
 	thread.Resume();
 	User::After(1000000);
@@ -1390,7 +1391,7 @@
 		{
 		TInt sessionDrive;
 		r=RFs::CharToDrive(gSessionPath[0],sessionDrive);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		if(sessionDrive!=RemovableDrive)
 			{
 			// first create a file on the removable drive
@@ -1399,9 +1400,9 @@
 			file2name+=_L("F32-TST\\testfile1");
 			TheFs.Delete(file2name);
 			r=file2.Create(TheFs,file2name,EFileShareAny|EFileWrite);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			r=file2.SetSize(KFileSize3);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			// test multiple sessions not notified on disk space change on wrong drive
 			test.Next(_L("test multiple sessions on different drives"));
 			task=ETaskFileReplace;
@@ -1414,7 +1415,7 @@
 			ses2.NotifyDiskSpace(threshold2,RemovableDrive,stat2);
 			test(stat1==KRequestPending&&stat2==KRequestPending);
 			r=thread.Create(_L("thread4"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			thread.Logon( deathStat );
 			thread.Resume();
 			User::After(1000000);
@@ -1431,7 +1432,7 @@
 			test(stat2==KErrCancel);
 			file2.Close();
 			r=TheFs.Delete(file2name);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			}
 		}
 
@@ -1441,7 +1442,7 @@
 
 	file.Close();
 	r=TheFs.Delete(KFileFiller);
-	test(r==KErrNone);
+	test_KErrNone(r);
 
 	}
 
@@ -1454,12 +1455,12 @@
 	// create the filler file
 	RFile file;
 	TInt r=file.Create(TheFs,KFileFiller,EFileShareAny|EFileWrite|EFileWriteDirectIO);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	TInt64 free=FreeDiskSpace(KDefaultDrive);
 	FillDisk(file,free-8192,KDefaultDrive);
 	TInt size;
 	r=file.Size(size);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	test.Printf(_L("filler file size=0x%x\n"),size);
 
 
@@ -1480,7 +1481,7 @@
 	test(stat1==KRequestPending&&stat2==KRequestPending&&stat3==KRequestPending);
 	RThread thread;
 	r=thread.Create(_L("thread10"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	TRequestStatus deathStat;
 	thread.Logon( deathStat );
 //	test.Printf(_L("Resuming other thread"));
@@ -1511,7 +1512,7 @@
 
 	TInt sessionDrive;
 	r=RFs::CharToDrive(gSessionPath[0],sessionDrive);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	if(sessionDrive!=EDriveC)
 		{
 		// test multiple sessions not notified on disk space change on wrong drive
@@ -1519,13 +1520,13 @@
 
 		RFs ses2,ses3;
 		r=ses2.Connect();
-		test(r==KErrNone);
+		test_KErrNone(r);
 		r=ses3.Connect();
-		test(r==KErrNone);
+		test_KErrNone(r);
 		r=ses2.SetSessionPath(gSessionPath);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		r=ses3.SetSessionPath(gSessionPath);
-		test(r==KErrNone);
+		test_KErrNone(r);
 
 		// first create a file on the C:\ drive
 		RFile file2;
@@ -1536,7 +1537,7 @@
 		file2name+=_L("testfile1");
 		TheFs.Delete(file2name);
 		r=file2.Create(TheFs,file2name,EFileShareAny|EFileWrite);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		WriteToFile( file2, KFileSize3 );
 
 		task=ETaskFileReplace;
@@ -1549,7 +1550,7 @@
 		ses2.NotifyDiskSpace(threshold2,EDriveC,stat2);
 		test(stat1==KRequestPending&&stat2==KRequestPending);
 		r=thread.Create(_L("thread11"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		thread.Logon( deathStat );
 		thread.Resume();
 		User::After(1000000);
@@ -1567,7 +1568,7 @@
 		test(stat2==KErrCancel);
 		file2.Close();
 		r=TheFs.Delete(file2name);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		ses2.Close();
 		ses3.Close();
 		}
@@ -1576,7 +1577,7 @@
 
 	file.Close();
 	r=TheFs.Delete(KFileFiller);
-	test(r==KErrNone);
+	test_KErrNone(r);
 
 	}
 
@@ -1589,7 +1590,7 @@
 	// create a filler file
 	RFile file;
 	TInt r=file.Create(TheFs,KFileFiller,EFileShareAny|EFileWrite|EFileWriteDirectIO);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	TInt64 free=FreeDiskSpace(KDefaultDrive);
 	// use 8KB in filler file
 	FillDisk(file,free-8192,KDefaultDrive);
@@ -1608,7 +1609,7 @@
 	test(stat1==KRequestPending&&stat2==KRequestPending&&stat3==KRequestPending);
 	RThread thread;
 	r=thread.Create(_L("thread1"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	TRequestStatus deathStat;
 	thread.Logon( deathStat );
 	thread.Resume();
@@ -1635,13 +1636,13 @@
 	test.Next(_L(" test change notification and disk space notification"));
 	RFs session2,session3;
 	r=session2.Connect();
-	test(r==KErrNone);
+	test_KErrNone(r);
 	r=session3.Connect();
-	test(r==KErrNone);
+	test_KErrNone(r);
 	r=session2.SetSessionPath(gSessionPath);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	r=session3.SetSessionPath(gSessionPath);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	task=ETaskFileWrite;
 	InitialiseForThread(task);
 	free=FreeDiskSpace(KDefaultDrive);
@@ -1651,7 +1652,7 @@
 	session3.NotifyChange(ENotifyAll,stat3,KTestFile1);
 	test(stat1==KRequestPending&&stat2==KRequestPending&&stat3==KRequestPending);
 	r=thread.Create(_L("thread2"),ThreadFunction,KStackSize,KHeapSize,KHeapSize,(TAny*)task);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	thread.Logon( deathStat );
 	thread.Resume();
 	User::After(1000000);
@@ -1692,7 +1693,7 @@
 
 	file.Close();
 	r=TheFs.Delete(KFileFiller);
-	test(r==KErrNone);
+	test_KErrNone(r);
 
 	}
 
@@ -1734,7 +1735,7 @@
 		}
 	//Test uses C drive as secondary drive so test can't be tested on that drive
 	r = TheFs.CharToDrive(gSessionPath[0], driveNumber);
-	test(r == KErrNone);
+	test_KErrNone(r);
 	if(driveNumber == EDriveC)
 		{
 		test.Printf(_L("Test uses C drive as secondary drive so test can't be test on C drive, test will exit"));