kerneltest/f32test/server/t_fsrv.cpp
changeset 109 b3a1d9898418
parent 33 0173bcd7697c
child 200 73ea206103e6
child 210 b592f7984442
equal deleted inserted replaced
102:ef2a444a7410 109:b3a1d9898418
    97 	test.Title();
    97 	test.Title();
    98 
    98 
    99 	test.Start(_L("Path test thread"));
    99 	test.Start(_L("Path test thread"));
   100 	RFs f;
   100 	RFs f;
   101 	TInt r=f.Connect();
   101 	TInt r=f.Connect();
   102 	test(r==KErrNone);
   102 	test_KErrNone(r);
   103 	r=f.SessionPath(tPath);
   103 	r=f.SessionPath(tPath);
   104 	test(r==KErrNone);
   104 	test_KErrNone(r);
   105 	f.Close();
   105 	f.Close();
   106 
   106 
   107 	return(KErrNone);
   107 	return(KErrNone);
   108 	}
   108 	}
   109 
   109 
   207  	
   207  	
   208  	TInt r=TheFs.DismountFileSystem(_L("DELAYFS"),EDriveQ);
   208  	TInt r=TheFs.DismountFileSystem(_L("DELAYFS"),EDriveQ);
   209  	 
   209  	 
   210  	test.Printf(_L("Dismounting the Remote Drive returned %d\n"),r);
   210  	test.Printf(_L("Dismounting the Remote Drive returned %d\n"),r);
   211  	
   211  	
   212  	test(r==KErrNone );
   212  	test_Value(r, r == KErrNone );
   213 	}
   213 	}
   214 
   214 
   215 
   215 
   216 LOCAL_C void CreateSubstDrive()
   216 LOCAL_C void CreateSubstDrive()
   217 	{
   217 	{
   218      test.Printf(_L("Create Substitute Drive \n"));
   218 	test.Printf(_L("Create Substitute Drive \n"));
   219     
   219 
   220     TDriveList driveList;   
   220 	TDriveList driveList;   
   221     TInt i ;
   221 
   222       
   222 	TInt r=TheFs.SessionPath(gTestSessionPath);
   223     TInt r=TheFs.SessionPath(gTestSessionPath);
   223 	test_KErrNone(r);
   224 	test(r==KErrNone);  
       
   225  	
   224  	
   226  	r=TheFs.DriveList(driveList, KDriveAttExclude|KDriveAttLocal);
   225  	r=TheFs.DriveList(driveList, KDriveAttExclude|KDriveAttLocal);
   227    	test( r==KErrNone );
   226    	test_KErrNone(r);
   228    
   227    
   229 
   228 
   230    	for ( i = EDriveO; i < KMaxDrives; i++) 
   229 	for (TInt i = EDriveO; i < KMaxDrives; i++)
   231       	{
   230 		{
   232     
   231 		if (driveList[i] == 0)
   233       	if ( driveList[i] == 0) 
   232 			{
   234           	{
   233 			if (i == EDriveQ)
   235           	if (i == EDriveQ) continue;  // Q reserved to mount a virtual Remote Drive, as part of the test.
   234 				continue;  // Q reserved to mount a virtual Remote Drive, as part of the test.
   236         	substDrive = i;
   235 			substDrive = i;
   237           	break;          
   236 			break;
   238           	}
   237 			}
   239       	}
   238 		}
   240            
   239 
   241    
       
   242    	if (substDrive)
   240    	if (substDrive)
   243    		{
   241    		{
   244  		TDriveInfo driveInfo;
   242  		TDriveInfo driveInfo;
   245 		r=TheFs.Drive(driveInfo,substDrive);
   243 		r=TheFs.Drive(driveInfo,substDrive);
   246 		test(r==KErrNone);
   244 		test_KErrNone(r);
   247 	
   245 	
   248 		if (driveInfo.iDriveAtt==KDriveAttLocal)
   246 		if (driveInfo.iDriveAtt==KDriveAttLocal)
   249 			{	
   247 			{
   250 			return;	//	Subst local drives fails
   248 			return;	//	Subst local drives fails
   251 			}
   249 			}
   252 	
   250 	
   253 		TFileName n;
   251 		TFileName n;
   254 		r=TheFs.Subst(n,substDrive);
   252 		r=TheFs.Subst(n,substDrive);
   255 		test(r==KErrNone);
   253 		test_KErrNone(r);
   256 		test(n.Length()==0);	
   254 		test_Value(n.Length(), n.Length() == 0);
   257 		r=TheFs.SetSubst(gTestSessionPath,substDrive);
   255 		r=TheFs.SetSubst(gTestSessionPath,substDrive);
   258 		test(r==KErrNone);
   256 		test_KErrNone(r);
   259 		r=TheFs.Subst(n,substDrive);
   257 		r=TheFs.Subst(n,substDrive);
   260 		test(r==KErrNone);
   258 		test_KErrNone(r);
   261 		test(n==gTestSessionPath);   		
   259 		test(n==gTestSessionPath);
   262    		}
   260    		}
   263 
       
   264 	
       
   265 	}
   261 	}
   266 
   262 
   267 		
   263 		
   268 LOCAL_C void RemoveSubstDrive()
   264 LOCAL_C void RemoveSubstDrive()
   269 	{
   265 	{
   270 	 	if( substDrive)
   266 	 	if( substDrive)
   271 	 		{
   267 	 		{
   272 	 		test.Printf(_L("Removing Substitute Drive \n"));	 	 
   268 	 		test.Printf(_L("Removing Substitute Drive \n"));
   273 	 		TInt r =TheFs.SetSubst(_L(""),substDrive);	
   269 	 		TInt r =TheFs.SetSubst(_L(""),substDrive);
   274 			test(r ==KErrNone);	 		
   270 			test_KErrNone(r);
   275 	 		}
   271 	 		}
   276 
   272 
   277 	}
   273 	}
   278 
   274 
   279 
   275 
   282 //
   278 //
   283 // Test the drive info is reasonable
   279 // Test the drive info is reasonable
   284 //
   280 //
   285 	{
   281 	{
   286 
   282 
   287 	test(anInfo.iConnectionBusType==EConnectionBusInternal || anInfo.iConnectionBusType==EConnectionBusUsb);
   283 	test_Value(anInfo.iConnectionBusType, anInfo.iConnectionBusType==EConnectionBusInternal || anInfo.iConnectionBusType==EConnectionBusUsb);
   288 	
   284 	
   289 	if (aDrive==EDriveZ)
   285 	if (aDrive==EDriveZ)
   290 		{
   286 		{
   291 		if (anInfo.iType==EMediaNotPresent)
   287 		if (anInfo.iType==EMediaNotPresent)
   292 			return;
   288 			return;
   293 		
   289 		
   294 		test(anInfo.iMediaAtt==KMediaAttWriteProtected);
   290 		test_Value(anInfo.iMediaAtt, anInfo.iMediaAtt==KMediaAttWriteProtected);
   295 		test(anInfo.iDriveAtt==(KDriveAttRom|KDriveAttInternal));
   291 		test_Value(anInfo.iDriveAtt, anInfo.iDriveAtt==(KDriveAttRom|KDriveAttInternal));
   296 		test(anInfo.iType==EMediaRom);
   292 		test_Value(anInfo.iType, anInfo.iType==EMediaRom);
   297 		}
   293 		}
   298 
   294 
   299 	else if (GetDriveLFFS()==aDrive)
   295 	else if (GetDriveLFFS()==aDrive)
   300 		{
   296 		{
   301         if (anInfo.iType==EMediaNotPresent)
   297         if (anInfo.iType==EMediaNotPresent)
   302             return;
   298             return;
   303 
   299 
   304 		test(anInfo.iDriveAtt&(KDriveAttLocal|KDriveAttInternal)==KDriveAttLocal|KDriveAttInternal);	// LFFS sets KDriveAttTransaction as well
   300 		test_Value(anInfo.iDriveAtt, anInfo.iDriveAtt&(KDriveAttLocal|KDriveAttInternal)==KDriveAttLocal|KDriveAttInternal);	// LFFS sets KDriveAttTransaction as well
   305         test(anInfo.iType==EMediaFlash);
   301         test_Value(anInfo.iType, anInfo.iType==EMediaFlash);
   306         test(anInfo.iMediaAtt==KMediaAttFormattable);
   302         test_Value(anInfo.iMediaAtt, anInfo.iMediaAtt==KMediaAttFormattable);
   307 		}
   303 		}
   308 /*
   304 /*
   309 Why assume certain drive letters can only refer to certain drive types?
   305 Why assume certain drive letters can only refer to certain drive types?
   310 	else if (aDrive==EDriveC || aDrive==EDriveY)
   306 	else if (aDrive==EDriveC || aDrive==EDriveY)
   311 		{
   307 		{
   379  
   375  
   380     
   376     
   381     test.Printf(_L("Test existing DriveList \n"));
   377     test.Printf(_L("Test existing DriveList \n"));
   382     
   378     
   383     err = TheFs.DriveList(driveList);
   379     err = TheFs.DriveList(driveList);
   384     test( err == KErrNone );
   380 	test_KErrNone(err);
   385     
   381     
   386     for ( i = 0; i < KMaxDrives; i++) 
   382     for ( i = 0; i < KMaxDrives; i++) 
   387         {
   383         {
   388         if (driveList[i]) 
   384         if (driveList[i]) 
   389             {
   385             {
   390             err = TheFs.Drive(info, i);
   386             err = TheFs.Drive(info, i);
   391             test( err == KErrNone );
   387 			test_KErrNone(err);
   392             test( info.iType  !=  EMediaRemote  );
   388             test_Value(info.iType, info.iType != EMediaRemote);
   393             test( !(info.iDriveAtt & KDriveAttRemote ) ); 
   389             test_Value(info.iDriveAtt, !(info.iDriveAtt & KDriveAttRemote)); 
   394 			test( !(info.iDriveAtt & KDriveAttHidden ) );
   390 			test_Value(info.iDriveAtt, !(info.iDriveAtt & KDriveAttHidden));
   395             drivecount++; 
   391             drivecount++; 
   396             
   392             
   397             if( info.iDriveAtt  & KDriveAttRemovable) 
   393             if( info.iDriveAtt  & KDriveAttRemovable) 
   398            	nonHiddenRemovableDriveCount++;
   394            	nonHiddenRemovableDriveCount++;
   399 
   395 
   428       
   424       
   429    TInt allDrivecount = 0;
   425    TInt allDrivecount = 0;
   430    flags = KDriveAttAll;
   426    flags = KDriveAttAll;
   431    err = TheFs.DriveList(driveList, flags);
   427    err = TheFs.DriveList(driveList, flags);
   432 
   428 
   433    test( err == KErrNone );
   429 	test_KErrNone(err);
   434    for ( i = 0; i < KMaxDrives; i++) 
   430    for ( i = 0; i < KMaxDrives; i++) 
   435        {
   431        {
   436        if (driveList[i]) 
   432        if (driveList[i]) 
   437            {
   433            {
   438            err = TheFs.Drive(info,i);
   434            err = TheFs.Drive(info,i);
   439            test( err == KErrNone );
   435 			test_KErrNone(err);
   440            allDrivecount++;
   436            allDrivecount++;
   441            
   437            
   442            if( info.iDriveAtt  & KDriveAttSubsted ) 
   438            if( info.iDriveAtt  & KDriveAttSubsted ) 
   443            		substDriveCount++;
   439            		substDriveCount++;
   444             
   440             
   460            
   456            
   461             printDriveAtt(i,info.iDriveAtt);
   457             printDriveAtt(i,info.iDriveAtt);
   462            }
   458            }
   463         }  
   459         }  
   464 
   460 
   465  	test(allDrivecount == drivecount + hiddenOrRemoteDriveCount);
       
   466 	test(hiddenOrRemoteDriveCount - hiddenDriveCount == 1);
       
   467 
       
   468 	test.Printf(_L("Found %d substitute drives\n"), substDriveCount);
   461 	test.Printf(_L("Found %d substitute drives\n"), substDriveCount);
   469 	test.Printf(_L("Found %d exclusively substitute  drives \n"),exclusiveSubstDriveCount);
   462 	test.Printf(_L("Found %d exclusively substitute  drives \n"),exclusiveSubstDriveCount);
   470 	test.Printf(_L("Found %d hidden drives\n"), hiddenDriveCount);
   463 	test.Printf(_L("Found %d hidden drives\n"), hiddenDriveCount);
   471 
   464 
   472 	TInt nonRemovables = drivecount -  removableDriveCount;
   465 	TInt nonRemovables = drivecount -  removableDriveCount;
   473 	TInt physicallyRemovable = removableDriveCount - logicallyRemovableDriveCount;
   466 	TInt physicallyRemovable = removableDriveCount - logicallyRemovableDriveCount;
   474 	test.Printf(_L("Found %d non removables drives\n"), nonRemovables);
   467 	test.Printf(_L("Found %d non removables drives\n"), nonRemovables);
   475 	test.Printf(_L("Found %d physically removable drives \n"),physicallyRemovable);
   468 	test.Printf(_L("Found %d physically removable drives \n"),physicallyRemovable);
   476 	test.Printf(_L("Found %d logically removable drives \n"),logicallyRemovableDriveCount);
   469 	test.Printf(_L("Found %d logically removable drives \n"),logicallyRemovableDriveCount);
   477   
   470   
       
   471  	test(allDrivecount == drivecount + hiddenOrRemoteDriveCount);
       
   472 	test(hiddenOrRemoteDriveCount - hiddenDriveCount == 1);
       
   473 
   478   
   474   
   479   	//--------------------------------------------- 
   475   	//--------------------------------------------- 
   480 	//! @SYMTestCaseID			PBASE-T_FSRV-0546
   476 	//! @SYMTestCaseID			PBASE-T_FSRV-0546
   481 	//! @SYMTestType			UT 
   477 	//! @SYMTestType			UT 
   482 	//! @SYMREQ					CR909
   478 	//! @SYMREQ					CR909
   493 	
   489 	
   494 	drivecount = 0;
   490 	drivecount = 0;
   495 	
   491 	
   496     flags = KDriveAttRemovable;
   492     flags = KDriveAttRemovable;
   497     err = TheFs.DriveList(driveList, flags);
   493     err = TheFs.DriveList(driveList, flags);
   498     test( err == KErrNone );
   494 	test_KErrNone(err);
   499     for ( i = 0; i < KMaxDrives; i++) 
   495     for ( i = 0; i < KMaxDrives; i++) 
   500         {
   496         {
   501         if (driveList[i]) 
   497         if (driveList[i]) 
   502             {
   498             {
   503             err = TheFs.Drive(info, i);
   499             err = TheFs.Drive(info, i);
   504             test( err == KErrNone );
   500 			test_KErrNone(err);
   505             test( info.iDriveAtt & KDriveAttRemovable );
   501             test_Value(info.iDriveAtt, info.iDriveAtt & KDriveAttRemovable);
   506             drivecount++; 
   502             drivecount++;
   507       
   503       
   508             printDriveAtt(i,info.iDriveAtt);
   504             printDriveAtt(i,info.iDriveAtt);
   509             }
   505             }
   510 
   506 
   511         }
   507         }
   512 
   508 
   513     test( drivecount == removableDriveCount ); // no removable drive was added
   509 	test_Value(drivecount, drivecount == removableDriveCount); // no removable drive was added
   514 
   510 
   515 
   511 
   516   	//--------------------------------------------- 
   512   	//--------------------------------------------- 
   517 	//! @SYMTestCaseID			PBASE-T_FSRV-0547
   513 	//! @SYMTestCaseID			PBASE-T_FSRV-0547
   518 	//! @SYMTestType			UT 
   514 	//! @SYMTestType			UT 
   529  	test.Printf(_L("Return only Removable and Remote \n"));
   525  	test.Printf(_L("Return only Removable and Remote \n"));
   530  	
   526  	
   531     drivecount = 0;
   527     drivecount = 0;
   532     flags = KDriveAttRemovable | KDriveAttRemote;
   528     flags = KDriveAttRemovable | KDriveAttRemote;
   533     err = TheFs.DriveList(driveList, flags);
   529     err = TheFs.DriveList(driveList, flags);
   534     test( err == KErrNone );
   530 	test_KErrNone(err);
   535     for ( i = 0; i < KMaxDrives; i++) 
   531     for ( i = 0; i < KMaxDrives; i++) 
   536         {
   532         {
   537         if (driveList[i]) 
   533         if (driveList[i]) 
   538             {
   534             {
   539             err = TheFs.Drive(info, i);
   535             err = TheFs.Drive(info, i);
   540             test( err == KErrNone );
   536 			test_KErrNone(err);
   541             test( (info.iDriveAtt & KDriveAttRemovable ) || (info.iDriveAtt & KDriveAttRemote)); 
   537             test_Value(info.iDriveAtt, (info.iDriveAtt & KDriveAttRemovable ) || (info.iDriveAtt & KDriveAttRemote)); 
   542             drivecount++; 
   538             drivecount++; 
   543            
   539            
   544            	printDriveAtt(i,info.iDriveAtt);
   540            	printDriveAtt(i,info.iDriveAtt);
   545             
   541             
   546             }
   542             }
   547 
   543 
   548         }
   544         }
   549     test( drivecount == removableDriveCount + 1 );  //contains the remote drive we mounted
   545 	test_Value(drivecount, drivecount == removableDriveCount + 1 );  //contains the remote drive we mounted
   550     
   546     
   551 
   547 
   552   	//--------------------------------------------- 
   548   	//--------------------------------------------- 
   553 	//! @SYMTestCaseID			PBASE-T_FSRV-0548
   549 	//! @SYMTestCaseID			PBASE-T_FSRV-0548
   554 	//! @SYMTestType			UT 
   550 	//! @SYMTestType			UT 
   566  	
   562  	
   567  	drivecount = 0;
   563  	drivecount = 0;
   568     flags = KDriveAttExclusive | KDriveAttRemote;
   564     flags = KDriveAttExclusive | KDriveAttRemote;
   569     TUint match = KDriveAttRemote;
   565     TUint match = KDriveAttRemote;
   570     err = TheFs.DriveList(driveList, flags);
   566     err = TheFs.DriveList(driveList, flags);
   571     test( err == KErrNone );
   567 	test_KErrNone(err);
   572     for ( i = 0; i < KMaxDrives; i++) 
   568     for ( i = 0; i < KMaxDrives; i++) 
   573         {
   569         {
   574         if (driveList[i]) 
   570         if (driveList[i]) 
   575             {
   571             {
   576             err = TheFs.Drive(info, i);
   572             err = TheFs.Drive(info, i);
   577             test( err == KErrNone );
   573 			test_KErrNone(err);
   578             test( (info.iDriveAtt == match)); 
   574             test_Value(info.iDriveAtt, (info.iDriveAtt == match)); 
   579             drivecount++;
   575             drivecount++;
   580             
   576             
   581             printDriveAtt(i,info.iDriveAtt);
   577             printDriveAtt(i,info.iDriveAtt);
   582             }
   578             }
   583 
   579 
   584         }
   580         }
   585    	test( drivecount == 1 ); //The remote drive we mounted.
   581    	test_Value(drivecount, drivecount == 1); //The remote drive we mounted.
   586 
   582 
   587 
   583 
   588   	//--------------------------------------------- 
   584   	//--------------------------------------------- 
   589 	//! @SYMTestCaseID			PBASE-T_FSRV-0549
   585 	//! @SYMTestCaseID			PBASE-T_FSRV-0549
   590 	//! @SYMTestType			UT 
   586 	//! @SYMTestType			UT 
   601    test.Printf(_L("Exclude Removable\n"));
   597    test.Printf(_L("Exclude Removable\n"));
   602 
   598 
   603    drivecount = 0; 	
   599    drivecount = 0; 	
   604    flags = KDriveAttExclude | KDriveAttRemovable;
   600    flags = KDriveAttExclude | KDriveAttRemovable;
   605    err = TheFs.DriveList(driveList, flags);
   601    err = TheFs.DriveList(driveList, flags);
   606    test( err == KErrNone );
   602 	test_KErrNone(err);
   607    for (i = 0; i < KMaxDrives; i++) 
   603    for (i = 0; i < KMaxDrives; i++) 
   608        {
   604        {
   609        if (driveList[i]) 
   605        if (driveList[i]) 
   610            {
   606            {
   611            err = TheFs.Drive(info, i);
   607            err = TheFs.Drive(info, i);
   612            test( err == KErrNone );
   608 			test_KErrNone(err);
   613            test( (!(info.iDriveAtt & KDriveAttRemovable ) )); 
   609            test_Value(info.iDriveAtt, (!(info.iDriveAtt & KDriveAttRemovable ) )); 
   614            drivecount++;
   610            drivecount++;
   615            
   611            
   616            printDriveAtt(i,info.iDriveAtt);
   612            printDriveAtt(i,info.iDriveAtt);
   617            }
   613            }
   618 
   614 
   619        }  
   615        }  
   620      test ( drivecount == allDrivecount - removableDriveCount); 
   616      test_Value(drivecount, drivecount == allDrivecount - removableDriveCount); 
   621 	 test ( drivecount == nonRemovables + hiddenDriveCount + 1) ;   //The remote drive we added is non removable  
   617 	 test_Value (drivecount, drivecount == nonRemovables + hiddenDriveCount + 1) ;   //The remote drive we added is non removable  
   622 
   618 
   623 
   619 
   624 
   620 
   625   	//--------------------------------------------- 
   621   	//--------------------------------------------- 
   626 	//! @SYMTestCaseID			PBASE-T_FSRV-0550
   622 	//! @SYMTestCaseID			PBASE-T_FSRV-0550
   641    
   637    
   642    drivecount = 0;
   638    drivecount = 0;
   643    flags = KDriveAttExclude | KDriveAttRemovable | KDriveAttRemote;
   639    flags = KDriveAttExclude | KDriveAttRemovable | KDriveAttRemote;
   644    err = TheFs.DriveList(driveList, flags);
   640    err = TheFs.DriveList(driveList, flags);
   645    
   641    
   646    test( err == KErrNone );
   642 	test_KErrNone(err);
   647    
   643    
   648    for ( i = 0; i < KMaxDrives; i++) 
   644    for ( i = 0; i < KMaxDrives; i++) 
   649        {
   645        {
   650        if (driveList[i]) 
   646        if (driveList[i]) 
   651            {
   647            {
   652            err = TheFs.Drive(info,i);
   648            err = TheFs.Drive(info,i);
   653            test( err == KErrNone );
   649 			test_KErrNone(err);
   654            test( (!(info.iDriveAtt & KDriveAttRemovable ) && (!(info.iDriveAtt & KDriveAttRemote ))));
   650            test_Value(info.iDriveAtt, (!(info.iDriveAtt & KDriveAttRemovable ) && (!(info.iDriveAtt & KDriveAttRemote ))));
   655            drivecount++;
   651            drivecount++;
   656            
   652            
   657            printDriveAtt(i,info.iDriveAtt);
   653            printDriveAtt(i,info.iDriveAtt);
   658            }
   654            }
   659        }
   655        }
   660    test(drivecount == (allDrivecount - removableDriveCount - 1)  ); // also excluding the removables and the remote drive   
   656 	test_Value(drivecount, drivecount == (allDrivecount - removableDriveCount - 1)  ); // also excluding the removables and the remote drive   
   661   
   657   
   662   
   658   
   663 
   659 
   664 
   660 
   665 
   661 
   685    
   681    
   686    		drivecount = 0;
   682    		drivecount = 0;
   687    		flags = KDriveAttExclude | KDriveAttRemote | KDriveAttSubsted;
   683    		flags = KDriveAttExclude | KDriveAttRemote | KDriveAttSubsted;
   688    		err = TheFs.DriveList(driveList, flags);
   684    		err = TheFs.DriveList(driveList, flags);
   689    
   685    
   690    		test( err == KErrNone );
   686 		test_KErrNone(err);
   691    
   687    
   692    		for ( i = 0; i < KMaxDrives; i++) 
   688    		for ( i = 0; i < KMaxDrives; i++) 
   693        		{
   689        		{
   694        		if (driveList[i]) 
   690        		if (driveList[i]) 
   695            		{
   691            		{
   696            		err = TheFs.Drive(info,i);
   692            		err = TheFs.Drive(info,i);
   697            		test( err == KErrNone );
   693 			test_KErrNone(err);
   698            		test( (!(info.iDriveAtt & KDriveAttRemote )  && (!(info.iDriveAtt & KDriveAttSubsted ))));
   694            		test_Value(info.iDriveAtt, (!(info.iDriveAtt & KDriveAttRemote )  && (!(info.iDriveAtt & KDriveAttSubsted ))));
   699            		drivecount++;
   695            		drivecount++;
   700            
   696            
   701            		printDriveAtt(i,info.iDriveAtt);
   697            		printDriveAtt(i,info.iDriveAtt);
   702            		}
   698            		}
   703        		}
   699        		}
   704     	test(drivecount == (allDrivecount - substDriveCount- 1)  );    
   700 		test_Value(drivecount, drivecount == (allDrivecount - substDriveCount- 1)  );    
   705 
   701 
   706 
   702 
   707 		
   703 		
   708    		test.Printf(_L("Exclusively Exclude Substed drives\n"));
   704    		test.Printf(_L("Exclusively Exclude Substed drives\n"));
   709    
   705    
   710    		drivecount = 0;
   706    		drivecount = 0;
   711    		flags = KDriveAttExclusive | KDriveAttExclude | KDriveAttSubsted;
   707    		flags = KDriveAttExclusive | KDriveAttExclude | KDriveAttSubsted;
   712    		err = TheFs.DriveList(driveList, flags);
   708    		err = TheFs.DriveList(driveList, flags);
   713    
   709    
   714    		test( err == KErrNone );
   710 		test_KErrNone(err);
   715    
   711    
   716    		for ( i = 0; i < KMaxDrives; i++) 
   712    		for ( i = 0; i < KMaxDrives; i++) 
   717        		{
   713        		{
   718        		if (driveList[i]) 
   714        		if (driveList[i]) 
   719            		{
   715            		{
   720            		err = TheFs.Drive(info,i);
   716            		err = TheFs.Drive(info,i);
   721            		test( err == KErrNone );
   717 				test_KErrNone(err);
   722            		test( info.iDriveAtt != KDriveAttSubsted );
   718            		test_Value(info.iDriveAtt, info.iDriveAtt != KDriveAttSubsted);
   723            		drivecount++;
   719            		drivecount++;
   724            
   720            
   725            		printDriveAtt(i,info.iDriveAtt);
   721            		printDriveAtt(i,info.iDriveAtt);
   726            		}		
   722            		}		
   727    		    
   723    		    
   728    		    }
   724    		    }
   729     
   725     
   730 		test(drivecount == (allDrivecount - exclusiveSubstDriveCount)  );        
   726 		test_Value(drivecount, drivecount == (allDrivecount - exclusiveSubstDriveCount)  );        
   731 		
   727 		
   732 		}
   728 		}
   733 
   729 
   734 
   730 
   735   	//--------------------------------------------- 
   731   	//--------------------------------------------- 
   765 		{ KDriveAttAll     | KDriveAttExclusive,					KErrArgument, KErrArgument},
   761 		{ KDriveAttAll     | KDriveAttExclusive,					KErrArgument, KErrArgument},
   766 		{ KDriveAttAll     | KDriveAttExclude | KDriveAttExclusive, KErrArgument, KErrArgument}};
   762 		{ KDriveAttAll     | KDriveAttExclude | KDriveAttExclusive, KErrArgument, KErrArgument}};
   767 
   763 
   768 	TDriveList fullDriveList;
   764 	TDriveList fullDriveList;
   769 	err = TheFs.DriveList(fullDriveList, KDriveAttAll);
   765 	err = TheFs.DriveList(fullDriveList, KDriveAttAll);
   770 	test( err == KErrNone );
   766 	test_KErrNone(err);
   771 
   767 
   772 	for ( i = 0; i < KMaxDrives; i++) 
   768 	for ( i = 0; i < KMaxDrives; i++) 
   773 		{
   769 		{
   774 		if (driveList[i]) 
   770 		if (driveList[i]) 
   775 			{
   771 			{
   776 			err = TheFs.Drive(info,i);
   772 			err = TheFs.Drive(info,i);
   777 			test( err == KErrNone );
   773 			test_KErrNone(err);
   778 			printDriveAtt(i,info.iDriveAtt);
   774 			printDriveAtt(i,info.iDriveAtt);
   779 			}
   775 			}
   780 		}
   776 		}
   781 
   777 
   782 	for(TUint matchIdx = 0; matchIdx < sizeof(testCombinations) / sizeof(TCombinations); matchIdx++)
   778 	for(TUint matchIdx = 0; matchIdx < sizeof(testCombinations) / sizeof(TCombinations); matchIdx++)
   792 	 		
   788 	 		
   793 			//test.Printf(_L("            ATT : 0x%08x \n"), testAtt);
   789 			//test.Printf(_L("            ATT : 0x%08x \n"), testAtt);
   794 			//test.Printf(_L("Expected Result : %d     \n"), testAtt == 0 ? testCombinations[matchIdx].iExpectedResultNoAtts : testCombinations[matchIdx].iExpectedResultWithAtts);
   790 			//test.Printf(_L("Expected Result : %d     \n"), testAtt == 0 ? testCombinations[matchIdx].iExpectedResultNoAtts : testCombinations[matchIdx].iExpectedResultWithAtts);
   795 			//test.Printf(_L("  Actual Result : 0x%08x \n"), err);
   791 			//test.Printf(_L("  Actual Result : 0x%08x \n"), err);
   796 
   792 
   797 			test( err == (testAtt == 0 ? testCombinations[matchIdx].iExpectedResultNoAtts : testCombinations[matchIdx].iExpectedResultWithAtts) );
   793 			test_Value(err, err == (testAtt == 0 ? testCombinations[matchIdx].iExpectedResultNoAtts : testCombinations[matchIdx].iExpectedResultWithAtts));
   798 
   794 
   799 			if(err == KErrNone)
   795 			if(err == KErrNone)
   800 				{
   796 				{
   801 				//printDriveAtt(0, testAtt);  //Prints attributes   
   797 				//printDriveAtt(0, testAtt);  //Prints attributes   
   802 				for ( i = 0; i < KMaxDrives; i++) 
   798 				for ( i = 0; i < KMaxDrives; i++) 
   803 					{
   799 					{
   804 					TBool expectMatch = EFalse;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
   800 					TBool expectMatch = EFalse;
   805 
   801 
   806 					switch(testCombinations[matchIdx].iMatchMask)
   802 					switch(testCombinations[matchIdx].iMatchMask)
   807 						{
   803 						{
   808 						case 0:
   804 						case 0:
   809 							expectMatch = (fullDriveList[i] & testAtt) != 0;                                                                                                                                                           
   805 							expectMatch = (fullDriveList[i] & testAtt) != 0;                                                                                                                                                           
   811 
   807 
   812 						case KDriveAttAll:
   808 						case KDriveAttAll:
   813 							expectMatch = ETrue;
   809 							expectMatch = ETrue;
   814 							break;
   810 							break;
   815 
   811 
   816 						case KDriveAttExclude :
   812 						case KDriveAttExclude:
   817 							expectMatch = (fullDriveList[i] & testAtt) == 0;
   813 							expectMatch = (fullDriveList[i] & testAtt) == 0;
   818 							break;
   814 							break;
   819 
   815 
   820 						case KDriveAttExclusive :
   816 						case KDriveAttExclusive:
   821 							expectMatch = (fullDriveList[i] == testAtt);
   817 							expectMatch = (fullDriveList[i] == testAtt);
   822 							break;
   818 							break;
   823 
   819 
   824 						case KDriveAttExclude | KDriveAttExclusive:
   820 						case KDriveAttExclude | KDriveAttExclusive:
   825 							expectMatch = (fullDriveList[i] != testAtt);
   821 							expectMatch = (fullDriveList[i] != testAtt);
   826 							break;
   822 							break;
   827 	
   823 	
   828 						case KDriveAttAll | KDriveAttExclude :
   824 						case KDriveAttAll | KDriveAttExclude:
   829 							test(0);	// Invalid - should never get here as this returns KErrArgument for all cases
   825 							// Invalid - should never get here as this returns KErrArgument for all cases
   830 							break;
   826 						case KDriveAttAll | KDriveAttExclusive:
   831 
   827 							// Invalid - should never get here as this returns KErrArgument for all cases
   832 						case KDriveAttAll | KDriveAttExclusive :
   828 						case KDriveAttAll | KDriveAttExclude | KDriveAttExclusive:
   833 							test(0);	// Invalid - should never get here as this returns KErrArgument for all cases
   829 							// Invalid - should never get here as this returns KErrArgument for all cases
   834 							break;
       
   835 
       
   836 						case KDriveAttAll | KDriveAttExclude | KDriveAttExclusive :
       
   837 							test(0);	// Invalid - should never get here as this returns KErrArgument for all cases
       
   838 							break;
       
   839 
       
   840 						default:
   830 						default:
   841 							test.Printf(_L("Unexpected Match Mask %08x"), testCombinations[matchIdx].iMatchMask);
   831 							test.Printf(_L("Unexpected or invalid Match Mask %08x"), testCombinations[matchIdx].iMatchMask);
   842 							test(0);
   832 							test(0);
   843 							break;
   833 							break;
   844 						}
   834 						}
   845 
   835 
   846 					if(expectMatch) 
   836 					if(expectMatch) 
   847 						{
   837 						{
   848 						//test.Printf(_L(" %c MATCHED OK "), 'A' + i);
   838 						//test.Printf(_L(" %c MATCHED OK "), 'A' + i);
   849 						test(newDriveList[i] == fullDriveList[i]);
   839 						test_Value(newDriveList[i], newDriveList[i] == fullDriveList[i]);
   850 						}
   840 						}
   851 					else
   841 					else
   852 						{
   842 						{
   853 						/*if(fullDriveList[i] == 0)
   843 						/*if(fullDriveList[i] == 0)
   854 							{
   844 							{
   857 						else
   847 						else
   858 							{
   848 							{
   859 							test.Printf(_L(" %c NOT MATCHED "), 'A' + i);
   849 							test.Printf(_L(" %c NOT MATCHED "), 'A' + i);
   860 							}
   850 							}
   861 						*/
   851 						*/
   862 						test(newDriveList[i] == 0);
   852 						test_Value(newDriveList[i], newDriveList[i] == 0);
   863 						}
   853 						}
   864 					}
   854 					}
   865 				}
   855 				}
   866 			}
   856 			}
   867 		}
   857 		}
   883 	test.Printf(_L("Return only Logically Removable drives \n"));
   873 	test.Printf(_L("Return only Logically Removable drives \n"));
   884  	
   874  	
   885  	drivecount = 0;
   875  	drivecount = 0;
   886     flags = KDriveAttLogicallyRemovable;
   876     flags = KDriveAttLogicallyRemovable;
   887     err = TheFs.DriveList(driveList, flags);
   877     err = TheFs.DriveList(driveList, flags);
   888     test( err == KErrNone );
   878 	test_KErrNone(err);
   889     for ( i = 0; i < KMaxDrives; i++) 
   879     for ( i = 0; i < KMaxDrives; i++) 
   890         {
   880         {
   891         if (driveList[i]) 
   881         if (driveList[i]) 
   892             {
   882             {
   893             err = TheFs.Drive(info, i);
   883             err = TheFs.Drive(info, i);
   894             test( err == KErrNone );
   884 			test_KErrNone(err);
   895             test( info.iDriveAtt & KDriveAttLogicallyRemovable );
   885             test_Value(info.iDriveAtt, info.iDriveAtt & KDriveAttLogicallyRemovable);
   896             drivecount++; 
   886             drivecount++; 
   897       
   887       
   898             printDriveAtt(i,info.iDriveAtt);
   888             printDriveAtt(i,info.iDriveAtt);
   899             }
   889             }
   900 
   890 
   901         }
   891         }
   902 
   892 
   903     test( drivecount == logicallyRemovableDriveCount ); // no logically removable drive was added
   893     test_Value(drivecount, drivecount == logicallyRemovableDriveCount); // no logically removable drive was added
   904  
       
   905 
   894 
   906 	test.End();
   895 	test.End();
   907 	}
   896 	}
   908 	
   897 	
   909 
   898 
   919 	{
   908 	{
   920 
   909 
   921 	test.Start(_L("The drive info"));
   910 	test.Start(_L("The drive info"));
   922 	TDriveList list;
   911 	TDriveList list;
   923 	TInt r=TheFs.DriveList(list);
   912 	TInt r=TheFs.DriveList(list);
   924 	test(r==KErrNone);
   913 	test_KErrNone(r);
   925 	for (TInt i=0;i<KMaxDrives;i++)
   914 	for (TInt i=0;i<KMaxDrives;i++)
   926 		{
   915 		{
   927 		TInt att=list[i];
   916 		TInt att=list[i];
   928 		if (att)
   917 		if (att)
   929 			{
   918 			{
   930 			TDriveInfo d;
   919 			TDriveInfo d;
   931 			r=TheFs.Drive(d,i);
   920 			r=TheFs.Drive(d,i);
   932 			test(r==KErrNone);
   921 			test_KErrNone(r);
   933 			printDriveInfo(i,d);
   922 			printDriveInfo(i,d);
   934 			test.Printf(_L("\n"));
   923 			test.Printf(_L("\n"));
   935 			testDriveInfo(i,d);
   924 			testDriveInfo(i,d);
   936 			}
   925 			}
   937 		}
   926 		}
   946 	{
   935 	{
   947 
   936 
   948 	test.Start(_L("The volume info"));
   937 	test.Start(_L("The volume info"));
   949 	TDriveList list;
   938 	TDriveList list;
   950 	TInt r=TheFs.DriveList(list);
   939 	TInt r=TheFs.DriveList(list);
   951 	test(r==KErrNone);
   940 	test_KErrNone(r);
   952 	for (TInt i=0;i<KMaxDrives;i++)
   941 	for (TInt i=0;i<KMaxDrives;i++)
   953 		{
   942 		{
   954 		TVolumeInfo v;
   943 		TVolumeInfo v;
   955 		TDriveInfo d;
   944 		TDriveInfo d;
   956 		switch (r=TheFs.Volume(v,i))
   945 		switch (r=TheFs.Volume(v,i))
  1010 				r=f.Set(name,&rel,NULL);
   999 				r=f.Set(name,&rel,NULL);
  1011                 }
  1000                 }
  1012 			}
  1001 			}
  1013 		else
  1002 		else
  1014 			r=f.Set(name,NULL,NULL);
  1003 			r=f.Set(name,NULL,NULL);
  1015 		test(r==KErrNone);
  1004 		test_KErrNone(r);
  1016 		test(TPtrC(p.fullName)==f.FullName());
  1005 		test(TPtrC(p.fullName)==f.FullName());
  1017 		test(TPtrC(p.drive)==f.Drive());
  1006 		test(TPtrC(p.drive)==f.Drive());
  1018 		test(TPtrC(p.path)==f.Path());
  1007 		test(TPtrC(p.path)==f.Path());
  1019 		test(TPtrC(p.name)==f.Name());
  1008 		test(TPtrC(p.name)==f.Name());
  1020 		test(TPtrC(p.ext)==f.Ext());
  1009 		test(TPtrC(p.ext)==f.Ext());
  1030 	{
  1019 	{
  1031 
  1020 
  1032 	test.Start(_L("Test path handling"));
  1021 	test.Start(_L("Test path handling"));
  1033 	TFileName p;
  1022 	TFileName p;
  1034 	TInt r=TheFs.SessionPath(p);
  1023 	TInt r=TheFs.SessionPath(p);
  1035 	test(r==KErrNone);
  1024 	test_KErrNone(r);
  1036 	test.Printf(_L("SESSION=\"%S\"\n"),&p);
  1025 	test.Printf(_L("SESSION=\"%S\"\n"),&p);
  1037 	r=TheFs.SetSessionPath(_L("A:\\TEST\\"));
  1026 	r=TheFs.SetSessionPath(_L("A:\\TEST\\"));
  1038 	test(r==KErrNone);
  1027 	test_KErrNone(r);
  1039 	r=TheFs.SessionPath(p);
  1028 	r=TheFs.SessionPath(p);
  1040 	test(r==KErrNone);
  1029 	test_KErrNone(r);
  1041 	test(p==_L("A:\\TEST\\"));
  1030 	test(p==_L("A:\\TEST\\"));
  1042 	r=TheFs.SetSessionPath(gSessionPath);
  1031 	r=TheFs.SetSessionPath(gSessionPath);
  1043 	test(r==KErrNone);
  1032 	test_KErrNone(r);
  1044 
  1033 
  1045 
  1034 
  1046 	TheFs.SetAllocFailure(gAllocFailOff);
  1035 	TheFs.SetAllocFailure(gAllocFailOff);
  1047 
  1036 
  1048 	RThread t;
  1037 	RThread t;
  1049 	r=t.Create(_L("PathTest"),pathTestThread,KDefaultStackSize,KHeapSize,KHeapSize,NULL);
  1038 	r=t.Create(_L("PathTest"),pathTestThread,KDefaultStackSize,KHeapSize,KHeapSize,NULL);
  1050 	test(r==KErrNone);
  1039 	test_KErrNone(r);
  1051 	TRequestStatus tStat;
  1040 	TRequestStatus tStat;
  1052 	t.Logon(tStat);
  1041 	t.Logon(tStat);
  1053 	t.Resume();
  1042 	t.Resume();
  1054 	User::WaitForRequest(tStat);
  1043 	User::WaitForRequest(tStat);
  1055 	test(tStat==KErrNone);
  1044 	r = tStat.Int();
  1056 	test(r==KErrNone);
  1045 	test_KErrNone(r);
  1057 	t.Close();
  1046 	t.Close();
  1058 
  1047 
  1059 	TheFs.SetAllocFailure(gAllocFailOn);
  1048 	TheFs.SetAllocFailure(gAllocFailOn);
  1060 
  1049 
  1061 	test.End();
  1050 	test.End();
  1069 
  1058 
  1070 	test.Start(_L("Test server side parsing"));
  1059 	test.Start(_L("Test server side parsing"));
  1071 
  1060 
  1072 	TFileName old;
  1061 	TFileName old;
  1073 	TInt r=TheFs.SessionPath(old);
  1062 	TInt r=TheFs.SessionPath(old);
  1074 	test(r==KErrNone);
  1063 	test_KErrNone(r);
  1075 	r=TheFs.SetSessionPath(_L("C:\\ABCDEF\\"));
  1064 	r=TheFs.SetSessionPath(_L("C:\\ABCDEF\\"));
  1076 	test(r==KErrNone);
  1065 	test_KErrNone(r);
  1077 	for (TInt i=0;i<KMaxParses;i++)
  1066 	for (TInt i=0;i<KMaxParses;i++)
  1078 		{
  1067 		{
  1079 		TInt r;
  1068 		TInt r;
  1080 		TParse f;
  1069 		TParse f;
  1081 		SParseServer& p=parseServer[i];
  1070 		SParseServer& p=parseServer[i];
  1082 		TPtrC name(p.src);
  1071 		TPtrC name(p.src);
  1083 		if (p.rel)
  1072 		if (p.rel)
  1084 			r=TheFs.Parse(name,TPtrC(p.rel),f);
  1073 			r=TheFs.Parse(name,TPtrC(p.rel),f);
  1085 		else
  1074 		else
  1086 			r=TheFs.Parse(name,f);
  1075 			r=TheFs.Parse(name,f);
  1087 		test(r==KErrNone);
  1076 		test_KErrNone(r);
  1088 		test(TPtrC(p.fullName)==f.FullName());
  1077 		test(TPtrC(p.fullName)==f.FullName());
  1089 		test(TPtrC(p.drive)==f.Drive());
  1078 		test(TPtrC(p.drive)==f.Drive());
  1090 		test(TPtrC(p.path)==f.Path());
  1079 		test(TPtrC(p.path)==f.Path());
  1091 		test(TPtrC(p.name)==f.Name());
  1080 		test(TPtrC(p.name)==f.Name());
  1092 		test(TPtrC(p.ext)==f.Ext());
  1081 		test(TPtrC(p.ext)==f.Ext());
  1093 		}
  1082 		}
  1094 	r=TheFs.SetSessionPath(old);
  1083 	r=TheFs.SetSessionPath(old);
  1095 	test(r==KErrNone);
  1084 	test_KErrNone(r);
  1096 
  1085 
  1097 	test.End();
  1086 	test.End();
  1098 	}
  1087 	}
  1099 
  1088 
  1100 LOCAL_C void testSubst()
  1089 LOCAL_C void testSubst()
  1104 	{
  1093 	{
  1105 
  1094 
  1106 	test.Printf(_L("Test subst"));
  1095 	test.Printf(_L("Test subst"));
  1107 	TVolumeInfo v;
  1096 	TVolumeInfo v;
  1108 	TInt r=TheFs.Volume(v);
  1097 	TInt r=TheFs.Volume(v);
  1109 	test(r==KErrNone);
  1098 	test_KErrNone(r);
  1110 	TDriveInfo origDI;
  1099 	TDriveInfo origDI;
  1111 	r=TheFs.Drive(origDI);
  1100 	r=TheFs.Drive(origDI);
  1112 	test(r==KErrNone);
  1101 	test_KErrNone(r);
  1113 	
  1102 	
  1114 	TDriveInfo driveInfo;
  1103 	TDriveInfo driveInfo;
  1115 	r=TheFs.Drive(driveInfo,EDriveO);
  1104 	r=TheFs.Drive(driveInfo,EDriveO);
  1116 	test(r==KErrNone);
  1105 	test_KErrNone(r);
  1117 	
  1106 	
  1118 	if (driveInfo.iDriveAtt==KDriveAttLocal)
  1107 	if (driveInfo.iDriveAtt==KDriveAttLocal)
  1119 		{	
  1108 		{	
  1120 		return;	//	Subst local drives fails
  1109 		return;	//	Subst local drives fails
  1121 		}
  1110 		}
  1122 	
  1111 	
  1123 	TFileName n;
  1112 	TFileName n;
  1124 	r=TheFs.Subst(n,EDriveO);
  1113 	r=TheFs.Subst(n,EDriveO);
  1125 	test(r==KErrNone);
  1114 	test_KErrNone(r);
  1126 	test(n.Length()==0);
  1115 	test_Value(n.Length(), n.Length()==0);
  1127 	r=TheFs.SetSubst(gSessionPath,EDriveO);
  1116 	r=TheFs.SetSubst(gSessionPath,EDriveO);
  1128 	test(r==KErrNone);
  1117 	test_KErrNone(r);
  1129 	r=TheFs.Subst(n,EDriveO);
  1118 	r=TheFs.Subst(n,EDriveO);
  1130 	test(r==KErrNone);
  1119 	test_KErrNone(r);
  1131 	test(n==gSessionPath);
  1120 	test(n==gSessionPath);
  1132 	TVolumeInfo w;
  1121 	TVolumeInfo w;
  1133 	r=TheFs.Volume(w,EDriveO);
  1122 	r=TheFs.Volume(w,EDriveO);
  1134 	test(r==KErrNone);
  1123 	test_KErrNone(r);
  1135 	test(w.iDrive.iType==v.iDrive.iType);
  1124 	test_Value(w.iDrive.iType, w.iDrive.iType==v.iDrive.iType);
  1136 	test(w.iDrive.iConnectionBusType==v.iDrive.iConnectionBusType);
  1125 	test_Value(w.iDrive.iConnectionBusType, w.iDrive.iConnectionBusType==v.iDrive.iConnectionBusType);
  1137 	test(w.iDrive.iDriveAtt==KDriveAttSubsted);
  1126 	test_Value(w.iDrive.iDriveAtt, w.iDrive.iDriveAtt==KDriveAttSubsted);
  1138 	test(w.iDrive.iMediaAtt==v.iDrive.iMediaAtt);
  1127 	test_Value(w.iDrive.iMediaAtt, w.iDrive.iMediaAtt==v.iDrive.iMediaAtt);
  1139 	test(w.iUniqueID==v.iUniqueID);
  1128 	test(w.iUniqueID==v.iUniqueID);
  1140 	test(w.iSize==v.iSize);
  1129 	test(w.iSize==v.iSize);
  1141 	test(w.iFree==v.iFree);
  1130 	test(w.iFree==v.iFree);
  1142 	test(w.iName==v.iName);
  1131 	test(w.iName==v.iName);
  1143 	TDriveList driveList;
  1132 	TDriveList driveList;
  1144 	r=TheFs.DriveList(driveList);
  1133 	r=TheFs.DriveList(driveList);
  1145 	test(r==KErrNone);
  1134 	test_KErrNone(r);
  1146 	test(driveList[EDriveO]==KDriveAttSubsted);
  1135 	test(driveList[EDriveO]==KDriveAttSubsted);
  1147 	TDriveInfo d;
  1136 	TDriveInfo d;
  1148 	r=TheFs.Drive(d,EDriveO);
  1137 	r=TheFs.Drive(d,EDriveO);
  1149 	test(r==KErrNone);
  1138 	test_KErrNone(r);
  1150 	test(d.iDriveAtt==KDriveAttSubsted);
  1139 	test_Value(d.iDriveAtt, d.iDriveAtt==KDriveAttSubsted);
  1151 	test(d.iMediaAtt==origDI.iMediaAtt);
  1140 	test_Value(d.iMediaAtt, d.iMediaAtt==origDI.iMediaAtt);
  1152 	test(d.iType==origDI.iType);
  1141 	test_Value(d.iType, d.iType==origDI.iType);
  1153 	test(d.iConnectionBusType==origDI.iConnectionBusType);
  1142 	test_Value(d.iConnectionBusType, d.iConnectionBusType==origDI.iConnectionBusType);
  1154 
  1143 
  1155 
  1144 
  1156 	test.Next(_L("Test real name"));
  1145 	test.Next(_L("Test real name"));
  1157 	r=TheFs.RealName(_L("O:\\FILE.XXX"),n);
  1146 	r=TheFs.RealName(_L("O:\\FILE.XXX"),n);
  1158 	test(r==KErrNone);
  1147 	test_KErrNone(r);
  1159 	TFileName substedPath=gSessionPath;
  1148 	TFileName substedPath=gSessionPath;
  1160 	substedPath.Append(_L("FILE.XXX"));
  1149 	substedPath.Append(_L("FILE.XXX"));
  1161 	test(n.CompareF(substedPath)==KErrNone);
  1150 	test(n.CompareF(substedPath)==KErrNone);
  1162 //
  1151 //
  1163 	test.Next(_L("Test MkDir, Rename and RmDir on Substed drive"));
  1152 	test.Next(_L("Test MkDir, Rename and RmDir on Substed drive"));
  1164 	_LIT(KTurgid,"turgid\\");
  1153 	_LIT(KTurgid,"turgid\\");
  1165 	TFileName dir=gSessionPath;
  1154 	TFileName dir=gSessionPath;
  1166 	dir+=KTurgid;
  1155 	dir+=KTurgid;
  1167 	r=TheFs.MkDirAll(dir);
  1156 	r=TheFs.MkDirAll(dir);
  1168 	test(r==KErrNone);
  1157 	test_KErrNone(r);
  1169 	dir+=_L("subdir\\");
  1158 	dir+=_L("subdir\\");
  1170 	r=TheFs.MkDir(dir);
  1159 	r=TheFs.MkDir(dir);
  1171 	test(r==KErrNone);
  1160 	test_KErrNone(r);
  1172 	r=TheFs.RmDir(_L("O:\\turgid\\subdir\\"));
  1161 	r=TheFs.RmDir(_L("O:\\turgid\\subdir\\"));
  1173 	test(r==KErrNone);
  1162 	test_KErrNone(r);
  1174 	r=TheFs.Rename(_L("O:\\turgid"), _L("O:\\facile"));
  1163 	r=TheFs.Rename(_L("O:\\turgid"), _L("O:\\facile"));
  1175 	test(r==KErrNone);
  1164 	test_KErrNone(r);
  1176 	r=TheFs.MkDir(_L("O:\\insipid\\"));
  1165 	r=TheFs.MkDir(_L("O:\\insipid\\"));
  1177 	test(r==KErrNone);
  1166 	test_KErrNone(r);
  1178 	r=TheFs.Rename(_L("O:\\insipid"), _L("O:\\glib"));
  1167 	r=TheFs.Rename(_L("O:\\insipid"), _L("O:\\glib"));
  1179 	test(r==KErrNone);
  1168 	test_KErrNone(r);
  1180 	r=TheFs.RmDir(_L("O:\\facile\\"));
  1169 	r=TheFs.RmDir(_L("O:\\facile\\"));
  1181 	test(r==KErrNone);
  1170 	test_KErrNone(r);
  1182 	_LIT(KGlib,"glib\\");
  1171 	_LIT(KGlib,"glib\\");
  1183 	dir=gSessionPath;
  1172 	dir=gSessionPath;
  1184 	dir+=KGlib;
  1173 	dir+=KGlib;
  1185 	r=TheFs.RmDir(dir);
  1174 	r=TheFs.RmDir(dir);
  1186 	test(r==KErrNone);
  1175 	test_KErrNone(r);
  1187 //	
  1176 //	
  1188 	test.Next(_L("Test file operations on Substed drive"));
  1177 	test.Next(_L("Test file operations on Substed drive"));
  1189 	_LIT(File1,"File1.txt");
  1178 	_LIT(File1,"File1.txt");
  1190 	_LIT(File2,"File2.txt");
  1179 	_LIT(File2,"File2.txt");
  1191 	_LIT(SubstRoot,"O:\\");
  1180 	_LIT(SubstRoot,"O:\\");
  1193 	TFileName name1,name2;
  1182 	TFileName name1,name2;
  1194 	name1=gSessionPath;
  1183 	name1=gSessionPath;
  1195 	name1+=File1;
  1184 	name1+=File1;
  1196 	RFile f1;
  1185 	RFile f1;
  1197 	r=f1.Replace(TheFs,name1,EFileShareExclusive|EFileWrite);
  1186 	r=f1.Replace(TheFs,name1,EFileShareExclusive|EFileWrite);
  1198 	test(r==KErrNone);
  1187 	test_KErrNone(r);
  1199 	name2=SubstRoot;
  1188 	name2=SubstRoot;
  1200 	name2+=File2;
  1189 	name2+=File2;
  1201 	TBool isValid=TheFs.IsValidName(name2);
  1190 	TBool isValid=TheFs.IsValidName(name2);
  1202 	test(isValid);
  1191 	test(isValid);
  1203 	r=f1.Rename(name2);
  1192 	r=f1.Rename(name2);
  1204 	test(r==KErrNone);
  1193 	test_KErrNone(r);
  1205 	f1.Close();
  1194 	f1.Close();
  1206 	r=f1.Create(TheFs,name1,EFileShareExclusive|EFileWrite);
  1195 	r=f1.Create(TheFs,name1,EFileShareExclusive|EFileWrite);
  1207 	test(r==KErrNone);
  1196 	test_KErrNone(r);
  1208 	f1.Close();
  1197 	f1.Close();
  1209 	r=TheFs.Replace(name2,name1);
  1198 	r=TheFs.Replace(name2,name1);
  1210 	test(r==KErrNone);
  1199 	test_KErrNone(r);
  1211 	r=TheFs.Delete(name1);
  1200 	r=TheFs.Delete(name1);
  1212 	test(r==KErrNone);
  1201 	test_KErrNone(r);
  1213 	test.Next(_L("Test notifications on Substed drive"));
  1202 	test.Next(_L("Test notifications on Substed drive"));
  1214 	name1=gSessionPath;
  1203 	name1=gSessionPath;
  1215 	name1+=Subdir;
  1204 	name1+=Subdir;
  1216 	name2=SubstRoot;
  1205 	name2=SubstRoot;
  1217 	name2+=Subdir;
  1206 	name2+=Subdir;
  1218 	// set up some extended notifications
  1207 	// set up some extended notifications
  1219 	TRequestStatus status1;
  1208 	TRequestStatus status1;
  1220 	TRequestStatus status2;
  1209 	TRequestStatus status2;
  1221 	TRequestStatus status3;
  1210 	TRequestStatus status3;
  1222 	TheFs.NotifyChange(ENotifyDir,status1,name1);
  1211 	TheFs.NotifyChange(ENotifyDir,status1,name1);
  1223 	test(status1==KRequestPending);
  1212 	test_Value(status1.Int(), status1==KRequestPending);
  1224 	TheFs.NotifyChange(ENotifyDir,status2,name2);
  1213 	TheFs.NotifyChange(ENotifyDir,status2,name2);
  1225 	test(status2==KRequestPending);
  1214 	test_Value(status2.Int(), status2==KRequestPending);
  1226 	r=TheFs.MkDirAll(name1);
  1215 	r=TheFs.MkDirAll(name1);
  1227 	test(r==KErrNone);
  1216 	test_KErrNone(r);
  1228 	User::WaitForRequest(status1);
  1217 	User::WaitForRequest(status1);
  1229 	User::WaitForRequest(status2);
  1218 	User::WaitForRequest(status2);
  1230 	test(status1==KErrNone && status2==KErrNone);
  1219 	test_KErrNone(status1.Int());
       
  1220 	test_KErrNone(status2.Int());
  1231 	TheFs.NotifyChange(ENotifyDir,status1,name1);
  1221 	TheFs.NotifyChange(ENotifyDir,status1,name1);
  1232 	test(status1==KRequestPending);
  1222 	test_Value(status1.Int(), status1==KRequestPending);
  1233 	TheFs.NotifyChange(ENotifyDir,status2,name2);
  1223 	TheFs.NotifyChange(ENotifyDir,status2,name2);
  1234 	test(status2==KRequestPending);
  1224 	test_Value(status2.Int(), status2==KRequestPending);
  1235 	TheFs.NotifyChange(ENotifyAll,status3,name2);
  1225 	TheFs.NotifyChange(ENotifyAll,status3,name2);
  1236 	test(status3==KRequestPending);
  1226 	test_Value(status3.Int(), status3==KRequestPending);
  1237 	r=f1.Temp(TheFs,name2,n,EFileShareAny|EFileWrite);
  1227 	r=f1.Temp(TheFs,name2,n,EFileShareAny|EFileWrite);
  1238 	test(r==KErrNone);
  1228 	test_KErrNone(r);
  1239 	User::WaitForRequest(status3);
  1229 	User::WaitForRequest(status3);
  1240 	test(status3==KErrNone && status1==KRequestPending && status2==KRequestPending);
  1230 	test_KErrNone(status3.Int());
       
  1231 	test_Value(status1.Int(), status1==KRequestPending);
       
  1232 	test_Value(status2.Int(), status2==KRequestPending);
  1241 	f1.Close();
  1233 	f1.Close();
  1242 	TheFs.NotifyChangeCancel();
  1234 	TheFs.NotifyChangeCancel();
  1243 	test(status1==KErrCancel && status2==KErrCancel);
  1235 	test_Value(status1.Int(), status1==KErrCancel);
       
  1236        	test_Value(status2.Int(), status2==KErrCancel);
  1244 	r=TheFs.Delete(n);
  1237 	r=TheFs.Delete(n);
  1245 	test(r==KErrNone);
  1238 	test_KErrNone(r);
  1246 	r=TheFs.RmDir(name1);
  1239 	r=TheFs.RmDir(name1);
  1247 	test(r==KErrNone);
  1240 	test_KErrNone(r);
  1248 //
  1241 //
  1249 	test.Next(_L("Test file systems on Substed drive"));
  1242 	test.Next(_L("Test file systems on Substed drive"));
  1250 	// test cannot mount file system on substituted drive
  1243 	// test cannot mount file system on substituted drive
  1251 	TInt sessionDrv;
  1244 	TInt sessionDrv;
  1252 	r=TheFs.CharToDrive(gSessionPath[0],sessionDrv);
  1245 	r=TheFs.CharToDrive(gSessionPath[0],sessionDrv);
  1253 	test(r==KErrNone);
  1246 	test_KErrNone(r);
  1254 	r=TheFs.FileSystemName(n,sessionDrv);
  1247 	r=TheFs.FileSystemName(n,sessionDrv);
  1255 	test(r==KErrNone || r==KErrNotFound);
  1248 	test_Value(r, r == KErrNone || r==KErrNotFound);
  1256 	r=TheFs.MountFileSystem(n,EDriveO);
  1249 	r=TheFs.MountFileSystem(n,EDriveO);
  1257 	test(r==KErrAccessDenied);
  1250 	test_Value(r, r == KErrAccessDenied);
  1258 	// test file system name on substitued drive is null
  1251 	// test file system name on substitued drive is null
  1259 	r=TheFs.FileSystemName(n,EDriveO);
  1252 	r=TheFs.FileSystemName(n,EDriveO);
  1260 	test(r==KErrNotFound && n==KNullDesC);
  1253 	test_Value(r, r == KErrNotFound && n==KNullDesC);
  1261 	// test cannot format a substitued drive
  1254 	// test cannot format a substitued drive
  1262 	RFormat format;
  1255 	RFormat format;
  1263 	TInt count;
  1256 	TInt count;
  1264 	r=format.Open(TheFs,SubstRoot,EHighDensity,count);
  1257 	r=format.Open(TheFs,SubstRoot,EHighDensity,count);
  1265 	test(r==KErrAccessDenied);
  1258 	test_Value(r, r == KErrAccessDenied);
  1266 	
  1259 	
  1267 	r=TheFs.SetSubst(_L(""),EDriveO);
  1260 	r=TheFs.SetSubst(_L(""),EDriveO);
  1268 	test(r==KErrNone);
  1261 	test_KErrNone(r);
  1269 	r=TheFs.Subst(n,EDriveO);
  1262 	r=TheFs.Subst(n,EDriveO);
  1270 	test(r==KErrNone);
  1263 	test_KErrNone(r);
  1271 	test(n==_L(""));
  1264 	test(n==_L(""));
  1272 	r=TheFs.Drive(d,EDriveO);
  1265 	r=TheFs.Drive(d,EDriveO);
  1273 	test(r==KErrNone);
  1266 	test_KErrNone(r);
  1274 	test(d.iDriveAtt==0);
  1267 	test_Value(d.iDriveAtt, d.iDriveAtt==0);
  1275 	}
  1268 	}
  1276 
  1269 
  1277 LOCAL_C void testSetVolume()
  1270 LOCAL_C void testSetVolume()
  1278 //
  1271 //
  1279 // Test setting the volume info.
  1272 // Test setting the volume info.
  1284 
  1277 
  1285 	const TInt driveNum=CurrentDrive();
  1278 	const TInt driveNum=CurrentDrive();
  1286 
  1279 
  1287 	TVolumeInfo v;
  1280 	TVolumeInfo v;
  1288 	TInt r=TheFs.Volume(v,driveNum);
  1281 	TInt r=TheFs.Volume(v,driveNum);
  1289 	test(r==KErrNone);
  1282 	test_KErrNone(r);
  1290 	TFileName n=v.iName;
  1283 	TFileName n=v.iName;
  1291 	test.Printf(_L("VOL=\"%S\"\n"),&n);
  1284 	test.Printf(_L("VOL=\"%S\"\n"),&n);
  1292 
  1285 
  1293 	test.Next(_L("Set volume label to nothing"));
  1286 	test.Next(_L("Set volume label to nothing"));
  1294 	r=TheFs.SetVolumeLabel(_L(""),driveNum);
  1287 	r=TheFs.SetVolumeLabel(_L(""),driveNum);
  1298 		test.Printf(_L("Error %d: Set volume label not testing on WINS\n"),r);
  1291 		test.Printf(_L("Error %d: Set volume label not testing on WINS\n"),r);
  1299 		test.End();
  1292 		test.End();
  1300 		return;
  1293 		return;
  1301 		}
  1294 		}
  1302 
  1295 
  1303 	test(r==KErrNone);
  1296 	test_KErrNone(r);
  1304 	r=TheFs.Volume(v,driveNum);
  1297 	r=TheFs.Volume(v,driveNum);
  1305 	test(r==KErrNone );
  1298 	test_Value(r, r == KErrNone );
       
  1299 	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
  1306 	test(v.iName==_L(""));
  1300 	test(v.iName==_L(""));
  1307 	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
       
  1308 
  1301 
  1309 	test.Next(_L("Set volume label to ABCDEFGHIJK"));
  1302 	test.Next(_L("Set volume label to ABCDEFGHIJK"));
  1310 	r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
  1303 	r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
  1311 	test(r==KErrNone);
  1304 	test_KErrNone(r);
  1312 	r=TheFs.Volume(v,driveNum);
  1305 	r=TheFs.Volume(v,driveNum);
  1313 	test(r==KErrNone);
  1306 	test_KErrNone(r);
       
  1307 	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
  1314 	test(v.iName==_L("ABCDEFGHIJK"));
  1308 	test(v.iName==_L("ABCDEFGHIJK"));
  1315 	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
       
  1316 
  1309 
  1317 	test.Next(_L("Set volume label to ABCDE"));
  1310 	test.Next(_L("Set volume label to ABCDE"));
  1318 	r=TheFs.SetVolumeLabel(_L("ABCDE"),driveNum);
  1311 	r=TheFs.SetVolumeLabel(_L("ABCDE"),driveNum);
  1319 	test(r==KErrNone);
  1312 	test_KErrNone(r);
  1320 	r=TheFs.Volume(v,driveNum);
  1313 	r=TheFs.Volume(v,driveNum);
  1321 	test(r==KErrNone);
  1314 	test_KErrNone(r);
       
  1315 	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
  1322 	test(v.iName==_L("ABCDE"));
  1316 	test(v.iName==_L("ABCDE"));
  1323 	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
       
  1324 
  1317 
  1325 
  1318 
  1326 	test.Next(_L("Test replacement of non-ascii chars"));
  1319 	test.Next(_L("Test replacement of non-ascii chars"));
  1327 	TBuf<KMaxVolumeName> uBuf(KMaxVolumeName);
  1320 	TBuf<KMaxVolumeName> uBuf(KMaxVolumeName);
  1328 	uBuf.FillZ();
  1321 	uBuf.FillZ();
  1336 	uBuf[7]=0x103;
  1329 	uBuf[7]=0x103;
  1337 	uBuf[8]='e';
  1330 	uBuf[8]='e';
  1338 	uBuf[9]=0x104;
  1331 	uBuf[9]=0x104;
  1339 	uBuf[10]='f';
  1332 	uBuf[10]='f';
  1340 	r=TheFs.SetVolumeLabel(uBuf,driveNum);
  1333 	r=TheFs.SetVolumeLabel(uBuf,driveNum);
  1341 	test(r==KErrNone);
  1334 	test_KErrNone(r);
  1342 	TFileName drive=_L("?:");
  1335 	TFileName drive=_L("?:");
  1343 	drive[0]=gSessionPath[0];
  1336 	drive[0]=gSessionPath[0];
  1344 
  1337 
  1345 // ??? this needs to be replaced
  1338 // ??? this needs to be replaced
  1346 //	UserSvr::ForceRemountMedia(ERemovableMedia0);
  1339 //	UserSvr::ForceRemountMedia(ERemovableMedia0);
  1347 	User::After(1000000);
  1340 	User::After(1000000);
  1348 
  1341 
  1349 	TFileName sess;
  1342 	TFileName sess;
  1350 	r=TheFs.SessionPath(sess);
  1343 	r=TheFs.SessionPath(sess);
  1351 	test(r==KErrNone);
  1344 	test_KErrNone(r);
  1352 	r=TheFs.Volume(v,driveNum);
  1345 	r=TheFs.Volume(v,driveNum);
  1353 	test(r==KErrNone);
  1346 	test_KErrNone(r);
  1354 
  1347 	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
  1355 	if(Is_Fat(TheFs, gDrive)) //-- FAT doesn't support normal UNICODE in volume labels
  1348 	if(Is_Fat(TheFs, gDrive)) //-- FAT doesn't support normal UNICODE in volume labels
  1356 		test(v.iName==_L("a_b_c_d_e_f"));
  1349 		test(v.iName==_L("a_b_c_d_e_f"));
  1357 	else
  1350 	else
  1358 		test(v.iName == uBuf);
  1351 		test(v.iName == uBuf);
  1359 
  1352 
  1360 
       
  1361 	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
       
  1362 
       
  1363 
       
  1364 	test.Next(_L("Set volume label back to nothing"));
  1353 	test.Next(_L("Set volume label back to nothing"));
  1365 	r=TheFs.SetVolumeLabel(_L(""),driveNum);
  1354 	r=TheFs.SetVolumeLabel(_L(""),driveNum);
  1366 	test(r==KErrNone);
  1355 	test_KErrNone(r);
  1367 	r=TheFs.Volume(v,driveNum);
  1356 	r=TheFs.Volume(v,driveNum);
  1368 	test(r==KErrNone);
  1357 	test_KErrNone(r);
       
  1358 	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
  1369 	test(v.iName==_L(""));
  1359 	test(v.iName==_L(""));
  1370 	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
       
  1371 
  1360 
  1372 	test.Next(_L("Attempt to set volume label containing illegal characters"));
  1361 	test.Next(_L("Attempt to set volume label containing illegal characters"));
  1373 	r=TheFs.SetVolumeLabel(_L("abc>def"),driveNum);
  1362 	r=TheFs.SetVolumeLabel(_L("abc>def"),driveNum);
  1374 	test(r==KErrBadName);
  1363 	test_Value(r, r == KErrBadName);
  1375 	r=TheFs.SetVolumeLabel(_L("ghi*jkl"),driveNum);
  1364 	r=TheFs.SetVolumeLabel(_L("ghi*jkl"),driveNum);
  1376 	test(r==KErrBadName);
  1365 	test_Value(r, r == KErrBadName);
  1377 	r=TheFs.SetVolumeLabel(_L("mno?pqr"),driveNum);
  1366 	r=TheFs.SetVolumeLabel(_L("mno?pqr"),driveNum);
  1378 	test(r==KErrBadName);
  1367 	test_Value(r, r == KErrBadName);
  1379 	r=TheFs.SetVolumeLabel(_L("stu|vwx"),driveNum);
  1368 	r=TheFs.SetVolumeLabel(_L("stu|vwx"),driveNum);
  1380 	test(r==KErrBadName);
  1369 	test_Value(r, r == KErrBadName);
  1381 	r=TheFs.SetVolumeLabel(_L("yz<abc"),driveNum);
  1370 	r=TheFs.SetVolumeLabel(_L("yz<abc"),driveNum);
  1382 	test(r==KErrBadName);
  1371 	test_Value(r, r == KErrBadName);
  1383 	r=TheFs.SetVolumeLabel(_L("def//ghi"),driveNum);
  1372 	r=TheFs.SetVolumeLabel(_L("def//ghi"),driveNum);
  1384 	test(r==KErrBadName);
  1373 	test_Value(r, r == KErrBadName);
  1385 
  1374 
  1386 	r=TheFs.Volume(v,driveNum);
  1375 	r=TheFs.Volume(v,driveNum);
  1387 	test(r==KErrNone);
  1376 	test_KErrNone(r);
       
  1377 	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
  1388 	test(v.iName==_L(""));
  1378 	test(v.iName==_L(""));
  1389 	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
       
  1390 
  1379 
  1391 	// test volume label after remount (for removable media only)
  1380 	// test volume label after remount (for removable media only)
  1392 	test.Next(_L("Test volume label after remount"));
  1381 	test.Next(_L("Test volume label after remount"));
  1393 
  1382 
  1394 	TDriveInfo info;
  1383 	TDriveInfo info;
  1395 	test(TheFs.Drive(info, driveNum) == KErrNone);
  1384 	r = TheFs.Drive(info, driveNum);
       
  1385 	test_KErrNone(r);
  1396 
  1386 
  1397 	if((info.iDriveAtt & KDriveAttRemovable) != 0)
  1387 	if((info.iDriveAtt & KDriveAttRemovable) != 0)
  1398 		{
  1388 		{
  1399 		// 1. set volume label
  1389 		// 1. set volume label
  1400 		test(TheFs.SetVolumeLabel(_L("XXX"), driveNum) == KErrNone);
  1390 		r = TheFs.SetVolumeLabel(_L("XXX"), driveNum);
       
  1391 		test_KErrNone(r);
  1401 
  1392 
  1402 		// 2. change bootsector volume label
  1393 		// 2. change bootsector volume label
  1403 		const TInt	offset = IsFileSystemFAT32(TheFs, driveNum)? 
  1394 		const TInt	offset = IsFileSystemFAT32(TheFs, driveNum)? 
  1404 			71 /*KFat32VolumeLabelPos*/ 
  1395 			71 /*KFat32VolumeLabelPos*/ 
  1405 			: 
  1396 			: 
  1406 			43 /*KFat16VolumeLabelPos*/;	// both from sfat32\inc\sl_bpb.h
  1397 			43 /*KFat16VolumeLabelPos*/;	// both from sfat32\inc\sl_bpb.h
  1407 
  1398 
  1408 		RRawDisk	rdisk;
  1399 		RRawDisk	rdisk;
  1409 		TPtrC8		label(_S8("Z"), 1);
  1400 		TPtrC8		label(_S8("Z"), 1);
  1410 
  1401 
  1411 		test(rdisk.Open(TheFs, driveNum) == KErrNone);
  1402 		r = rdisk.Open(TheFs, driveNum);
  1412 		test(rdisk.Write(offset, label) == KErrNone);
  1403 		test_KErrNone(r);
       
  1404 		r = rdisk.Write(offset, label);
       
  1405 		test_KErrNone(r);
  1413 		rdisk.Close();
  1406 		rdisk.Close();
  1414 
  1407 
  1415 		// 3. remount the drive
  1408 		// 3. remount the drive
  1416 		test(TheFs.RemountDrive(driveNum) == KErrNone);
  1409 		r = TheFs.RemountDrive(driveNum);
       
  1410 		test_KErrNone(r);
  1417 
  1411 
  1418 		// 4. check volume label
  1412 		// 4. check volume label
  1419 		test(TheFs.Volume(v, driveNum) == KErrNone);
  1413 		r = TheFs.Volume(v, driveNum);
       
  1414 		test_KErrNone(r);
       
  1415 		test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
  1420 		test(v.iName == _L("XXX"));
  1416 		test(v.iName == _L("XXX"));
  1421 		test.Printf(_L("- Passed.\n"));
  1417 		test.Printf(_L("- Passed.\n"));
  1422 		}
  1418 		}
  1423 	else
  1419 	else
  1424 		test.Printf(_L("- Skipped (drive is not removable).\n"));
  1420 		test.Printf(_L("- Skipped (drive is not removable).\n"));
  1425 
  1421 
  1426 	// clean up
  1422 	// clean up
  1427 	test.Next(_L("Set volume label to original"));
  1423 	test.Next(_L("Set volume label to original"));
  1428 	r=TheFs.SetVolumeLabel(n,driveNum);
  1424 	r=TheFs.SetVolumeLabel(n,driveNum);
  1429 	test(r==KErrNone);
  1425 	test_KErrNone(r);
  1430 	r=TheFs.Volume(v,driveNum);
  1426 	r=TheFs.Volume(v,driveNum);
  1431 	test(r==KErrNone);
  1427 	test_KErrNone(r);
       
  1428 	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
  1432 	test(v.iName==n);
  1429 	test(v.iName==n);
  1433 	test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
       
  1434 
  1430 
  1435 	test.End();
  1431 	test.End();
  1436 	}
  1432 	}
  1437 
  1433 
  1438 LOCAL_C void testModified()
  1434 LOCAL_C void testModified()
  1442 	{
  1438 	{
  1443 	
  1439 	
  1444 	test.Start(_L("Test modified/SetModified functions"));
  1440 	test.Start(_L("Test modified/SetModified functions"));
  1445 	TTime savedTime;
  1441 	TTime savedTime;
  1446 	TInt r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),savedTime);
  1442 	TInt r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),savedTime);
  1447 	test(r==KErrNone);
  1443 	test_KErrNone(r);
  1448 	TDateTime dateTime=savedTime.DateTime();
  1444 	TDateTime dateTime=savedTime.DateTime();
  1449 	test.Printf(_L("T_FSRV.CPP last modified %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond());
  1445 	test.Printf(_L("T_FSRV.CPP last modified %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond());
  1450 	test.Next(_L("Set modified"));
  1446 	test.Next(_L("Set modified"));
  1451 	dateTime.Set(1993,EAugust,23,1,13,54,123456);
  1447 	dateTime.Set(1993,EAugust,23,1,13,54,123456);
  1452 	TTime newTime(dateTime);
  1448 	TTime newTime(dateTime);
  1453 	r=TheFs.SetModified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),newTime);
  1449 	r=TheFs.SetModified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),newTime);
  1454 	test(r==KErrNone);
  1450 	test_KErrNone(r);
  1455 	TTime checkTime;
  1451 	TTime checkTime;
  1456 	r=TheFs.Modified(_L("\\XXXX\\YYYY\\ZZZZ.CPP"),checkTime);
  1452 	r=TheFs.Modified(_L("\\XXXX\\YYYY\\ZZZZ.CPP"),checkTime);
  1457 	test(r==KErrPathNotFound);
  1453 	test_Value(r, r == KErrPathNotFound);
  1458 	r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),checkTime);
  1454 	r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),checkTime);
  1459 	test(r==KErrNone);
  1455 	test_KErrNone(r);
  1460 	dateTime=checkTime.DateTime();	
  1456 	dateTime=checkTime.DateTime();	
       
  1457 	test.Printf(_L("T_FSRV.CPP last modified %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond());
  1461 	test(dateTime.Year()==1993);
  1458 	test(dateTime.Year()==1993);
  1462 	test(dateTime.Month()==EAugust);
  1459 	test(dateTime.Month()==EAugust);
  1463 	test(dateTime.Day()==23);
  1460 	test(dateTime.Day()==23);
  1464 	test(dateTime.Hour()==1);
  1461 	test(dateTime.Hour()==1);
  1465 	test(dateTime.Minute()==13);
  1462 	test(dateTime.Minute()==13);
  1466 	test(dateTime.Second()==54);
  1463 	test(dateTime.Second()==54);
  1467 	test.Printf(_L("T_FSRV.CPP last modified %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond());
       
  1468 //		test(dateTime.MicroSecond()==123456); // dos is not accurate enough
  1464 //		test(dateTime.MicroSecond()==123456); // dos is not accurate enough
  1469 	r=TheFs.SetModified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),savedTime);
  1465 	r=TheFs.SetModified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),savedTime);
  1470 	test(r==KErrNone);
  1466 	test_KErrNone(r);
  1471 	r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),checkTime);
  1467 	r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),checkTime);
  1472 	test(r==KErrNone);
  1468 	test_KErrNone(r);
  1473 	test(checkTime==savedTime);
  1469 	test(checkTime==savedTime);
  1474 
  1470 
  1475 	RFile f;
  1471 	RFile f;
  1476 	r=f.Open(TheFs,_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),EFileWrite);
  1472 	r=f.Open(TheFs,_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),EFileWrite);
  1477 	test(r==KErrNone);
  1473 	test_KErrNone(r);
  1478 	dateTime.Set(1997,EJanuary,1,2,55,51,999999);
  1474 	dateTime.Set(1997,EJanuary,1,2,55,51,999999);
  1479 	newTime=dateTime;
  1475 	newTime=dateTime;
  1480 	r=f.SetModified(newTime);
  1476 	r=f.SetModified(newTime);
  1481 	test(r==KErrNone);
  1477 	test_KErrNone(r);
  1482 	r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),checkTime);
  1478 	r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),checkTime);
  1483 	test(r==KErrNone);
  1479 	test_KErrNone(r);
  1484 
  1480 
  1485 	dateTime=checkTime.DateTime();	
  1481 	dateTime=checkTime.DateTime();	
       
  1482 	test.Printf(_L("T_FSRV.CPP last modified via RFs::Modified() %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond());
  1486 	test(dateTime.Year()==1997);
  1483 	test(dateTime.Year()==1997);
  1487 	test(dateTime.Month()==EJanuary);
  1484 	test(dateTime.Month()==EJanuary);
  1488 	test(dateTime.Day()==1);
  1485 	test(dateTime.Day()==1);
  1489 	test(dateTime.Hour()==2);
  1486 	test(dateTime.Hour()==2);
  1490 	test(dateTime.Minute()==55);
  1487 	test(dateTime.Minute()==55);
  1491 	test(dateTime.Second()>=50 && dateTime.Second()<=51); // Dos stores seconds %2
  1488 	test(dateTime.Second()>=50 && dateTime.Second()<=51); // Dos stores seconds %2
  1492 
  1489 
  1493 	r=f.Modified(checkTime);
  1490 	r=f.Modified(checkTime);
  1494 	test(r==KErrNone);
  1491 	test_KErrNone(r);
  1495 
  1492 
  1496 	dateTime=checkTime.DateTime();	
  1493 	dateTime=checkTime.DateTime();	
       
  1494 	test.Printf(_L("T_FSRV.CPP last modified via RFile::Modified() %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond());
  1497 	test(dateTime.Year()==1997);
  1495 	test(dateTime.Year()==1997);
  1498 	test(dateTime.Month()==EJanuary);
  1496 	test(dateTime.Month()==EJanuary);
  1499 	test(dateTime.Day()==1);
  1497 	test(dateTime.Day()==1);
  1500 	test(dateTime.Hour()==2);
  1498 	test(dateTime.Hour()==2);
  1501 	test(dateTime.Minute()==55);
  1499 	test(dateTime.Minute()==55);
  1502 	test(dateTime.Second()>=50 && dateTime.Second()<=51); // Dos stores seconds %2
  1500 	test(dateTime.Second()>=50 && dateTime.Second()<=51); // Dos stores seconds %2
  1503 	f.Close();
  1501 	f.Close();
  1504 
  1502 
  1505 	r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),checkTime);
  1503 	r=TheFs.Modified(_L("\\F32-TST\\TFSRV\\T_FSRV.CPP"),checkTime);
  1506 	test(r==KErrNone);
  1504 	test_KErrNone(r);
  1507 
  1505 
  1508 	dateTime=checkTime.DateTime();	
  1506 	dateTime=checkTime.DateTime();	
       
  1507 	test.Printf(_L("T_FSRV.CPP last modified via RFs::Modified() %d/%d/%d %d:%d:%d.%-06d\n"),dateTime.Day()+1,dateTime.Month()+1,dateTime.Year(),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond());
  1509 	test(dateTime.Year()==1997);
  1508 	test(dateTime.Year()==1997);
  1510 	test(dateTime.Month()==EJanuary);
  1509 	test(dateTime.Month()==EJanuary);
  1511 	test(dateTime.Day()==1);
  1510 	test(dateTime.Day()==1);
  1512 	test(dateTime.Hour()==2);
  1511 	test(dateTime.Hour()==2);
  1513 	test(dateTime.Minute()==55);
  1512 	test(dateTime.Minute()==55);
  1527 	_LIT(KFileName, "T_FSRV.CPP");
  1526 	_LIT(KFileName, "T_FSRV.CPP");
  1528 	
  1527 	
  1529 	RFile file;
  1528 	RFile file;
  1530 	
  1529 	
  1531 	TInt r=file.Open(TheFs, KFileName, 0 );
  1530 	TInt r=file.Open(TheFs, KFileName, 0 );
  1532 	if (r!=KErrNone)
  1531 	test_KErrNone(r);
  1533 		{
       
  1534 		test.Printf(_L("Error %d opening file %S\n"), r, &KFileName);
       
  1535 		test(0);
       
  1536 		}
       
  1537 	
  1532 	
  1538 	TFileName fileName;
  1533 	TFileName fileName;
  1539 
  1534 
  1540 	// Check RFile::Name just retuns the file name, without path and drive
  1535 	// Check RFile::Name just retuns the file name, without path and drive
  1541 	r=file.Name(fileName);
  1536 	r=file.Name(fileName);
  1542 	test(r==KErrNone);
  1537 	test_KErrNone(r);
  1543 	test(fileName==KFileName());
  1538 	if (fileName != KFileName)
       
  1539 		{
       
  1540 		test.Printf(_L("%S\n"), &fileName);
       
  1541 		test(0);
       
  1542 		}
  1544 
  1543 
  1545 	// Check RFile::FullName returns the complete file name and path
  1544 	// Check RFile::FullName returns the complete file name and path
  1546 	r=file.FullName(fileName);
  1545 	r=file.FullName(fileName);
  1547 	test(r==KErrNone);
  1546 	test_KErrNone(r);
  1548 	test(fileName.Mid(2)==KFileNameAndPath); // chop off drive letter + ':'
  1547 	if (fileName.Mid(2)!=KFileNameAndPath)	// chop off drive letter + ':'
       
  1548 		{
       
  1549 		test.Printf(_L("%S\n"), &fileName);
       
  1550 		test(0);
       
  1551 		}
  1549 	
  1552 	
  1550 	file.Close();
  1553 	file.Close();
  1551 	
  1554 	
  1552 	test.End();
  1555 	test.End();
  1553 	}
  1556 	}
  1563 	RFile file;
  1566 	RFile file;
  1564 
  1567 
  1565 	TInt r=file.Replace(TheFs,fileName,EFileWrite);
  1568 	TInt r=file.Replace(TheFs,fileName,EFileWrite);
  1566 	if (r==KErrDiskFull)
  1569 	if (r==KErrDiskFull)
  1567 		return(r);
  1570 		return(r);
  1568 	if (r!=KErrNone)
  1571 	test_KErrNone(r);
  1569 		{
       
  1570 		test.Printf(_L("ERROR:: Replace returned %d\n"),r);
       
  1571 		test(0);
       
  1572 		//test.Getch();
       
  1573 		return(KErrDiskFull);
       
  1574 		}
       
  1575 
  1572 
  1576 	if (!IsTestingLFFS())
  1573 	if (!IsTestingLFFS())
  1577 		r=file.SetSize(LargeFileSize);
  1574 		r=file.SetSize(LargeFileSize);
  1578 	else
  1575 	else
  1579 		{ // ??? Whats wrong with setsize 
  1576 		{ // ??? Whats wrong with setsize 
  1586 	if (r==KErrDiskFull)
  1583 	if (r==KErrDiskFull)
  1587 		{
  1584 		{
  1588 		file.Close();
  1585 		file.Close();
  1589 		return(r);
  1586 		return(r);
  1590 		}
  1587 		}
  1591 	if (r!=KErrNone)
  1588 	test_KErrNone(r);
  1592 		{
       
  1593 		test.Printf(_L("ERROR:: SetSize/Write returned %d\n"),r);
       
  1594 		test(0);
       
  1595 		//test.Getch();
       
  1596 		file.Close();
       
  1597 		return(KErrDiskFull);
       
  1598 		}
       
  1599 
  1589 
  1600 	file.Close();
  1590 	file.Close();
  1601 //	r=TheFs.CheckDisk(fileName);
  1591 //	r=TheFs.CheckDisk(fileName);
  1602 //	if (r!=KErrNone && r!=KErrNotSupported)
  1592 //	if (r!=KErrNone && r!=KErrNotSupported)
  1603 //		{
  1593 //		{
  1616 	{
  1606 	{
  1617 
  1607 
  1618 	TBuf<128> fileName=aBaseName;
  1608 	TBuf<128> fileName=aBaseName;
  1619 	fileName.AppendNum(aX);
  1609 	fileName.AppendNum(aX);
  1620 	TInt r=TheFs.Delete(fileName);
  1610 	TInt r=TheFs.Delete(fileName);
  1621 	test(r==KErrNone);
  1611 	test_KErrNone(r);
  1622 //	r=TheFs.CheckDisk(fileName);
  1612 //	r=TheFs.CheckDisk(fileName);
  1623 //	if (r!=KErrNone && r!=KErrNotSupported)
  1613 //	if (r!=KErrNone && r!=KErrNotSupported)
  1624 //		{
  1614 //		{
  1625 //		test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r);
  1615 //		test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r);
  1626 //		test(r==KErrNone);
  1616 //		test_KErrNone(r);
  1627 //		}
  1617 //		}
  1628 	test.Printf(_L("Deleted File %d\n"),aX);
  1618 	test.Printf(_L("Deleted File %d\n"),aX);
  1629 	return(KErrNone);
  1619 	return(KErrNone);
  1630 	}
  1620 	}
  1631 
  1621 
  1635 //
  1625 //
  1636 	{
  1626 	{
  1637 
  1627 
  1638 	test.Start(_L("Create and delete large files"));
  1628 	test.Start(_L("Create and delete large files"));
  1639 	TInt r=TheFs.MkDirAll(_L("\\F32-TST\\SMALLDIRECTORY\\"));
  1629 	TInt r=TheFs.MkDirAll(_L("\\F32-TST\\SMALLDIRECTORY\\"));
  1640 	test(r==KErrNone || r==KErrAlreadyExists);
  1630 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
  1641 	TBuf<128> fileName=_L("\\F32-TST\\SMALLDIRECTORY\\FILE");
  1631 	TBuf<128> fileName=_L("\\F32-TST\\SMALLDIRECTORY\\FILE");
  1642 	r=CreateFileX(fileName,0);
  1632 	r=CreateFileX(fileName,0);
  1643 	test(r==KErrNone);
  1633 	test_KErrNone(r);
  1644 	r=CreateFileX(fileName,1);
  1634 	r=CreateFileX(fileName,1);
  1645 	test(r==KErrNone);
  1635 	test_KErrNone(r);
  1646 	r=DeleteFileX(fileName,0);	
  1636 	r=DeleteFileX(fileName,0);	
  1647 	test(r==KErrNone);
  1637 	test_KErrNone(r);
  1648 	r=CreateFileX(fileName,2);
  1638 	r=CreateFileX(fileName,2);
  1649 	test(r==KErrNone);
  1639 	test_KErrNone(r);
  1650 	r=CreateFileX(fileName,1);
  1640 	r=CreateFileX(fileName,1);
  1651 	test(r==KErrNone);
  1641 	test_KErrNone(r);
  1652 	r=CreateFileX(fileName,3);
  1642 	r=CreateFileX(fileName,3);
  1653 	test(r==KErrNone);
  1643 	test_KErrNone(r);
  1654 	r=DeleteFileX(fileName,1);	
  1644 	r=DeleteFileX(fileName,1);	
  1655 	test(r==KErrNone);
  1645 	test_KErrNone(r);
  1656 	r=CreateFileX(fileName,4);
  1646 	r=CreateFileX(fileName,4);
  1657 	test(r==KErrNone);
  1647 	test_KErrNone(r);
  1658 	r=DeleteFileX(fileName,2);	
  1648 	r=DeleteFileX(fileName,2);	
  1659 	test(r==KErrNone);
  1649 	test_KErrNone(r);
  1660 	r=DeleteFileX(fileName,3);	
  1650 	r=DeleteFileX(fileName,3);	
  1661 	test(r==KErrNone);
  1651 	test_KErrNone(r);
  1662 	r=DeleteFileX(fileName,4);	
  1652 	r=DeleteFileX(fileName,4);	
  1663 	test(r==KErrNone);
  1653 	test_KErrNone(r);
  1664 	r=CreateFileX(fileName,1);
  1654 	r=CreateFileX(fileName,1);
  1665 	test(r==KErrNone);
  1655 	test_KErrNone(r);
  1666 	r=DeleteFileX(fileName,1);	
  1656 	r=DeleteFileX(fileName,1);	
  1667 	test(r==KErrNone);
  1657 	test_KErrNone(r);
  1668 
  1658 
  1669 	r=TheFs.CheckDisk(fileName);
  1659 	r=TheFs.CheckDisk(fileName);
  1670 	if (r!=KErrNone && r!=KErrNotSupported)
  1660 	test_Value(r, r == KErrNone || r == KErrNotSupported);
  1671 		{
       
  1672 		test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r);
       
  1673 		test(0);
       
  1674 		//test.Getch();
       
  1675 		}
       
  1676 	
       
  1677 	test.End();
  1661 	test.End();
  1678 	}
  1662 	}
  1679 
  1663 
  1680 LOCAL_C void FillUpDisk()
  1664 LOCAL_C void FillUpDisk()
  1681 //
  1665 //
  1683 //
  1667 //
  1684 	{
  1668 	{
  1685 
  1669 
  1686 	test.Start(_L("Fill disk to capacity"));
  1670 	test.Start(_L("Fill disk to capacity"));
  1687 	TInt r=TheFs.MkDirAll(_L("\\F32-TST\\BIGDIRECTORY\\"));
  1671 	TInt r=TheFs.MkDirAll(_L("\\F32-TST\\BIGDIRECTORY\\"));
  1688 	test(r==KErrNone || r==KErrAlreadyExists);
  1672 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
  1689 	TInt count=0;
  1673 	TInt count=0;
  1690 	TFileName sessionPath;
  1674 	TFileName sessionPath;
  1691 	r=TheFs.SessionPath(sessionPath);
  1675 	r=TheFs.SessionPath(sessionPath);
  1692 	test(r==KErrNone);
  1676 	test_KErrNone(r);
  1693 	TBuf<128> fileName=_L("\\F32-TST\\BIGDIRECTORY\\FILE");
  1677 	TBuf<128> fileName=_L("\\F32-TST\\BIGDIRECTORY\\FILE");
  1694 	FOREVER
  1678 	FOREVER
  1695 		{
  1679 		{
  1696 		TInt r=CreateFileX(fileName,count);
  1680 		TInt r=CreateFileX(fileName,count);
  1697 		if (r==KErrDiskFull)
  1681 		if (r==KErrDiskFull)
  1698 			break;
  1682 			break;
  1699 		test(r==KErrNone);
  1683 		test_KErrNone(r);
  1700 		count++;
  1684 		count++;
  1701 #if defined(__WINS__)
  1685 #if defined(__WINS__)
  1702 		if (count==32 && sessionPath[0]=='C')
  1686 		if (count==32 && sessionPath[0]=='C')
  1703 			break;
  1687 			break;
  1704 #endif
  1688 #endif
  1705 		}
  1689 		}
  1706 
  1690 
  1707 	r=TheFs.CheckDisk(fileName);
  1691 	r=TheFs.CheckDisk(fileName);
  1708 	if (r!=KErrNone && r!=KErrNotSupported)
  1692 	test_Value(r, r == KErrNone || r == KErrNotSupported);
  1709 		{
       
  1710 		test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r);
       
  1711 		test(0);
       
  1712 		//test.Getch();
       
  1713 		}
       
  1714 
  1693 
  1715 	while(count--)
  1694 	while(count--)
  1716 		DeleteFileX(fileName,count);
  1695 		DeleteFileX(fileName,count);
  1717 
  1696 
  1718 	r=TheFs.CheckDisk(fileName);
  1697 	r=TheFs.CheckDisk(fileName);
  1719 	if (r!=KErrNone && r!=KErrNotSupported)
  1698 	test_Value(r, r == KErrNone || r == KErrNotSupported);
  1720 		{
       
  1721 		test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r);
       
  1722 		test(0);
       
  1723 		//test.Getch();
       
  1724 		}
       
  1725 
  1699 
  1726 	test.End();
  1700 	test.End();
  1727 	}
  1701 	}
  1728 
  1702 
  1729 LOCAL_C void CopyFileToTestDirectory()
  1703 LOCAL_C void CopyFileToTestDirectory()
  1734 
  1708 
  1735 	TFileName fn = _L("Z:\\TEST\\T_FSRV.CPP");
  1709 	TFileName fn = _L("Z:\\TEST\\T_FSRV.CPP");
  1736 	fn[0] = gExeFileName[0];
  1710 	fn[0] = gExeFileName[0];
  1737 	TParse f;
  1711 	TParse f;
  1738 	TInt r=TheFs.Parse(fn,f);
  1712 	TInt r=TheFs.Parse(fn,f);
  1739 	test(r==KErrNone);
  1713 	test_KErrNone(r);
  1740 	test.Next(_L("Copying file to test directory"));
  1714 	test.Next(_L("Copying file to test directory"));
  1741 	TParse fCopy;
  1715 	TParse fCopy;
  1742 	r=TheFs.Parse(f.NameAndExt(),fCopy);
  1716 	r=TheFs.Parse(f.NameAndExt(),fCopy);
  1743 	test(r==KErrNone);
  1717 	test_KErrNone(r);
  1744 
  1718 
  1745 	RFile f1;
  1719 	RFile f1;
  1746 	r=f1.Open(TheFs,f.FullName(),EFileStreamText|EFileShareReadersOnly);
  1720 	r=f1.Open(TheFs,f.FullName(),EFileStreamText|EFileShareReadersOnly);
  1747 	test(r==KErrNone);
  1721 	test_KErrNone(r);
  1748 	RFile f2;
  1722 	RFile f2;
  1749 	r=f2.Replace(TheFs,fCopy.FullName(),EFileWrite);
  1723 	r=f2.Replace(TheFs,fCopy.FullName(),EFileWrite);
  1750 	test(r==KErrNone);
  1724 	test_KErrNone(r);
  1751 	TBuf8<512> copyBuf;
  1725 	TBuf8<512> copyBuf;
  1752 	TInt rem;
  1726 	TInt rem;
  1753 	r=f1.Size(rem);
  1727 	r=f1.Size(rem);
  1754 	test(r==KErrNone);
  1728 	test_KErrNone(r);
  1755 	TInt pos=0;
  1729 	TInt pos=0;
  1756 	while (rem)
  1730 	while (rem)
  1757 		{
  1731 		{
  1758 		TInt s=Min(rem,copyBuf.MaxSize());
  1732 		TInt s=Min(rem,copyBuf.MaxSize());
  1759 		r=f1.Read(pos,copyBuf,s);
  1733 		r=f1.Read(pos,copyBuf,s);
  1760 		test(r==KErrNone);
  1734 		test_KErrNone(r);
  1761 		test(copyBuf.Length()==s);
  1735 		test_Value(copyBuf.Length(), copyBuf.Length() == s);
  1762 		r=f2.Write(pos,copyBuf,s);
  1736 		r=f2.Write(pos,copyBuf,s);
  1763 		test(r==KErrNone);
  1737 		test_KErrNone(r);
  1764 		pos+=s;
  1738 		pos+=s;
  1765 		rem-=s;
  1739 		rem-=s;
  1766 		}
  1740 		}
  1767 	f1.Close();
  1741 	f1.Close();
  1768 	f2.Close();
  1742 	f2.Close();
  1788     
  1762     
  1789     const TInt KMyError = -756; //-- specific error code we will simulate
  1763     const TInt KMyError = -756; //-- specific error code we will simulate
  1790     
  1764     
  1791     //==========  just create a file
  1765     //==========  just create a file
  1792     nRes = TheFs.SetErrorCondition(KMyError,0); //-- set up FS error simulation
  1766     nRes = TheFs.SetErrorCondition(KMyError,0); //-- set up FS error simulation
  1793     test(nRes == KErrNone);
  1767     test_KErrNone(nRes);
  1794 
  1768 
  1795     //-- this shall fail immediately 
  1769     //-- this shall fail immediately 
  1796     nRes = file.Replace(TheFs, KFileName, EFileWrite);
  1770     nRes = file.Replace(TheFs, KFileName, EFileWrite);
  1797     test(nRes == KMyError);
  1771     test_Value(nRes, nRes == KMyError);
  1798 
  1772 
  1799     nRes = TheFs.SetErrorCondition(KErrNone); //-- disable FS error simulation
  1773     nRes = TheFs.SetErrorCondition(KErrNone); //-- disable FS error simulation
  1800     file.Close();
  1774     file.Close();
  1801 
  1775 
  1802     //========== create file & duplicate a handle #1
  1776     //========== create file & duplicate a handle #1
  1803     nRes = TheFs.SetErrorCondition(KMyError,1); //-- set up FS error simulation
  1777     nRes = TheFs.SetErrorCondition(KMyError,1); //-- set up FS error simulation
  1804     test(nRes == KErrNone);
  1778     test_KErrNone(nRes);
  1805 
  1779 
  1806     //-- this shall succeed
  1780     //-- this shall succeed
  1807     nRes = file.Replace(TheFs, KFileName, EFileWrite); //-- err cnt -> 0
  1781     nRes = file.Replace(TheFs, KFileName, EFileWrite); //-- err cnt -> 0
  1808     test(nRes == KErrNone);
  1782     test_KErrNone(nRes);
  1809 
  1783 
  1810     //-- this shall fail inside RFile::Duplicate() half way through in the RFile::DuplicateHandle()
  1784     //-- this shall fail inside RFile::Duplicate() half way through in the RFile::DuplicateHandle()
  1811     nRes = file1.Duplicate(file);
  1785     nRes = file1.Duplicate(file);
  1812     test(nRes == KMyError);
  1786     test_Value(nRes, nRes == KMyError);
  1813     file1.Close();
  1787     file1.Close();
  1814     
  1788     
  1815     nRes = TheFs.SetErrorCondition(KErrNone); //-- disable FS error simulation
  1789     nRes = TheFs.SetErrorCondition(KErrNone); //-- disable FS error simulation
  1816     file.Close();
  1790     file.Close();
  1817 
  1791 
  1818     //-- check that the file isn't locked
  1792     //-- check that the file isn't locked
  1819     nRes = TheFs.Delete(KFileName);
  1793     nRes = TheFs.Delete(KFileName);
  1820     test(nRes == KErrNone);
  1794     test_KErrNone(nRes);
  1821 
  1795 
  1822     //========== create file & duplicate a handle #2
  1796     //========== create file & duplicate a handle #2
  1823     nRes = TheFs.SetErrorCondition(KMyError,2); //-- set up FS error simulation
  1797     nRes = TheFs.SetErrorCondition(KMyError,2); //-- set up FS error simulation
  1824     test(nRes == KErrNone);
  1798     test_KErrNone(nRes);
  1825 
  1799 
  1826     //-- this shall succeed
  1800     //-- this shall succeed
  1827     nRes = file.Replace(TheFs, KFileName, EFileWrite); //-- err cnt -> 1
  1801     nRes = file.Replace(TheFs, KFileName, EFileWrite); //-- err cnt -> 1
  1828     test(nRes == KErrNone);
  1802     test_KErrNone(nRes);
  1829 
  1803 
  1830     //-- this must not fail, because EFsFileAdopt is excluded from the erros simulation
  1804     //-- this must not fail, because EFsFileAdopt is excluded from the erros simulation
  1831     nRes = file1.Duplicate(file);
  1805     nRes = file1.Duplicate(file);
  1832     test(nRes == KErrNone);
  1806     test_KErrNone(nRes);
  1833     file1.Close();
  1807     file1.Close();
  1834     
  1808     
  1835     nRes = TheFs.SetErrorCondition(KErrNone); //-- disable FS error simulation
  1809     nRes = TheFs.SetErrorCondition(KErrNone); //-- disable FS error simulation
  1836     file.Close();
  1810     file.Close();
  1837 
  1811 
  1838     //-- check that the file isn't locked
  1812     //-- check that the file isn't locked
  1839     nRes = TheFs.Delete(KFileName);
  1813     nRes = TheFs.Delete(KFileName);
  1840     test(nRes == KErrNone);
  1814     test_KErrNone(nRes);
  1841 
  1815 
  1842     //========== crazy loop, for DEF103757
  1816     //========== crazy loop, for DEF103757
  1843 
  1817 
  1844     for(TInt i=0; i<6; ++i)
  1818     for(TInt i=0; i<6; ++i)
  1845     {
  1819     {
  1857         nRes = TheFs.SetErrorCondition(KErrNone); //-- disable FS error simulation
  1831         nRes = TheFs.SetErrorCondition(KErrNone); //-- disable FS error simulation
  1858     }
  1832     }
  1859 
  1833 
  1860     //-- check that the file isn't locked
  1834     //-- check that the file isn't locked
  1861     nRes = TheFs.Delete(KFileName);
  1835     nRes = TheFs.Delete(KFileName);
  1862     test(nRes == KErrNone);
  1836     test_KErrNone(nRes);
  1863 
  1837 
  1864 
  1838 
  1865 #endif
  1839 #endif
  1866 }
  1840 }
  1867 
  1841 
  1875 
  1849 
  1876     //-- set up console output 
  1850     //-- set up console output 
  1877     F32_Test_Utils::SetConsole(test.Console()); 
  1851     F32_Test_Utils::SetConsole(test.Console()); 
  1878     
  1852     
  1879     TInt nRes=TheFs.CharToDrive(gDriveToTest, gDrive);
  1853     TInt nRes=TheFs.CharToDrive(gDriveToTest, gDrive);
  1880     test(nRes==KErrNone);
  1854     test_KErrNone(nRes);
  1881     
  1855     
  1882     PrintDrvInfo(TheFs, gDrive);
  1856     PrintDrvInfo(TheFs, gDrive);
  1883 
  1857 
  1884 
  1858 
  1885 	TVolumeInfo v;
  1859 	TVolumeInfo v;
  1886 	TInt r=TheFs.Volume(v, CurrentDrive());
  1860 	TInt r=TheFs.Volume(v, CurrentDrive());
  1887 	test(r==KErrNone);
  1861 	test_KErrNone(r);
  1888 	LargeFileSize=Max((TUint32)I64LOW(v.iFree >> 7), (TUint32)65536u);
  1862 	LargeFileSize=Max((TUint32)I64LOW(v.iFree >> 7), (TUint32)65536u);
  1889 
  1863 
  1890     if (gFirstTime)
  1864     if (gFirstTime)
  1891 		{
  1865 		{
  1892 		MountRemoteFilesystem();
  1866 		MountRemoteFilesystem();