kerneltest/f32test/server/t_format.cpp
changeset 109 b3a1d9898418
parent 0 a41df078684a
child 200 73ea206103e6
--- a/kerneltest/f32test/server/t_format.cpp	Mon May 03 13:47:38 2010 +0300
+++ b/kerneltest/f32test/server/t_format.cpp	Fri May 14 17:13:29 2010 +0300
@@ -40,7 +40,7 @@
 	RFormat format;
 	TInt count;
 	TInt r=format.Open(TheFs,b,EHighDensity,count);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	format.Close();
 	}
 
@@ -96,9 +96,9 @@
 
 	RFs fs;
 	TInt ret=fs.Connect();
-	test(ret==KErrNone);
+	test_KErrNone(ret);
 	ret=fs.SetSessionPath(gSessionPath);
-	test(ret==KErrNone);
+	test_KErrNone(ret);
 	TTestCode testCode=*(TTestCode*)&aTestCode;
 	TInt count;
 	RFormat format;
@@ -107,10 +107,10 @@
 		case ETest3:
 			{
 			ret=format.Open(fs,gSessionPath,EQuickFormat,count);
-			test(ret==KErrNone);
+			test_KErrNone(ret);
 			
             ret = DoFormatSteps(format, count);
-            test(ret==KErrNone);
+            test_KErrNone(ret);
 	
             format.Close();
 			break;
@@ -118,7 +118,7 @@
 		case ETest5:
 			{
 			ret=format.Open(fs,gSessionPath,EFullFormat,count);
-			test(ret==KErrNone);
+			test_KErrNone(ret);
 			gSleepThread.Signal();
 			User::After(100000000);		
 			break;
@@ -139,7 +139,7 @@
     
 	RRawDisk raw;
 	TInt r=raw.Open(TheFs,CurrentDrive());
-	test(r==KErrNone);
+	test_KErrNone(r);
 	if (!Is_Lffs(TheFs, gDrive))
 		{
 		TBuf8<KSectorSize> zeroBuf(KSectorSize);
@@ -151,7 +151,7 @@
         for(TInt i=0; i<KMaxSectors; ++i)
             {
             r=raw.Write(i*KSectorSize, zeroBuf);
-		    test(r==KErrNone);
+		    test_KErrNone(r);
             }
 		}
 	else
@@ -174,7 +174,7 @@
 				// aligned 32-byte blocks, we don't need to bother that much.
 				// The device driver writes the block but fails when reading
 				// it back.
-				// test(r==KErrNone);
+				// test_KErrNone(r);
 				}
 			}
 		else if(cntlModeSize>0)
@@ -238,16 +238,16 @@
 	RFormat format;
 
 	TInt r=format.Open(TheFs,gSessionPath,EFullFormat,count);
-	test(r==KErrNone);
+	test_KErrNone(r);
 
     r = DoFormatSteps(format, count);
