kerneltest/f32test/server/t_fsys.cpp
changeset 122 70ba09fd07a5
parent 33 0173bcd7697c
child 254 1560c419b176
equal deleted inserted replaced
121:661475905584 122:70ba09fd07a5
    34     TFullName name;
    34     TFullName name;
    35     TInt r;
    35     TInt r;
    36     for(TInt i=EDriveA;i<KMaxDrives;++i)
    36     for(TInt i=EDriveA;i<KMaxDrives;++i)
    37         {
    37         {
    38         r=TheFs.FileSystemName(name,i);
    38         r=TheFs.FileSystemName(name,i);
    39         test(r==KErrNone || r==KErrNotFound);
    39         test_Value(r, r == KErrNone || r==KErrNotFound);
    40         TChar c;
    40         TChar c;
    41         r=RFs::DriveToChar(i,c);
    41         r=RFs::DriveToChar(i,c);
    42         test(r==KErrNone);
    42         test_KErrNone(r);
    43         if(name.Length())       
    43         if(name.Length())       
    44             test.Printf(_L("File System Name on drive %c is %S\n"),(char)c,&name);
    44             test.Printf(_L("File System Name on drive %c is %S\n"),(char)c,&name);
    45         else
    45         else
    46             test.Printf(_L("No file system on drive %c\n"),(char)c);
    46             test.Printf(_L("No file system on drive %c\n"),(char)c);
    47         }
    47         }
    53     if (aDrive==EDriveC) // ??? Can't test on C: - see below
    53     if (aDrive==EDriveC) // ??? Can't test on C: - see below
    54         return;
    54         return;
    55     TInt r;
    55     TInt r;
    56     TFullName oldSess, newSess;
    56     TFullName oldSess, newSess;
    57     r=TheFs.SessionPath(oldSess);
    57     r=TheFs.SessionPath(oldSess);
    58     test(r==KErrNone);
    58     test_KErrNone(r);
    59     TChar c;
    59     TChar c;
    60     r=TheFs.DriveToChar(aDrive,c);
    60     r=TheFs.DriveToChar(aDrive,c);
    61     test(r==KErrNone);
    61     test_KErrNone(r);
    62     newSess.Append(c);
    62     newSess.Append(c);
    63     newSess.Append(':');
    63     newSess.Append(':');
    64     newSess.Append('\\');
    64     newSess.Append('\\');
    65 
    65 
    66     TBuf<128> b;
    66     TBuf<128> b;
    67     TDriveInfo di;
    67     TDriveInfo di;
    68     r=TheFs.Drive(di,aDrive);
    68     r=TheFs.Drive(di,aDrive);
    69     test(r==KErrNone);
    69     test_KErrNone(r);
    70     b.Format(_L("Test dismounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt);
    70     b.Format(_L("Test dismounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt);
    71     test.Next(b);
    71     test.Next(b);
    72     
    72     
    73     // Test cannot dismount on rom drive
    73     // Test cannot dismount on rom drive
    74     test.Next(_L("Test cannot dismount on Rom drive"));
    74     test.Next(_L("Test cannot dismount on Rom drive"));
    75     TFullName zName;
    75     TFullName zName;
    76     r=TheFs.FileSystemName(zName,EDriveZ);
    76     r=TheFs.FileSystemName(zName,EDriveZ);
    77     test(r==KErrNone);
    77     test_KErrNone(r);
    78     r=TheFs.DismountFileSystem(zName,EDriveZ);
    78     r=TheFs.DismountFileSystem(zName,EDriveZ);
    79     test.Printf(_L("r=%d"),r);
    79     test.Printf(_L("r=%d"),r);
    80     // NB if paging is enabled on a ROFS partition which is part of the composite file system then the 
    80     // NB if paging is enabled on a ROFS partition which is part of the composite file system then the 
    81     // likelihood is that there will be a at least one file clamped: in this case there error will be KErrInUse
    81     // likelihood is that there will be a at least one file clamped: in this case there error will be KErrInUse
    82     test(r==KErrAccessDenied || r==KErrInUse);
    82     test_Value(r, r == KErrAccessDenied || r==KErrInUse);
    83 
    83 
    84     // Test cannot dismount on wrong drive
    84     // Test cannot dismount on wrong drive
    85     test.Next(_L("Test cannot dismount on wrong drive"));
    85     test.Next(_L("Test cannot dismount on wrong drive"));
    86     r=TheFs.DismountFileSystem(aFs,EDriveA);
    86     r=TheFs.DismountFileSystem(aFs,EDriveA);
    87     test(r==KErrNotReady);
    87     test_Value(r, r == KErrNotReady);
    88 
    88 
    89     // Test cannot dismount with wrong name
    89     // Test cannot dismount with wrong name
    90     test.Next(_L("Test cannot dismount with wrong file system name"));
    90     test.Next(_L("Test cannot dismount with wrong file system name"));
    91     r=TheFs.DismountFileSystem(_L("abc"),aDrive);
    91     r=TheFs.DismountFileSystem(_L("abc"),aDrive);
    92     test(r==KErrNotFound);
    92     test_Value(r, r == KErrNotFound);
    93  
    93  
    94     // Test cannot dismount with a file open
    94     // Test cannot dismount with a file open
    95     test.Next(_L("Test cannot dismount with a file open"));
    95     test.Next(_L("Test cannot dismount with a file open"));
    96     r=TheFs.SetSessionPath(newSess);
    96     r=TheFs.SetSessionPath(newSess);
    97     RFile file;
    97     RFile file;
    98     r=file.Replace(TheFs,_L("abc"),EFileShareAny);
    98     r=file.Replace(TheFs,_L("abc"),EFileShareAny);
    99     test(r==KErrNone);
    99     test_KErrNone(r);
   100     r=TheFs.SessionPath(newSess);
   100     r=TheFs.SessionPath(newSess);
   101     TBool open;
   101     TBool open;
   102     r=TheFs.IsFileOpen(_L("abc"),open);
   102     r=TheFs.IsFileOpen(_L("abc"),open);
   103     test(r==KErrNone);
   103     test_KErrNone(r);
   104     test(open);
   104     test(open);
   105     r=TheFs.DismountFileSystem(aFs,aDrive);
   105     r=TheFs.DismountFileSystem(aFs,aDrive);
   106     test(r==KErrInUse);
   106     test_Value(r, r == KErrInUse);
   107     file.Close();
   107     file.Close();
   108 
   108 
   109     // Now test dismount works
   109     // Now test dismount works
   110     test.Next(_L("Test dismounts OK"));
   110     test.Next(_L("Test dismounts OK"));
   111     r=TheFs.DismountFileSystem(aFs,aDrive);
   111     r=TheFs.DismountFileSystem(aFs,aDrive);
   114         test.Printf(_L("Error = %d"),r);    
   114         test.Printf(_L("Error = %d"),r);    
   115         test(EFalse);
   115         test(EFalse);
   116         }
   116         }
   117     TFullName n;
   117     TFullName n;
   118     r=TheFs.FileSystemName(n,aDrive);
   118     r=TheFs.FileSystemName(n,aDrive);
   119     test(r==KErrNone || r==KErrNotFound);
   119     test_Value(r, r == KErrNone || r==KErrNotFound);
   120     test(!n.Length());
   120     test(!n.Length());
   121     r=file.Replace(TheFs,_L("abc"),EFileShareAny);
   121     r=file.Replace(TheFs,_L("abc"),EFileShareAny);
   122     test(r==KErrNotReady);
   122     test_Value(r, r == KErrNotReady);
   123     file.Close();
   123     file.Close();
   124 
   124 
   125     r=TheFs.MountFileSystem(aFs,aDrive);
   125     r=TheFs.MountFileSystem(aFs,aDrive);
   126     if(r!=KErrNone) 
   126     if(r!=KErrNone) 
   127         {
   127         {
   128         test.Printf(_L("error = %d\n"),r);
   128         test.Printf(_L("error = %d\n"),r);
   129         test(EFalse);
   129         test(EFalse);
   130         }
   130         }
   131     r=TheFs.FileSystemName(n,aDrive);
   131     r=TheFs.FileSystemName(n,aDrive);
   132     test(r==KErrNone);
   132     test_KErrNone(r);
   133     test(n.Compare(aFs)==0);
   133     test(n.Compare(aFs)==0);
   134     r=file.Replace(TheFs,_L("abc"),EFileShareAny); // ??? bang
   134     r=file.Replace(TheFs,_L("abc"),EFileShareAny); // ??? bang
   135     test(r==KErrNone);
   135     test_KErrNone(r);
   136     file.Close();
   136     file.Close();
   137     r=TheFs.SetSessionPath(oldSess);
   137     r=TheFs.SetSessionPath(oldSess);
   138     test(r==KErrNone);
   138     test_KErrNone(r);
   139     }
   139     }
   140 
   140 
   141 static void TestDismountFileSystem(TInt aDrive)
   141 static void TestDismountFileSystem(TInt aDrive)
   142     {
   142     {
   143 
   143 
   144     TInt r;
   144     TInt r;
   145     TFullName name;
   145     TFullName name;
   146     r=TheFs.FileSystemName(name,aDrive);
   146     r=TheFs.FileSystemName(name,aDrive);
   147     test(r==KErrNone || r==KErrNotFound);
   147     test_Value(r, r == KErrNone || r==KErrNotFound);
   148     if(name.Length())
   148     if(name.Length())
   149         CheckDismount(name,aDrive);
   149         CheckDismount(name,aDrive);
   150     }
   150     }
   151 
   151 
   152 #if defined(__EPOC32__)
   152 #if defined(__EPOC32__)
   156 //
   156 //
   157     {
   157     {
   158     TBuf<64> b;
   158     TBuf<64> b;
   159     TChar c;
   159     TChar c;
   160     TInt r=TheFs.DriveToChar(aDrive,c);
   160     TInt r=TheFs.DriveToChar(aDrive,c);
   161     test(r==KErrNone);
   161     test_KErrNone(r);
   162     TDriveInfo di;
   162     TDriveInfo di;
   163     r=TheFs.Drive(di,aDrive);
   163     r=TheFs.Drive(di,aDrive);
   164     test(r==KErrNone);
   164     test_KErrNone(r);
   165     b.Format(_L("Test mounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt);
   165     b.Format(_L("Test mounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt);
   166     test.Next(b);
   166     test.Next(b);
   167 
   167 
   168     test.Next(_L("Test mounting of test file system"));
   168     test.Next(_L("Test mounting of test file system"));
   169     r=TheFs.AddFileSystem(_L("T_TFSYS"));
   169     r=TheFs.AddFileSystem(_L("T_TFSYS"));
   175 
   175 
   176     TFullName oldFs;
   176     TFullName oldFs;
   177     r=TheFs.FileSystemName(oldFs,aDrive);
   177     r=TheFs.FileSystemName(oldFs,aDrive);
   178 //  TFileName oldFs;
   178 //  TFileName oldFs;
   179 //  r=TheFs.FileSystemName(oldFs,aDrive);
   179 //  r=TheFs.FileSystemName(oldFs,aDrive);
   180     test(r==KErrNone);
   180     test_KErrNone(r);
   181     r=TheFs.DismountFileSystem(oldFs,aDrive);
   181     r=TheFs.DismountFileSystem(oldFs,aDrive);
   182     if(r!=KErrNone)
   182     if(r!=KErrNone)
   183         {
   183         {
   184         test.Printf(_L("Error = %d"),r);    
   184         test.Printf(_L("Error = %d"),r);    
   185         test(EFalse);
   185         test(EFalse);
   186         }
   186         }
   187     r=TheFs.MountFileSystem(_L("Test"),aDrive);
   187     r=TheFs.MountFileSystem(_L("Test"),aDrive);
   188     test(r==KErrNone);
   188     test_KErrNone(r);
   189 
   189 
   190     TFileName newFs;
   190     TFileName newFs;
   191     r=TheFs.FileSystemName(newFs,aDrive);
   191     r=TheFs.FileSystemName(newFs,aDrive);
   192     test(r==KErrNone);
   192     test_KErrNone(r);
   193     test(newFs.Compare(_L("Test"))==0);
   193     test(newFs.Compare(_L("Test"))==0);
   194 
   194 
   195     // Check attributes
   195     // Check attributes
   196     TDriveInfo info;
   196     TDriveInfo info;
   197     r=TheFs.Drive(info,aDrive);
   197     r=TheFs.Drive(info,aDrive);
   198     test(r==KErrNone);
   198     test_KErrNone(r);
   199  
   199  
   200     test.Printf(_L("iType=%d,iConnectionBusType=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
   200     test.Printf(_L("iType=%d,iConnectionBusType=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
   201         (TUint)info.iConnectionBusType,info.iDriveAtt,info.iMediaAtt);
   201         (TUint)info.iConnectionBusType,info.iDriveAtt,info.iMediaAtt);
   202 
   202 
   203     //Try to remove filesystem without dismounting.
   203     //Try to remove filesystem without dismounting.
   206         {
   206         {
   207         test.Printf(_L("error=%d"),r);
   207         test.Printf(_L("error=%d"),r);
   208         test(EFalse);
   208         test(EFalse);
   209         }
   209         }
   210     r=TheFs.FileSystemName(newFs,aDrive);
   210     r=TheFs.FileSystemName(newFs,aDrive);
   211     test(r==KErrNone);
   211     test_KErrNone(r);
   212     test(newFs.Compare(_L("Test"))==0);
   212     test(newFs.Compare(_L("Test"))==0);
   213 
   213 
   214     r=TheFs.DismountFileSystem(newFs,aDrive);
   214     r=TheFs.DismountFileSystem(newFs,aDrive);
   215     test(r==KErrNone);
   215     test_KErrNone(r);
   216 
   216 
   217     r=TheFs.MountFileSystem(oldFs,aDrive);
   217     r=TheFs.MountFileSystem(oldFs,aDrive);
   218     test(r==KErrNone);
   218     test_KErrNone(r);
   219     }
   219     }
   220 #endif
   220 #endif
   221 
   221 
   222 static void TestMountInvalidDrive()
   222 static void TestMountInvalidDrive()
   223 //
   223 //
   234     _LIT(KFsNm, "ELOCAL");
   234     _LIT(KFsNm, "ELOCAL");
   235 #endif
   235 #endif
   236 
   236 
   237     r = TheFs.AddFileSystem(KFsNm);
   237     r = TheFs.AddFileSystem(KFsNm);
   238     test.Printf(_L("afs: r = %d\n"), r);
   238     test.Printf(_L("afs: r = %d\n"), r);
   239     test(r == KErrNone || r == KErrAlreadyExists);
   239     test_Value(r, r == KErrNone || r == KErrAlreadyExists);
   240     test.Next(_L("mounting FAT on drive R"));
   240     test.Next(_L("mounting FAT on drive R"));
   241     r = TheFs.MountFileSystem(KFileSystemName_FAT, EDriveR);
   241     r = TheFs.MountFileSystem(KFileSystemName_FAT, EDriveR);
   242     test(r == KErrArgument);
   242     test_Value(r, r == KErrArgument);
   243     
   243     
   244     test.End();
   244     test.End();
   245     }
   245     }
   246 
   246 
   247 // Additional step for INC083446: Corrupted miniSD not detected as corrupted by phone 
   247 // Additional step for INC083446: Corrupted miniSD not detected as corrupted by phone 
   254         return;
   254         return;
   255 
   255 
   256     TBuf<64> b;
   256     TBuf<64> b;
   257     TChar c;
   257     TChar c;
   258     TInt r=TheFs.DriveToChar(aDrive,c);
   258     TInt r=TheFs.DriveToChar(aDrive,c);
   259     test(r==KErrNone);
   259     test_KErrNone(r);
   260     TDriveInfo di;
   260     TDriveInfo di;
   261     r=TheFs.Drive(di,aDrive);
   261     r=TheFs.Drive(di,aDrive);
   262     test(r==KErrNone);
   262     test_KErrNone(r);
   263     b.Format(_L("Test mounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt);
   263     b.Format(_L("Test mounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt);
   264     test.Next(b);
   264     test.Next(b);
   265 
   265 
   266     test.Next(_L("Test mounting of test file system"));
   266     test.Next(_L("Test mounting of test file system"));
   267     r=TheFs.AddFileSystem(_L("T_TFSYS2"));
   267     r=TheFs.AddFileSystem(_L("T_TFSYS2"));
   271         test(EFalse);
   271         test(EFalse);
   272         }
   272         }
   273 
   273 
   274     TFullName oldFs;
   274     TFullName oldFs;
   275     r=TheFs.FileSystemName(oldFs,aDrive);
   275     r=TheFs.FileSystemName(oldFs,aDrive);
   276     test(r==KErrNone);
   276     test_KErrNone(r);
   277     r=TheFs.DismountFileSystem(oldFs,aDrive);
   277     r=TheFs.DismountFileSystem(oldFs,aDrive);
   278     if(r!=KErrNone)
   278     if(r!=KErrNone)
   279         {
   279         {
   280         test.Printf(_L("Error = %d"),r);    
   280         test.Printf(_L("Error = %d"),r);    
   281         test(EFalse);
   281         test(EFalse);
   282         }
   282         }
   283     r=TheFs.MountFileSystem(_L("Test2"),aDrive);
   283     r=TheFs.MountFileSystem(_L("Test2"),aDrive);
   284     test(r == KErrCorrupt);
   284     test_Value(r, r == KErrCorrupt);
   285 
   285 
   286     TFileName newFs;
   286     TFileName newFs;
   287     r=TheFs.FileSystemName(newFs,aDrive);
   287     r=TheFs.FileSystemName(newFs,aDrive);
   288     test(r==KErrNone);
   288     test_KErrNone(r);
   289     test(newFs.Compare(_L("Test2"))==0);
   289     test(newFs.Compare(_L("Test2"))==0);
   290 
   290 
   291     // Get the number of remounts by checking the volume attributes -
   291     // Get the number of remounts by checking the volume attributes -
   292     // T_TFSYS2 hijacks the iBattery member to report back the number of times MountL() has been called
   292     // T_TFSYS2 hijacks the iBattery member to report back the number of times MountL() has been called
   293     TDriveInfo info;
   293     TDriveInfo info;
   294     TInt remounts;
   294     TInt remounts;
   295     r=TheFs.Drive(info,aDrive);
   295     r=TheFs.Drive(info,aDrive);
   296     test(r==KErrNone);
   296     test_KErrNone(r);
   297     test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
   297     test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
   298         (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt);
   298         (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt);
   299     remounts = (TInt) info.iBattery;
   299     remounts = (TInt) info.iBattery;
   300     test.Printf(_L("Initial remounts = %d"), remounts);
   300     test.Printf(_L("Initial remounts = %d"), remounts);
   301 
   301 
   307     for (entryAttempts=0; entryAttempts < KEntryAttempts; entryAttempts++)
   307     for (entryAttempts=0; entryAttempts < KEntryAttempts; entryAttempts++)
   308         {
   308         {
   309         TEntry entry;
   309         TEntry entry;
   310         _LIT(KNonExistantFilename, "NONEXISTANT_FILENAME.DLL");
   310         _LIT(KNonExistantFilename, "NONEXISTANT_FILENAME.DLL");
   311         r = TheFs.Entry(KNonExistantFilename, entry);
   311         r = TheFs.Entry(KNonExistantFilename, entry);
   312         test(r == KErrCorrupt);
   312         test_Value(r, r == KErrCorrupt);
   313         }
   313         }
   314     r=TheFs.Drive(info,aDrive);
   314     r=TheFs.Drive(info,aDrive);
   315     test(r==KErrNone);
   315     test_KErrNone(r);
   316     test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
   316     test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
   317         (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt);
   317         (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt);
   318     remounts = (TInt) info.iBattery;
   318     remounts = (TInt) info.iBattery;
   319     test.Printf(_L("Remounts = %d"), remounts);
   319     test.Printf(_L("Remounts = %d"), remounts);
   320     test(remounts ==  KMaxMountFailures);
   320     test(remounts ==  KMaxMountFailures);
   326     for (entryAttempts=0; entryAttempts < KEntryAttempts; entryAttempts++)
   326     for (entryAttempts=0; entryAttempts < KEntryAttempts; entryAttempts++)
   327         {
   327         {
   328         TEntry entry;
   328         TEntry entry;
   329         _LIT(KNonExistantFilename, "NONEXISTANT_FILENAME.DLL");
   329         _LIT(KNonExistantFilename, "NONEXISTANT_FILENAME.DLL");
   330         r = TheFs.Entry(KNonExistantFilename, entry);
   330         r = TheFs.Entry(KNonExistantFilename, entry);
   331         test(r == KErrCorrupt);
   331         test_Value(r, r == KErrCorrupt);
   332         }
   332         }
   333     r=TheFs.Drive(info,aDrive);
   333     r=TheFs.Drive(info,aDrive);
   334     test(r==KErrNone);
   334     test_KErrNone(r);
   335     test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
   335     test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
   336         (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt);
   336         (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt);
   337     remounts = (TInt) info.iBattery;
   337     remounts = (TInt) info.iBattery;
   338     test.Printf(_L("Remounts = %d"), remounts);
   338     test.Printf(_L("Remounts = %d"), remounts);
   339     test(remounts ==  KMaxMountFailures * 2);
   339     test(remounts ==  KMaxMountFailures * 2);
   340     
   340     
   341 
   341 
   342 
   342 
   343     r=TheFs.DismountFileSystem(newFs,aDrive);
   343     r=TheFs.DismountFileSystem(newFs,aDrive);
   344     test(r==KErrNone);
   344     test_KErrNone(r);
   345     r=TheFs.MountFileSystem(oldFs,aDrive);
   345     r=TheFs.MountFileSystem(oldFs,aDrive);
   346     test(r==KErrNone);
   346     test_KErrNone(r);
   347     
   347     
   348     r=TheFs.RemoveFileSystem(_L("Test2"));
   348     r=TheFs.RemoveFileSystem(_L("Test2"));
   349     if(r!=KErrNone)
   349     if(r!=KErrNone)
   350         {
   350         {
   351         test.Printf(_L("error=%d"),r);
   351         test.Printf(_L("error=%d"),r);
   364     TInt  nRes;
   364     TInt  nRes;
   365     const TInt currDrvNum=CurrentDrive();
   365     const TInt currDrvNum=CurrentDrive();
   366     
   366     
   367     TDriveInfo drvInfo;
   367     TDriveInfo drvInfo;
   368     nRes=TheFs.Drive(drvInfo, currDrvNum);
   368     nRes=TheFs.Drive(drvInfo, currDrvNum);
   369     test(nRes==KErrNone);
   369     test_KErrNone(nRes);
   370 
   370 
   371     if(drvInfo.iDriveAtt & (KDriveAttRom | KDriveAttRedirected | KDriveAttSubsted))
   371     if(drvInfo.iDriveAtt & (KDriveAttRom | KDriveAttRedirected | KDriveAttSubsted))
   372     {
   372     {
   373         test.Printf(_L("Can't test on this drive!\n"));
   373         test.Printf(_L("Can't test on this drive!\n"));
   374         return;
   374         return;
   383         TDriveInfo drvInfo;
   383         TDriveInfo drvInfo;
   384         if(KErrNone==TheFs.Drive(drvInfo, drvNum) && drvInfo.iType==EMediaNotPresent)
   384         if(KErrNone==TheFs.Drive(drvInfo, drvNum) && drvInfo.iType==EMediaNotPresent)
   385             {
   385             {
   386             // found a non-extant drive, test it...
   386             // found a non-extant drive, test it...
   387             nRes = TheFs.GetMediaSerialNumber(serNum, drvNum);
   387             nRes = TheFs.GetMediaSerialNumber(serNum, drvNum);
   388             test(nRes == KErrNotReady);
   388             test_Value(nRes, nRes == KErrNotReady);
   389             break;
   389             break;
   390             }
   390             }
   391         }
   391         }
   392     }
   392     }
   393     
   393     
   404     //-- make directory, which will be substituted ad a drive
   404     //-- make directory, which will be substituted ad a drive
   405     substPath.Format(_L("%c:\\SubstDrv1\\"), (TUint8)'A'+currDrvNum);
   405     substPath.Format(_L("%c:\\SubstDrv1\\"), (TUint8)'A'+currDrvNum);
   406     MakeDir(substPath);
   406     MakeDir(substPath);
   407   
   407   
   408     nRes = TheFs.SetSubst(substPath, KSubstDrv);
   408     nRes = TheFs.SetSubst(substPath, KSubstDrv);
   409     test(nRes == KErrNone);
   409     test_KErrNone(nRes);
   410 
   410 
   411     //-- an attempt to obtain Media Serial Number on a substed drive shall result in KErrNotSupported
   411     //-- an attempt to obtain Media Serial Number on a substed drive shall result in KErrNotSupported
   412     nRes = TheFs.GetMediaSerialNumber(serNum, KSubstDrv);
   412     nRes = TheFs.GetMediaSerialNumber(serNum, KSubstDrv);
   413     test(nRes == KErrNotSupported);
   413     test_Value(nRes, nRes == KErrNotSupported);
   414 
   414 
   415     //-- delete substed drive
   415     //-- delete substed drive
   416     nRes = TheFs.SetSubst(_L(""), KSubstDrv);
   416     nRes = TheFs.SetSubst(_L(""), KSubstDrv);
   417     test(nRes == KErrNone);
   417     test_KErrNone(nRes);
   418 }
   418 }
   419 
   419 
   420 
   420 
   421 //----------------------------------------------------------------------------------------------
   421 //----------------------------------------------------------------------------------------------
   422 //! @SYMTestCaseID      PBASE-t_fsys-0317
   422 //! @SYMTestCaseID      PBASE-t_fsys-0317
   451         r = TheFs.FileSystemName(fsName, i);
   451         r = TheFs.FileSystemName(fsName, i);
   452         if (r == KErrNone)
   452         if (r == KErrNone)
   453             {
   453             {
   454             test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
   454             test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
   455             r=TheFs.Drive(driveInfo, i);
   455             r=TheFs.Drive(driveInfo, i);
   456             test(r==KErrNone);
   456             test_KErrNone(r);
   457             
   457             
   458             if (driveInfo.iType==EMediaNotPresent)
   458             if (driveInfo.iType==EMediaNotPresent)
   459                 {
   459                 {
   460                 test.Printf(_L("The media is not present.\n"));
   460                 test.Printf(_L("The media is not present.\n"));
   461                 r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName);
   461                 r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName);
   462                 test(r == KErrNone || r == KErrNotReady);
   462                 test_Value(r, r == KErrNone || r == KErrNotReady);
   463                 }
   463                 }
   464             else if (driveInfo.iType==EMediaCdRom)
   464             else if (driveInfo.iType==EMediaCdRom)
   465                 {
   465                 {
   466                 test.Printf(_L("CD ROM with no media will report not ready!\n"));
   466                 test.Printf(_L("CD ROM with no media will report not ready!\n"));
   467                 r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName);
   467                 r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName);
   468                 test(r == KErrNotReady);
   468                 test_Value(r, r == KErrNotReady);
   469                 }
   469                 }
   470             else
   470             else
   471                 {
   471                 {
   472                 r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName);
   472                 r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName);
   473                 test_KErrNone(r);
   473                 test_KErrNone(r);
   474 
   474 
   475                 //-- test EIsDriveSync command
   475                 //-- test EIsDriveSync command
   476                 r = TheFs.QueryVolumeInfoExt(i, EIsDriveSync, fDrvSyncBuf);
   476                 r = TheFs.QueryVolumeInfoExt(i, EIsDriveSync, fDrvSyncBuf);
   477                 test(r == KErrNone);
   477                 test_KErrNone(r);
   478                 if(fDrvSyncBuf())
   478                 if(fDrvSyncBuf())
   479                     test.Printf(_L("The drive is Synchronous.\n"));
   479                     test.Printf(_L("The drive is Synchronous.\n"));
   480                 else
   480                 else
   481                     test.Printf(_L("The drive is Asynchronous.\n"));
   481                     test.Printf(_L("The drive is Asynchronous.\n"));
   482 
   482 
   483                 //-----------------
   483                 //-----------------
   484                 
   484                 
   485                 // if Fat, testing returning sub type name
   485                 // if Fat, testing returning sub type name
   486                 if (fsName.CompareF(KFileSystemName_FAT)==0)
   486                 if (fsName.CompareF(KFileSystemName_FAT)==0)
   487                     {
   487                     {
   488                     test(r == KErrNone);
   488                     test_KErrNone(r);
   489                     test(subName().CompareF(KFSSubType_FAT12)==0 ||
   489                     test(subName().CompareF(KFSSubType_FAT12)==0 ||
   490                          subName().CompareF(KFSSubType_FAT16)==0 ||
   490                          subName().CompareF(KFSSubType_FAT16)==0 ||
   491                          subName().CompareF(KFSSubType_FAT32)==0);
   491                          subName().CompareF(KFSSubType_FAT32)==0);
   492                     continue;
   492                     continue;
   493                     }
   493                     }
   494                 
   494                 
   495                 // if Lffs, testing returning file system name
   495                 // if Lffs, testing returning file system name
   496                 if (fsName.CompareF(_L("Lffs"))==0)
   496                 if (fsName.CompareF(_L("Lffs"))==0)
   497                     {
   497                     {
   498                     test(r == KErrNone);
   498                     test_KErrNone(r);
   499                     test(subName().CompareF(_L("Lffs"))==0);
   499                     test(subName().CompareF(_L("Lffs"))==0);
   500                     continue;
   500                     continue;
   501                     }
   501                     }
   502                 // if rofs, testing returning file system name
   502                 // if rofs, testing returning file system name
   503                 if (fsName.CompareF(_L("rofs"))==0)
   503                 if (fsName.CompareF(_L("rofs"))==0)
   504                     {
   504                     {
   505                     test(r == KErrNone);
   505                     test_KErrNone(r);
   506                     test(subName().CompareF(_L("rofs"))==0);
   506                     test(subName().CompareF(_L("rofs"))==0);
   507                     continue;
   507                     continue;
   508                     }
   508                     }
   509                 // if Composite, testing returning file system name
   509                 // if Composite, testing returning file system name
   510                 if (fsName.CompareF(_L("Composite"))==0)
   510                 if (fsName.CompareF(_L("Composite"))==0)
   511                     {
   511                     {
   512                     test(r == KErrNone);
   512                     test_KErrNone(r);
   513                     test(subName().CompareF(_L("Composite"))==0);
   513                     test(subName().CompareF(_L("Composite"))==0);
   514                     continue;
   514                     continue;
   515                     }
   515                     }
   516 
   516 
   517                 // else
   517                 // else
   518                 test(r == KErrNone);
   518                 test_KErrNone(r);
   519                 test(subName().Length()!=0);
   519                 test(subName().Length()!=0);
   520                 
   520                 
   521                 }
   521                 }
   522             }
   522             }
   523         }
   523         }
   552         if (r == KErrNone)
   552         if (r == KErrNone)
   553             {
   553             {
   554             test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
   554             test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
   555 
   555 
   556             r=TheFs.Drive(driveInfo, i);
   556             r=TheFs.Drive(driveInfo, i);
   557             test(r==KErrNone);
   557             test_KErrNone(r);
   558             // if no media present
   558             // if no media present
   559             if (driveInfo.iType==EMediaNotPresent)
   559             if (driveInfo.iType==EMediaNotPresent)
   560                 {
   560                 {
   561                 r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
   561                 r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
   562                 test(r == KErrNone || r == KErrNotReady);
   562                 test_Value(r, r == KErrNone || r == KErrNotReady);
   563                 }
   563                 }
   564             else if (driveInfo.iType==EMediaCdRom)
   564             else if (driveInfo.iType==EMediaCdRom)
   565                 {
   565                 {
   566                 test.Printf(_L("CD ROM with no media!\n"));
   566                 test.Printf(_L("CD ROM with no media!\n"));
   567                 r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
   567                 r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
   568                 test(r == KErrNone || r == KErrNotReady);
   568                 test_Value(r, r == KErrNone || r == KErrNotReady);
   569                 }
   569                 }
   570             else
   570             else
   571                 {
   571                 {
   572                 r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
   572                 r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
   573                 test(KErrNone == r);
   573                 test(KErrNone == r);
   600                                 drive.Disconnect();
   600                                 drive.Disconnect();
   601                             }
   601                             }
   602                         }
   602                         }
   603                         TPckg<TLocalDriveCapsV7> capsPckg(DriveCapsV7);
   603                         TPckg<TLocalDriveCapsV7> capsPckg(DriveCapsV7);
   604                         r=drive.Caps(capsPckg);
   604                         r=drive.Caps(capsPckg);
   605                         test(r==KErrNone);
   605                         test_KErrNone(r);
   606                         drive.Disconnect();
   606                         drive.Disconnect();
   607                         if(DriveCapsV7.iObjectModeSize == 0)
   607                         if(DriveCapsV7.iObjectModeSize == 0)
   608                         {
   608                         {
   609                     test(ioInfo().iClusterSize == 512);
   609                     test(ioInfo().iClusterSize == 512);
   610                     continue;
   610                     continue;
   661         r = TheFs.FileSystemName(fsName, i);
   661         r = TheFs.FileSystemName(fsName, i);
   662         if (r == KErrNone)
   662         if (r == KErrNone)
   663             {
   663             {
   664             test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
   664             test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
   665             r=TheFs.Drive(driveInfo, i);
   665             r=TheFs.Drive(driveInfo, i);
   666             test(r==KErrNone);
   666             test_KErrNone(r);
   667             // if no media present
   667             // if no media present
   668             if (driveInfo.iType==EMediaNotPresent)
   668             if (driveInfo.iType==EMediaNotPresent)
   669                 {
   669                 {
   670                 r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
   670                 r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
   671                 test(r == KErrNone || r == KErrNotReady);
   671                 test_Value(r, r == KErrNone || r == KErrNotReady);
   672                 }
   672                 }
   673             else if (driveInfo.iType==EMediaCdRom)
   673             else if (driveInfo.iType==EMediaCdRom)
   674                 {
   674                 {
   675                 test.Printf(_L("CD ROM with no media will report not ready!\n"));
   675                 test.Printf(_L("CD ROM with no media will report not ready!\n"));
   676                 r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
   676                 r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
   677                 test(r == KErrNotReady);
   677                 test_Value(r, r == KErrNotReady);
   678                 }
   678                 }
   679             else
   679             else
   680                 {
   680                 {
   681                 r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
   681                 r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
   682                 test(KErrNone == r);
   682                 test(KErrNone == r);
   723                             drive.Disconnect();
   723                             drive.Disconnect();
   724                             }
   724                             }
   725                         }
   725                         }
   726                     TPckg<TLocalDriveCapsV7> capsPckg(DriveCapsV7);
   726                     TPckg<TLocalDriveCapsV7> capsPckg(DriveCapsV7);
   727                     r=drive.Caps(capsPckg);
   727                     r=drive.Caps(capsPckg);
   728                     test(r==KErrNone);
   728                     test_KErrNone(r);
   729                     if ((fsName.CompareF(_L("Lffs"))==0) && (DriveCapsV7.iObjectModeSize != 0))
   729                     if ((fsName.CompareF(_L("Lffs"))==0) && (DriveCapsV7.iObjectModeSize != 0))
   730                         {                   
   730                         {                   
   731                         test(ioInfo().iBlockSize == (TInt) DriveCapsV7.iObjectModeSize);
   731                         test(ioInfo().iBlockSize == (TInt) DriveCapsV7.iObjectModeSize);
   732                         continue;
   732                         continue;
   733                         }
   733                         }
   778         if (r == KErrNone)
   778         if (r == KErrNone)
   779             {
   779             {
   780             test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
   780             test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
   781             r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName);
   781             r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName);
   782             r1 = TheFs.FileSystemSubType(i, subName1);
   782             r1 = TheFs.FileSystemSubType(i, subName1);
   783             test(r==r1);
   783             test_Value(r, r == r1);
   784             if (subName().Length())
   784             if (subName().Length())
   785                 {
   785                 {
   786                 test(subName().CompareF(subName1)==0);
   786                 test(subName().CompareF(subName1)==0);
   787                 }
   787                 }
   788             else
   788             else
   820         if (r == KErrNone)
   820         if (r == KErrNone)
   821             {
   821             {
   822             test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
   822             test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A'));
   823             r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
   823             r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo);
   824             r1 = TheFs.VolumeIOParam(i, ioInfo1);
   824             r1 = TheFs.VolumeIOParam(i, ioInfo1);
   825             test(r==r1);
   825             test_Value(r, r == r1);
   826             test(ioInfo().iBlockSize == ioInfo1.iBlockSize);
   826             test(ioInfo().iBlockSize == ioInfo1.iBlockSize);
   827             test(ioInfo().iClusterSize == ioInfo1.iClusterSize);
   827             test(ioInfo().iClusterSize == ioInfo1.iClusterSize);
   828             test(ioInfo().iRecReadBufSize == ioInfo1.iRecReadBufSize);
   828             test(ioInfo().iRecReadBufSize == ioInfo1.iRecReadBufSize);
   829             test(ioInfo().iRecWriteBufSize == ioInfo1.iRecWriteBufSize);
   829             test(ioInfo().iRecWriteBufSize == ioInfo1.iRecWriteBufSize);
   830             }
   830             }
   863         test.Printf(_L("error=%d"),r);
   863         test.Printf(_L("error=%d"),r);
   864         test(EFalse);
   864         test(EFalse);
   865         }
   865         }
   866     TFSName oldFs;
   866     TFSName oldFs;
   867     r = TheFs.FileSystemName(oldFs,aDrive);
   867     r = TheFs.FileSystemName(oldFs,aDrive);
   868     test(r==KErrNone);
   868     test_KErrNone(r);
   869     r = TheFs.DismountFileSystem(oldFs,aDrive);
   869     r = TheFs.DismountFileSystem(oldFs,aDrive);
   870     if (r != KErrNone)
   870     if (r != KErrNone)
   871         {
   871         {
   872         test.Printf(_L("Error = %d"),r);    
   872         test.Printf(_L("Error = %d"),r);    
   873         test(EFalse);
   873         test(EFalse);
   874         }
   874         }
   875     r = TheFs.MountFileSystem(_L("Test3"),aDrive);
   875     r = TheFs.MountFileSystem(_L("Test3"),aDrive);
   876     test(r==KErrNone);
   876     test_KErrNone(r);
   877     TFSName newFs;
   877     TFSName newFs;
   878     r = TheFs.FileSystemName(newFs,aDrive);
   878     r = TheFs.FileSystemName(newFs,aDrive);
   879     test(r==KErrNone);
   879     test_KErrNone(r);
   880     test(newFs.Compare(_L("Test3"))==0);
   880     test(newFs.Compare(_L("Test3"))==0);
   881 
   881 
   882     // Sub type name query: 
   882     // Sub type name query: 
   883     TPckgBuf<TFSName> subNameP;
   883     TPckgBuf<TFSName> subNameP;
   884     r = TheFs.QueryVolumeInfoExt(aDrive, EFileSystemSubType, subNameP);
   884     r = TheFs.QueryVolumeInfoExt(aDrive, EFileSystemSubType, subNameP);
   885     test(r==KErrNone);
   885     test_KErrNone(r);
   886     test(subNameP() == _L("Test3SubType"));
   886     test(subNameP() == _L("Test3SubType"));
   887 
   887 
   888     // Cluster size querys:
   888     // Cluster size querys:
   889     TPckgBuf<TVolumeIOParamInfo> ioInfoP;
   889     TPckgBuf<TVolumeIOParamInfo> ioInfoP;
   890     r = TheFs.QueryVolumeInfoExt(aDrive, EIOParamInfo, ioInfoP);
   890     r = TheFs.QueryVolumeInfoExt(aDrive, EIOParamInfo, ioInfoP);
   891     test(r==KErrNone);
   891     test_KErrNone(r);
   892     test(ioInfoP().iClusterSize==1024);
   892     test(ioInfoP().iClusterSize==1024);
   893 
   893 
   894     // Mount the original file system back
   894     // Mount the original file system back
   895     r=TheFs.DismountFileSystem(newFs,aDrive);
   895     r=TheFs.DismountFileSystem(newFs,aDrive);
   896     test(r==KErrNone);
   896     test_KErrNone(r);
   897     r=TheFs.MountFileSystem(oldFs,aDrive);
   897     r=TheFs.MountFileSystem(oldFs,aDrive);
   898     test(r==KErrNone);
   898     test_KErrNone(r);
   899     
   899     
   900     r=TheFs.RemoveFileSystem(_L("Test3"));
   900     r=TheFs.RemoveFileSystem(_L("Test3"));
   901     if(r!=KErrNone)
   901     if(r!=KErrNone)
   902         {
   902         {
   903         test.Printf(_L("error=%d"),r);
   903         test.Printf(_L("error=%d"),r);
   931     RFile file;
   931     RFile file;
   932 
   932 
   933     //-- 2. open this file
   933     //-- 2. open this file
   934     nRes = file.Open(TheFs, KFile, EFileRead);
   934     nRes = file.Open(TheFs, KFile, EFileRead);
   935     test_KErrNone(nRes);
   935     test_KErrNone(nRes);
       
   936     
       
   937     const TInt drvNumber = CurrentDrive();
   936 
   938 
   937     //-- 2.1 try to dismount the FS, it must fail because of the opened object.
   939     //-- 2.1 try to dismount the FS, it must fail because of the opened object.
   938     TBuf<40> fsName;
   940     TBuf<40> fsName;
   939     nRes = TheFs.FileSystemName(fsName, CurrentDrive());
   941     nRes = TheFs.FileSystemName(fsName, drvNumber);
   940     test_KErrNone(nRes);
   942     test_KErrNone(nRes);
   941 
   943 
   942     nRes = TheFs.DismountFileSystem(fsName, CurrentDrive());
   944     nRes = TheFs.DismountFileSystem(fsName, drvNumber);
   943     test(nRes == KErrInUse);
   945     test_Value(nRes, nRes == KErrInUse);
   944 
   946 
   945 
   947     // Flag from locmedia.h to simulate ejecting and re-inserting the media.
       
   948     const TUint KMediaRemountForceMediaChange = 0x00000001;
       
   949     TRequestStatus changeStatus;
       
   950     TheFs.NotifyChange(ENotifyAll, changeStatus);
       
   951     TDriveInfo driveInfo;
       
   952     
   946     //-- 3. forcedly remount the drive
   953     //-- 3. forcedly remount the drive
   947     nRes = TheFs.RemountDrive(CurrentDrive());
   954     nRes = TheFs.RemountDrive(drvNumber, NULL, KMediaRemountForceMediaChange);
       
   955     
   948     if(nRes == KErrNotSupported)
   956     if(nRes == KErrNotSupported)
   949     {//-- this feature is not supported and the test is inconsistent.
   957     	{//-- this feature is not supported and the test is inconsistent.
   950         test.Printf(_L("RemountDrive() is not supported, the test is inconsistent!"));
   958         test.Printf(_L("RemountDrive() is not supported, the test is inconsistent!"));
   951         
   959         
   952         //-- remounting must work at least on MMC drives
   960         //-- remounting must work at least on MMC drives
   953         const TBool isFAT = Is_Fat(TheFs, CurrentDrive());
   961         const TBool isFAT = Is_Fat(TheFs, drvNumber);
   954 
   962 
   955         TDriveInfo  driveInfo;
   963         nRes = TheFs.Drive(driveInfo, drvNumber);
   956         nRes = TheFs.Drive(driveInfo, CurrentDrive());
       
   957         test_KErrNone(nRes);
   964         test_KErrNone(nRes);
   958 
   965 
   959         test(!isFAT || (!(driveInfo.iDriveAtt & KDriveAttRemovable)));
   966         test_Value(driveInfo.iDriveAtt, !isFAT || (!(driveInfo.iDriveAtt & KDriveAttRemovable)));
   960 
   967     	}
   961     }
       
   962     else
   968     else
   963     {
   969     	{
   964         test_KErrNone(nRes);
   970 		test_Value(nRes, nRes == KErrNotReady || nRes == KErrNone);
   965     }
   971 		
   966 
   972 		//-- 3.1 wait for media change to complete
   967     User::After(500*K1mSec);
   973 		do
       
   974 			{
       
   975 			// Waiting for media change...
       
   976 			User::WaitForRequest(changeStatus);
       
   977 			nRes = TheFs.Drive(driveInfo, drvNumber);
       
   978 			TheFs.NotifyChange(ENotifyAll, changeStatus);
       
   979 			}
       
   980 		while (nRes == KErrNotReady);
       
   981 		
       
   982 		test_KErrNone(nRes);
       
   983 		User::After(1000*K1mSec);	// Wait 1 sec (needed by certain platforms)
       
   984     	}
       
   985     
       
   986     TheFs.NotifyChangeCancel(changeStatus);
   968 
   987 
   969     //-- 4. read this file. The FS will be remounted and the read must be OK.
   988     //-- 4. read this file. The FS will be remounted and the read must be OK.
   970     TBuf8<40> buf;
   989     TBuf8<40> buf;
   971     nRes = file.Read(0, buf, 30);
   990     nRes = file.Read(0, buf, 30);
   972     test_KErrNone(nRes);
   991     test_KErrNone(nRes);