kerneltest/f32test/server/t_appins.cpp
changeset 109 b3a1d9898418
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
102:ef2a444a7410 109:b3a1d9898418
    13 // Description:
    13 // Description:
    14 // f32test\server\t_appins.cpp
    14 // f32test\server\t_appins.cpp
    15 // 
    15 // 
    16 //
    16 //
    17 
    17 
       
    18 #define __E32TEST_EXTENSION__
    18 #include <f32file.h>
    19 #include <f32file.h>
    19 #include <e32test.h>
    20 #include <e32test.h>
    20 #include <hal.h>
    21 #include <hal.h>
    21 #include "t_server.h"
    22 #include "t_server.h"
    22 #include "t_chlffs.h"
    23 #include "t_chlffs.h"
    51 	{
    52 	{
    52 	TFileName path;
    53 	TFileName path;
    53 	path=_L("?:\\F32-TST\\T_APPINS\\");
    54 	path=_L("?:\\F32-TST\\T_APPINS\\");
    54 		
    55 		
    55 	TInt r=TheNotifyFs.SessionPath(gSessionPath);
    56 	TInt r=TheNotifyFs.SessionPath(gSessionPath);
    56 	test(r==KErrNone);
    57 	test_KErrNone(r);
    57 
    58 
    58 	TChar driveChar;
    59 	TChar driveChar;
    59 	r=RFs::DriveToChar(RemovableDrive,driveChar);
    60 	r=RFs::DriveToChar(RemovableDrive,driveChar);
    60 	test(r==KErrNone);
    61 	test_KErrNone(r);
    61 	
    62 	
    62 	if (gSessionPath[0]=='C')
    63 	if (gSessionPath[0]=='C')
    63 		(gSessionPath[0] == (TText)gDriveToTest)? (path[0] = (TText)driveChar):(path[0] = (TText)gDriveToTest);
    64 		(gSessionPath[0] == (TText)gDriveToTest)? (path[0] = (TText)driveChar):(path[0] = (TText)gDriveToTest);
    64 	else if (gSessionPath[0]=='Y')
    65 	else if (gSessionPath[0]=='Y')
    65 		path[0]='X';
    66 		path[0]='X';
    74 	TRequestStatus statDir(KRequestPending);
    75 	TRequestStatus statDir(KRequestPending);
    75 	TRequestStatus statWild(KRequestPending);
    76 	TRequestStatus statWild(KRequestPending);
    76 	TRequestStatus statWilder(KRequestPending);
    77 	TRequestStatus statWilder(KRequestPending);
    77 
    78 
    78 	r=TheFs.RmDir(path);
    79 	r=TheFs.RmDir(path);
    79 	test((r==KErrNone)||(r==KErrNotFound)||(r==KErrPathNotFound));
    80 	test_Value(r, (r == KErrNone)||(r==KErrNotFound)||(r==KErrPathNotFound));
    80 
    81 
    81 	test.Printf(_L("Notify Session Path %S\n"),&gSessionPath);
    82 	test.Printf(_L("Notify Session Path %S\n"),&gSessionPath);
    82 
    83 
    83 //	Submit notify change requests (requesting ahead)
    84 //	Submit notify change requests (requesting ahead)
    84 	test.Printf(_L("Create a directory %S\n"),&path);
    85 	test.Printf(_L("Create a directory %S\n"),&path);
    87 	TheNotifyFs.NotifyChange(ENotifyDir,statDir,path);
    88 	TheNotifyFs.NotifyChange(ENotifyDir,statDir,path);
    88 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
    89 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
    89 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
    90 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
    90 
    91 
    91 	r=TheFs.MkDir(path);	
    92 	r=TheFs.MkDir(path);	
    92 	test((r==KErrNone)||(r==KErrAlreadyExists));
    93 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
    93 	User::WaitForAnyRequest();
    94 	User::WaitForAnyRequest();
    94 	test(statEntry==KErrNone);
    95 	test(statEntry==KErrNone);
    95 	test(statFile==KErrNone);
    96 	test(statFile==KErrNone);
    96 	test(statDir==KErrNone);
    97 	test(statDir==KErrNone);
    97 	test(statWild==KErrNone);
    98 	test(statWild==KErrNone);
   110 	filePath+=_L("TestFile.app");
   111 	filePath+=_L("TestFile.app");
   111 	RFile file;
   112 	RFile file;
   112 	r=file.Replace(TheFs,filePath,EFileRead|EFileWrite);
   113 	r=file.Replace(TheFs,filePath,EFileRead|EFileWrite);
   113 	file.Close();
   114 	file.Close();
   114 	User::WaitForAnyRequest();
   115 	User::WaitForAnyRequest();
   115 	test(r==KErrNone);
   116 	test_KErrNone(r);
   116 	test (statEntry==KErrNone);
   117 	test (statEntry==KErrNone);
   117 	test(statFile==KErrNone);
   118 	test(statFile==KErrNone);
   118 	test(statDir==KRequestPending);
   119 	test(statDir==KRequestPending);
   119 	test(statWild==KErrNone);
   120 	test(statWild==KErrNone);
   120 	test(statWilder==KErrNone);
   121 	test(statWilder==KErrNone);
   125 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   126 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   126 	TheNotifyFs.NotifyChange(ENotifyDir,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   127 	TheNotifyFs.NotifyChange(ENotifyDir,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   127 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
   128 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
   128 	
   129 	
   129 	r=TheFs.Delete(filePath);
   130 	r=TheFs.Delete(filePath);
   130 	test(r==KErrNone);
   131 	test_KErrNone(r);
   131 	User::WaitForAnyRequest();
   132 	User::WaitForAnyRequest();
   132 	test (statEntry==KErrNone);
   133 	test (statEntry==KErrNone);
   133 	test(statFile==KErrNone);
   134 	test(statFile==KErrNone);
   134 	test(statDir==KRequestPending);
   135 	test(statDir==KRequestPending);
   135 	test(statWild==KRequestPending);
   136 	test(statWild==KRequestPending);
   141 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   142 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   142 //	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   143 //	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   143 	TheNotifyFs.NotifyChange(ENotifyFile,statWilder,_L("*:\\"));
   144 	TheNotifyFs.NotifyChange(ENotifyFile,statWilder,_L("*:\\"));
   144 
   145 
   145 	r=TheFs.RmDir(path);
   146 	r=TheFs.RmDir(path);
   146 	test(r==KErrNone);
   147 	test_KErrNone(r);
   147 	User::WaitForAnyRequest();
   148 	User::WaitForAnyRequest();
   148 	test (statEntry==KErrNone);
   149 	test (statEntry==KErrNone);
   149 	test(statFile==KRequestPending);
   150 	test(statFile==KRequestPending);
   150 	test(statDir==KErrNone);
   151 	test(statDir==KErrNone);
   151 	test(statWild==KErrNone);
   152 	test(statWild==KErrNone);
   164 	TFileName sessionPath;
   165 	TFileName sessionPath;
   165 	sessionPath=_L("?:\\F32-TST\\");
   166 	sessionPath=_L("?:\\F32-TST\\");
   166 		
   167 		
   167 	TChar driveChar;
   168 	TChar driveChar;
   168 	TInt err=RFs::DriveToChar(RemovableDrive,driveChar);
   169 	TInt err=RFs::DriveToChar(RemovableDrive,driveChar);
   169 	test(err==KErrNone);
   170 	test_KErrNone(err);
   170 
   171 
   171 	if (gSessionPath[0]=='C')
   172 	if (gSessionPath[0]=='C')
   172 		(gSessionPath[0] == (TText)gDriveToTest)? (sessionPath[0] = (TText)driveChar):(sessionPath[0] = (TText)gDriveToTest);
   173 		(gSessionPath[0] == (TText)gDriveToTest)? (sessionPath[0] = (TText)driveChar):(sessionPath[0] = (TText)gDriveToTest);
   173 	else if (gSessionPath[0]=='Y')
   174 	else if (gSessionPath[0]=='Y')
   174 		sessionPath[0]='X';
   175 		sessionPath[0]='X';
   177 	else 
   178 	else 
   178 		sessionPath[0]='C';	//invalid drive numbers shouldn't reach here, must be filtered out from t_main
   179 		sessionPath[0]='C';	//invalid drive numbers shouldn't reach here, must be filtered out from t_main
   179 		//return;
   180 		//return;
   180 	
   181 	
   181 	TInt r=TheFs.SetSessionPath(sessionPath);
   182 	TInt r=TheFs.SetSessionPath(sessionPath);
   182 	test(r==KErrNone);
   183 	test_KErrNone(r);
   183 
   184 
   184 	TFileName path;
   185 	TFileName path;
   185 	path=_L("\\F32-TST\\T_APPINS\\");	//	Takes drive implicitly from associated session path
   186 	path=_L("\\F32-TST\\T_APPINS\\");	//	Takes drive implicitly from associated session path
   186 						
   187 						
   187 	r=TheFs.RmDir(path);
   188 	r=TheFs.RmDir(path);
   188 	test((r==KErrNone)||(r==KErrNotFound)||(r==KErrPathNotFound));
   189 	test_Value(r, (r == KErrNone)||(r==KErrNotFound)||(r==KErrPathNotFound));
   189 	
   190 	
   190 	TRequestStatus statEntry(KRequestPending);
   191 	TRequestStatus statEntry(KRequestPending);
   191 	TRequestStatus statFile(KRequestPending);
   192 	TRequestStatus statFile(KRequestPending);
   192 	TRequestStatus statDir(KRequestPending);
   193 	TRequestStatus statDir(KRequestPending);
   193 	TRequestStatus statWild(KRequestPending);
   194 	TRequestStatus statWild(KRequestPending);
   204 	TheNotifyFs.NotifyChange(ENotifyDir,statDir,path);
   205 	TheNotifyFs.NotifyChange(ENotifyDir,statDir,path);
   205 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   206 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   206 	TheNotifyFs.NotifyChange(ENotifyAll,statWilder,_L("*:\\"));
   207 	TheNotifyFs.NotifyChange(ENotifyAll,statWilder,_L("*:\\"));
   207 
   208 
   208 	r=TheFs.MkDir(path);										//	Creates the directory on the drive
   209 	r=TheFs.MkDir(path);										//	Creates the directory on the drive
   209 	test((r==KErrNone)||(r==KErrAlreadyExists));				//	associated with TheFs session path
   210 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));				//	associated with TheFs session path
   210 	test (statEntry==KRequestPending);
   211 	test (statEntry==KRequestPending);
   211 	test(statFile==KRequestPending);
   212 	test(statFile==KRequestPending);
   212 	test(statDir==KRequestPending);	//	No notification because it's watching a different drive!
   213 	test(statDir==KRequestPending);	//	No notification because it's watching a different drive!
   213 	test(statWild==KErrNone);	//	BUG FIX TEST
   214 	test(statWild==KErrNone);	//	BUG FIX TEST
   214 	test(statWilder==KErrNone);
   215 	test(statWilder==KErrNone);
   222 	filePath=path;
   223 	filePath=path;
   223 	filePath+=_L("TestFile.app");
   224 	filePath+=_L("TestFile.app");
   224 	RFile file;
   225 	RFile file;
   225 	r=file.Replace(TheFs,filePath,EFileRead|EFileWrite);
   226 	r=file.Replace(TheFs,filePath,EFileRead|EFileWrite);
   226 	file.Close();
   227 	file.Close();
   227 	test(r==KErrNone);
   228 	test_KErrNone(r);
   228 
   229 
   229 	test (statEntry==KRequestPending);	//	No notification!
   230 	test (statEntry==KRequestPending);	//	No notification!
   230 	test(statFile==KRequestPending);
   231 	test(statFile==KRequestPending);
   231 	test(statDir==KRequestPending);	
   232 	test(statDir==KRequestPending);	
   232 	test(statWild==KErrNone);
   233 	test(statWild==KErrNone);
   235 //	No need to resubmit notify change requests	
   236 //	No need to resubmit notify change requests	
   236 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   237 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   237 	TheNotifyFs.NotifyChange(ENotifyDir,statWilder,_L("*:\\"));
   238 	TheNotifyFs.NotifyChange(ENotifyDir,statWilder,_L("*:\\"));
   238 
   239 
   239 	r=TheFs.Delete(filePath);
   240 	r=TheFs.Delete(filePath);
   240 	test(r==KErrNone);
   241 	test_KErrNone(r);
   241 //	Still no notification	
   242 //	Still no notification	
   242 	test (statEntry==KRequestPending);
   243 	test (statEntry==KRequestPending);
   243 	test(statFile==KRequestPending);
   244 	test(statFile==KRequestPending);
   244 	test(statDir==KRequestPending);
   245 	test(statDir==KRequestPending);
   245 	test(statWild==KErrNone);
   246 	test(statWild==KErrNone);
   248 //	No need to resubmit notify change requests	
   249 //	No need to resubmit notify change requests	
   249 	test.Next(_L("Remove the directory"));
   250 	test.Next(_L("Remove the directory"));
   250 	TheNotifyFs.NotifyChange(ENotifyDir,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   251 	TheNotifyFs.NotifyChange(ENotifyDir,statWild,_L("?:\\F32-TST\\T_APPINS\\"));
   251 //	TheNotifyFs.NotifyChange(ENotifyDir,statWilder,_L("*:\\"));
   252 //	TheNotifyFs.NotifyChange(ENotifyDir,statWilder,_L("*:\\"));
   252 	r=TheFs.RmDir(path);
   253 	r=TheFs.RmDir(path);
   253 	test(r==KErrNone);
   254 	test_KErrNone(r);
   254 //	Still no notification	
   255 //	Still no notification	
   255 	test (statEntry==KRequestPending);
   256 	test (statEntry==KRequestPending);
   256 	test(statFile==KRequestPending);
   257 	test(statFile==KRequestPending);
   257 	test(statDir==KRequestPending);
   258 	test(statDir==KRequestPending);
   258 	test(statWild==KErrNone);
   259 	test(statWild==KErrNone);
   269 //
   270 //
   270 	{
   271 	{
   271 	TFileName path;
   272 	TFileName path;
   272 	path=_L("\\F32-TST\\T_APPINS\\");
   273 	path=_L("\\F32-TST\\T_APPINS\\");
   273 	TInt r=TheFs.RmDir(path);
   274 	TInt r=TheFs.RmDir(path);
   274 	test((r==KErrNone)||(r==KErrNotFound)||(r==KErrPathNotFound));
   275 	test_Value(r, (r == KErrNone)||(r==KErrNotFound)||(r==KErrPathNotFound));
   275 	
   276 	
   276 	TRequestStatus statEntry(KRequestPending);
   277 	TRequestStatus statEntry(KRequestPending);
   277 	TRequestStatus statFile(KRequestPending);
   278 	TRequestStatus statFile(KRequestPending);
   278 	TRequestStatus statDir(KRequestPending);
   279 	TRequestStatus statDir(KRequestPending);
   279 	TRequestStatus statWild(KRequestPending);
   280 	TRequestStatus statWild(KRequestPending);
   281 
   282 
   282 	test.Printf(_L("Session Path %S\n"),&gSessionPath);
   283 	test.Printf(_L("Session Path %S\n"),&gSessionPath);
   283 //	Set the session path of the session	which creates the file/directory to be
   284 //	Set the session path of the session	which creates the file/directory to be
   284 //	the same as the notification session's session path
   285 //	the same as the notification session's session path
   285 	r=TheFs.SetSessionPath(gSessionPath);
   286 	r=TheFs.SetSessionPath(gSessionPath);
   286 	test(r==KErrNone);
   287 	test_KErrNone(r);
   287 
   288 
   288 //	Submit notify change requests (requesting ahead)
   289 //	Submit notify change requests (requesting ahead)
   289 	test.Printf(_L("Create a directory %S\n"),&path);
   290 	test.Printf(_L("Create a directory %S\n"),&path);
   290 	TheNotifyFs.NotifyChange(ENotifyEntry,statEntry,path);
   291 	TheNotifyFs.NotifyChange(ENotifyEntry,statEntry,path);
   291 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   292 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   292 	TheNotifyFs.NotifyChange(ENotifyDir,statDir,path);
   293 	TheNotifyFs.NotifyChange(ENotifyDir,statDir,path);
   293 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\"));
   294 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\"));
   294 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
   295 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
   295 
   296 
   296 	r=TheFs.MkDir(path);	
   297 	r=TheFs.MkDir(path);	
   297 	test((r==KErrNone)||(r==KErrAlreadyExists));
   298 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
   298 	User::WaitForAnyRequest();
   299 	User::WaitForAnyRequest();
   299 	test (statEntry==KErrNone);
   300 	test (statEntry==KErrNone);
   300 	test(statFile==KErrNone);
   301 	test(statFile==KErrNone);
   301 	test(statDir==KErrNone);
   302 	test(statDir==KErrNone);
   302 	test(statWild==KErrNone);
   303 	test(statWild==KErrNone);
   316 	filePath+=_L("TestFile.app");
   317 	filePath+=_L("TestFile.app");
   317 	RFile file;
   318 	RFile file;
   318 	r=file.Replace(TheFs,filePath,EFileRead|EFileWrite);
   319 	r=file.Replace(TheFs,filePath,EFileRead|EFileWrite);
   319 	file.Close();
   320 	file.Close();
   320 	User::WaitForAnyRequest();
   321 	User::WaitForAnyRequest();
   321 	test(r==KErrNone);
   322 	test_KErrNone(r);
   322 	test (statEntry==KErrNone);
   323 	test (statEntry==KErrNone);
   323 	test(statFile==KErrNone);
   324 	test(statFile==KErrNone);
   324 	test(statDir==KRequestPending);	
   325 	test(statDir==KRequestPending);	
   325 	test(statWild==KErrNone);
   326 	test(statWild==KErrNone);
   326 	test(statWilder==KErrNone);
   327 	test(statWilder==KErrNone);
   331 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   332 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   332 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\"));
   333 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\"));
   333 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
   334 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
   334 
   335 
   335 	r=TheFs.Delete(filePath);
   336 	r=TheFs.Delete(filePath);
   336 	test(r==KErrNone);
   337 	test_KErrNone(r);
   337 	User::WaitForAnyRequest();
   338 	User::WaitForAnyRequest();
   338 	test (statEntry==KErrNone);
   339 	test (statEntry==KErrNone);
   339 	test(statFile==KErrNone);
   340 	test(statFile==KErrNone);
   340 	test(statDir==KRequestPending);
   341 	test(statDir==KRequestPending);
   341 	test(statWild==KErrNone);
   342 	test(statWild==KErrNone);
   347 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   348 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   348 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\"));
   349 	TheNotifyFs.NotifyChange(ENotifyEntry,statWild,_L("?:\\F32-TST\\"));
   349 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
   350 	TheNotifyFs.NotifyChange(ENotifyEntry,statWilder,_L("*:\\"));
   350 
   351 
   351 	r=TheFs.RmDir(path);
   352 	r=TheFs.RmDir(path);
   352 	test(r==KErrNone);
   353 	test_KErrNone(r);
   353 	User::WaitForAnyRequest();
   354 	User::WaitForAnyRequest();
   354 	test (statEntry==KErrNone);
   355 	test (statEntry==KErrNone);
   355 	test(statFile==KRequestPending);
   356 	test(statFile==KRequestPending);
   356 	test(statDir==KErrNone);
   357 	test(statDir==KErrNone);
   357 	test(statWild==KErrNone);
   358 	test(statWild==KErrNone);
   372 	TFileName path;
   373 	TFileName path;
   373 	TBuf<23> pathBuf=_L("?:\\F32-TST\\T_APPINS\\");
   374 	TBuf<23> pathBuf=_L("?:\\F32-TST\\T_APPINS\\");
   374 	
   375 	
   375 	TChar driveChar;
   376 	TChar driveChar;
   376 	TInt r=RFs::DriveToChar(RemovableDrive,driveChar);
   377 	TInt r=RFs::DriveToChar(RemovableDrive,driveChar);
   377 	test(r==KErrNone);
   378 	test_KErrNone(r);
   378 	
   379 	
   379 	if (gDriveToTest =='C')
   380 	if (gDriveToTest =='C')
   380 		pathBuf[0]=driveChar;
   381 		pathBuf[0]=driveChar;
   381 	else
   382 	else
   382 		pathBuf[0] =gDriveToTest;
   383 		pathBuf[0] =gDriveToTest;
   383 	
   384 	
   384 	path = pathBuf;
   385 	path = pathBuf;
   385 	r=TheFs.RmDir(path);
   386 	r=TheFs.RmDir(path);
   386 	test((r==KErrNone)||(r==KErrNotFound)||(r==KErrPathNotFound));
   387 	test_Value(r, (r == KErrNone)||(r==KErrNotFound)||(r==KErrPathNotFound));
   387 		
   388 		
   388 	TInt result;
   389 	TInt result;
   389 	result=TheFs.MkDir(_L("C:\\SILLY\\"));
   390 	result=TheFs.MkDir(_L("C:\\SILLY\\"));
   390 	test((result==KErrNone)||(result==KErrAlreadyExists));
   391 	test_Value(result, (result == KErrNone)||(result==KErrAlreadyExists));
   391 	result=TheFs.MkDir(_L("C:\\SILLY\\SILLIER\\"));
   392 	result=TheFs.MkDir(_L("C:\\SILLY\\SILLIER\\"));
   392 	test((result==KErrNone)||(result==KErrAlreadyExists));
   393 	test_Value(result, (result == KErrNone)||(result==KErrAlreadyExists));
   393 	result=TheFs.MkDir(_L("C:\\SILLY\\SILLIER\\SILLIEST\\"));
   394 	result=TheFs.MkDir(_L("C:\\SILLY\\SILLIER\\SILLIEST\\"));
   394 	test((result==KErrNone)||(result==KErrAlreadyExists));
   395 	test_Value(result, (result == KErrNone)||(result==KErrAlreadyExists));
   395 
   396 
   396 	result=TheNotifyFs.SetSessionPath(_L("C:\\SILLY\\SILLIER\\SILLIEST\\"));
   397 	result=TheNotifyFs.SetSessionPath(_L("C:\\SILLY\\SILLIER\\SILLIEST\\"));
   397 	test(result==KErrNone);
   398 	test_KErrNone(result);
   398 	
   399 	
   399 	result=TheNotifyFs.SessionPath(gSessionPath);
   400 	result=TheNotifyFs.SessionPath(gSessionPath);
   400 	test(result==KErrNone);
   401 	test_KErrNone(result);
   401 	test.Printf(_L("Session Path %S\n"),&gSessionPath);
   402 	test.Printf(_L("Session Path %S\n"),&gSessionPath);
   402 
   403 
   403 	TRequestStatus statEntry(KRequestPending);
   404 	TRequestStatus statEntry(KRequestPending);
   404 	TRequestStatus statFile(KRequestPending);
   405 	TRequestStatus statFile(KRequestPending);
   405 	TRequestStatus statDir(KRequestPending);
   406 	TRequestStatus statDir(KRequestPending);
   409 	TheNotifyFs.NotifyChange(ENotifyEntry,statEntry,path);
   410 	TheNotifyFs.NotifyChange(ENotifyEntry,statEntry,path);
   410 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   411 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   411 	TheNotifyFs.NotifyChange(ENotifyDir,statDir,path);
   412 	TheNotifyFs.NotifyChange(ENotifyDir,statDir,path);
   412 
   413 
   413 	r=TheFs.MkDir(path);	
   414 	r=TheFs.MkDir(path);	
   414 	test((r==KErrNone)||(r==KErrAlreadyExists));
   415 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
   415 	User::WaitForAnyRequest();
   416 	User::WaitForAnyRequest();
   416 	test (statEntry==KErrNone);
   417 	test (statEntry==KErrNone);
   417 	test(statFile==KErrNone);
   418 	test(statFile==KErrNone);
   418 	test(statDir==KErrNone);
   419 	test(statDir==KErrNone);
   419 
   420 
   428 	filePath+=_L("TestFile.app");
   429 	filePath+=_L("TestFile.app");
   429 	RFile file;
   430 	RFile file;
   430 	r=file.Replace(TheFs,filePath,EFileRead|EFileWrite);
   431 	r=file.Replace(TheFs,filePath,EFileRead|EFileWrite);
   431 	file.Close();
   432 	file.Close();
   432 	User::WaitForAnyRequest();
   433 	User::WaitForAnyRequest();
   433 	test(r==KErrNone);
   434 	test_KErrNone(r);
   434 	test (statEntry==KErrNone);
   435 	test (statEntry==KErrNone);
   435 	test(statFile==KErrNone);
   436 	test(statFile==KErrNone);
   436 	test(statDir==KRequestPending);
   437 	test(statDir==KRequestPending);
   437 
   438 
   438 //	Resubmit notify change requests	
   439 //	Resubmit notify change requests	
   439 	test.Next(_L("Remove the file from the directory"));
   440 	test.Next(_L("Remove the file from the directory"));
   440 	TheNotifyFs.NotifyChange(ENotifyEntry,statEntry,path);
   441 	TheNotifyFs.NotifyChange(ENotifyEntry,statEntry,path);
   441 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   442 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   442 	
   443 	
   443 	r=TheFs.Delete(filePath);
   444 	r=TheFs.Delete(filePath);
   444 	test(r==KErrNone);
   445 	test_KErrNone(r);
   445 	User::WaitForAnyRequest();
   446 	User::WaitForAnyRequest();
   446 	test (statEntry==KErrNone);
   447 	test (statEntry==KErrNone);
   447 	test(statFile==KErrNone);
   448 	test(statFile==KErrNone);
   448 	test(statDir==KRequestPending);
   449 	test(statDir==KRequestPending);
   449 
   450 
   450 //	Resubmit notify change requests	
   451 //	Resubmit notify change requests	
   451 	test.Next(_L("Remove the directory"));
   452 	test.Next(_L("Remove the directory"));
   452 	TheNotifyFs.NotifyChange(ENotifyEntry,statEntry,path);
   453 	TheNotifyFs.NotifyChange(ENotifyEntry,statEntry,path);
   453 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   454 	TheNotifyFs.NotifyChange(ENotifyFile,statFile,path);
   454 	r=TheFs.RmDir(path);
   455 	r=TheFs.RmDir(path);
   455 	test(r==KErrNone);
   456 	test_KErrNone(r);
   456 	User::WaitForAnyRequest();
   457 	User::WaitForAnyRequest();
   457 	test (statEntry==KErrNone);
   458 	test (statEntry==KErrNone);
   458 	test(statFile==KRequestPending);
   459 	test(statFile==KRequestPending);
   459 	test(statDir==KErrNone);
   460 	test(statDir==KErrNone);
   460 
   461 
   461 	result=TheFs.RmDir(_L("C:\\SILLY\\SILLIER\\SILLIEST\\"));
   462 	result=TheFs.RmDir(_L("C:\\SILLY\\SILLIER\\SILLIEST\\"));
   462 	test((result==KErrNone)||(result==KErrAlreadyExists));
   463 	test_Value(result, (result == KErrNone)||(result==KErrAlreadyExists));
   463 	result=TheFs.RmDir(_L("C:\\SILLY\\SILLIER\\"));
   464 	result=TheFs.RmDir(_L("C:\\SILLY\\SILLIER\\"));
   464 	test((result==KErrNone)||(result==KErrAlreadyExists));
   465 	test_Value(result, (result == KErrNone)||(result==KErrAlreadyExists));
   465 	result=TheFs.RmDir(_L("C:\\SILLY\\"));
   466 	result=TheFs.RmDir(_L("C:\\SILLY\\"));
   466 	test((result==KErrNone)||(result==KErrAlreadyExists));	
   467 	test_Value(result, (result == KErrNone)||(result==KErrAlreadyExists));	
   467 	}
   468 	}
   468 
   469 
   469 #endif
   470 #endif
   470 LOCAL_C void DoTests()
   471 LOCAL_C void DoTests()
   471 //
   472 //
   496 		return;
   497 		return;
   497 		}
   498 		}
   498 
   499 
   499 	test.Start(_L("Testing filesystem"));
   500 	test.Start(_L("Testing filesystem"));
   500 	TInt r=TheNotifyFs.Connect();
   501 	TInt r=TheNotifyFs.Connect();
   501 	test(r==KErrNone);
   502 	test_KErrNone(r);
   502 	TFileName sessionPath;
   503 	TFileName sessionPath;
   503 	TInt uid;
   504 	TInt uid;
   504 	test(HAL::Get(HAL::EMachineUid,uid)==KErrNone);
   505 	test(HAL::Get(HAL::EMachineUid,uid)==KErrNone);
   505 	if(uid==HAL::EMachineUid_Cogent || uid==HAL::EMachineUid_IQ80310 || uid==HAL::EMachineUid_X86PC)
   506 	if(uid==HAL::EMachineUid_Cogent || uid==HAL::EMachineUid_IQ80310 || uid==HAL::EMachineUid_X86PC)
   506 		{
   507 		{
   509 		}
   510 		}
   510 
   511 
   511 #if !defined(__WINS__)
   512 #if !defined(__WINS__)
   512 //	MARM TESTS
   513 //	MARM TESTS
   513 	r=TheFs.MkDir(_L("C:\\F32-TST\\"));
   514 	r=TheFs.MkDir(_L("C:\\F32-TST\\"));
   514 	test((r==KErrNone)||(r==KErrAlreadyExists));
   515 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
   515 
   516 
   516 	if(KErrNone == TheFs.DriveList(drvList))
   517 	if(KErrNone == TheFs.DriveList(drvList))
   517 		{
   518 		{
   518 		TInt i;
   519 		TInt i;
   519 		//should be successful, otherwise it means a system w/o any drive!!!
   520 		//should be successful, otherwise it means a system w/o any drive!!!
   541 		test.Printf(_L("No Drive found! Testing discontinued.\n"));
   542 		test.Printf(_L("No Drive found! Testing discontinued.\n"));
   542 		User::Exit(KErrNone);
   543 		User::Exit(KErrNone);
   543 		}
   544 		}
   544 	
   545 	
   545 	r=RFs::DriveToChar(RemovableDrive,driveChar);
   546 	r=RFs::DriveToChar(RemovableDrive,driveChar);
   546 	test(r==KErrNone);
   547 	test_KErrNone(r);
   547 	
   548 	
   548 	if(gDriveToTest == 'C')
   549 	if(gDriveToTest == 'C')
   549 		dirBuf[0] = (TText)driveChar;
   550 		dirBuf[0] = (TText)driveChar;
   550 	else
   551 	else
   551 		dirBuf[0] = (TText)gDriveToTest;
   552 		dirBuf[0] = (TText)gDriveToTest;
   556 		test.Printf(_L("TEST REQUIRES A CF CARD - "));
   557 		test.Printf(_L("TEST REQUIRES A CF CARD - "));
   557 		//test.Printf(_L("PUT A VALID CARD IN AND PRESS A KEY..."));
   558 		//test.Printf(_L("PUT A VALID CARD IN AND PRESS A KEY..."));
   558 		//test.Getch();
   559 		//test.Getch();
   559 		r=TheFs.MkDir(dirBuf);
   560 		r=TheFs.MkDir(dirBuf);
   560 		}
   561 		}
   561 	test((r==KErrNone)||(r==KErrAlreadyExists));	
   562 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));	
   562 		
   563 		
   563 //	Set the notification session path to the test directory on C drive
   564 //	Set the notification session path to the test directory on C drive
   564 	sessionPath=_L("C:\\F32-TST\\");
   565 	sessionPath=_L("C:\\F32-TST\\");
   565 	r=TheNotifyFs.SetSessionPath(sessionPath);
   566 	r=TheNotifyFs.SetSessionPath(sessionPath);
   566 	test(r==KErrNone);
   567 	test_KErrNone(r);
   567 //	Run tests
   568 //	Run tests
   568 	TRAP(r,DoTests());
   569 	TRAP(r,DoTests());
   569 	if (r!=KErrNone)
   570 	if (r!=KErrNone)
   570 		test.Printf(_L("Error: %d\n"),r);
   571 		test.Printf(_L("Error: %d\n"),r);
   571 	Test4();
   572 	Test4();
   577 	else
   578 	else
   578 		sessionPath[0] = (TText)gDriveToTest;
   579 		sessionPath[0] = (TText)gDriveToTest;
   579 		
   580 		
   580 
   581 
   581 	r=TheNotifyFs.SetSessionPath(sessionPath);
   582 	r=TheNotifyFs.SetSessionPath(sessionPath);
   582 	test(r==KErrNone);
   583 	test_KErrNone(r);
   583 
   584 
   584 	test(r==KErrNone);
   585 	test_KErrNone(r);
   585 	TRAP(r,DoTests());
   586 	TRAP(r,DoTests());
   586 	if (r!=KErrNone)
   587 	if (r!=KErrNone)
   587 		test.Printf(_L("Error: %d\n"),r);
   588 		test.Printf(_L("Error: %d\n"),r);
   588 	Test4();
   589 	Test4();
   589 	CheckDisk();
   590 	CheckDisk();
   590 #elif defined (__WINS__)
   591 #elif defined (__WINS__)
   591 	r=TheFs.MkDir(_L("X:\\F32-TST\\"));
   592 	r=TheFs.MkDir(_L("X:\\F32-TST\\"));
   592 	test((r==KErrNone)||(r==KErrAlreadyExists));
   593 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
   593 	r=TheFs.MkDir(_L("Y:\\F32-TST\\"));
   594 	r=TheFs.MkDir(_L("Y:\\F32-TST\\"));
   594 	test((r==KErrNone)||(r==KErrAlreadyExists));
   595 	test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists));
   595 //	Set session path to test directory on Y drive
   596 //	Set session path to test directory on Y drive
   596 	r=TheNotifyFs.SetSessionPath(_L("Y:\\F32-TST\\"));
   597 	r=TheNotifyFs.SetSessionPath(_L("Y:\\F32-TST\\"));
   597 	test(r==KErrNone);
   598 	test_KErrNone(r);
   598 	TRAP(r,DoTests());
   599 	TRAP(r,DoTests());
   599 	if (r!=KErrNone)
   600 	if (r!=KErrNone)
   600 		test.Printf(_L("Error: %d\n"),r);
   601 		test.Printf(_L("Error: %d\n"),r);
   601 
   602 
   602 	CheckDisk();
   603 	CheckDisk();
   603 
   604 
   604 	//we have no X drive on eka2 yet
   605 	//we have no X drive on eka2 yet
   605 //	Set session path to test directory on X drive	
   606 //	Set session path to test directory on X drive	
   606 //	r=TheNotifyFs.SetSessionPath(_L("X:\\F32-TST\\"));
   607 //	r=TheNotifyFs.SetSessionPath(_L("X:\\F32-TST\\"));
   607 //	test(r==KErrNone);
   608 //	test_KErrNone(r);
   608 //	TRAP(r,DoTests());
   609 //	TRAP(r,DoTests());
   609 
   610 
   610 	if (r!=KErrNone)
   611 	if (r!=KErrNone)
   611 		test.Printf(_L("Error: %d\n"),r);
   612 		test.Printf(_L("Error: %d\n"),r);
   612 
   613