kerneltest/f32test/server/t_fsys.cpp
branchRCL_3
changeset 256 c1f20ce4abcf
parent 110 c734af59ce98
child 257 3e88ff8f41d5
--- a/kerneltest/f32test/server/t_fsys.cpp	Thu Aug 19 11:14:22 2010 +0300
+++ b/kerneltest/f32test/server/t_fsys.cpp	Tue Aug 31 16:34:26 2010 +0300
@@ -36,10 +36,10 @@
     for(TInt i=EDriveA;i<KMaxDrives;++i)
         {
         r=TheFs.FileSystemName(name,i);
-        test(r==KErrNone || r==KErrNotFound);
+        test_Value(r, r == KErrNone || r==KErrNotFound);
         TChar c;
         r=RFs::DriveToChar(i,c);
-        test(r==KErrNone);
+        test_KErrNone(r);
         if(name.Length())       
             test.Printf(_L("File System Name on drive %c is %S\n"),(char)c,&name);
         else
@@ -55,10 +55,10 @@
     TInt r;
     TFullName oldSess, newSess;
     r=TheFs.SessionPath(oldSess);
-    test(r==KErrNone);
+    test_KErrNone(r);
     TChar c;
     r=TheFs.DriveToChar(aDrive,c);
-    test(r==KErrNone);
+    test_KErrNone(r);
     newSess.Append(c);
     newSess.Append(':');
     newSess.Append('\\');
@@ -66,7 +66,7 @@
     TBuf<128> b;
     TDriveInfo di;
     r=TheFs.Drive(di,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     b.Format(_L("Test dismounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt);
     test.Next(b);
     
@@ -74,36 +74,36 @@
     test.Next(_L("Test cannot dismount on Rom drive"));
     TFullName zName;
     r=TheFs.FileSystemName(zName,EDriveZ);
-    test(r==KErrNone);
+    test_KErrNone(r);
     r=TheFs.DismountFileSystem(zName,EDriveZ);
     test.Printf(_L("r=%d"),r);
     // NB if paging is enabled on a ROFS partition which is part of the composite file system then the 
     // likelihood is that there will be a at least one file clamped: in this case there error will be KErrInUse
-    test(r==KErrAccessDenied || r==KErrInUse);
+    test_Value(r, r == KErrAccessDenied || r==KErrInUse);
 
     // Test cannot dismount on wrong drive
     test.Next(_L("Test cannot dismount on wrong drive"));
     r=TheFs.DismountFileSystem(aFs,EDriveA);
-    test(r==KErrNotReady);
+    test_Value(r, r == KErrNotReady);
 
     // Test cannot dismount with wrong name
     test.Next(_L("Test cannot dismount with wrong file system name"));
     r=TheFs.DismountFileSystem(_L("abc"),aDrive);
-    test(r==KErrNotFound);
+    test_Value(r, r == KErrNotFound);
  
     // Test cannot dismount with a file open
     test.Next(_L("Test cannot dismount with a file open"));
     r=TheFs.SetSessionPath(newSess);
     RFile file;
     r=file.Replace(TheFs,_L("abc"),EFileShareAny);
-    test(r==KErrNone);
+    test_KErrNone(r);
     r=TheFs.SessionPath(newSess);
     TBool open;
     r=TheFs.IsFileOpen(_L("abc"),open);
-    test(r==KErrNone);
+    test_KErrNone(r);
     test(open);
     r=TheFs.DismountFileSystem(aFs,aDrive);
-    test(r==KErrInUse);
+    test_Value(r, r == KErrInUse);
     file.Close();
 
     // Now test dismount works
@@ -116,10 +116,10 @@
         }
     TFullName n;
     r=TheFs.FileSystemName(n,aDrive);
-    test(r==KErrNone || r==KErrNotFound);
+    test_Value(r, r == KErrNone || r==KErrNotFound);
     test(!n.Length());
     r=file.Replace(TheFs,_L("abc"),EFileShareAny);
-    test(r==KErrNotReady);
+    test_Value(r, r == KErrNotReady);
     file.Close();
 
     r=TheFs.MountFileSystem(aFs,aDrive);
@@ -129,13 +129,13 @@
         test(EFalse);
         }
     r=TheFs.FileSystemName(n,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     test(n.Compare(aFs)==0);
     r=file.Replace(TheFs,_L("abc"),EFileShareAny); // ??? bang
-    test(r==KErrNone);
+    test_KErrNone(r);
     file.Close();
     r=TheFs.SetSessionPath(oldSess);
-    test(r==KErrNone);
+    test_KErrNone(r);
     }
 
 static void TestDismountFileSystem(TInt aDrive)
@@ -144,7 +144,7 @@
     TInt r;
     TFullName name;
     r=TheFs.FileSystemName(name,aDrive);
-    test(r==KErrNone || r==KErrNotFound);
+    test_Value(r, r == KErrNone || r==KErrNotFound);
     if(name.Length())
         CheckDismount(name,aDrive);
     }
@@ -158,10 +158,10 @@
     TBuf<64> b;
     TChar c;
     TInt r=TheFs.DriveToChar(aDrive,c);
-    test(r==KErrNone);
+    test_KErrNone(r);
     TDriveInfo di;
     r=TheFs.Drive(di,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     b.Format(_L("Test mounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt);
     test.Next(b);
 
@@ -177,7 +177,7 @@
     r=TheFs.FileSystemName(oldFs,aDrive);
 //  TFileName oldFs;
 //  r=TheFs.FileSystemName(oldFs,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     r=TheFs.DismountFileSystem(oldFs,aDrive);
     if(r!=KErrNone)
         {
@@ -185,17 +185,17 @@
         test(EFalse);
         }
     r=TheFs.MountFileSystem(_L("Test"),aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
 
     TFileName newFs;
     r=TheFs.FileSystemName(newFs,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     test(newFs.Compare(_L("Test"))==0);
 
     // Check attributes
     TDriveInfo info;
     r=TheFs.Drive(info,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
  
     test.Printf(_L("iType=%d,iConnectionBusType=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
         (TUint)info.iConnectionBusType,info.iDriveAtt,info.iMediaAtt);
@@ -208,14 +208,14 @@
         test(EFalse);
         }
     r=TheFs.FileSystemName(newFs,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     test(newFs.Compare(_L("Test"))==0);
 
     r=TheFs.DismountFileSystem(newFs,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
 
     r=TheFs.MountFileSystem(oldFs,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     }
 #endif
 
@@ -236,10 +236,10 @@
 
     r = TheFs.AddFileSystem(KFsNm);
     test.Printf(_L("afs: r = %d\n"), r);
-    test(r == KErrNone || r == KErrAlreadyExists);
+    test_Value(r, r == KErrNone || r == KErrAlreadyExists);
     test.Next(_L("mounting FAT on drive R"));
     r = TheFs.MountFileSystem(KFileSystemName_FAT, EDriveR);
-    test(r == KErrArgument);
+    test_Value(r, r == KErrArgument);
     
     test.End();
     }
@@ -256,10 +256,10 @@
     TBuf<64> b;
     TChar c;
     TInt r=TheFs.DriveToChar(aDrive,c);
-    test(r==KErrNone);
+    test_KErrNone(r);
     TDriveInfo di;
     r=TheFs.Drive(di,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     b.Format(_L("Test mounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt);
     test.Next(b);
 
@@ -273,7 +273,7 @@
 
     TFullName oldFs;
     r=TheFs.FileSystemName(oldFs,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     r=TheFs.DismountFileSystem(oldFs,aDrive);
     if(r!=KErrNone)
         {
@@ -281,11 +281,11 @@
         test(EFalse);
         }
     r=TheFs.MountFileSystem(_L("Test2"),aDrive);
-    test(r == KErrCorrupt);
+    test_Value(r, r == KErrCorrupt);
 
     TFileName newFs;
     r=TheFs.FileSystemName(newFs,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     test(newFs.Compare(_L("Test2"))==0);
 
     // Get the number of remounts by checking the volume attributes -
@@ -293,7 +293,7 @@
     TDriveInfo info;
     TInt remounts;
     r=TheFs.Drive(info,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
         (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt);
     remounts = (TInt) info.iBattery;
@@ -309,10 +309,10 @@
         TEntry entry;
         _LIT(KNonExistantFilename, "NONEXISTANT_FILENAME.DLL");
         r = TheFs.Entry(KNonExistantFilename, entry);
-        test(r == KErrCorrupt);
+        test_Value(r, r == KErrCorrupt);
         }
     r=TheFs.Drive(info,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
         (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt);
     remounts = (TInt) info.iBattery;
@@ -328,10 +328,10 @@
         TEntry entry;
         _LIT(KNonExistantFilename, "NONEXISTANT_FILENAME.DLL");
         r = TheFs.Entry(KNonExistantFilename, entry);
-        test(r == KErrCorrupt);
+        test_Value(r, r == KErrCorrupt);
         }
     r=TheFs.Drive(info,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
         (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt);
     remounts = (TInt) info.iBattery;
@@ -341,9 +341,9 @@
 
 
     r=TheFs.DismountFileSystem(newFs,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     r=TheFs.MountFileSystem(oldFs,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     
     r=TheFs.RemoveFileSystem(_L("Test2"));
     if(r!=KErrNone)
@@ -366,7 +366,7 @@
     
     TDriveInfo drvInfo;
     nRes=TheFs.Drive(drvInfo, currDrvNum);
-    test(nRes==KErrNone);
+    test_KErrNone(nRes);
 
     if(drvInfo.iDriveAtt & (KDriveAttRom | KDriveAttRedirected | KDriveAttSubsted))
     {
@@ -385,7 +385,7 @@
             {
             // found a non-extant drive, test it...
             nRes = TheFs.GetMediaSerialNumber(serNum, drvNum);
-            test(nRes == KErrNotReady);
+            test_Value(nRes, nRes == KErrNotReady);
             break;
             }
         }
@@ -406,15 +406,15 @@
     MakeDir(substPath);
   
     nRes = TheFs.SetSubst(substPath, KSubstDrv);
-    test(nRes == KErrNone);
+    test_KErrNone(nRes);
 
     //-- an attempt to obtain Media Serial Number on a substed drive shall result in KErrNotSupported
     nRes = TheFs.GetMediaSerialNumber(serNum, KSubstDrv);
-    test(nRes == KErrNotSupported);
+    test_Value(nRes, nRes == KErrNotSupported);
 
     //-- delete substed drive
     nRes = TheFs.SetSubst(_L(""), KSubstDrv);
-    test(nRes == KErrNone);
+    test_KErrNone(nRes);
 }
 
 
@@ -453,19 +453,19 @@
             {
             test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
             r=TheFs.Drive(driveInfo, i);
-            test(r==KErrNone);
+            test_KErrNone(r);
             
             if (driveInfo.iType==EMediaNotPresent)
                 {
                 test.Printf(_L("The media is not present.\n"));
                 r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName);
-                test(r == KErrNone || r == KErrNotReady);
+                test_Value(r, r == KErrNone || r == KErrNotReady);
                 }
             else if (driveInfo.iType==EMediaCdRom)
                 {
                 test.Printf(_L("CD ROM with no media will report not ready!\n"));
                 r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName);
-                test(r == KErrNotReady);
+                test_Value(r, r == KErrNotReady);
                 }
             else
                 {
@@ -474,7 +474,7 @@
 
                 //-- test EIsDriveSync command
                 r = TheFs.QueryVolumeInfoExt(i, EIsDriveSync, fDrvSyncBuf);
-                test(r == KErrNone);
+                test_KErrNone(r);
                 if(fDrvSyncBuf())
                     test.Printf(_L("The drive is Synchronous.\n"));
                 else
@@ -485,7 +485,7 @@
                 // if Fat, testing returning sub type name
                 if (fsName.CompareF(KFileSystemName_FAT)==0)
                     {
-                    test(r == KErrNone);
+                    test_KErrNone(r);
                     test(subName().CompareF(KFSSubType_FAT12)==0 ||
                          subName().CompareF(KFSSubType_FAT16)==0 ||
                          subName().CompareF(KFSSubType_FAT32)==0);
@@ -495,27 +495,27 @@
                 // if Lffs, testing returning file system name
                 if (fsName.CompareF(_L("Lffs"))==0)
                     {
-                    test(r == KErrNone);
+                    test_KErrNone(r);
                     test(subName().CompareF(_L("Lffs"))==0);
                     continue;
                     }
                 // if rofs, testing returning file system name
                 if (fsName.CompareF(_L("rofs"))==0)
                     {
-                    test(r == KErrNone);
+                    test_KErrNone(r);
                     test(subName().CompareF(_L("rofs"))==0);
                     continue;
                     }
                 // if Composite, testing returning file system name
                 if (fsName.CompareF(_L("Composite"))==0)
                     {
-                    test(r == KErrNone);
+                    test_KErrNone(r);
                     test(subName().CompareF(_L("Composite"))==0);
                     continue;
                     }
 
                 // else
-                test(r == KErrNone);
+                test_KErrNone(r);
                 test(subName().Length()!=0);
                 
                 }
@@ -554,18 +554,18 @@
             test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
 
             r=TheFs.Drive(driveInfo, i);
-            test(r==KErrNone);
+            test_KErrNone(r);
             // if no media present
             if (driveInfo.iType==EMediaNotPresent)
                 {
                 r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
-                test(r == KErrNone || r == KErrNotReady);
+                test_Value(r, r == KErrNone || r == KErrNotReady);
                 }
             else if (driveInfo.iType==EMediaCdRom)
                 {
                 test.Printf(_L("CD ROM with no media!\n"));
                 r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
-                test(r == KErrNone || r == KErrNotReady);
+                test_Value(r, r == KErrNone || r == KErrNotReady);
                 }
             else
                 {
@@ -602,7 +602,7 @@
                         }
                         TPckg<TLocalDriveCapsV7> capsPckg(DriveCapsV7);
                         r=drive.Caps(capsPckg);
-                        test(r==KErrNone);
+                        test_KErrNone(r);
                         drive.Disconnect();
                         if(DriveCapsV7.iObjectModeSize == 0)
                         {
@@ -663,18 +663,18 @@
             {
             test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
             r=TheFs.Drive(driveInfo, i);
-            test(r==KErrNone);
+            test_KErrNone(r);
             // if no media present
             if (driveInfo.iType==EMediaNotPresent)
                 {
                 r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
-                test(r == KErrNone || r == KErrNotReady);
+                test_Value(r, r == KErrNone || r == KErrNotReady);
                 }
             else if (driveInfo.iType==EMediaCdRom)
                 {
                 test.Printf(_L("CD ROM with no media will report not ready!\n"));
                 r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
-                test(r == KErrNotReady);
+                test_Value(r, r == KErrNotReady);
                 }
             else
                 {
@@ -725,7 +725,7 @@
                         }
                     TPckg<TLocalDriveCapsV7> capsPckg(DriveCapsV7);
                     r=drive.Caps(capsPckg);
-                    test(r==KErrNone);
+                    test_KErrNone(r);
                     if ((fsName.CompareF(_L("Lffs"))==0) && (DriveCapsV7.iObjectModeSize != 0))
                         {                   
                         test(ioInfo().iBlockSize == (TInt) DriveCapsV7.iObjectModeSize);
@@ -780,7 +780,7 @@
             test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
             r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName);
             r1 = TheFs.FileSystemSubType(i, subName1);
-            test(r==r1);
+            test_Value(r, r == r1);
             if (subName().Length())
                 {
                 test(subName().CompareF(subName1)==0);
@@ -822,7 +822,7 @@
             test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
             r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
             r1 = TheFs.VolumeIOParam(i, ioInfo1);
-            test(r==r1);
+            test_Value(r, r == r1);
             test(ioInfo().iBlockSize == ioInfo1.iBlockSize);
             test(ioInfo().iClusterSize == ioInfo1.iClusterSize);
             test(ioInfo().iRecReadBufSize == ioInfo1.iRecReadBufSize);
@@ -865,7 +865,7 @@
         }
     TFSName oldFs;
     r = TheFs.FileSystemName(oldFs,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     r = TheFs.DismountFileSystem(oldFs,aDrive);
     if (r != KErrNone)
         {
@@ -873,29 +873,29 @@
         test(EFalse);
         }
     r = TheFs.MountFileSystem(_L("Test3"),aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     TFSName newFs;
     r = TheFs.FileSystemName(newFs,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     test(newFs.Compare(_L("Test3"))==0);
 
     // Sub type name query: 
     TPckgBuf<TFSName> subNameP;
     r = TheFs.QueryVolumeInfoExt(aDrive, EFileSystemSubType, subNameP);
-    test(r==KErrNone);
+    test_KErrNone(r);
     test(subNameP() == _L("Test3SubType"));
 
     // Cluster size querys:
     TPckgBuf<TVolumeIOParamInfo> ioInfoP;
     r = TheFs.QueryVolumeInfoExt(aDrive, EIOParamInfo, ioInfoP);
-    test(r==KErrNone);
+    test_KErrNone(r);
     test(ioInfoP().iClusterSize==1024);
 
     // Mount the original file system back
     r=TheFs.DismountFileSystem(newFs,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     r=TheFs.MountFileSystem(oldFs,aDrive);
-    test(r==KErrNone);
+    test_KErrNone(r);
     
     r=TheFs.RemoveFileSystem(_L("Test3"));
     if(r!=KErrNone)