-    test(r==KErrNone);
+    test_KErrNone(r);
 
 	format.Close();
 	
 	TVolumeInfo volInfo;
 	r=TheFs.Volume(volInfo);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	
 	if (volInfo.iSize-volInfo.iFree!=0)
 		{
@@ -258,15 +258,15 @@
 		
 	test.Next(_L("Test EQuickFormat"));
 	r=format.Open(TheFs,gSessionPath,EQuickFormat,count);
-	test(r==KErrNone);
+	test_KErrNone(r);
 
     r = DoFormatSteps(format, count);
-    test(r==KErrNone);
+    test_KErrNone(r);
 
 	format.Close();
 
 	r=TheFs.Volume(volInfo);
-	test(r==KErrNone);
+	test_KErrNone(r);
 		
 	if (volInfo.iSize-volInfo.iFree!=0)
 		{
@@ -288,16 +288,16 @@
 	test.Next(_L("Test disk cannot be formatted while a file is open"));
 	RFile f;
 	TInt r=f.Replace(TheFs,_L("BLARGME.BLARG"),EFileStream);
-	test(r==KErrNone);
+	test_KErrNone(r);
 
 	TInt count;
 	RFormat format;
 	r=format.Open(TheFs,gSessionPath,EFullFormat,count);
-	test(r==KErrInUse);
+	test_Value(r, r == KErrInUse);
 
 	f.Close();
 	r=format.Open(TheFs,gSessionPath,EFullFormat,count);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	format.Close();
 
 	CheckFileExists(_L("BLARGME.BLARG"),KErrNone);
@@ -318,7 +318,7 @@
 	RThread clientThread;
 	TInt r=clientThread.Create(_L("ClientThread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest3);
 	test.Printf(_L("Created helper thread #1, res=%d\n"),r);	
-	test(r==KErrNone);
+	test_KErrNone(r);
 	
 	clientThread.Logon(gThreadLogon);
 	clientThread.Resume();
@@ -336,7 +336,7 @@
 	TheFs.NotifyChange(ENotifyAll,reqStat);
 	r=clientThread.Create(_L("ClientThread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest3);
     test.Printf(_L("Created helper thread #2, res=%d\n"),r);	
-	test(r==KErrNone);
+	test_KErrNone(r);
 
 
 	clientThread.Logon(gThreadLogon);
@@ -375,15 +375,15 @@
 
 	RFormat format;
 	TInt r=format.Open(TheFs,gSessionPath,EFullFormat,count);
-	test(r==KErrNone);
+	test_KErrNone(r);
 
 	while(count)
 		{
 		RDir dir;
 		r=dir.Open(TheFs,_L("\\*.*"),KEntryAttNormal);
-		test(r==KErrInUse);
+		test_Value(r, r == KErrInUse);
 		r=format.Next(count);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		}
 	format.Close();
 
@@ -418,7 +418,7 @@
 	RThread clientThread;
 	TInt r=clientThread.Create(_L("ClientThread"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5);
 	test.Printf(_L("Created helper thread #1, res=%d\n"),r);	
-	test(r==KErrNone);
+	test_KErrNone(r);
 
     test.Printf(_L("Panicing formatting thread #1\n"));	
 	clientThread.Resume();
@@ -438,7 +438,7 @@
 //	}
 //	else
 //	{
-	test(r==KErrCorrupt);
+	test_Value(r, r == KErrCorrupt);
 //	}
 
     test.Printf(_L("Formatting the drive...\n"));	
@@ -446,10 +446,10 @@
 	TInt count;
 	RFormat format;
 	r=format.Open(TheFs,gSessionPath,EQuickFormat,count);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	
     r = DoFormatSteps(format, count);
-    test(r==KErrNone);
+    test_KErrNone(r);
 	
     format.Close();
 
@@ -469,51 +469,51 @@
 	test.Next(_L("Test ramdrive shrinks after formatting"));
 	TVolumeInfo volInfo;
 	TInt r=TheFs.Volume(volInfo);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	if ((volInfo.iDrive.iMediaAtt&KMediaAttVariableSize)==0)
 		return;
 
 	TInt64 used=volInfo.iSize-volInfo.iFree;
 	RFile f;
 	r=f.Replace(TheFs,_L("BIGFILE.SIZE"),EFileRead|EFileWrite);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	f.SetSize(0x100000); // 1MB
 	f.Close();
 
 	r=TheFs.Volume(volInfo);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	TInt64 used2=volInfo.iSize-volInfo.iFree;
 	test(used<used2);
 
 	r=TheFs.Delete(_L("BIGFILE.SIZE"));
-	test(r==KErrNone);
+	test_KErrNone(r);
 	r=TheFs.Volume(volInfo);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	used2=volInfo.iSize-volInfo.iFree;
 	test(used==used2);
 
 	r=f.Replace(TheFs,_L("BIGFILE.SIZE"),EFileRead|EFileWrite);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	f.SetSize(0x100000); // 1MB
 	f.Close();
 
 	r=TheFs.Volume(volInfo);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	used2=volInfo.iSize-volInfo.iFree;
 	test(used<used2);
 
 	TInt count;
 	RFormat format;
 	r=format.Open(TheFs,gSessionPath,EQuickFormat,count);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	
     r = DoFormatSteps(format, count);
-    test(r==KErrNone);
+    test_KErrNone(r);
 	
     format.Close();
 
 	r=TheFs.Volume(volInfo);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	used2=volInfo.iSize-volInfo.iFree;
 	test(used>=used2);
 	}
@@ -535,7 +535,7 @@
 	
     TVolumeInfo volInfo;
 	TInt r=TheFs.Volume(volInfo);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	
     if (volInfo.iDrive.iMediaAtt&KMediaAttVariableSize)
 		return; // Don't bother on internal disk
@@ -550,10 +550,10 @@
 	TInt count;
 	RFormat format;
 	r=format.Open(TheFs,gSessionPath,EQuickFormat,count);
-	test(r==KErrNone);
+	test_KErrNone(r);
 
     r = DoFormatSteps(format, count);
-    test(r==KErrNone);
+    test_KErrNone(r);
 
 	format.Close();
 	}
@@ -585,33 +585,33 @@
 	
     TVolumeInfo volInfo;
 	TInt r=TheFs.Volume(volInfo);
-//	test(r==KErrCorrupt);
+//	test_Value(r, r == KErrCorrupt);
 	TInt count;
 	RFormat format;
 	r=format.Open(TheFs,gSessionPath,EQuickFormat,count);
 	r=TheFs.Volume(volInfo);
-	test(r==KErrInUse);
+	test_Value(r, r == KErrInUse);
 	r=format.Next(count);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	TDriveList driveList;
 	r=TheFs.DriveList(driveList);
-	test(r==KErrNone);
+	test_KErrNone(r);
 
     if(gDrive == EDriveC)
     {
 		r=TheFs.Volume(volInfo, gDrive);
-		test(r==KErrInUse);
+		test_Value(r, r == KErrInUse);
     } 
     else
     {
 		r=TheFs.Volume(volInfo,EDriveC);
-		test(r==KErrNone);
+		test_KErrNone(r);
 
 		r=TheFs.Volume(volInfo,gDrive);	
-		test(r==KErrInUse);
+		test_Value(r, r == KErrInUse);
 
     	r=TheFs.Volume(volInfo,gDrive);	
-		test(r==KErrInUse);
+		test_Value(r, r == KErrInUse);
     }
 
     
@@ -664,7 +664,7 @@
     fmtMode = EQuickFormat;
 
     nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt);
-    test(nRes == KErrInUse);
+    test_Value(nRes, nRes == KErrInUse);
     format.Close();
 
     buf8.SetLength(22);
@@ -679,7 +679,7 @@
 
     fmtMode = EQuickFormat;
     nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt);
-    test(nRes == KErrInUse);
+    test_Value(nRes, nRes == KErrInUse);
     format.Close();
 
     dir.Close();
@@ -707,11 +707,11 @@
 
  
 	nRes=TheFs.CheckDisk(gSessionPath);
-	test(nRes==KErrNone||nRes==KErrNotSupported);
+	test_Value(nRes, nRes == KErrNone||nRes==KErrNotSupported);
 
     buf8.SetLength(22);
     nRes = file1.Write(buf8);
-    test(nRes == KErrDisMounted);
+    test_Value(nRes, nRes == KErrDisMounted);
     file1.Close();  //-- this will make the previously "Dismounted" mount die.
     dir.Close();
 
@@ -734,11 +734,11 @@
     format.Close();
 
 	nRes=TheFs.CheckDisk(gSessionPath);
-	test(nRes==KErrNone||nRes==KErrNotSupported);
+	test_Value(nRes, nRes == KErrNone||nRes==KErrNotSupported);
 
     buf8.SetLength(22);
     nRes = file1.Write(buf8);
-    test(nRes == KErrDisMounted);
+    test_Value(nRes, nRes == KErrDisMounted);
     file1.Close();  //-- this will make the previously "Dismounted" mount die.
 
     //---------------------------------------------------------------------------------
@@ -754,7 +754,7 @@
 
     fmtMode = EQuickFormat;
     nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt);
-    test(nRes == KErrInUse);
+    test_Value(nRes, nRes == KErrInUse);
     format.Close();
 
     test(stat1.Int() == KRequestPending);
@@ -769,7 +769,7 @@
 
     buf8.SetLength(22);
     nRes = file1.Write(buf8);
-    test(nRes == KErrDisMounted);
+    test_Value(nRes, nRes == KErrDisMounted);
     file1.Close();  
 
     //---------------------------------------------------------------------------------
@@ -789,7 +789,7 @@
     format.Close();
 
     nRes = file1.Write(buf8);
-    test(nRes == KErrDisMounted);
+    test_Value(nRes, nRes == KErrDisMounted);
     file1.Close();  
 
 
@@ -801,11 +801,11 @@
     RFormat     format1;
 
     nRes = format1.Open(TheFs, drivePath, fmtMode, fmtCnt);
-    test(nRes == KErrNone);
+    test_KErrNone(nRes);
     
     fmtMode = EQuickFormat | EForceFormat; 
     nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt); 
-    test(nRes == KErrInUse);
+    test_Value(nRes, nRes == KErrInUse);
     format.Close();
 
     format1.Close();
@@ -813,11 +813,11 @@
     //-- 5.1 check that forced formatting will fail when there are "disk access" objects opened RRawDisk
     RRawDisk    rawDisk;
     nRes = rawDisk.Open(TheFs, gDrive);
-    test(nRes == KErrNone);
+    test_KErrNone(nRes);
 
     fmtMode = EQuickFormat | EForceFormat; 
     nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt); 
-    test(nRes == KErrInUse);
+    test_Value(nRes, nRes == KErrInUse);
     format.Close();
 
     rawDisk.Close();
@@ -847,7 +847,7 @@
     {
         fmtMode = EQuickFormat | EForceFormat; 
         nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt); 
-        test(nRes == KErrInUse);
+        test_Value(nRes, nRes == KErrInUse);
         format.Close();
     }
     
@@ -867,13 +867,13 @@
 
     TInt r;
     r = TheFs.CharToDrive(gDriveToTest, gDrive);
-    test(r == KErrNone);
+    test_KErrNone(r);
 
     //-- set up console output 
     F32_Test_Utils::SetConsole(test.Console()); 
     
     TInt nRes=TheFs.CharToDrive(gDriveToTest, gDrive);
-    test(nRes==KErrNone);
+    test_KErrNone(nRes);
     
     PrintDrvInfo(TheFs, gDrive);
 
@@ -894,7 +894,7 @@
     TestFormat_ForceDismount();
 
 	r=TheFs.CheckDisk(gSessionPath);
-	test(r==KErrNone||r==KErrNotSupported);
+	test_Value(r, r == KErrNone||r==KErrNotSupported);
 	}