kerneltest/f32test/server/t_dctcballfiles.cpp
branchRCL_3
changeset 256 c1f20ce4abcf
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
249:a179b74831c9 256:c1f20ce4abcf
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
       
    16 #define __E32TEST_EXTENSION__
    16 #include <f32file.h>
    17 #include <f32file.h>
    17 #include <e32test.h>
    18 #include <e32test.h>
    18 #include <e32std.h>
    19 #include <e32std.h>
    19 #include <e32std_private.h>
    20 #include <e32std_private.h>
    20 #include <e32svr.h>
    21 #include <e32svr.h>
    74 TRequestStatus aStat1;
    75 TRequestStatus aStat1;
    75 TRequestStatus aStat2;
    76 TRequestStatus aStat2;
    76 TRequestStatus aStat3;
    77 TRequestStatus aStat3;
    77 TRequestStatus aStat4;
    78 TRequestStatus aStat4;
    78 
    79 
    79 TVolumeInfo aVolInfo;
       
    80 //	TDriveInfo adriveInfo;
       
    81 
       
    82 TBuf<40> systestfile;
    80 TBuf<40> systestfile;
    83 TBuf<40> pritestfile;
    81 TBuf<40> pritestfile;
    84 TBuf<40> restestfile;
    82 TBuf<40> restestfile;
    85 TBuf<40> systestfile1;
    83 TBuf<40> systestfile1;
    86 TBuf<40> pritestfile1;
    84 TBuf<40> pritestfile1;
   104 	
   102 	
   105 	mkdirname.Zero();
   103 	mkdirname.Zero();
   106 	mkdirname.Append(systestname);
   104 	mkdirname.Append(systestname);
   107 	mkdirname.Append(KMkDirSub);
   105 	mkdirname.Append(KMkDirSub);
   108 	r=TheFs.MkDirAll(mkdirname);	
   106 	r=TheFs.MkDirAll(mkdirname);	
   109 	test(r==KErrNone);
   107 	test_KErrNone(r);
   110 
   108 
   111 	TheFs.RmDir(mkdirname);
   109 	TheFs.RmDir(mkdirname);
   112 	test(r==KErrNone);
   110 	test_KErrNone(r);
   113 
   111 
   114 	r=TheFs.SetSubst(systestname,EDriveO);
   112 	r=TheFs.SetSubst(systestname,EDriveO);
   115 	test(r==KErrPermissionDenied);
   113 	test_Value(r, r == KErrPermissionDenied);
   116 	
   114 	
   117 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   115 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   118 	test(r==KErrNone);
   116 	test_KErrNone(r);
   119 
   117 
   120 	r=TheFs.SetSessionPath(systestname);
   118 	r=TheFs.SetSessionPath(systestname);
   121 	test(r==KErrNone);
   119 	test_KErrNone(r);
   122 	
   120 	
   123 	TheFs.NotifyChange(ENotifyAll,aStat1,systestname);
   121 	TheFs.NotifyChange(ENotifyAll,aStat1,systestname);
   124 	test(aStat1==KRequestPending);
   122 	test(aStat1==KRequestPending);
   125 
   123 
   126 	systestfile=KSystemPath;
   124 	systestfile=KSystemPath;
   131 	
   129 	
   132 	oldName=KOldFile;
   130 	oldName=KOldFile;
   133 	oldName[0]=(TText)gDriveToTest;
   131 	oldName[0]=(TText)gDriveToTest;
   134 
   132 
   135 	r=TheFs.GetShortName(systestfile, shortfilename);
   133 	r=TheFs.GetShortName(systestfile, shortfilename);
   136 	test(r==KErrNotFound || r==KErrNotSupported);
   134 	test_Value(r, r == KErrNotFound || r==KErrNotSupported);
   137 
   135 
   138 	r=TheFs.GetLongName(systestfile1, longfilename);
   136 	r=TheFs.GetLongName(systestfile1, longfilename);
   139 	test(r==KErrNotFound || r==KErrNotSupported);
   137 	test_Value(r, r == KErrNotFound || r==KErrNotSupported);
   140 
   138 
   141 	r=file1.Create(TheFs,oldName,EFileWrite);
   139 	r=file1.Create(TheFs,oldName,EFileWrite);
   142 	test(r==KErrNone || r==KErrAlreadyExists);
   140 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   143 	file1.Close();
   141 	file1.Close();
   144 
   142 
   145 	r=TheFs.Replace(oldName,systestfile);
   143 	r=TheFs.Replace(oldName,systestfile);
   146 	test(r==KErrNone);
   144 	test_KErrNone(r);
   147 	
   145 	
   148 	r=TheFs.Rename(systestfile,systestfile1);
   146 	r=TheFs.Rename(systestfile,systestfile1);
   149 	test(r==KErrNone);
   147 	test_KErrNone(r);
   150 	
   148 	
   151 	r=TheFs.Entry(systestfile1,entry);
   149 	r=TheFs.Entry(systestfile1,entry);
   152 	test(r==KErrNone);
   150 	test_KErrNone(r);
   153 
   151 
   154 	r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   152 	r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   155 	test(r==KErrNone);
   153 	test_KErrNone(r);
   156 
   154 
   157 	r=TheFs.Delete(systestfile1);
   155 	r=TheFs.Delete(systestfile1);
   158 	test(r==KErrNone);
   156 	test_KErrNone(r);
   159 	}
   157 	}
   160 
   158 
   161 LOCAL_C void ResourceRFsTest()
   159 LOCAL_C void ResourceRFsTest()
   162 //
   160 //
   163 //
   161 //
   168 	
   166 	
   169 	mkdirname.Zero();
   167 	mkdirname.Zero();
   170 	mkdirname.Append(restestname);
   168 	mkdirname.Append(restestname);
   171 	mkdirname.Append(KMkDirSub);
   169 	mkdirname.Append(KMkDirSub);
   172 	r=TheFs.MkDirAll(mkdirname);	
   170 	r=TheFs.MkDirAll(mkdirname);	
   173 	test(r==KErrNone);
   171 	test_KErrNone(r);
   174 
   172 
   175 	TheFs.RmDir(mkdirname);
   173 	TheFs.RmDir(mkdirname);
   176 	test(r==KErrNone);
   174 	test_KErrNone(r);
   177 
   175 
   178 	r=TheFs.SetSubst(restestname,EDriveO);
   176 	r=TheFs.SetSubst(restestname,EDriveO);
   179 	test(r==KErrPermissionDenied);
   177 	test_Value(r, r == KErrPermissionDenied);
   180 	
   178 	
   181 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   179 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   182 	test(r==KErrNone);
   180 	test_KErrNone(r);
   183 
   181 
   184 	r=TheFs.SetSessionPath(restestname);
   182 	r=TheFs.SetSessionPath(restestname);
   185 	test(r==KErrNone);
   183 	test_KErrNone(r);
   186 	
   184 	
   187 	TheFs.NotifyChange(ENotifyAll,aStat4,restestname);
   185 	TheFs.NotifyChange(ENotifyAll,aStat4,restestname);
   188 	test(aStat4==KRequestPending);
   186 	test(aStat4==KRequestPending);
   189 
   187 
   190 	restestfile=KResourcePath;
   188 	restestfile=KResourcePath;
   195 	
   193 	
   196 	oldName=KOldFile;
   194 	oldName=KOldFile;
   197 	oldName[0]=(TText)gDriveToTest;
   195 	oldName[0]=(TText)gDriveToTest;
   198 
   196 
   199 	r=TheFs.GetShortName(restestfile, shortfilename);
   197 	r=TheFs.GetShortName(restestfile, shortfilename);
   200 	test(r==KErrNone || KErrNotFound || r==KErrNotSupported);
   198 	test_Value(r, r == KErrNone || r == KErrNotFound || r==KErrNotSupported);
   201 
   199 
   202 	r=TheFs.GetLongName(restestfile1, longfilename);
   200 	r=TheFs.GetLongName(restestfile1, longfilename);
   203 	test(r==KErrNone || KErrNotFound || r==KErrNotSupported);
   201 	test_Value(r, r == KErrNone || r == KErrNotFound || r==KErrNotSupported);
   204 
   202 
   205 	r=file1.Create(TheFs,oldName,EFileWrite);
   203 	r=file1.Create(TheFs,oldName,EFileWrite);
   206 	test(r==KErrNone || r==KErrAlreadyExists);
   204 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   207 	file1.Close();
   205 	file1.Close();
   208 
   206 
   209 	r=TheFs.Replace(oldName,restestfile);
   207 	r=TheFs.Replace(oldName,restestfile);
   210 	test(r==KErrNone);
   208 	test_KErrNone(r);
   211 	
   209 	
   212 	r=TheFs.Rename(restestfile,restestfile1);
   210 	r=TheFs.Rename(restestfile,restestfile1);
   213 	test(r==KErrNone);
   211 	test_KErrNone(r);
   214 	
   212 	
   215 	r=TheFs.Entry(restestfile1,entry);
   213 	r=TheFs.Entry(restestfile1,entry);
   216 	test(r==KErrNone);
   214 	test_KErrNone(r);
   217 
   215 
   218 	r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   216 	r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   219 	test(r==KErrNone);
   217 	test_KErrNone(r);
   220 
   218 
   221 	r=TheFs.Delete(restestfile1);
   219 	r=TheFs.Delete(restestfile1);
   222 	test(r==KErrNone);
   220 	test_KErrNone(r);
   223 
   221 
   224 	}
   222 	}
   225 
   223 
   226 
   224 
   227 LOCAL_C void privatefalseIDRFsTest()
   225 LOCAL_C void privatefalseIDRFsTest()
   235 	mkdirname.Zero();
   233 	mkdirname.Zero();
   236 	mkdirname.Append(pritestfalseidname);
   234 	mkdirname.Append(pritestfalseidname);
   237 	mkdirname.Append(KMkDirSub);
   235 	mkdirname.Append(KMkDirSub);
   238 
   236 
   239 	r=TheFs.MkDirAll(mkdirname);	
   237 	r=TheFs.MkDirAll(mkdirname);	
   240 	test(r==KErrNone);
   238 	test_KErrNone(r);
   241 
   239 
   242 	r=TheFs.RmDir(mkdirname);	
   240 	r=TheFs.RmDir(mkdirname);	
   243 	test(r==KErrNone);
   241 	test_KErrNone(r);
   244 
   242 
   245 	r=TheFs.SetSubst(pritestfalseidname,EDriveO);
   243 	r=TheFs.SetSubst(pritestfalseidname,EDriveO);
   246 	test(r==KErrPermissionDenied);
   244 	test_Value(r, r == KErrPermissionDenied);
   247 
   245 
   248 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   246 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   249 	test(r==KErrNone);
   247 	test_KErrNone(r);
   250 
   248 
   251 	r=TheFs.SetSessionPath(pritestfalseidname);
   249 	r=TheFs.SetSessionPath(pritestfalseidname);
   252 	test(r==KErrNone);
   250 	test_KErrNone(r);
   253 
   251 
   254 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname);
   252 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname);
   255 	test(aStat2==KRequestPending);
   253 	test(aStat2==KRequestPending);
   256 
   254 
   257 
   255 
   263 	
   261 	
   264 	oldName=KOldFile;
   262 	oldName=KOldFile;
   265 	oldName[0]=(TText)gDriveToTest;
   263 	oldName[0]=(TText)gDriveToTest;
   266 
   264 
   267 	r=TheFs.GetShortName(pritestfile, shortfilename);
   265 	r=TheFs.GetShortName(pritestfile, shortfilename);
   268 	test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
   266 	test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported);
   269 
   267 
   270 	r=TheFs.GetLongName(pritestfile1, longfilename);
   268 	r=TheFs.GetLongName(pritestfile1, longfilename);
   271 	test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
   269 	test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported);
   272 
   270 
   273 	r=file1.Create(TheFs,oldName,EFileWrite);
   271 	r=file1.Create(TheFs,oldName,EFileWrite);
   274 	test(r==KErrNone || r==KErrAlreadyExists);
   272 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   275 	file1.Close();
   273 	file1.Close();
   276 
   274 
   277 	r=TheFs.Replace(oldName,pritestfile);
   275 	r=TheFs.Replace(oldName,pritestfile);
   278 	test(r==KErrNone);
   276 	test_KErrNone(r);
   279 	
   277 	
   280 	r=TheFs.Rename(pritestfile,pritestfile1);
   278 	r=TheFs.Rename(pritestfile,pritestfile1);
   281 	test(r==KErrNone);
   279 	test_KErrNone(r);
   282 	
   280 	
   283 	r=TheFs.Entry(pritestfile1,entry);
   281 	r=TheFs.Entry(pritestfile1,entry);
   284 	test(r==KErrNone);
   282 	test_KErrNone(r);
   285 
   283 
   286 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   284 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   287 	test(r==KErrNone);
   285 	test_KErrNone(r);
   288 
   286 
   289 	r=TheFs.Delete(pritestfile1);
   287 	r=TheFs.Delete(pritestfile1);
   290 	test(r==KErrNone);
   288 	test_KErrNone(r);
   291 
   289 
   292 	}
   290 	}
   293 
   291 
   294 
   292 
   295 LOCAL_C void privateRFsTest()
   293 LOCAL_C void privateRFsTest()
   304 	mkdirname.Zero();
   302 	mkdirname.Zero();
   305 	mkdirname.Append(pritestname);
   303 	mkdirname.Append(pritestname);
   306 	mkdirname.Append(KMkDirSub);
   304 	mkdirname.Append(KMkDirSub);
   307 
   305 
   308 	r=TheFs.MkDirAll(mkdirname);	
   306 	r=TheFs.MkDirAll(mkdirname);	
   309 	test(r==KErrNone);
   307 	test_KErrNone(r);
   310 
   308 
   311 	r=TheFs.RmDir(mkdirname);	
   309 	r=TheFs.RmDir(mkdirname);	
   312 	test(r==KErrNone);
   310 	test_KErrNone(r);
   313 
   311 
   314 	r=TheFs.SetSubst(pritestname,EDriveO);
   312 	r=TheFs.SetSubst(pritestname,EDriveO);
   315 	test(r==KErrPermissionDenied);
   313 	test_Value(r, r == KErrPermissionDenied);
   316 
   314 
   317 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   315 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   318 	test(r==KErrNone);
   316 	test_KErrNone(r);
   319 
   317 
   320 	r=TheFs.SetSessionPath(pritestname);
   318 	r=TheFs.SetSessionPath(pritestname);
   321 	test(r==KErrNone);
   319 	test_KErrNone(r);
   322 
   320 
   323 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestname);
   321 	TheFs.NotifyChange(ENotifyAll,aStat2,pritestname);
   324 	test(aStat2==KRequestPending);
   322 	test(aStat2==KRequestPending);
   325 
   323 
   326 
   324 
   332 	
   330 	
   333 	oldName=KOldFile;
   331 	oldName=KOldFile;
   334 	oldName[0]=(TText)gDriveToTest;
   332 	oldName[0]=(TText)gDriveToTest;
   335 
   333 
   336 	r=TheFs.GetShortName(pritestfile, shortfilename);
   334 	r=TheFs.GetShortName(pritestfile, shortfilename);
   337 	test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
   335 	test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported);
   338 
   336 
   339 	r=TheFs.GetLongName(pritestfile1, longfilename);
   337 	r=TheFs.GetLongName(pritestfile1, longfilename);
   340 	test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
   338 	test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported);
   341 
   339 
   342 	r=file1.Create(TheFs,oldName,EFileWrite);
   340 	r=file1.Create(TheFs,oldName,EFileWrite);
   343 	test(r==KErrNone || r==KErrAlreadyExists);
   341 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   344 	file1.Close();
   342 	file1.Close();
   345 
   343 
   346 	r=TheFs.Replace(oldName,pritestfile);
   344 	r=TheFs.Replace(oldName,pritestfile);
   347 	test(r==KErrNone);
   345 	test_KErrNone(r);
   348 	
   346 	
   349 	r=TheFs.Rename(pritestfile,pritestfile1);
   347 	r=TheFs.Rename(pritestfile,pritestfile1);
   350 	test(r==KErrNone);
   348 	test_KErrNone(r);
   351 	
   349 	
   352 	r=TheFs.Entry(pritestfile1,entry);
   350 	r=TheFs.Entry(pritestfile1,entry);
   353 	test(r==KErrNone);
   351 	test_KErrNone(r);
   354 
   352 
   355 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   353 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   356 	test(r==KErrNone);
   354 	test_KErrNone(r);
   357 
   355 
   358 	r=TheFs.Delete(pritestfile1);
   356 	r=TheFs.Delete(pritestfile1);
   359 	test(r==KErrNone);
   357 	test_KErrNone(r);
   360 
   358 
   361 	}
   359 	}
   362 
   360 
   363 
   361 
   364 LOCAL_C void privateSIDRFstest()
   362 LOCAL_C void privateSIDRFstest()
   368 
   366 
   369 	mkdirname.Zero();
   367 	mkdirname.Zero();
   370 	mkdirname.Append(theprivatepath);
   368 	mkdirname.Append(theprivatepath);
   371 	mkdirname.Append(KMkDirSub);
   369 	mkdirname.Append(KMkDirSub);
   372 	r=TheFs.MkDirAll(mkdirname);	
   370 	r=TheFs.MkDirAll(mkdirname);	
   373 	test(r==KErrNone);
   371 	test_KErrNone(r);
   374 
   372 
   375 	r=TheFs.RmDir(mkdirname);	
   373 	r=TheFs.RmDir(mkdirname);	
   376 	test(r==KErrNone);
   374 	test_KErrNone(r);
   377 
   375 
   378 	r=TheFs.SetSubst(theprivatepath,EDriveO);	
   376 	r=TheFs.SetSubst(theprivatepath,EDriveO);	
   379 	test(r==KErrPermissionDenied);
   377 	test_Value(r, r == KErrPermissionDenied);
   380 
   378 
   381 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   379 	r=TheFs.RealName(_L("O:\\File.XXX"),realName);
   382 	test(r==KErrNone);
   380 	test_KErrNone(r);
   383 
   381 
   384 	r=TheFs.SetSessionPath(theprivatepath);
   382 	r=TheFs.SetSessionPath(theprivatepath);
   385 	test(r==KErrNone);
   383 	test_KErrNone(r);
   386 
   384 
   387 	TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath);
   385 	TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath);
   388 	test(aStat3==KRequestPending);
   386 	test(aStat3==KRequestPending);
   389 
   387 
   390 	pritestfile=theprivatepath;
   388 	pritestfile=theprivatepath;
   395 	
   393 	
   396 	oldName=KOldFile;
   394 	oldName=KOldFile;
   397 	oldName[0]=(TText)gDriveToTest;
   395 	oldName[0]=(TText)gDriveToTest;
   398 
   396 
   399 	r=TheFs.GetShortName(pritestfile, shortfilename);
   397 	r=TheFs.GetShortName(pritestfile, shortfilename);
   400 	test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
   398 	test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported);
   401 
   399 
   402 	r=TheFs.GetLongName(pritestfile1, longfilename);
   400 	r=TheFs.GetLongName(pritestfile1, longfilename);
   403 	test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported);
   401 	test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported);
   404 
   402 
   405 	r=file1.Create(TheFs,oldName,EFileWrite);
   403 	r=file1.Create(TheFs,oldName,EFileWrite);
   406 	test(r==KErrNone || r==KErrAlreadyExists);
   404 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   407 	file1.Close();
   405 	file1.Close();
   408 
   406 
   409 	r=TheFs.Replace(oldName,pritestfile);
   407 	r=TheFs.Replace(oldName,pritestfile);
   410 	test(r==KErrNone);
   408 	test_KErrNone(r);
   411 	
   409 	
   412 	r=TheFs.Rename(pritestfile,pritestfile1);
   410 	r=TheFs.Rename(pritestfile,pritestfile1);
   413 	test(r==KErrNone || r==KErrAlreadyExists);
   411 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   414 	
   412 	
   415 	r=TheFs.Entry(pritestfile1,entry);
   413 	r=TheFs.Entry(pritestfile1,entry);
   416 	test(r==KErrNone);
   414 	test_KErrNone(r);
   417 
   415 
   418 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   416 	r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly);
   419 	test(r==KErrNone);
   417 	test_KErrNone(r);
   420 
   418 
   421 	r=TheFs.Delete(pritestfile1);
   419 	r=TheFs.Delete(pritestfile1);
   422 	test(r==KErrNone);
   420 	test_KErrNone(r);
   423 	}
   421 	}
   424 
   422 
   425 
   423 
   426 LOCAL_C void systemRFiletest()
   424 LOCAL_C void systemRFiletest()
   427 //
   425 //
   428 //RFile testing with session path set to //system//
   426 //RFile testing with session path set to //system//
   429 //
   427 //
   430 	{
   428 	{
   431 
   429 
   432 	r=TheFs.SetSessionPath(systestname);
   430 	r=TheFs.SetSessionPath(systestname);
   433 	test(r==KErrNone);
   431 	test_KErrNone(r);
   434 
   432 
   435 	r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite);
   433 	r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite);
   436 	test(r==KErrNone);
   434 	test_KErrNone(r);
   437 	file1.Close();
   435 	file1.Close();
   438 
   436 
   439 	r=file1.Create(TheFs,KFileSys,EFileWrite);
   437 	r=file1.Create(TheFs,KFileSys,EFileWrite);
   440 	test(r==KErrNone);
   438 	test_KErrNone(r);
   441 	file1.Close();
   439 	file1.Close();
   442 
   440 
   443 	r=file1.Open(TheFs,KFileSys,EFileWrite);
   441 	r=file1.Open(TheFs,KFileSys,EFileWrite);
   444 	test(r==KErrNone);
   442 	test_KErrNone(r);
   445 	file1.Close();
   443 	file1.Close();
   446 	
   444 	
   447 	r=file1.Open(TheFs,KFileSys,EFileRead);
   445 	r=file1.Open(TheFs,KFileSys,EFileRead);
   448 	test(r==KErrNone);
   446 	test_KErrNone(r);
   449 	file1.Close();
   447 	file1.Close();
   450 
   448 
   451 	r=file1.Replace(TheFs,KFileSys,EFileWrite);
   449 	r=file1.Replace(TheFs,KFileSys,EFileWrite);
   452 	test(r==KErrNone);
   450 	test_KErrNone(r);
   453 	
   451 	
   454 	r=file1.Rename(KFileSys3);
   452 	r=file1.Rename(KFileSys3);
   455 	test(r==KErrNone);
   453 	test_KErrNone(r);
   456 	file1.Close();
   454 	file1.Close();
   457 
   455 
   458     TFindFile finder(TheFs);
   456     TFindFile finder(TheFs);
   459     CDir* dir = NULL;
   457     CDir* dir = NULL;
   460     r=finder.FindWildByDir(KWildFile, KWildPath, dir);
   458     r=finder.FindWildByDir(KWildFile, KWildPath, dir);
   461 	if (!(r==KErrNone))
   459 	if (!(r==KErrNone))
   462         test.Printf(_L("T_DCTCBALLFILES: test find wildcards r = %d (expected KErrNone)\n"), r);
   460         test.Printf(_L("T_DCTCBALLFILES: test find wildcards r = %d (expected KErrNone)\n"), r);
   463 	test(r==KErrNone);
   461 	test_KErrNone(r);
   464 	delete dir;
   462 	delete dir;
   465 	}
   463 	}
   466 
   464 
   467 LOCAL_C void resourceRFiletest()
   465 LOCAL_C void resourceRFiletest()
   468 //
   466 //
   469 //RFile testing with session path set to //resource//
   467 //RFile testing with session path set to //resource//
   470 //
   468 //
   471 	{
   469 	{
   472 	r=TheFs.SetSessionPath(restestname);
   470 	r=TheFs.SetSessionPath(restestname);
   473 	test(r==KErrNone);
   471 	test_KErrNone(r);
   474 
   472 
   475 	r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite);
   473 	r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite);
   476 	test(r==KErrNone);
   474 	test_KErrNone(r);
   477 	file1.Close();
   475 	file1.Close();
   478 
   476 
   479 	r=file1.Create(TheFs,KFileRes,EFileWrite);
   477 	r=file1.Create(TheFs,KFileRes,EFileWrite);
   480 	test(r==KErrNone);
   478 	test_KErrNone(r);
   481 	file1.Close();
   479 	file1.Close();
   482 
   480 
   483 	r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive );
   481 	r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive );
   484 	test(r==KErrNone);
   482 	test_KErrNone(r);
   485 	
   483 	
   486 	r=file1.Rename(KFileRes3);
   484 	r=file1.Rename(KFileRes3);
   487 	test(r==KErrNone);
   485 	test_KErrNone(r);
   488 	file1.Close();
   486 	file1.Close();
   489 
   487 
   490 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileRead);
   488 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileRead);
   491 	test(r==KErrNone);
   489 	test_KErrNone(r);
   492 	file1.Close();
   490 	file1.Close();
   493 
   491 
   494 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileWrite);
   492 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileWrite);
   495 	test(r==KErrNone);
   493 	test_KErrNone(r);
   496 	file1.Close();
   494 	file1.Close();
   497 
   495 
   498 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOnly);
   496 	r=file1.Open(TheFs,KFileRes3,EFileShareReadersOnly);
   499 	test(r==KErrNone);
   497 	test_KErrNone(r);
   500 
   498 
   501 	r=file1.ChangeMode(EFileShareExclusive);
   499 	r=file1.ChangeMode(EFileShareExclusive);
   502 	test(r==KErrNone);
   500 	test_KErrNone(r);
   503 	file1.Close();
   501 	file1.Close();
   504 
   502 
   505 	r=file1.Replace(TheFs,KFileRes,EFileWrite);
   503 	r=file1.Replace(TheFs,KFileRes,EFileWrite);
   506 	test(r==KErrNone);
   504 	test_KErrNone(r);
   507 	file1.Close();	
   505 	file1.Close();	
   508 	}
   506 	}
   509 
   507 
   510 
   508 
   511 LOCAL_C void privateRFiletest()
   509 LOCAL_C void privateRFiletest()
   512 //
   510 //
   513 //RFile testing with session path set to //Private//
   511 //RFile testing with session path set to //Private//
   514 //
   512 //
   515 	{
   513 	{
   516 	r=TheFs.SetSessionPath(pritestfalseidname);
   514 	r=TheFs.SetSessionPath(pritestfalseidname);
   517 	test(r==KErrNone);
   515 	test_KErrNone(r);
   518 
   516 
   519 	r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite);
   517 	r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite);
   520 	test(r==KErrNone);
   518 	test_KErrNone(r);
   521 	file1.Close();
   519 	file1.Close();
   522 
   520 
   523 	r=file1.Create(TheFs,KFilePri,EFileWrite);
   521 	r=file1.Create(TheFs,KFilePri,EFileWrite);
   524 	test(r==KErrNone);
   522 	test_KErrNone(r);
   525 	file1.Close();
   523 	file1.Close();
   526 
   524 
   527 	r=file1.Open(TheFs,KFilePri,EFileWrite);
   525 	r=file1.Open(TheFs,KFilePri,EFileWrite);
   528 	test(r==KErrNone);
   526 	test_KErrNone(r);
   529 	file1.Close();
   527 	file1.Close();
   530 	
   528 	
   531 	r=file1.Open(TheFs,KFilePri,EFileRead);
   529 	r=file1.Open(TheFs,KFilePri,EFileRead);
   532 	test(r==KErrNone);
   530 	test_KErrNone(r);
   533 	file1.Close();
   531 	file1.Close();
   534 	
   532 	
   535 	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   533 	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   536 	test(r==KErrNone);
   534 	test_KErrNone(r);
   537 	
   535 	
   538 	r=file1.Rename(KFilePri3);
   536 	r=file1.Rename(KFilePri3);
   539 	test(r==KErrNone);
   537 	test_KErrNone(r);
   540 	file1.Close();
   538 	file1.Close();
   541 	}
   539 	}
   542 
   540 
   543 
   541 
   544 LOCAL_C void privatefalseIDRFiletest()
   542 LOCAL_C void privatefalseIDRFiletest()
   545 //
   543 //
   546 //RFile testing with session path set to //Private//
   544 //RFile testing with session path set to //Private//
   547 //
   545 //
   548 	{
   546 	{
   549 	r=TheFs.SetSessionPath(pritestname);
   547 	r=TheFs.SetSessionPath(pritestname);
   550 	test(r==KErrNone);
   548 	test_KErrNone(r);
   551 
   549 
   552 	r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite);
   550 	r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite);
   553 	test(r==KErrNone);
   551 	test_KErrNone(r);
   554 	file1.Close();
   552 	file1.Close();
   555 
   553 
   556 	r=file1.Create(TheFs,KFilePri,EFileWrite);
   554 	r=file1.Create(TheFs,KFilePri,EFileWrite);
   557 	test(r==KErrNone);
   555 	test_KErrNone(r);
   558 	file1.Close();
   556 	file1.Close();
   559 
   557 
   560 	r=file1.Open(TheFs,KFilePri,EFileWrite);
   558 	r=file1.Open(TheFs,KFilePri,EFileWrite);
   561 	test(r==KErrNone);
   559 	test_KErrNone(r);
   562 	file1.Close();
   560 	file1.Close();
   563 	
   561 	
   564 	r=file1.Open(TheFs,KFilePri,EFileRead);
   562 	r=file1.Open(TheFs,KFilePri,EFileRead);
   565 	test(r==KErrNone);
   563 	test_KErrNone(r);
   566 	file1.Close();
   564 	file1.Close();
   567 	
   565 	
   568 	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   566 	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   569 	test(r==KErrNone);
   567 	test_KErrNone(r);
   570 	
   568 	
   571 	r=file1.Rename(KFilePri3);
   569 	r=file1.Rename(KFilePri3);
   572 	test(r==KErrNone);
   570 	test_KErrNone(r);
   573 	file1.Close();
   571 	file1.Close();
   574 	}
   572 	}
   575 
   573 
   576 
   574 
   577 LOCAL_C void privateSIDRFiletest()
   575 LOCAL_C void privateSIDRFiletest()
   578 //
   576 //
   579 //Rfile Testing with session path set to //Private//UID//
   577 //Rfile Testing with session path set to //Private//UID//
   580 //
   578 //
   581 	{
   579 	{
   582 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   580 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   583 	test(r==KErrNone);
   581 	test_KErrNone(r);
   584 	
   582 	
   585 	r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite);
   583 	r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite);
   586 	test(r==KErrNone);
   584 	test_KErrNone(r);
   587 	file1.Close();
   585 	file1.Close();
   588 
   586 
   589 	r=file1.Create(TheFs,KFilePri,EFileWrite);
   587 	r=file1.Create(TheFs,KFilePri,EFileWrite);
   590 	test(r==KErrNone);
   588 	test_KErrNone(r);
   591 	file1.Close();
   589 	file1.Close();
   592 
   590 
   593 	r=file1.Open(TheFs,KFilePri,EFileWrite);
   591 	r=file1.Open(TheFs,KFilePri,EFileWrite);
   594 	test(r==KErrNone);
   592 	test_KErrNone(r);
   595 	file1.Close();
   593 	file1.Close();
   596 	
   594 	
   597 	r=file1.Open(TheFs,KFilePri,EFileRead);
   595 	r=file1.Open(TheFs,KFilePri,EFileRead);
   598 	test(r==KErrNone);
   596 	test_KErrNone(r);
   599 	file1.Close();
   597 	file1.Close();
   600 	
   598 	
   601 	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   599 	r=file1.Replace(TheFs,KFilePri,EFileWrite);
   602 	test(r==KErrNone);
   600 	test_KErrNone(r);
   603 	
   601 	
   604 	r=file1.Rename(KFilePri3);
   602 	r=file1.Rename(KFilePri3);
   605 	test(r==KErrNone);
   603 	test_KErrNone(r);
   606 	file1.Close();
   604 	file1.Close();
   607 	}
   605 	}
   608 
   606 
   609 LOCAL_C void RDirtest()
   607 LOCAL_C void RDirtest()
   610 //
   608 //
   615 	//system
   613 	//system
   616 	CDir*	dirEntries;
   614 	CDir*	dirEntries;
   617 	TBuf<30> dirNameBuf(KSystemPath);
   615 	TBuf<30> dirNameBuf(KSystemPath);
   618 	dirNameBuf[0]=(TText)gDriveToTest;
   616 	dirNameBuf[0]=(TText)gDriveToTest;
   619 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   617 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   620 	test(r==KErrNone);
   618 	test_KErrNone(r);
   621 	dir.Close();
   619 	dir.Close();
   622 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   620 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   623 	test(r==KErrNone);
   621 	test_KErrNone(r);
   624 	dirNameBuf.Zero();
   622 	dirNameBuf.Zero();
   625 	delete dirEntries;
   623 	delete dirEntries;
   626 
   624 
   627 	//Private
   625 	//Private
   628 	dirNameBuf=KPrivatePath;
   626 	dirNameBuf=KPrivatePath;
   629 	dirNameBuf[0]=(TText)gDriveToTest;
   627 	dirNameBuf[0]=(TText)gDriveToTest;
   630 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   628 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   631 	test(r==KErrNone);
   629 	test_KErrNone(r);
   632 	dir.Close();
   630 	dir.Close();
   633 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   631 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   634 	test(r==KErrNone);
   632 	test_KErrNone(r);
   635 	dirNameBuf.Zero();
   633 	dirNameBuf.Zero();
   636 	delete dirEntries;
   634 	delete dirEntries;
   637 
   635 
   638 	//Private//false ID
   636 	//Private//false ID
   639 	dirNameBuf=KPrivateFalseID;
   637 	dirNameBuf=KPrivateFalseID;
   640 	dirNameBuf[0]=(TText)gDriveToTest;
   638 	dirNameBuf[0]=(TText)gDriveToTest;
   641 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   639 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   642 	test(r==KErrNone);
   640 	test_KErrNone(r);
   643 	dir.Close();
   641 	dir.Close();
   644 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   642 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   645 	test(r==KErrNone);
   643 	test_KErrNone(r);
   646 	dirNameBuf.Zero();
   644 	dirNameBuf.Zero();
   647 	delete dirEntries;
   645 	delete dirEntries;
   648 
   646 
   649 	//Private/uid
   647 	//Private/uid
   650 	TheFs.PrivatePath(dirNameBuf);
   648 	TheFs.PrivatePath(dirNameBuf);
   651 	dirNameBuf.Insert(0,_L("?:"));
   649 	dirNameBuf.Insert(0,_L("?:"));
   652 	dirNameBuf[0]=(TText)gDriveToTest;
   650 	dirNameBuf[0]=(TText)gDriveToTest;
   653 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   651 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   654 	test(r==KErrNone);
   652 	test_KErrNone(r);
   655 	dir.Close();
   653 	dir.Close();
   656 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   654 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   657 	test(r==KErrNone);
   655 	test_KErrNone(r);
   658 	dirNameBuf.Zero();
   656 	dirNameBuf.Zero();
   659 	delete dirEntries;
   657 	delete dirEntries;
   660 	//Resource
   658 	//Resource
   661 	dirNameBuf=KResourcePath;
   659 	dirNameBuf=KResourcePath;
   662 	dirNameBuf[0]=(TText)gDriveToTest;
   660 	dirNameBuf[0]=(TText)gDriveToTest;
   663 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   661 	r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal);
   664 	test(r==KErrNone);
   662 	test_KErrNone(r);
   665 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   663 	r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries);
   666 	test(r==KErrNone);
   664 	test_KErrNone(r);
   667 	dir.Close();
   665 	dir.Close();
   668 	delete dirEntries;
   666 	delete dirEntries;
   669 	}
   667 	}
   670 
   668 
   671 
   669 
   673 //
   671 //
   674 //	Test with tcb capabilities
   672 //	Test with tcb capabilities
   675 //
   673 //
   676 	{
   674 	{
   677 	r=TheFs.FileSystemName(fsname,gTheDriveNum);
   675 	r=TheFs.FileSystemName(fsname,gTheDriveNum);
   678 	test(r==KErrNone);
   676 	test_KErrNone(r);
   679 	r = DismountFileSystem(TheFs, fsname, gTheDriveNum);
   677 	r = DismountFileSystem(TheFs, fsname, gTheDriveNum);
   680 	test(r==KErrPermissionDenied);
   678 	test_Value(r, r == KErrPermissionDenied);
   681 //	r=TheFs.RemoveFileSystem(fsname);	//can not test due to bug else where fix exists
   679 //	r=TheFs.RemoveFileSystem(fsname);	//can not test due to bug else where fix exists
   682 //	test(r==KErrNone);
   680 //	test_KErrNone(r);
   683 //	r=TheFs.AddFileSystem(fsname);
   681 //	r=TheFs.AddFileSystem(fsname);
   684 //	test(r==KErrNone);
   682 //	test_KErrNone(r);
   685 	r = MountFileSystem(TheFs, fsname, gTheDriveNum);
   683 	r = MountFileSystem(TheFs, fsname, gTheDriveNum);
   686 	test(r==KErrPermissionDenied);
   684 	test_Value(r, r == KErrPermissionDenied);
   687 	test.Printf(_L("r=%d"),r);
   685 	test.Printf(_L("r=%d"),r);
   688 	r=TheFs.SetDriveName(gTheDriveNum,KDriveName);
   686 	r=TheFs.SetDriveName(gTheDriveNum,KDriveName);
   689 	test(r==KErrPermissionDenied);
   687 	test_Value(r, r == KErrPermissionDenied);
   690 #ifndef __WINS__
   688 #ifndef __WINS__
   691  	r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum);
   689  	r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum);
   692 	test(r==KErrPermissionDenied);
   690 	test_Value(r, r == KErrPermissionDenied);
   693 #endif
   691 #endif
   694 
   692 
   695 	systemRFsTest();
   693 	systemRFsTest();
   696 	ResourceRFsTest();
   694 	ResourceRFsTest();
   697 	privateRFsTest();	
   695 	privateRFsTest();	
   713 	test(aStat2==KErrNone);
   711 	test(aStat2==KErrNone);
   714 	test(aStat3==KErrNone);
   712 	test(aStat3==KErrNone);
   715 	test(aStat4==KErrNone);
   713 	test(aStat4==KErrNone);
   716 
   714 
   717 	r=TheFs.SetSessionPath(systestname);
   715 	r=TheFs.SetSessionPath(systestname);
   718 	test(r==KErrNone);
   716 	test_KErrNone(r);
   719 	
   717 	
   720 //Test RRawDisk class
   718 //Test RRawDisk class
   721 	r=rawdisk.Open(TheFs,gTheDriveNum);
   719 	r=rawdisk.Open(TheFs,gTheDriveNum);
   722 	test(r==KErrNone);
   720 	test_KErrNone(r);
   723 	rawdisk.Close();
   721 	rawdisk.Close();
   724 
   722 
   725 	RDirtest();
   723 	RDirtest();
   726 
   724 
   727 #ifdef __WINS__
   725 #ifdef __WINS__
   728 	if (User::UpperCase(driveBuf[0]) != 'C')
   726 	if (User::UpperCase(driveBuf[0]) != 'C')
   729 #endif
   727 #endif
   730 		{
   728 		{
   731 		//Test RFormat class
   729 		//Test RFormat class
   732 		r=format.Open(TheFs,driveBuf,EHighDensity,count);
   730 		r=format.Open(TheFs,driveBuf,EHighDensity,count);
   733 		test(r==KErrPermissionDenied);
   731 		test_Value(r, r == KErrPermissionDenied);
   734 
   732 
   735 		while(count)	
   733 		while(count)	
   736 			{
   734 			{
   737 			TInt r=format.Next(count);
   735 			TInt r=format.Next(count);
   738 			test(r==KErrNone);
   736 			test_KErrNone(r);
   739 			}
   737 			}
   740 		format.Close();
   738 		format.Close();
   741 		}
   739 		}
   742 
   740 
   743 	driveBuf[0]=(TText)gDriveToTest;
   741 	driveBuf[0]=(TText)gDriveToTest;
   744 	r=TheFs.ScanDrive(driveBuf);
   742 	r=TheFs.ScanDrive(driveBuf);
   745 	RDebug::Print(_L("r=%d"),r);
   743 	RDebug::Print(_L("r=%d"),r);
   746 	test(r==KErrPermissionDenied);
   744 	test_Value(r, r == KErrPermissionDenied);
   747 	r=TheFs.CheckDisk(driveBuf);
   745 	r=TheFs.CheckDisk(driveBuf);
   748 	test(r==KErrPermissionDenied);
   746 	test_Value(r, r == KErrPermissionDenied);
   749 	}
   747 	}
   750 
   748 
   751 LOCAL_C void TestCaps()
   749 LOCAL_C void TestCaps()
   752 //
   750 //
   753 //	test format etc that require certain capabilities
   751 //	test format etc that require certain capabilities
   761 	r=RProcess().HasCapability(ECapabilityAllFiles, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg));
   759 	r=RProcess().HasCapability(ECapabilityAllFiles, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg));
   762 	test(r);
   760 	test(r);
   763 	
   761 	
   764 	driveBuf[0]=(TText)gDriveToTest;
   762 	driveBuf[0]=(TText)gDriveToTest;
   765 	r=TheFs.SessionPath(temp);
   763 	r=TheFs.SessionPath(temp);
   766 	test(r==KErrNone);
   764 	test_KErrNone(r);
   767 
   765 
   768 	test.Printf(_L("Session path: %S"),&temp);
   766 	test.Printf(_L("Session path: %S"),&temp);
   769 
   767 
   770 	r=TheFs.CreatePrivatePath(gTheDriveNum);
   768 	r=TheFs.CreatePrivatePath(gTheDriveNum);
   771 	test(r==KErrNone || r== KErrAlreadyExists);
   769 	test_Value(r, r == KErrNone || r== KErrAlreadyExists);
   772 
   770 
   773 	TBuf<18> tempPri;
   771 	TBuf<18> tempPri;
   774 	r=TheFs.PrivatePath(tempPri);
   772 	r=TheFs.PrivatePath(tempPri);
   775 	test(r==KErrNone);
   773 	test_KErrNone(r);
   776 	theprivatepath = _L("?:");
   774 	theprivatepath = _L("?:");
   777 	theprivatepath.Append(tempPri);
   775 	theprivatepath.Append(tempPri);
   778 
   776 
   779 	TestTcbAllfiles();
   777 	TestTcbAllfiles();
   780 	
   778 	
   781 	TFileName thesessionpath;
   779 	TFileName thesessionpath;
   782 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   780 	r=TheFs.SetSessionToPrivate(gTheDriveNum);
   783 	test(r==KErrNone);
   781 	test_KErrNone(r);
   784 	r=TheFs.SessionPath(thesessionpath);
   782 	r=TheFs.SessionPath(thesessionpath);
   785 	test(r==KErrNone);
   783 	test_KErrNone(r);
   786 
   784 
   787 	test(thesessionpath == theprivatepath);
   785 	test(thesessionpath == theprivatepath);
   788 	}
   786 	}
   789 
   787 
   790 
   788 
   792 
   790 
   793 LOCAL_C void ScanDir(const TDesC& aName, CDirScan::TScanDirection aDirection, TInt aError)
   791 LOCAL_C void ScanDir(const TDesC& aName, CDirScan::TScanDirection aDirection, TInt aError)
   794 	{
   792 	{
   795 	CDirScan* scanner = NULL;
   793 	CDirScan* scanner = NULL;
   796 	TRAP(r, scanner = CDirScan::NewL(TheFs));
   794 	TRAP(r, scanner = CDirScan::NewL(TheFs));
   797 	test(r == KErrNone && scanner);
   795 	test_Value(r, r == KErrNone && scanner);
   798 
   796 
   799 	TRAP(r, scanner->SetScanDataL(aName,KEntryAttDir,ESortByName|EAscending,aDirection));
   797 	TRAP(r, scanner->SetScanDataL(aName,KEntryAttDir,ESortByName|EAscending,aDirection));
   800 	test(r == KErrNone);
   798 	test_KErrNone(r);
   801 
   799 
   802 	CDir *entryList=NULL;
   800 	CDir *entryList=NULL;
   803 	for (;;)
   801 	for (;;)
   804 		{
   802 		{
   805 		TRAP(r, scanner->NextL(entryList));
   803 		TRAP(r, scanner->NextL(entryList));
   806 		test(r == aError);
   804 		test_Value(r, r == aError);
   807 		if (entryList==NULL)
   805 		if (entryList==NULL)
   808 			break;
   806 			break;
   809 
   807 
   810         TInt count=entryList->Count();
   808         TInt count=entryList->Count();
   811 
   809 
   843 		TBuf<30> privatepath;
   841 		TBuf<30> privatepath;
   844 		r=TheFs.PrivatePath(privatepath);
   842 		r=TheFs.PrivatePath(privatepath);
   845 		test.Printf(_L("Private Path is=%S"),&privatepath);
   843 		test.Printf(_L("Private Path is=%S"),&privatepath);
   846 		
   844 		
   847 		r = TheFs.MkDir(_L("\\Caged\\"));
   845 		r = TheFs.MkDir(_L("\\Caged\\"));
   848 		test(r==KErrNone || r==KErrAlreadyExists);
   846 		test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   849 		
   847 		
   850 		CDir* entryCount=NULL;
   848 		CDir* entryCount=NULL;
   851 		r=TheFs.GetDir(_L("\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount);
   849 		r=TheFs.GetDir(_L("\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount);
   852 		test(r==KErrNone);
   850 		test_KErrNone(r);
   853 		
   851 		
   854 		delete entryCount;
   852 		delete entryCount;
   855 		entryCount=NULL;
   853 		entryCount=NULL;
   856 
   854 
   857 
   855 
   858 		//Testing Copy
   856 		//Testing Copy
   859 		CDir* entryCount2=NULL;
   857 		CDir* entryCount2=NULL;
   860 		r=fMan->Copy(_L("\\sys\\"),_L("\\Caged\\"));
   858 		r=fMan->Copy(_L("\\sys\\"),_L("\\Caged\\"));
   861 		test(r == KErrNone);
   859 		test_KErrNone(r);
   862 		r=fMan->Copy(_L("\\*"),_L("\\Caged\\"));
   860 		r=fMan->Copy(_L("\\*"),_L("\\Caged\\"));
   863 		test(r == KErrNone);
   861 		test_KErrNone(r);
   864 		
   862 		
   865 		r=TheFs.GetDir(_L("\\Caged\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount2);
   863 		r=TheFs.GetDir(_L("\\Caged\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount2);
   866 		test(r==KErrNone);
   864 		test_KErrNone(r);
   867 		
   865 		
   868 		delete entryCount2;
   866 		delete entryCount2;
   869 		entryCount2=NULL;
   867 		entryCount2=NULL;
   870 	
   868 	
   871 		r=fMan->Copy(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); 
   869 		r=fMan->Copy(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); 
   872 		test(r == KErrPathNotFound);
   870 		test_Value(r, r == KErrPathNotFound);
   873 	
   871 	
   874 		// Create a test file
   872 		// Create a test file
   875 		RFile testFile;
   873 		RFile testFile;
   876 		r = testFile.Replace(TheFs, _L("\\capTest"),EFileWrite);
   874 		r = testFile.Replace(TheFs, _L("\\capTest"),EFileWrite);
   877 		test(r==KErrNone || r==KErrAlreadyExists);
   875 		test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   878 		testFile.Close();
   876 		testFile.Close();
   879 		
   877 		
   880 		TFileName name;
   878 		TFileName name;
   881 		name = privatepath;
   879 		name = privatepath;
   882 		name.Append(_L("privateFile.tst"));
   880 		name.Append(_L("privateFile.tst"));
   883 		RFile privateFile;
   881 		RFile privateFile;
   884 		r = privateFile.Replace(TheFs, name,EFileWrite);
   882 		r = privateFile.Replace(TheFs, name,EFileWrite);
   885 		test(r==KErrNone || r==KErrAlreadyExists);
   883 		test_Value(r, r == KErrNone || r==KErrAlreadyExists);
   886 		privateFile.Close();
   884 		privateFile.Close();
   887 
   885 
   888 	
   886 	
   889 		r=fMan->Copy(_L("\\capTest"),_L("\\private\\two\\moo")); 
   887 		r=fMan->Copy(_L("\\capTest"),_L("\\private\\two\\moo")); 
   890 		test(r == KErrPathNotFound);
   888 		test_Value(r, r == KErrPathNotFound);
   891 		r=fMan->Copy(_L("\\capTest"),_L("\\sys\\bin\\moo")); 
   889 		r=fMan->Copy(_L("\\capTest"),_L("\\sys\\bin\\moo")); 
   892 		test(r == KErrPathNotFound); 
   890 		test_Value(r, r == KErrPathNotFound); 
   893 		r=fMan->Copy(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo")); 
   891 		r=fMan->Copy(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo")); 
   894 		test(r == KErrPathNotFound);
   892 		test_Value(r, r == KErrPathNotFound);
   895 		r=fMan->Copy(_L("\\capTest"),_L("\\sys\\capTest")); 
   893 		r=fMan->Copy(_L("\\capTest"),_L("\\sys\\capTest")); 
   896 		test(r == KErrNone || r==KErrAlreadyExists); 
   894 		test_Value(r, r == KErrNone || r==KErrAlreadyExists); 
   897 		r=fMan->Copy(_L("\\sys\\*"),_L("\\"));
   895 		r=fMan->Copy(_L("\\sys\\*"),_L("\\"));
   898 		test (r==KErrNone);
   896 		test_KErrNone(r);
   899 		r=fMan->Copy(name,_L("\\sys\\"));
   897 		r=fMan->Copy(name,_L("\\sys\\"));
   900 		test(r==KErrNone);
   898 		test_KErrNone(r);
   901 
   899 
   902 		// Testing Attribs
   900 		// Testing Attribs
   903 		r=fMan->Attribs(_L("\\private\\two\\moo"),KEntryAttReadOnly,0,TTime(0)); 
   901 		r=fMan->Attribs(_L("\\private\\two\\moo"),KEntryAttReadOnly,0,TTime(0)); 
   904 		test(r == KErrPathNotFound);
   902 		test_Value(r, r == KErrPathNotFound);
   905 		r=fMan->Attribs(_L("\\private\\moo"),KEntryAttReadOnly,0,TTime(0)); 
   903 		r=fMan->Attribs(_L("\\private\\moo"),KEntryAttReadOnly,0,TTime(0)); 
   906 		test(r == KErrNotFound);
   904 		test_Value(r, r == KErrNotFound);
   907 		r=fMan->Attribs(name,KEntryAttReadOnly,0,TTime(0));
   905 		r=fMan->Attribs(name,KEntryAttReadOnly,0,TTime(0));
   908 		test(r == KErrNone);
   906 		test_KErrNone(r);
   909 		r=fMan->Attribs(name,0,KEntryAttReadOnly,TTime(0));
   907 		r=fMan->Attribs(name,0,KEntryAttReadOnly,TTime(0));
   910 		test(r == KErrNone);
   908 		test_KErrNone(r);
   911 
   909 
   912 		// Testing Move
   910 		// Testing Move
   913 		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo"));
   911 		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo"));
   914 		test(r == KErrPathNotFound);
   912 		test_Value(r, r == KErrPathNotFound);
   915 		r=fMan->Move(_L("\\private\\two\\moo.."),_L("\\private\\one\\moo"));
   913 		r=fMan->Move(_L("\\private\\two\\moo.."),_L("\\private\\one\\moo"));
   916 		test(r == KErrPathNotFound);
   914 		test_Value(r, r == KErrPathNotFound);
   917 		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo.."));
   915 		r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo.."));
   918 		test(r == KErrPathNotFound);
   916 		test_Value(r, r == KErrPathNotFound);
   919 		r=fMan->Move(name,_L("\\privateFile.tst"));
   917 		r=fMan->Move(name,_L("\\privateFile.tst"));
   920 		test(r == KErrNone);
   918 		test_KErrNone(r);
   921 		r=fMan->Move(_L("\\privateFile.tst"),name);
   919 		r=fMan->Move(_L("\\privateFile.tst"),name);
   922 		test(r == KErrNone);
   920 		test_KErrNone(r);
   923 
   921 
   924 
   922 
   925 		// Testing RmDir
   923 		// Testing RmDir
   926 		r=fMan->RmDir(_L("\\private\\"));
   924 		r=fMan->RmDir(_L("\\private\\"));
   927 		test(r == KErrNone);
   925 		test_KErrNone(r);
   928 		// put it back where it was
   926 		// put it back where it was
   929 		r = TheFs.MkDirAll(_L("\\private\\00000001\\"));
   927 		r = TheFs.MkDirAll(_L("\\private\\00000001\\"));
   930 		test(r == KErrNone);
   928 		test_KErrNone(r);
   931 		r=fMan->RmDir(_L("\\private\\two\\"));
   929 		r=fMan->RmDir(_L("\\private\\two\\"));
   932 		test(r == KErrPathNotFound);
   930 		test_Value(r, r == KErrPathNotFound);
   933 		r=fMan->RmDir(_L("\\private\\tw?\\"));
   931 		r=fMan->RmDir(_L("\\private\\tw?\\"));
   934 		test(r == KErrBadName);
   932 		test_Value(r, r == KErrBadName);
   935 
   933 
   936 		r=fMan->RmDir(_L("\\private\\two\\"));
   934 		r=fMan->RmDir(_L("\\private\\two\\"));
   937 		test(r == KErrPathNotFound);
   935 		test_Value(r, r == KErrPathNotFound);
   938 		r=fMan->RmDir(_L("\\private\\tw?\\"));
   936 		r=fMan->RmDir(_L("\\private\\tw?\\"));
   939 		test(r == KErrBadName);
   937 		test_Value(r, r == KErrBadName);
   940 		
   938 		
   941 		
   939 		
   942 		// Testing Rename
   940 		// Testing Rename
   943 		r=fMan->Rename(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); 
   941 		r=fMan->Rename(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); 
   944 		test(r == KErrPathNotFound);
   942 		test_Value(r, r == KErrPathNotFound);
   945 		
   943 		
   946 		// Testing Delete
   944 		// Testing Delete
   947 		r=fMan->Delete(_L("\\private\\two\\test")); 
   945 		r=fMan->Delete(_L("\\private\\two\\test")); 
   948 		test(r == KErrPathNotFound);
   946 		test_Value(r, r == KErrPathNotFound);
   949 		r=fMan->Delete(_L("\\private\\moo")); 
   947 		r=fMan->Delete(_L("\\private\\moo")); 
   950 		test(r == KErrNotFound);
   948 		test_Value(r, r == KErrNotFound);
   951 		
   949 		
   952 		//Something that actually exists in Private
   950 		//Something that actually exists in Private
   953 		r=fMan->Rename(name,_L("\\private\\00000001\\moo")); 
   951 		r=fMan->Rename(name,_L("\\private\\00000001\\moo")); 
   954 		test(r == KErrNotFound);
   952 		test_Value(r, r == KErrNotFound);
   955 		r=fMan->Rename(_L("\\private\\00000001\\moo"),name); 
   953 		r=fMan->Rename(_L("\\private\\00000001\\moo"),name); 
   956 		test(r == KErrNotFound);
   954 		test_Value(r, r == KErrNotFound);
   957 		r=fMan->Copy(name,_L("\\private\\00000001\\moo")); 
   955 		r=fMan->Copy(name,_L("\\private\\00000001\\moo")); 
   958 		test(r == KErrNotFound);
   956 		test_Value(r, r == KErrNotFound);
   959 		r=fMan->Delete(_L("\\private\\00000001\\moo")); 
   957 		r=fMan->Delete(_L("\\private\\00000001\\moo")); 
   960 		test(r == KErrNotFound);
   958 		test_Value(r, r == KErrNotFound);
   961 
   959 
   962 		// Clean up the test data
   960 		// Clean up the test data
   963 		r=fMan->RmDir(_L("\\Caged\\")); 
   961 		r=fMan->RmDir(_L("\\Caged\\")); 
   964 		test(r == KErrNone);
   962 		test_KErrNone(r);
   965 		r=fMan->Delete(_L("\\capTest")); 
   963 		r=fMan->Delete(_L("\\capTest")); 
   966 		test(r == KErrNone);
   964 		test_KErrNone(r);
   967 		delete(fMan);
   965 		delete(fMan);
   968 		}
   966 		}
   969 	
   967 	
   970 	// CDirScan tests
   968 	// CDirScan tests
   971 	ScanDir(_L("\\"), CDirScan::EScanUpTree, KErrNone);
   969 	ScanDir(_L("\\"), CDirScan::EScanUpTree, KErrNone);
   982 //
   980 //
   983 	{
   981 	{
   984 	test.Next(_L("Delete test directory"));
   982 	test.Next(_L("Delete test directory"));
   985 	CFileMan* fMan=CFileMan::NewL(TheFs);
   983 	CFileMan* fMan=CFileMan::NewL(TheFs);
   986 	TInt r=fMan->RmDir(gSessionPath);
   984 	TInt r=fMan->RmDir(gSessionPath);
   987 	test(r==KErrNone || KErrPathNotFound);
   985 	test_Value(r, r == KErrNone || r == KErrPathNotFound);
   988 	delete fMan;
   986 	delete fMan;
   989 	}
   987 	}
   990 
   988 
   991 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
   989 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
   992 //
   990 //
  1006 	TBuf<30> sesspath;
  1004 	TBuf<30> sesspath;
  1007 	sesspath=_L("?:\\");
  1005 	sesspath=_L("?:\\");
  1008 	sesspath[0] = (TText)gDriveToTest;
  1006 	sesspath[0] = (TText)gDriveToTest;
  1009 
  1007 
  1010 	TInt r= TheFs.SetSessionPath(sesspath);
  1008 	TInt r= TheFs.SetSessionPath(sesspath);
  1011 	test(r==KErrNone);
  1009 	test_KErrNone(r);
  1012 
  1010 
  1013 	//cleanup from previous run of this test
  1011 	//cleanup from previous run of this test
  1014 	TBuf<20> delDir;
  1012 	TBuf<20> delDir;
  1015 	CFileMan* fMan=CFileMan::NewL(TheFs);
  1013 	CFileMan* fMan=CFileMan::NewL(TheFs);
  1016 	delDir=KResourcePath;
  1014 	delDir=KResourcePath;
  1017 	delDir[0]=(TText)gDriveToTest;
  1015 	delDir[0]=(TText)gDriveToTest;
  1018 	r=fMan->RmDir(delDir);
  1016 	r=fMan->RmDir(delDir);
  1019 	test(r==KErrNone || KErrNotFound);
  1017 	test_Value(r, r == KErrNone || r == KErrNotFound || r == KErrPathNotFound);
  1020 	delDir=KSystemPath;
  1018 	delDir=KSystemPath;
  1021 	delDir[0]=(TText)gDriveToTest;
  1019 	delDir[0]=(TText)gDriveToTest;
  1022 	r=fMan->RmDir(delDir);
  1020 	r=fMan->RmDir(delDir);
  1023 	test(r==KErrNone || KErrNotFound);
  1021 	test_Value(r, r == KErrNone || r == KErrNotFound || r == KErrPathNotFound);
  1024 	delDir=KPrivatePath;
  1022 	delDir=KPrivatePath;
  1025 	delDir[0]=(TText)gDriveToTest;
  1023 	delDir[0]=(TText)gDriveToTest;
  1026 	r=fMan->RmDir(delDir);
  1024 	r=fMan->RmDir(delDir);
  1027 	test(r==KErrNone || KErrNotFound);
  1025 	test_Value(r, r == KErrNone || r == KErrNotFound || r == KErrPathNotFound);
  1028 	delete fMan;
  1026 	delete fMan;
  1029 
  1027 
  1030 	//check double mode ie that Defpath still works	
  1028 	//check double mode ie that Defpath still works	
  1031 	RFs fs1;
  1029 	RFs fs1;
  1032 	RFs fs2;
  1030 	RFs fs2;
  1033 	
  1031 	
  1034 	r=fs1.Connect();
  1032 	r=fs1.Connect();
  1035 	test(r==KErrNone);
  1033 	test_KErrNone(r);
  1036 	r=fs1.SessionPath(sesspath);
  1034 	r=fs1.SessionPath(sesspath);
  1037 	test(r==KErrNone);
  1035 	test_KErrNone(r);
  1038 	test.Printf(_L("session1 Path=%S"),&sesspath);
  1036 	test.Printf(_L("session1 Path=%S"),&sesspath);
  1039 
  1037 
  1040 	TBuf<30> privatepath;
  1038 	TBuf<30> privatepath;
  1041 	r=fs1.SetSessionToPrivate(gTheDriveNum);
  1039 	r=fs1.SetSessionToPrivate(gTheDriveNum);
  1042 	test(r==KErrNone);
  1040 	test_KErrNone(r);
  1043 	r=fs1.PrivatePath(privatepath);
  1041 	r=fs1.PrivatePath(privatepath);
  1044 	test(r==KErrNone);
  1042 	test_KErrNone(r);
  1045 	r=privatepath.Compare(KExpectedPrivatePath());
  1043 	r=privatepath.Compare(KExpectedPrivatePath());
  1046 	test(r==0);
  1044 	test_Value(r, r == 0);
  1047 	r=fs1.SessionPath(sesspath);
  1045 	r=fs1.SessionPath(sesspath);
  1048 	test(r==KErrNone);
  1046 	test_KErrNone(r);
  1049 	r=privatepath.Compare(sesspath.Mid(KPathPosition));
  1047 	r=privatepath.Compare(sesspath.Mid(KPathPosition));
  1050 	test(r==0);
  1048 	test_Value(r, r == 0);
  1051 	r=fs1.CreatePrivatePath(gTheDriveNum);
  1049 	r=fs1.CreatePrivatePath(gTheDriveNum);
  1052 	test(r==KErrNone);
  1050 	test_KErrNone(r);
  1053 	fs1.Close();
  1051 	fs1.Close();
  1054 
  1052 
  1055 	r=fs2.Connect();
  1053 	r=fs2.Connect();
  1056 	test(r==KErrNone);
  1054 	test_KErrNone(r);
  1057 	r=fs2.SessionPath(sesspath);
  1055 	r=fs2.SessionPath(sesspath);
  1058 	test(r==KErrNone);
  1056 	test_KErrNone(r);
  1059 	test.Printf(_L("session2 Path=%S"),&sesspath);
  1057 	test.Printf(_L("session2 Path=%S"),&sesspath);
  1060 	fs2.Close();
  1058 	fs2.Close();
  1061 
  1059 
  1062 	TestCaps();
  1060 	TestCaps();
  1063 	TestCaging();
  1061 	TestCaging();