os/kernelhwsrv/kerneltest/f32test/fsstress/t_remote.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // f32test\fsstress\t_remote.cpp
    15 // 
    16 //
    17 
    18 #if !defined(__F32FILE_H__)
    19 #include <f32file.h>
    20 #endif
    21 #if !defined(__E32TEST_H__)
    22 #include <e32test.h>
    23 #endif
    24 #if !defined(__T_STD_H__)
    25 #include "t_std.h"
    26 #endif
    27 #if !defined(__T_REMFSY_H__)
    28 #include "t_remfsy.h"
    29 #endif
    30 
    31 GLDEF_D RTest test(_L("T_REMOTE - DEFAULT DRIVE"));
    32 GLDEF_D RTest testx(_L("X Drive (WINS) <-> D Drive (MARM)"));
    33 GLDEF_D RTest testy(_L("Y Drive (WINS) <-> C Drive (MARM)"));
    34 GLDEF_D RTest testq(_L("REMOTE Q Drive"));
    35 
    36 LOCAL_D TFileName gBatchFile;
    37 LOCAL_D TBool gRunByBatch=EFalse;
    38 
    39 GLDEF_D TFileName gExeFileName(RProcess().FileName());
    40 
    41 /*
    42 INFORMATION - What this test is all about
    43 
    44 T_REMOTE tests the asynchronous remote file system implementation, introduced in
    45 F32 release 110 and refined in release 112.  The test sets up and mounts four drives,
    46 the default drive (usually C on WINS and MARM), a remote drive (Q) and two others, on
    47 MARM these are C and D, on WINS these are X and Y.  The remote filesystem is the only
    48 system treated asynchronously by F32.  
    49 
    50 The test sets up a thread for each drive and runs a number of tests on each drive.
    51 In the remote filesystem case, a dummy filesystem has been implemented, this is built
    52 as T_REMFSY.fsy.  The tests are designed to stress a number of fileserver API
    53 functions.  The test MultipleSessions() is adapted from another F32 test T_SESSION.
    54 It sets up an array of fileserver connections and then uses each connection to run
    55 a number of tests - alternating between connections to stress F32 as it does so.  The
    56 test should therefore be testing multiple fileserver connections on multiple drives -
    57 the remote filesystem running concurrently with the other drives.  There should be
    58 no failure or confusion between fileserver sessions.  Each drive has a separate test
    59 console which should complete successfully.
    60 
    61 NOTE: TO RUN THIS CARD SUCCESSFULLY ON MARM A CF CARD IS REQUIRED
    62 
    63 */
    64 
    65 LOCAL_C void Test0(RTest& aTest)
    66 //
    67 //	Scan for open files - no sessions
    68 //	
    69 	{
    70 	aTest.Next(_L("Scan for open files with no sessions open"));
    71 	CFileList* list;
    72 	TOpenFileScan fileScan(TheFs);
    73 	fileScan.NextL(list);
    74 	if (list==NULL)
    75 		return;
    76 	TInt count=list->Count();
    77 	if (count==1)
    78 		{
    79 		gRunByBatch=ETrue;
    80 		gBatchFile=(*list)[0].iName;
    81 		delete list;
    82 		fileScan.NextL(list);
    83 		if (list==NULL)
    84 			return;
    85 		count=list->Count();
    86 		}
    87 	while (count--)
    88 		{
    89 		TEntry entry=(*list)[count];
    90 		aTest.Printf(_L("%d) EntryName = %S\n"),count,&entry.iName);
    91 		}
    92 	//aTest.Printf(_L("Test will fail unless files are closed.\n"));
    93 	//aTest.Printf(_L("Press any key ...\n"));
    94 	//aTest.Getch();
    95 	}
    96 
    97 
    98 LOCAL_C void Test1()	
    99 //
   100 //	This test is only called by default drive
   101 //	Test OpenFileScan			
   102 //
   103 	{
   104 	test.Next(_L("Scan for open files - one session only"));
   105 
   106 	RFile file1,file2,file3;
   107 	TFileName fn;
   108 	fn = _L("Z:\\TEST\\T_FSRV.CPP");
   109 	fn[0] = gExeFileName[0];
   110 	TInt r=file1.Open(TheFs,fn,EFileRead|EFileShareReadersOnly);
   111 	test(r==KErrNone);
   112 	fn = _L("Z:\\TEST\\T_FILE.CPP");
   113 	fn[0] = gExeFileName[0];
   114 	r=file2.Open(TheFs,fn,EFileRead);
   115 	test(r==KErrNone);
   116 	fn = _L("Z:\\TEST\\T_FSRV.CPP");
   117 	fn[0] = gExeFileName[0];
   118 	r=file3.Open(TheFs,fn,EFileRead|EFileShareReadersOnly);
   119 	test(r==KErrNone);
   120 	
   121 	CFileList* list;
   122 	TOpenFileScan fileScan(TheFs);
   123 	fileScan.NextL(list);
   124 
   125 	if (gRunByBatch)
   126 		{
   127 		test(list!=NULL);
   128 		test(list->Count()==1);
   129 		TEntry entry=(*list)[0];
   130 		test(entry.iName.FindF(_L(".BAT"))>=0);
   131 		delete list;
   132 		fileScan.NextL(list);
   133 		}
   134 
   135 	test(list!=NULL);
   136 	TInt count=list->Count();
   137 	test(count==3);
   138 	TEntry entry=(*list)[0];
   139 	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
   140 	entry=(*list)[1];
   141 	test(entry.iName.FindF(_L("T_FILE.CPP"))>=0);
   142 	entry=(*list)[2];
   143 	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
   144 	TThreadId threadId=fileScan.ThreadId();
   145 	RThread current;
   146 	TThreadId currentId=current.Id();
   147 	test(threadId==currentId);
   148 	delete list;
   149 
   150 	fileScan.NextL(list);
   151 	test(list==NULL);
   152 
   153 	file1.Close();
   154 	file2.Close();
   155 	file3.Close();
   156 	}
   157 
   158 LOCAL_C void Test2()
   159 //
   160 // Test openfilescan - empty, full, empty.
   161 //
   162 	{
   163 	test.Next(_L("Scan for open files - empty sessions"));
   164 
   165 	RFs fs1,fs2,fs3,fs4;
   166 	TInt r=fs1.Connect();
   167 	test(r==KErrNone);
   168 	r=fs2.Connect();
   169 	test(r==KErrNone);
   170 	r=fs3.Connect();
   171 	test(r==KErrNone);
   172 	r=fs4.Connect();
   173 	test(r==KErrNone);
   174 
   175 	RFile file1,file2,file3;
   176 	TFileName fn;
   177 	fn = _L("Z:\\TEST\\T_FSRV.CPP");
   178 	fn[0] = gExeFileName[0];
   179 	r=file1.Open(fs2,fn,EFileRead|EFileShareReadersOnly);
   180 	test(r==KErrNone);
   181 	fn = _L("Z:\\TEST\\T_FILE.CPP");
   182 	fn[0] = gExeFileName[0];
   183 	r=file2.Open(fs2,fn,EFileRead);
   184 	test(r==KErrNone);
   185 	fn = _L("Z:\\TEST\\T_FSRV.CPP");
   186 	fn[0] = gExeFileName[0];
   187 	r=file3.Open(fs2,fn,EFileRead|EFileShareReadersOnly);
   188 	test(r==KErrNone);
   189 	
   190 	CFileList* list;
   191 	TOpenFileScan fileScan(TheFs);
   192 	fileScan.NextL(list);
   193 
   194 	if (gRunByBatch)
   195 		{
   196 		test(list!=NULL);
   197 		test(list->Count()==1);
   198 		TEntry entry=(*list)[0];
   199 		test(entry.iName.FindF(_L(".BAT"))>=0);
   200 		delete list;
   201 		fileScan.NextL(list);
   202 		}
   203 
   204 	test(list!=NULL);
   205 	TInt count=list->Count();
   206 	test(count==3);
   207 	TEntry entry=(*list)[0];
   208 	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
   209 	entry=(*list)[1];
   210 	test(entry.iName.FindF(_L("T_FILE.CPP"))>=0);
   211 	entry=(*list)[2];
   212 	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
   213 	TThreadId threadId=fileScan.ThreadId();
   214 	RThread current;
   215 	TThreadId currentId=current.Id();
   216 	test(threadId==currentId);
   217 	delete list;
   218 
   219 	fileScan.NextL(list);
   220 	test(list==NULL);
   221 
   222 	file1.Close();
   223 	file2.Close();
   224 	file3.Close();
   225 	fs1.Close();
   226 	fs2.Close();
   227 	fs3.Close();
   228 	fs4.Close();
   229 	}
   230 
   231 LOCAL_C void Test3()
   232 //
   233 // Test openfilescan - empty, full, empty full
   234 //
   235 	{
   236 	test.Next(_L("Scan for open files - multiple sessions"));
   237 
   238 	RFs fs1,fs2,fs3,fs4;
   239 	TInt r=fs1.Connect();
   240 	test(r==KErrNone);
   241 	r=fs2.Connect();
   242 	test(r==KErrNone);
   243 	r=fs3.Connect();
   244 	test(r==KErrNone);
   245 	r=fs4.Connect();
   246 	test(r==KErrNone);
   247 
   248 	RFile file1,file2,file3;
   249 	TFileName fn;
   250 	fn = _L("Z:\\TEST\\T_FSRV.CPP");
   251 	fn[0] = gExeFileName[0];
   252 	r=file1.Open(fs2,fn,EFileRead|EFileShareReadersOnly);
   253 	test(r==KErrNone);
   254 	fn = _L("Z:\\TEST\\T_FILE.CPP");
   255 	fn[0] = gExeFileName[0];
   256 	r=file2.Open(fs2,fn,EFileRead|EFileShareReadersOnly);
   257 	test(r==KErrNone);
   258 	fn = _L("Z:\\TEST\\T_FSRV.CPP");
   259 	fn[0] = gExeFileName[0];
   260 	r=file3.Open(fs2,fn,EFileRead|EFileShareReadersOnly);
   261 	test(r==KErrNone);
   262 	
   263 	r=file1.Open(fs4,fn,EFileRead|EFileShareReadersOnly);
   264 	test(r==KErrNone);
   265 	fn = _L("Z:\\TEST\\T_FILE.CPP");
   266 	fn[0] = gExeFileName[0];
   267 	r=file2.Open(fs4,fn,EFileRead|EFileShareReadersOnly);
   268 	test(r==KErrNone);
   269 	fn = _L("Z:\\TEST\\T_FSRV.CPP");
   270 	fn[0] = gExeFileName[0];
   271 	r=file3.Open(fs4,fn,EFileRead|EFileShareReadersOnly);
   272 	test(r==KErrNone);
   273 	
   274 	CFileList* list;
   275 	TOpenFileScan fileScan(TheFs);
   276 	fileScan.NextL(list);
   277 
   278 	if (gRunByBatch)
   279 		{
   280 		test(list!=NULL);
   281 		test(list->Count()==1);
   282 		TEntry entry=(*list)[0];
   283 		test(entry.iName.FindF(_L(".BAT"))>=0);
   284 		delete list;
   285 		fileScan.NextL(list);
   286 		}
   287 
   288 	test(list!=NULL);
   289 	TInt count=list->Count();
   290 	test(count==3);
   291 	TEntry entry=(*list)[0];
   292 	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
   293 	entry=(*list)[1];
   294 	test(entry.iName.FindF(_L("T_FILE.CPP"))>=0);
   295 	entry=(*list)[2];
   296 	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
   297 	TThreadId threadId=fileScan.ThreadId();
   298 	RThread current;
   299 	TThreadId currentId=current.Id();
   300 	test(threadId==currentId);
   301 	delete list;
   302 
   303 	fileScan.NextL(list);
   304 	test(list!=NULL);
   305 	count=list->Count();
   306 	test(count==3);
   307 	entry=(*list)[0];
   308 	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
   309 	entry=(*list)[1];
   310 	test(entry.iName.FindF(_L("T_FILE.CPP"))>=0);
   311 	entry=(*list)[2];
   312 	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
   313 	threadId=fileScan.ThreadId();
   314 	currentId=current.Id();
   315 	test(threadId==currentId);
   316 	delete list;
   317 
   318 	fileScan.NextL(list);
   319 	test(list==NULL);
   320 
   321 	file1.Close();
   322 	file2.Close();
   323 	file3.Close();
   324 	fs1.Close();
   325 	fs2.Close();
   326 	fs3.Close();
   327 	fs4.Close();
   328 	}
   329 
   330 LOCAL_C void Test4()
   331 //
   332 // Test openfilescan - rdirs, empty, full, empty rdirs.
   333 //
   334 	{
   335 	test.Next(_L("Scan for open files - check RDir sessions are ignored"));
   336 
   337 	RFs fs1,fs2,fs3,fs4;
   338 	TFileName fn;
   339 	TInt r=fs1.Connect();
   340 	test(r==KErrNone);
   341 	r=fs2.Connect();
   342 	test(r==KErrNone);
   343 	r=fs3.Connect();
   344 	test(r==KErrNone);
   345 	r=fs4.Connect();
   346 	test(r==KErrNone);
   347 
   348 	RDir dir1,dir2,dir3,dir4;
   349 	fn = _L("Z:\\TEST\\*.XDE");
   350 	fn[0] = gExeFileName[0];
   351 	r=dir1.Open(TheFs,fn,KEntryAttMaskSupported);
   352 	test(r==KErrNone);
   353 	r=dir2.Open(TheFs,fn,KEntryAttMaskSupported);
   354 	test(r==KErrNone);
   355 	r=dir3.Open(TheFs,fn,KEntryAttMaskSupported);
   356 	test(r==KErrNone);
   357 	r=dir4.Open(TheFs,fn,KEntryAttMaskSupported);
   358 	test(r==KErrNone);
   359 
   360 	RFile file1,file2,file3;
   361 	fn = _L("Z:\\TEST\\T_FSRV.CPP");
   362 	fn[0] = gExeFileName[0];
   363 	r=file1.Open(fs2,fn,EFileRead|EFileShareReadersOnly);
   364 	test(r==KErrNone);
   365 	fn = _L("Z:\\TEST\\T_FILE.CPP");
   366 	fn[0] = gExeFileName[0];
   367 	r=file2.Open(fs2,fn,EFileRead);
   368 	test(r==KErrNone);
   369 	fn = _L("Z:\\TEST\\T_FSRV.CPP");
   370 	fn[0] = gExeFileName[0];
   371 	r=file3.Open(fs2,fn,EFileRead|EFileShareReadersOnly);
   372 	test(r==KErrNone);
   373 	
   374 	RDir dir5,dir6,dir7,dir8;
   375 	fn = _L("Z:\\TEST\\*.XDE");
   376 	fn[0] = gExeFileName[0];
   377 	r=dir5.Open(fs4,fn,KEntryAttMaskSupported);
   378 	test(r==KErrNone);
   379 	r=dir6.Open(fs4,fn,KEntryAttMaskSupported);
   380 	test(r==KErrNone);
   381 	r=dir7.Open(fs4,fn,KEntryAttMaskSupported);
   382 	test(r==KErrNone);
   383 	r=dir8.Open(fs4,fn,KEntryAttMaskSupported);
   384 	test(r==KErrNone);
   385 
   386 	CFileList* list;
   387 	TOpenFileScan fileScan(TheFs);
   388 	fileScan.NextL(list);
   389 
   390 	if (gRunByBatch)
   391 		{
   392 		test(list!=NULL);
   393 		test(list->Count()==1);
   394 		TEntry entry=(*list)[0];
   395 		test(entry.iName.FindF(_L(".BAT"))>=0);
   396 		delete list;
   397 		fileScan.NextL(list);
   398 		}
   399 
   400 	test(list!=NULL);
   401 	TInt count=list->Count();
   402 	test(count==3);
   403 	TEntry entry=(*list)[0];
   404 	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
   405 	entry=(*list)[1];
   406 	test(entry.iName.FindF(_L("T_FILE.CPP"))>=0);
   407 	entry=(*list)[2];
   408 	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
   409 	TThreadId threadId=fileScan.ThreadId();
   410 	RThread current;
   411 	TThreadId currentId=current.Id();
   412 	test(threadId==currentId);
   413 	delete list;
   414 
   415 	fileScan.NextL(list);
   416 	test(list==NULL);
   417 
   418 	file1.Close();
   419 	file2.Close();
   420 	file3.Close();
   421 	dir1.Close();	dir2.Close();
   422 	dir3.Close();	dir4.Close();
   423 	dir5.Close();	dir6.Close();
   424 	dir7.Close();	dir8.Close();
   425 	fs1.Close();	fs2.Close();
   426 	fs3.Close();	fs4.Close();
   427 	}
   428 
   429 LOCAL_C void Test5()
   430 //
   431 // Test OpenFileScan
   432 //
   433 	{
   434 
   435 	test.Next(_L("Scan for open files - mixed RDirs and RFiles"));
   436 
   437 	RFile file1,file2,file3;
   438 	TFileName fn;
   439 	fn = _L("Z:\\TEST\\T_FSRV.CPP");
   440 	fn[0] = gExeFileName[0];
   441 	TInt r=file1.Open(TheFs,fn,EFileRead|EFileShareReadersOnly);
   442 	test(r==KErrNone);
   443 	fn = _L("Z:\\TEST\\T_FILE.CPP");
   444 	fn[0] = gExeFileName[0];
   445 	r=file2.Open(TheFs,fn,EFileRead);
   446 	test(r==KErrNone);
   447 	fn = _L("Z:\\TEST\\T_FSRV.CPP");
   448 	fn[0] = gExeFileName[0];
   449 	r=file3.Open(TheFs,fn,EFileRead|EFileShareReadersOnly);
   450 	test(r==KErrNone);
   451 	
   452 	RDir dir1,dir2,dir3,dir4;
   453 	fn = _L("Z:\\TEST\\*.XDE");
   454 	fn[0] = gExeFileName[0];
   455 	r=dir1.Open(TheFs,fn,KEntryAttMaskSupported);
   456 	test(r==KErrNone);
   457 	r=dir2.Open(TheFs,fn,KEntryAttMaskSupported);
   458 	test(r==KErrNone);
   459 	r=dir3.Open(TheFs,fn,KEntryAttMaskSupported);
   460 	test(r==KErrNone);
   461 	r=dir4.Open(TheFs,fn,KEntryAttMaskSupported);
   462 	test(r==KErrNone);
   463 
   464 	CFileList* list;
   465 	TOpenFileScan fileScan(TheFs);
   466 	fileScan.NextL(list);
   467 
   468 	if (gRunByBatch)
   469 		{
   470 		test(list!=NULL);
   471 		test(list->Count()==1);
   472 		TEntry entry=(*list)[0];
   473 		test(entry.iName.FindF(_L(".BAT"))>=0);
   474 		delete list;
   475 		fileScan.NextL(list);
   476 		}
   477 
   478 	test(list!=NULL);
   479 	TInt count=list->Count();
   480 	test(count==3);
   481 	TEntry entry=(*list)[0];
   482 	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
   483 	entry=(*list)[1];
   484 	test(entry.iName.FindF(_L("T_FILE.CPP"))>=0);
   485 	entry=(*list)[2];
   486 	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
   487 	TThreadId threadId=fileScan.ThreadId();
   488 	RThread current;
   489 	TThreadId currentId=current.Id();
   490 	test(threadId==currentId);
   491 	delete list;
   492 
   493 	fileScan.NextL(list);
   494 	test(list==NULL);
   495 
   496 	file1.Close();
   497 	file2.Close();
   498 	file3.Close();
   499 	dir1.Close();
   500 	dir2.Close();
   501 	dir3.Close();
   502 	dir4.Close();
   503 	}
   504 
   505 
   506 
   507 LOCAL_C void MultipleSessions(TInt aDrive, RTest& aTest)
   508 //
   509 //	Create an array of fileserver sessions
   510 //	Create an array of TMultipleSessionTest objects 
   511 //
   512 	
   513 	{
   514 #if defined(UNICODE)
   515 	const TInt maxNumberSessions=10;	
   516 #else
   517 	const TInt maxNumberSessions=20;
   518 #endif
   519 
   520 	RFs session[maxNumberSessions];
   521 	TMultipleSessionTest testObject[maxNumberSessions];
   522 	TInt i=0;
   523 	TInt r;
   524 
   525 	for (; i<maxNumberSessions; i++)
   526 		{
   527 		r=session[i].Connect();
   528 		test(r==KErrNone);
   529 		testObject[i].Initialise(session[i]);
   530 		testObject[i].SetSessionPath(aDrive);
   531 		testObject[i].RunTests(aTest);		//	Run the set of tests for each session
   532 		}									//	Leave each session open
   533 											
   534 
   535 	for (i=0; i<(maxNumberSessions-1); i++)
   536 		{
   537 	//	Alternate tests between open sessions
   538 		testObject[i].testSetVolume(aTest);
   539 		testObject[i+1].testInitialisation(aTest);
   540 		testObject[i].testSubst(aTest);
   541 		testObject[i+1].testInitialisation(aTest);
   542 		testObject[i].testInitialisation(aTest);
   543 		testObject[i].testDriveList(aTest);
   544 		testObject[i].MakeAndDeleteFiles(aTest);
   545 	//	Close session[i] and check that session[i+1] is OK	
   546 		session[i].Close();	
   547 		testObject[i+1].testInitialisation(aTest);
   548 		testObject[i+1].testSetVolume(aTest);
   549 		testObject[i+1].testInitialisation(aTest);
   550 		testObject[i+1].testSubst(aTest);
   551 		testObject[i+1].testDriveList(aTest);
   552 	//	Reconnect session[i]	
   553 		r=session[i].Connect();
   554 		test(r==KErrNone);
   555 		testObject[i].Initialise(session[i]);
   556 		testObject[i].SetSessionPath(aDrive);
   557 		testObject[i].testSetVolume(aTest);
   558 		testObject[i+1].testInitialisation(aTest);
   559 		testObject[i].testSubst(aTest);
   560 		testObject[i+1].testInitialisation(aTest);
   561 		testObject[i].testInitialisation(aTest);
   562 		testObject[i].testDriveList(aTest);
   563 	//	Close session[i+1] and check that session[i] is OK
   564 		session[i+1].Close();	
   565 		testObject[i].testInitialisation(aTest);
   566 		testObject[i].testSetVolume(aTest);
   567 		testObject[i].testInitialisation(aTest);
   568 		testObject[i].testSubst(aTest);
   569 		testObject[i].testDriveList(aTest);
   570 	//	Reconnect session[i+1]	
   571 		r=session[i+1].Connect();
   572 		test(r==KErrNone);
   573 		testObject[i+1].Initialise(session[i+1]);
   574 		testObject[i+1].SetSessionPath(aDrive);
   575 		testObject[i].testSetVolume(aTest);
   576 		testObject[i+1].testInitialisation(aTest);
   577 		testObject[i].testSubst(aTest);
   578 		testObject[i+1].testInitialisation(aTest);
   579 	//	Close session[i] and check that session[i+1] is OK	
   580 		session[i].Close();	
   581 		testObject[i+1].testInitialisation(aTest);
   582 		testObject[i+1].testSetVolume(aTest);
   583 		testObject[i+1].testInitialisation(aTest);
   584 		testObject[i+1].testSubst(aTest);
   585 		testObject[i+1].testDriveList(aTest);
   586 		
   587 		if (i==maxNumberSessions-1)	//	Tidy up by closing remaining open session
   588 			{
   589 			session[i+1].Close();	
   590 			}
   591 		}
   592 	}
   593 
   594 GLDEF_C void CallTestsDefaultL(TInt aDrive)
   595 //
   596 // Call tests that may leave
   597 //
   598 	{
   599 	Test0(test);
   600 	Test1();		
   601 	Test2();
   602 	Test3();
   603 	Test4();
   604 	Test5();
   605 	MultipleSessions(aDrive,test);
   606 	}
   607 
   608 GLDEF_C void CallTestsXL(TInt aDrive)
   609 //
   610 // Call tests for drive X
   611 //
   612 	{
   613 	Test0(testx);
   614 
   615 	RFile file1;
   616 	TFileName fn;
   617 	fn = _L("Z:\\TEST\\T_FSRV.CPP");
   618 	fn[0] = gExeFileName[0];
   619 	TInt r=file1.Open(TheFs,fn,EFileRead|EFileShareReadersOnly);
   620 	testx(r==KErrNone);
   621 	file1.Close();
   622 	MultipleSessions(aDrive,testx);
   623 	}
   624 
   625 GLDEF_C void CallTestsYL(TInt aDrive)
   626 //
   627 // Call tests for drive Y
   628 //
   629 	{
   630 	Test0(testy);
   631 
   632 	RFile file1;
   633 	TFileName fn;
   634 	fn = _L("Z:\\TEST\\T_FSRV.CPP");
   635 	fn[0] = gExeFileName[0];
   636 	TInt r=file1.Open(TheFs,fn,EFileRead|EFileShareReadersOnly);
   637 	testy(r==KErrNone);
   638 	file1.Close();
   639 	MultipleSessions(aDrive,testy);
   640 	}
   641 
   642 GLDEF_C void CallTestsQL(TInt aDrive)
   643 //
   644 // Call tests for remote drive
   645 //
   646 	{
   647 
   648 	Test0(testq);
   649 	
   650 	testq.Printf(_L("This may take some time.  Please be patient...\n"));
   651 	
   652 	testq.Next(_L("Test remote drive with multiple sessions"));
   653 	MultipleSessions(aDrive,testq);
   654 
   655 	const TInt numberOfTests=10;
   656 	
   657 	TPtrC record[numberOfTests];
   658 	
   659 	TInt i=0;
   660 	for (;i<numberOfTests;i++)
   661 		{
   662 		if (i%2)
   663 			record[i].Set(_L("Hubble_Bubble"));
   664 		else
   665 			record[i].Set(_L("Toil_and_Trouble"));
   666 		}
   667 	
   668 	testq.Next(_L("Create a file 'TEXTFILE.TXT' on the remote drive"));
   669 	RFile f;
   670 	TInt r=f.Replace(TheFs,_L("TEXTFILE.TXT"),0);
   671 	testq(r==KErrNone);
   672 	TFileText textFile;
   673 	textFile.Set(f);
   674 	
   675 	testq.Next(_L("Write to 'TEXTFILE.TXT'"));
   676 	
   677 	for (i=0;i<numberOfTests;i++)
   678 		{
   679 		r=textFile.Write(record[i]);
   680 		testq(r==KErrNone);
   681 		testq.Printf(_L("Write %d completed OK\n"),i+1);
   682 		}
   683 	
   684 	f.Close();
   685 
   686 	RFile file1;
   687 	r=file1.Open(TheFs,_L("Q:\\TEST\\T_FSRV.CPP"),EFileRead|EFileShareReadersOnly);
   688 	testq(r==KErrNone);
   689 	file1.Close();	
   690 
   691 	}