os/kernelhwsrv/kerneltest/f32test/bench/t_fsrdel.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// f32test\bench\t_fsrdel.cpp
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
sl@0
    19
#include <f32file.h>
sl@0
    20
#include <e32test.h>
sl@0
    21
#include "t_benchmain.h"
sl@0
    22
sl@0
    23
GLDEF_D RTest test(_L("File Server Benchmarks, deletion of a massive amount of files"));
sl@0
    24
sl@0
    25
//----------------------------------------------------------------------------------------------
sl@0
    26
//! @SYMTestCaseID      PBASE-T_FSRDEL-0272
sl@0
    27
//! @SYMTestType        CIT
sl@0
    28
//! @SYMPREQ            PREQ000
sl@0
    29
//! @SYMTestCaseDesc    This test case is measuring performance of the FAT implementation.  
sl@0
    30
//! @SYMTestActions     0.  Expects the files to exist in order to successful execution
sl@0
    31
//!						1.	Time the deletion of a file from each directory with RFs::Delete
sl@0
    32
//!						2.	Time the deletion of a file from each directory with CFileMan::Delete
sl@0
    33
//!						3.	Time the deletion of all the files from each directory 
sl@0
    34
//!							with RFs::Delete
sl@0
    35
//!						4.	Time the deletion of all the files from each directory with 
sl@0
    36
//!							CFileMan::Delete (wildcard F*.*)
sl@0
    37
//!						5.	Time the deletion of a file from each directory with RFs::Delete 
sl@0
    38
//!							with two clients accessing the directory
sl@0
    39
//!						6.	Time the deletion of a file from each directory with CFileMan::Delete 
sl@0
    40
//!							with two clients accessing the directory
sl@0
    41
//!						7.	Time the deletion of all the files from each directory with RFs::Delete 
sl@0
    42
//!							with two clients accessing the directory
sl@0
    43
//!						8.	Time the deletion of all the files from each directory with 
sl@0
    44
//!							CFileMan::Delete with two clients accessing the directory (wildcard F*.*)
sl@0
    45
//!						9.	Time the deletion of a file from each directory with RFs::Delete 
sl@0
    46
//!							with two clients accessing different directories 
sl@0
    47
//!						10.	Time the deletion of a file from each directory with CFileMan::Delete 
sl@0
    48
//!							with two clients accessing different directories 
sl@0
    49
//!						11.	Time the deletion of all the files from each directory with RFs::Delete 
sl@0
    50
//!							with two clients accessing different directories
sl@0
    51
//!						12.	Time the deletion of all the files from each directory with 
sl@0
    52
//!							CFileMan::Delete with two clients accessing different directories (wildcard F*.*)
sl@0
    53
//! @SYMTestExpectedResults Finishes if the system behaves as expected, panics otherwise
sl@0
    54
//! @SYMTestPriority        High
sl@0
    55
//! @SYMTestStatus          Implemented
sl@0
    56
//----------------------------------------------------------------------------------------------
sl@0
    57
sl@0
    58
LOCAL_D RSemaphore client,write_screen;
sl@0
    59
LOCAL_D const TInt KHeapSize=0x4000;
sl@0
    60
LOCAL_D TBuf8<4096> buf;
sl@0
    61
LOCAL_D TDriveList gDriveList;
sl@0
    62
sl@0
    63
// Concurrent thread varibles
sl@0
    64
RThread gSpeedy;
sl@0
    65
RThread gSpeedyII;
sl@0
    66
TInt gT1;
sl@0
    67
TInt gT2;
sl@0
    68
LOCAL_D TFileName gDelEntryDir;
sl@0
    69
LOCAL_D TFileName gDelEntryDir2;
sl@0
    70
LOCAL_D TInt ThreadCount=0;
sl@0
    71
TBool gWriting = EFalse;
sl@0
    72
sl@0
    73
TBool gKillMe=EFalse; 
sl@0
    74
sl@0
    75
_LIT(KDeleteMe,"delete%d.me");
sl@0
    76
_LIT(KDeleteMe2,"blabla%d.rhd");
sl@0
    77
sl@0
    78
sl@0
    79
/** Send content through the RDebug for trgtest 
sl@0
    80
	not to hung, when the test is not writing
sl@0
    81
sl@0
    82
*/
sl@0
    83
LOCAL_C TInt noise(TAny* )
sl@0
    84
{
sl@0
    85
	FOREVER
sl@0
    86
	{	
sl@0
    87
		User::After(2147483647); // max value, 35 minutes, 47 seconds
sl@0
    88
		if(!gWriting)
sl@0
    89
			RDebug::Print(_L("."));
sl@0
    90
	}
sl@0
    91
}
sl@0
    92
sl@0
    93
/** Create background noise by deleting/creating file in gDelEntryDir2 directory
sl@0
    94
sl@0
    95
*/
sl@0
    96
LOCAL_C TInt DeleteEntryAccess2(TAny* )
sl@0
    97
	{
sl@0
    98
	RFs fs;
sl@0
    99
	TInt r = 0;
sl@0
   100
	TBuf<100> dirfile;
sl@0
   101
	TBuf<50> filename;
sl@0
   102
	RFile file;
sl@0
   103
	RTest test(_L("test 2")); 
sl@0
   104
sl@0
   105
	// Not checking error state until main thread has been signalled, to avoid deadlock
sl@0
   106
	fs.Connect();
sl@0
   107
	r = fs.SetSessionPath(gSessionPath);
sl@0
   108
	
sl@0
   109
	filename.Format(KDeleteMe2,gT2);
sl@0
   110
	
sl@0
   111
	dirfile = gDelEntryDir2;
sl@0
   112
	dirfile.Append(filename);
sl@0
   113
	
sl@0
   114
	client.Signal();
sl@0
   115
	FailIfError(r);
sl@0
   116
	
sl@0
   117
	FOREVER
sl@0
   118
		{
sl@0
   119
			if(!gKillMe)
sl@0
   120
				{
sl@0
   121
				r = file.Create(fs, dirfile, EFileShareAny|EFileWrite);
sl@0
   122
				if(r == KErrAlreadyExists) 
sl@0
   123
					r = file.Open(fs, dirfile, EFileShareAny|EFileWrite);
sl@0
   124
				file.Close();
sl@0
   125
				FailIfError(r);
sl@0
   126
				
sl@0
   127
				r = fs.Delete(dirfile);
sl@0
   128
				if((r != KErrNone) && (r != KErrInUse)) 
sl@0
   129
					FailIfError(r);
sl@0
   130
				}
sl@0
   131
		}
sl@0
   132
	}
sl@0
   133
sl@0
   134
/** Create background noise by deleting/creating file in gDelEntryDir directory
sl@0
   135
sl@0
   136
*/
sl@0
   137
LOCAL_C TInt DeleteEntryAccess(TAny*)
sl@0
   138
	{
sl@0
   139
	RFs fs2;
sl@0
   140
	TInt r = 0;
sl@0
   141
	TBuf<100> dirfile;
sl@0
   142
	TBuf<50> filename;
sl@0
   143
	RFile file2;
sl@0
   144
	RTest test(_L("test 2")); 
sl@0
   145
sl@0
   146
	// Not checking error state until main thread has been signalled, to avoid deadlock
sl@0
   147
	fs2.Connect();
sl@0
   148
	r = fs2.SetSessionPath(gSessionPath);
sl@0
   149
	
sl@0
   150
	filename.Format(KDeleteMe,gT1);
sl@0
   151
	
sl@0
   152
	dirfile = gDelEntryDir;
sl@0
   153
	dirfile.Append(filename);
sl@0
   154
	
sl@0
   155
	client.Signal();
sl@0
   156
	FailIfError(r);
sl@0
   157
	
sl@0
   158
	FOREVER
sl@0
   159
		{
sl@0
   160
			if(!gKillMe)
sl@0
   161
				{
sl@0
   162
				r = file2.Create(fs2, dirfile, EFileShareAny|EFileWrite);
sl@0
   163
				if(r == KErrAlreadyExists) 
sl@0
   164
					r = file2.Open(fs2, dirfile, EFileShareAny|EFileWrite);
sl@0
   165
				file2.Close();
sl@0
   166
				FailIfError(r);
sl@0
   167
				r = fs2.Delete(dirfile);
sl@0
   168
				if((r != KErrNone) && (r != KErrInUse)) 
sl@0
   169
					FailIfError(r);
sl@0
   170
				}
sl@0
   171
		}
sl@0
   172
	}
sl@0
   173
sl@0
   174
/**  Starts a concurrent client session in different directories
sl@0
   175
sl@0
   176
*/
sl@0
   177
LOCAL_C void DoTest(TThreadFunction aFunction)
sl@0
   178
	{
sl@0
   179
	gKillMe = EFalse;
sl@0
   180
sl@0
   181
	TBuf<20> buffer = _L("Speedy");
sl@0
   182
	buffer.AppendNum(ThreadCount++);
sl@0
   183
	gT1 = ThreadCount;
sl@0
   184
	TInt r = gSpeedy.Create(buffer, aFunction, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   185
	FailIfError(r);
sl@0
   186
sl@0
   187
	buffer = _L("Speedy");
sl@0
   188
	buffer.AppendNum(ThreadCount++);
sl@0
   189
	gT2=ThreadCount;
sl@0
   190
	r = gSpeedyII.Create(buffer, DeleteEntryAccess2, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
   191
	FailIfError(r);
sl@0
   192
sl@0
   193
 	gSpeedy.SetPriority(EPriorityLess);
sl@0
   194
    gSpeedyII.SetPriority(EPriorityLess);
sl@0
   195
	
sl@0
   196
	gSpeedy.Resume();
sl@0
   197
	gSpeedyII.Resume();
sl@0
   198
	
sl@0
   199
	client.Wait();
sl@0
   200
	client.Wait();
sl@0
   201
	}
sl@0
   202
		
sl@0
   203
/**   Kills the concurrent sessions
sl@0
   204
sl@0
   205
*/
sl@0
   206
LOCAL_C void DoTestKill()
sl@0
   207
	{
sl@0
   208
	gKillMe = ETrue;
sl@0
   209
	User::After(10000000);
sl@0
   210
	
sl@0
   211
	gSpeedy.Kill(KErrNone);
sl@0
   212
	gSpeedy.Close();	
sl@0
   213
	
sl@0
   214
	gSpeedyII.Kill(KErrNone);
sl@0
   215
	gSpeedyII.Close();	
sl@0
   216
	}
sl@0
   217
sl@0
   218
/**  Creates again the last.txt file in each directory that is being used
sl@0
   219
sl@0
   220
*/
sl@0
   221
LOCAL_C void ReCreateLast() 
sl@0
   222
	{
sl@0
   223
	TInt i = 1, r = 0;
sl@0
   224
	RFile file;
sl@0
   225
	TBuf16<50> dirtemp;
sl@0
   226
	
sl@0
   227
	TBuf16<50> path;
sl@0
   228
	TBuf8<1024> dummy(1024);
sl@0
   229
	
sl@0
   230
	
sl@0
   231
	while(i <= gTypes) 
sl@0
   232
		{
sl@0
   233
		path = gSessionPath;
sl@0
   234
		dirtemp.Format(KDirMultipleName, i, 100);
sl@0
   235
		path.Append(dirtemp);
sl@0
   236
		path.Append(KCommonFile);
sl@0
   237
		r = file.Create(TheFs, path, EFileShareAny|EFileWrite);
sl@0
   238
		if(r == KErrAlreadyExists) 
sl@0
   239
			{
sl@0
   240
			r = file.Open(TheFs, path, EFileShareAny|EFileWrite);
sl@0
   241
			FailIfError(r);
sl@0
   242
			}
sl@0
   243
		r = file.Write(dummy);
sl@0
   244
		FailIfError(r);
sl@0
   245
		file.Close();
sl@0
   246
		i++;
sl@0
   247
		}
sl@0
   248
sl@0
   249
	if(gFilesLimit >= 1000) 
sl@0
   250
		{
sl@0
   251
		i = 1;
sl@0
   252
		while(i <= gTypes) 
sl@0
   253
			{
sl@0
   254
			path = gSessionPath;
sl@0
   255
			dirtemp.Format(KDirMultipleName, i, 1000);
sl@0
   256
			path.Append(dirtemp);
sl@0
   257
			path.Append(KCommonFile);
sl@0
   258
			r = file.Create(TheFs, path, EFileShareAny|EFileWrite);
sl@0
   259
			if(r == KErrAlreadyExists) 
sl@0
   260
				{
sl@0
   261
				r = file.Open(TheFs, path, EFileShareAny|EFileWrite);
sl@0
   262
				FailIfError(r);
sl@0
   263
				}
sl@0
   264
			r = file.Write(dummy);
sl@0
   265
			FailIfError(r);
sl@0
   266
			file.Close();
sl@0
   267
			i++;
sl@0
   268
			}
sl@0
   269
		}
sl@0
   270
	
sl@0
   271
	if(gFilesLimit >= 5000) 
sl@0
   272
		{
sl@0
   273
		i = 1;
sl@0
   274
		while(i <= gTypes) 
sl@0
   275
			{
sl@0
   276
			path = gSessionPath;
sl@0
   277
			dirtemp.Format(KDirMultipleName, i, 5000);
sl@0
   278
			path.Append(dirtemp);
sl@0
   279
			path.Append(KCommonFile);
sl@0
   280
			r = file.Create(TheFs, path, EFileShareAny|EFileWrite);
sl@0
   281
			if(r == KErrAlreadyExists) 
sl@0
   282
				{
sl@0
   283
				r = file.Open(TheFs, path, EFileShareAny|EFileWrite);
sl@0
   284
				FailIfError(r);
sl@0
   285
				}
sl@0
   286
			r = file.Write(dummy);
sl@0
   287
			FailIfError(r);
sl@0
   288
			file.Close();
sl@0
   289
			i++;
sl@0
   290
			}
sl@0
   291
		}
sl@0
   292
	if(gFilesLimit >= 10000) 
sl@0
   293
		{
sl@0
   294
		i = 1;
sl@0
   295
		while(i <= gTypes) 
sl@0
   296
			{
sl@0
   297
			path = gSessionPath;
sl@0
   298
			dirtemp.Format(KDirMultipleName, i, 10000);
sl@0
   299
			path.Append(dirtemp);
sl@0
   300
			path.Append(KCommonFile);
sl@0
   301
			r = file.Create(TheFs, path, EFileShareAny|EFileWrite);
sl@0
   302
			if(r ==KErrAlreadyExists) 
sl@0
   303
				{
sl@0
   304
				r = file.Open(TheFs, path, EFileShareAny|EFileWrite);
sl@0
   305
				FailIfError(r);
sl@0
   306
				}
sl@0
   307
			r = file.Write(dummy);
sl@0
   308
			FailIfError(r);
sl@0
   309
			file.Close();
sl@0
   310
			i++;
sl@0
   311
			}
sl@0
   312
		}
sl@0
   313
	}
sl@0
   314
sl@0
   315
/**  Deletes all files in a given directory one by one
sl@0
   316
sl@0
   317
	@param aN 		Number of files in the directory
sl@0
   318
	@param aStep 	Test step
sl@0
   319
*/
sl@0
   320
LOCAL_C TInt DelAllFiles1(TInt aN, TInt aStep)
sl@0
   321
	{
sl@0
   322
	TInt i = 0, r = 0;
sl@0
   323
	TBuf16<50> directory;
sl@0
   324
	TBuf16<50> dirtemp;
sl@0
   325
	
sl@0
   326
	TBuf16<50> path;
sl@0
   327
	TBuf16<50> buffer(50); 	
sl@0
   328
sl@0
   329
	_LIT(KMsg, "This file caused a problem: %S\n");
sl@0
   330
sl@0
   331
	TTime startTime;
sl@0
   332
	TTime endTime;
sl@0
   333
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
   334
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
sl@0
   335
	
sl@0
   336
	if(aN <= gFilesLimit) 
sl@0
   337
		{
sl@0
   338
		if(gTypes >= 1) 
sl@0
   339
			{
sl@0
   340
			// all 8.3 
sl@0
   341
			directory = gSessionPath;
sl@0
   342
			dirtemp.Format(KDirMultipleName, 1, aN);
sl@0
   343
			directory.Append(dirtemp);
sl@0
   344
		
sl@0
   345
			i = 0;
sl@0
   346
			startTime.HomeTime();
sl@0
   347
			while(i < aN) 
sl@0
   348
				{
sl@0
   349
				FileNamesGeneration(buffer, 8, i, i%3+1) ;
sl@0
   350
				path = directory;
sl@0
   351
				path.Append(buffer);
sl@0
   352
				r = TheFs.Delete(path);
sl@0
   353
				if(r != KErrNone) 
sl@0
   354
					{
sl@0
   355
					TBuf16<250> msg;
sl@0
   356
					msg.Format(KMsg, &path);
sl@0
   357
					test.Printf(msg);
sl@0
   358
					FailIfError(r);
sl@0
   359
					}
sl@0
   360
				i++;
sl@0
   361
				}
sl@0
   362
			endTime.HomeTime();
sl@0
   363
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   364
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   365
			}	
sl@0
   366
		
sl@0
   367
		if(gTypes >= 2) 
sl@0
   368
			{
sl@0
   369
			// all 20.3 chars
sl@0
   370
			dirtemp.Format(KDirMultipleName, 2, aN);
sl@0
   371
			directory = gSessionPath;
sl@0
   372
			directory.Append(dirtemp);
sl@0
   373
			
sl@0
   374
			i = 0;
sl@0
   375
			startTime.HomeTime();
sl@0
   376
			while(i < aN) 
sl@0
   377
				{ 
sl@0
   378
				FileNamesGeneration(buffer, 20, i, i%3+1) ;
sl@0
   379
				path = directory;
sl@0
   380
				path.Append(buffer);
sl@0
   381
				r = TheFs.Delete(path);
sl@0
   382
				if(r != KErrNone) 
sl@0
   383
					{
sl@0
   384
					TBuf16<250> msg;
sl@0
   385
					msg.Format(KMsg, &path);
sl@0
   386
					test.Printf(msg);
sl@0
   387
					FailIfError(r);
sl@0
   388
					}
sl@0
   389
				i++;
sl@0
   390
				}	
sl@0
   391
			endTime.HomeTime();
sl@0
   392
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   393
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   394
			}
sl@0
   395
		
sl@0
   396
		if(gTypes >= 3) 
sl@0
   397
			{
sl@0
   398
			// 50/50 
sl@0
   399
			dirtemp.Format(KDirMultipleName, 3, aN);
sl@0
   400
			directory = gSessionPath;
sl@0
   401
			directory.Append(dirtemp);
sl@0
   402
			i = 0;
sl@0
   403
			startTime.HomeTime();
sl@0
   404
			while(i < aN) 
sl@0
   405
				{
sl@0
   406
				if(1 == (i % 2)) 	FileNamesGeneration(buffer, 8, i, i%3+1) ;
sl@0
   407
				else  				FileNamesGeneration(buffer, 20, i, i%3+1) ;
sl@0
   408
					
sl@0
   409
				path = directory;
sl@0
   410
				path.Append(buffer);
sl@0
   411
				r = TheFs.Delete(path);
sl@0
   412
				if(r != KErrNone) 
sl@0
   413
					{
sl@0
   414
					TBuf16<250> msg;
sl@0
   415
					msg.Format(KMsg, &path);
sl@0
   416
					test.Printf(msg);
sl@0
   417
					FailIfError(r);
sl@0
   418
					}
sl@0
   419
				i++;
sl@0
   420
				}
sl@0
   421
			endTime.HomeTime();
sl@0
   422
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   423
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
sl@0
   424
			}	
sl@0
   425
		}
sl@0
   426
sl@0
   427
	gWriting = ETrue; User::After(1000000);
sl@0
   428
	PrintResult(aStep, 1, aN);
sl@0
   429
	PrintResultTime(aStep, 2, timeTaken1);
sl@0
   430
	PrintResultTime(aStep, 3, timeTaken2);
sl@0
   431
	PrintResultTime(aStep, 4, timeTaken3);
sl@0
   432
	gWriting = EFalse;
sl@0
   433
				
sl@0
   434
	return(KErrNone);
sl@0
   435
	}
sl@0
   436
sl@0
   437
/**  Deletes all files in a given directory using wildcards
sl@0
   438
sl@0
   439
	@param aN 		Number of files in the directory
sl@0
   440
	@param aStep 	Test step
sl@0
   441
*/
sl@0
   442
LOCAL_C TInt DelAllFiles2(TInt aN, TInt aStep)
sl@0
   443
	{
sl@0
   444
	TInt r = 0;
sl@0
   445
	
sl@0
   446
	TBuf16<50> directory;
sl@0
   447
	TBuf16<50> dirtemp;
sl@0
   448
	
sl@0
   449
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;  
sl@0
   450
	TTime startTime;
sl@0
   451
	TTime endTime;
sl@0
   452
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
   453
	CFileMan* fMan=CFileMan::NewL(TheFs);
sl@0
   454
	
sl@0
   455
sl@0
   456
	if(aN <= gFilesLimit) 
sl@0
   457
		{
sl@0
   458
		if(gTypes >= 1) 
sl@0
   459
			{
sl@0
   460
			// all 8.3 
sl@0
   461
			dirtemp.Format(KDirMultipleName, 1, aN);
sl@0
   462
			directory = gSessionPath;
sl@0
   463
			directory.Append(dirtemp);
sl@0
   464
sl@0
   465
			startTime.HomeTime();
sl@0
   466
			directory.Append(_L("F*.*"));
sl@0
   467
			
sl@0
   468
			r = fMan->Delete(directory);
sl@0
   469
			FailIfError(r);
sl@0
   470
sl@0
   471
			endTime.HomeTime();
sl@0
   472
			timeTaken = endTime.MicroSecondsFrom(startTime); 
sl@0
   473
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   474
			}
sl@0
   475
		if(gTypes >= 2) 
sl@0
   476
			{		
sl@0
   477
			// all 20.3 chars
sl@0
   478
			dirtemp.Format(KDirMultipleName, 2, aN);
sl@0
   479
			directory = gSessionPath;
sl@0
   480
			directory.Append(dirtemp);
sl@0
   481
sl@0
   482
			startTime.HomeTime();
sl@0
   483
			directory.Append(_L("F*.*"));
sl@0
   484
			r = fMan->Delete(directory);
sl@0
   485
			FailIfError(r);
sl@0
   486
			
sl@0
   487
			endTime.HomeTime();
sl@0
   488
sl@0
   489
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   490
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   491
			}
sl@0
   492
		
sl@0
   493
		if(gTypes >= 3) 
sl@0
   494
			{
sl@0
   495
			// 50/50 
sl@0
   496
			dirtemp.Format(KDirMultipleName,3, aN);
sl@0
   497
			directory = gSessionPath;
sl@0
   498
			directory.Append(dirtemp);
sl@0
   499
sl@0
   500
			startTime.HomeTime();
sl@0
   501
			directory.Append(_L("F*.*"));
sl@0
   502
			r = fMan->Delete(directory);
sl@0
   503
			FailIfError(r);
sl@0
   504
			
sl@0
   505
			endTime.HomeTime();
sl@0
   506
			
sl@0
   507
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   508
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   509
			}
sl@0
   510
		}
sl@0
   511
	delete fMan;
sl@0
   512
	
sl@0
   513
	gWriting = ETrue; User::After(1000000);
sl@0
   514
	PrintResult(aStep, 1, aN);
sl@0
   515
	PrintResultTime(aStep, 2, timeTaken1);
sl@0
   516
	PrintResultTime(aStep, 3, timeTaken2);
sl@0
   517
	PrintResultTime(aStep, 4, timeTaken3);
sl@0
   518
	gWriting = EFalse;
sl@0
   519
sl@0
   520
	return(KErrNone);
sl@0
   521
	}
sl@0
   522
sl@0
   523
/** Delete last.txt with two threads accessing the current directory and 
sl@0
   524
	creating/deleting a file with RFs::Delete
sl@0
   525
sl@0
   526
	@param aN Number of files in the directory
sl@0
   527
	@param aStep 	Test step
sl@0
   528
*/
sl@0
   529
LOCAL_C void DelFileM1(TInt aN, TInt aStep) 
sl@0
   530
	{
sl@0
   531
	TBuf16<100> dir1;
sl@0
   532
	TBuf16<100> dir2;
sl@0
   533
	TBuf16<100> dir3;
sl@0
   534
    TBuf16<100> dir4;
sl@0
   535
	
sl@0
   536
	TInt r = 0;
sl@0
   537
	TTime startTime;
sl@0
   538
	TTime endTime;
sl@0
   539
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
   540
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1; 
sl@0
   541
sl@0
   542
	dir1 = gSessionPath;
sl@0
   543
	dir2 = gSessionPath;
sl@0
   544
	dir3 = gSessionPath;
sl@0
   545
	
sl@0
   546
	dir4.Format(KDirMultipleName, 1, aN);
sl@0
   547
	dir1.Append(dir4);
sl@0
   548
	dir4.Format(KDirMultipleName, 2, aN);
sl@0
   549
	dir2.Append(dir4);	
sl@0
   550
	dir4.Format(KDirMultipleName, 3, aN);
sl@0
   551
	dir3.Append(dir4);
sl@0
   552
	
sl@0
   553
	if(aN <= gFilesLimit) 
sl@0
   554
		{
sl@0
   555
		if(gTypes >= 1) 
sl@0
   556
			{	
sl@0
   557
			gDelEntryDir = dir1;
sl@0
   558
			gDelEntryDir2 = dir1;
sl@0
   559
			dir1.Append(KCommonFile);
sl@0
   560
			
sl@0
   561
			DoTest(DeleteEntryAccess);
sl@0
   562
			
sl@0
   563
			startTime.HomeTime();
sl@0
   564
sl@0
   565
			r = TheFs.Delete(dir1);
sl@0
   566
			FailIfError(r);
sl@0
   567
			
sl@0
   568
			endTime.HomeTime();
sl@0
   569
			
sl@0
   570
			DoTestKill();
sl@0
   571
			
sl@0
   572
			timeTaken=endTime.MicroSecondsFrom(startTime);
sl@0
   573
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   574
			}
sl@0
   575
sl@0
   576
		if(gTypes >= 2) 
sl@0
   577
			{
sl@0
   578
			gDelEntryDir = dir2;
sl@0
   579
			gDelEntryDir2 = dir2;
sl@0
   580
			
sl@0
   581
			dir2.Append(KCommonFile);
sl@0
   582
			
sl@0
   583
			DoTest(DeleteEntryAccess);
sl@0
   584
sl@0
   585
			startTime.HomeTime();
sl@0
   586
sl@0
   587
			r = TheFs.Delete(dir2);
sl@0
   588
			FailIfError(r);
sl@0
   589
			
sl@0
   590
			endTime.HomeTime();
sl@0
   591
			timeTaken=endTime.MicroSecondsFrom(startTime);
sl@0
   592
				
sl@0
   593
			DoTestKill();
sl@0
   594
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   595
			}
sl@0
   596
sl@0
   597
		if(gTypes >= 3) 
sl@0
   598
			{
sl@0
   599
			gDelEntryDir = dir3;
sl@0
   600
			gDelEntryDir2 = dir3;
sl@0
   601
			
sl@0
   602
			dir3.Append(KCommonFile);
sl@0
   603
sl@0
   604
			
sl@0
   605
			DoTest(DeleteEntryAccess);
sl@0
   606
sl@0
   607
			startTime.HomeTime();
sl@0
   608
sl@0
   609
			r = TheFs.Delete(dir3);
sl@0
   610
			FailIfError(r);
sl@0
   611
			
sl@0
   612
			endTime.HomeTime();
sl@0
   613
			DoTestKill();
sl@0
   614
			
sl@0
   615
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   616
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   617
			}
sl@0
   618
		}
sl@0
   619
	
sl@0
   620
	gWriting = ETrue; User::After(1000000);
sl@0
   621
	PrintResult(aStep, 1, aN);
sl@0
   622
	PrintResultTime(aStep, 2, timeTaken1);
sl@0
   623
	PrintResultTime(aStep, 3, timeTaken2);
sl@0
   624
	PrintResultTime(aStep, 4, timeTaken3);
sl@0
   625
	gWriting = EFalse;
sl@0
   626
	}
sl@0
   627
sl@0
   628
/** Delete last.txt by opening it and with two threads accessing the current 
sl@0
   629
	directory and creating/deleting a file with CFileMan::Delete
sl@0
   630
sl@0
   631
	@param aN 		Number of files in the directory
sl@0
   632
	@param aStep 	Test step 
sl@0
   633
*/
sl@0
   634
LOCAL_C void DelFileM2(TInt aN, TInt aStep) 
sl@0
   635
 	{
sl@0
   636
	TBuf16<100> dir1;
sl@0
   637
	TBuf16<100> dir2;
sl@0
   638
	TBuf16<100> dir3;
sl@0
   639
    TBuf16<100> dir4;
sl@0
   640
	
sl@0
   641
	TInt r = 0;
sl@0
   642
	TTime startTime;
sl@0
   643
	TTime endTime;
sl@0
   644
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
   645
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1; 
sl@0
   646
sl@0
   647
	CFileMan* fMan = CFileMan::NewL(TheFs);
sl@0
   648
sl@0
   649
	dir1 = gSessionPath;
sl@0
   650
	dir2 = gSessionPath;
sl@0
   651
	dir3 = gSessionPath;
sl@0
   652
	
sl@0
   653
	dir4.Format(KDirMultipleName, 1, aN);
sl@0
   654
	dir1.Append(dir4);
sl@0
   655
	dir4.Format(KDirMultipleName, 2, aN);
sl@0
   656
	dir2.Append(dir4);	
sl@0
   657
	dir4.Format(KDirMultipleName, 3, aN);
sl@0
   658
	dir3.Append(dir4);
sl@0
   659
sl@0
   660
	if(aN <= gFilesLimit) 
sl@0
   661
		{
sl@0
   662
		if(gTypes >= 1) 
sl@0
   663
			{
sl@0
   664
			gDelEntryDir = dir1;
sl@0
   665
			gDelEntryDir2 = dir1;
sl@0
   666
			
sl@0
   667
			dir1.Append(KCommonFile);
sl@0
   668
			
sl@0
   669
			DoTest(DeleteEntryAccess);
sl@0
   670
			
sl@0
   671
			startTime.HomeTime();
sl@0
   672
			
sl@0
   673
			r = fMan->Delete(dir1);
sl@0
   674
			FailIfError(r);
sl@0
   675
			
sl@0
   676
			endTime.HomeTime();
sl@0
   677
			DoTestKill();
sl@0
   678
			
sl@0
   679
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   680
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   681
			}
sl@0
   682
sl@0
   683
		if(gTypes >= 2) 
sl@0
   684
			{
sl@0
   685
			gDelEntryDir = dir2;
sl@0
   686
			gDelEntryDir2 = dir2;
sl@0
   687
			
sl@0
   688
			dir2.Append(KCommonFile);
sl@0
   689
			
sl@0
   690
			DoTest(DeleteEntryAccess);
sl@0
   691
sl@0
   692
			startTime.HomeTime();
sl@0
   693
sl@0
   694
			r = fMan->Delete(dir2);
sl@0
   695
			FailIfError(r);
sl@0
   696
			
sl@0
   697
			endTime.HomeTime();
sl@0
   698
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   699
			DoTestKill();
sl@0
   700
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   701
			}
sl@0
   702
		
sl@0
   703
		if(gTypes >= 3) 
sl@0
   704
			{
sl@0
   705
			gDelEntryDir = dir3;
sl@0
   706
			gDelEntryDir2 = dir3;
sl@0
   707
			dir3.Append(KCommonFile);
sl@0
   708
sl@0
   709
			
sl@0
   710
			DoTest(DeleteEntryAccess);
sl@0
   711
sl@0
   712
			startTime.HomeTime();
sl@0
   713
sl@0
   714
			r = fMan->Delete(dir3);
sl@0
   715
			FailIfError(r);
sl@0
   716
			
sl@0
   717
			endTime.HomeTime();
sl@0
   718
			DoTestKill();
sl@0
   719
			
sl@0
   720
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   721
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   722
			}
sl@0
   723
		}
sl@0
   724
	delete fMan;
sl@0
   725
sl@0
   726
	gWriting = ETrue; User::After(1000000);
sl@0
   727
	PrintResult(aStep, 1, aN);
sl@0
   728
	PrintResultTime(aStep, 2, timeTaken1);
sl@0
   729
	PrintResultTime(aStep, 3, timeTaken2);
sl@0
   730
	PrintResultTime(aStep, 4, timeTaken3);
sl@0
   731
	gWriting = EFalse;
sl@0
   732
sl@0
   733
	}
sl@0
   734
sl@0
   735
/** Delete all files with two threads accessing the current directory and creating/deleting a file
sl@0
   736
	with RFs::Delete
sl@0
   737
sl@0
   738
	@param aN Number of files in the directory
sl@0
   739
	@param aStep 	Test step
sl@0
   740
*/
sl@0
   741
LOCAL_C void DelAllM1(TInt aN, TInt aStep) 
sl@0
   742
	{
sl@0
   743
	TInt i = 0, r = 0;
sl@0
   744
	
sl@0
   745
	TBuf16<50> directory;
sl@0
   746
	TBuf16<50> dirtemp;
sl@0
   747
	
sl@0
   748
	TBuf16<50> path;
sl@0
   749
	TBuf16<50> buffer(50); 	
sl@0
   750
sl@0
   751
	TTime startTime;
sl@0
   752
	TTime endTime;
sl@0
   753
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
   754
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;  
sl@0
   755
	
sl@0
   756
	if(aN <= gFilesLimit) 
sl@0
   757
		{
sl@0
   758
		// Start the noise in the background
sl@0
   759
		gDelEntryDir = directory;
sl@0
   760
		gDelEntryDir2 = directory;
sl@0
   761
		DoTest(DeleteEntryAccess);
sl@0
   762
		
sl@0
   763
		if(gTypes >= 1) 
sl@0
   764
			{
sl@0
   765
			// all 8.3 
sl@0
   766
			dirtemp.Format(KDirMultipleName, 1, aN);
sl@0
   767
			directory = gSessionPath;
sl@0
   768
			directory.Append(dirtemp);
sl@0
   769
sl@0
   770
			i = 0;
sl@0
   771
					
sl@0
   772
			startTime.HomeTime();
sl@0
   773
			while(i < aN) 
sl@0
   774
				{
sl@0
   775
				FileNamesGeneration(buffer, 8, i, i%3+1) ;
sl@0
   776
				path = directory;
sl@0
   777
				path.Append(buffer);
sl@0
   778
				r = TheFs.Delete(path);
sl@0
   779
				FailIfError(r);
sl@0
   780
				i++;
sl@0
   781
				}
sl@0
   782
			endTime.HomeTime();
sl@0
   783
			
sl@0
   784
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   785
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   786
			}
sl@0
   787
		
sl@0
   788
		if(gTypes >= 2) 
sl@0
   789
			{
sl@0
   790
			// all 20.3 chars
sl@0
   791
			dirtemp.Format(KDirMultipleName, 2, aN);
sl@0
   792
			directory = gSessionPath;
sl@0
   793
			directory.Append(dirtemp);
sl@0
   794
sl@0
   795
			i = 0;
sl@0
   796
			startTime.HomeTime();
sl@0
   797
			while(i < aN) 
sl@0
   798
			 	{
sl@0
   799
				FileNamesGeneration(buffer, 20, i, i%3+1) ;
sl@0
   800
				path = directory;
sl@0
   801
				path.Append(buffer);
sl@0
   802
				r = TheFs.Delete(path);
sl@0
   803
				FailIfError(r);
sl@0
   804
				i++;
sl@0
   805
				}	
sl@0
   806
			endTime.HomeTime();
sl@0
   807
sl@0
   808
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   809
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   810
			}
sl@0
   811
		
sl@0
   812
		if(gTypes >= 3) 
sl@0
   813
			{
sl@0
   814
			// 50/50 
sl@0
   815
			dirtemp.Format(KDirMultipleName,3, aN);
sl@0
   816
			directory = gSessionPath;
sl@0
   817
			directory.Append(dirtemp);
sl@0
   818
			
sl@0
   819
			i = 0;
sl@0
   820
			startTime.HomeTime();
sl@0
   821
			while(i < aN) 
sl@0
   822
				{
sl@0
   823
				if(1 == (i % 2)) 	FileNamesGeneration(buffer, 8, i, i%3+1) ;
sl@0
   824
				else  		FileNamesGeneration(buffer, 20, i, i%3+1) ;
sl@0
   825
					
sl@0
   826
				path = directory;
sl@0
   827
				path.Append(buffer);
sl@0
   828
				r = TheFs.Delete(path);
sl@0
   829
				FailIfError(r);
sl@0
   830
				i++;
sl@0
   831
				}
sl@0
   832
			endTime.HomeTime();
sl@0
   833
sl@0
   834
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   835
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   836
			}
sl@0
   837
		// Stop the noise in the background
sl@0
   838
		DoTestKill();
sl@0
   839
		}
sl@0
   840
sl@0
   841
	gWriting = ETrue; User::After(1000000);
sl@0
   842
	PrintResult(aStep, 1, aN);
sl@0
   843
	PrintResultTime(aStep, 2, timeTaken1);
sl@0
   844
	PrintResultTime(aStep, 3, timeTaken2);
sl@0
   845
	PrintResultTime(aStep, 4, timeTaken3);
sl@0
   846
	gWriting = EFalse;
sl@0
   847
	}
sl@0
   848
sl@0
   849
/** Delete all files with two threads accessing the same directory and creating/deleting a file
sl@0
   850
	with CFileMan::Delete
sl@0
   851
sl@0
   852
	@param aN Number of files in the directory	
sl@0
   853
	@param aStep 	Test step
sl@0
   854
*/
sl@0
   855
LOCAL_C void DelAllM2(TInt aN, TInt aStep) 
sl@0
   856
	{
sl@0
   857
	TInt r = 0;
sl@0
   858
	TBuf16<50> directory;
sl@0
   859
	TBuf16<50> dirtemp;
sl@0
   860
	
sl@0
   861
	TTime startTime;
sl@0
   862
	TTime endTime;
sl@0
   863
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
   864
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;  
sl@0
   865
sl@0
   866
	CFileMan* fMan = CFileMan::NewL(TheFs);
sl@0
   867
	
sl@0
   868
	if(aN <= gFilesLimit) 
sl@0
   869
		{	
sl@0
   870
		// Start the noise in the background
sl@0
   871
		gDelEntryDir = directory;
sl@0
   872
		gDelEntryDir2 = directory;
sl@0
   873
		DoTest(DeleteEntryAccess);
sl@0
   874
		
sl@0
   875
		if(gTypes >= 1) 
sl@0
   876
			{
sl@0
   877
			// all 8.3 
sl@0
   878
			dirtemp.Format(KDirMultipleName, 1, aN);
sl@0
   879
			directory = gSessionPath;
sl@0
   880
			directory.Append(dirtemp);
sl@0
   881
			
sl@0
   882
			startTime.HomeTime();
sl@0
   883
			directory.Append(_L("F*.*"));
sl@0
   884
			r = fMan->Delete(directory);
sl@0
   885
			FailIfError(r);
sl@0
   886
			
sl@0
   887
			endTime.HomeTime();
sl@0
   888
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   889
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   890
			}
sl@0
   891
sl@0
   892
		if(gTypes >= 2) 
sl@0
   893
			{
sl@0
   894
			// all 20.3 chars
sl@0
   895
			dirtemp.Format(KDirMultipleName, 2, aN);
sl@0
   896
			directory = gSessionPath;
sl@0
   897
			directory.Append(dirtemp);
sl@0
   898
sl@0
   899
			startTime.HomeTime();
sl@0
   900
			directory.Append(_L("F*.*"));
sl@0
   901
			r = fMan->Delete(directory);
sl@0
   902
			FailIfError(r);
sl@0
   903
			endTime.HomeTime();
sl@0
   904
			
sl@0
   905
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   906
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   907
			
sl@0
   908
			}
sl@0
   909
		if(gTypes >= 3) 
sl@0
   910
			{
sl@0
   911
			// 50/50 
sl@0
   912
			dirtemp.Format(KDirMultipleName, 3, aN);
sl@0
   913
			directory = gSessionPath;
sl@0
   914
			directory.Append(dirtemp);
sl@0
   915
sl@0
   916
			startTime.HomeTime();
sl@0
   917
			directory.Append(_L("F*.*"));
sl@0
   918
			r = fMan->Delete(directory);
sl@0
   919
			FailIfError(r);
sl@0
   920
			endTime.HomeTime();
sl@0
   921
			
sl@0
   922
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
   923
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   924
			}
sl@0
   925
		
sl@0
   926
		// Stop the noise in the background	
sl@0
   927
		DoTestKill();
sl@0
   928
		}
sl@0
   929
	
sl@0
   930
	delete fMan;
sl@0
   931
	
sl@0
   932
	gWriting = ETrue; User::After(1000000);
sl@0
   933
	PrintResult(aStep, 1, aN);
sl@0
   934
	PrintResultTime(aStep, 2, timeTaken1);
sl@0
   935
	PrintResultTime(aStep, 3, timeTaken2);
sl@0
   936
	PrintResultTime(aStep, 4, timeTaken3);
sl@0
   937
	gWriting = EFalse;
sl@0
   938
	}
sl@0
   939
sl@0
   940
sl@0
   941
/** Delete last.txt file with two threads accessing different directories and 
sl@0
   942
	creating/deleting a file in them 
sl@0
   943
sl@0
   944
	@param aN Number of files in the directory
sl@0
   945
	@param aStep 	Test step
sl@0
   946
*/
sl@0
   947
LOCAL_C void DelFileMD1(TInt aN, TInt aStep) 
sl@0
   948
	{
sl@0
   949
	TBuf16<100> dir1;
sl@0
   950
	TBuf16<100> dir2;
sl@0
   951
	TBuf16<100> dir3;
sl@0
   952
    TBuf16<100> dir4;
sl@0
   953
    TBuf16<100> temp;
sl@0
   954
		
sl@0
   955
	TInt r = 0;
sl@0
   956
	TTime startTime;
sl@0
   957
	TTime endTime;
sl@0
   958
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
   959
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;  
sl@0
   960
sl@0
   961
sl@0
   962
	dir1 = gSessionPath;
sl@0
   963
	dir2 = gSessionPath;
sl@0
   964
	dir3 = gSessionPath;
sl@0
   965
	
sl@0
   966
	dir4.Format(KDirMultipleName, 1, aN);
sl@0
   967
	dir1.Append(dir4);
sl@0
   968
	dir4.Format(KDirMultipleName, 2, aN);
sl@0
   969
	dir2.Append(dir4);	
sl@0
   970
	dir4.Format(KDirMultipleName, 3, aN);
sl@0
   971
	dir3.Append(dir4);
sl@0
   972
sl@0
   973
sl@0
   974
	temp = gSessionPath;
sl@0
   975
	dir4.Format(KDirMultipleName, 3 ,300);
sl@0
   976
	temp.Append(dir4);
sl@0
   977
sl@0
   978
	if(aN <= gFilesLimit) 
sl@0
   979
		{
sl@0
   980
		if(gTypes >= 1) 
sl@0
   981
			{
sl@0
   982
			gDelEntryDir = dir1;
sl@0
   983
			gDelEntryDir2=temp;
sl@0
   984
			dir1.Append(KCommonFile);
sl@0
   985
			
sl@0
   986
			DoTest(DeleteEntryAccess);
sl@0
   987
			
sl@0
   988
			startTime.HomeTime();
sl@0
   989
			
sl@0
   990
			r = TheFs.Delete(dir1);
sl@0
   991
			FailIfError(r);
sl@0
   992
			
sl@0
   993
			endTime.HomeTime();
sl@0
   994
			DoTestKill();
sl@0
   995
			
sl@0
   996
			timeTaken=endTime.MicroSecondsFrom(startTime);
sl@0
   997
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
   998
			}
sl@0
   999
sl@0
  1000
		if(gTypes >= 2) 
sl@0
  1001
			{	
sl@0
  1002
			gDelEntryDir = dir2;
sl@0
  1003
			
sl@0
  1004
			dir2.Append(KCommonFile);
sl@0
  1005
			
sl@0
  1006
			DoTest(DeleteEntryAccess);
sl@0
  1007
sl@0
  1008
			startTime.HomeTime();
sl@0
  1009
sl@0
  1010
			r = TheFs.Delete(dir2);
sl@0
  1011
			FailIfError(r);
sl@0
  1012
			
sl@0
  1013
			endTime.HomeTime();
sl@0
  1014
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
  1015
			DoTestKill();
sl@0
  1016
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
  1017
			}
sl@0
  1018
	
sl@0
  1019
		if(gTypes >= 3) 
sl@0
  1020
			{
sl@0
  1021
			gDelEntryDir = dir3;
sl@0
  1022
			
sl@0
  1023
			dir3.Append(KCommonFile);
sl@0
  1024
sl@0
  1025
			DoTest(DeleteEntryAccess);
sl@0
  1026
sl@0
  1027
			startTime.HomeTime();
sl@0
  1028
sl@0
  1029
			r = TheFs.Delete(dir3);
sl@0
  1030
			FailIfError(r);
sl@0
  1031
			
sl@0
  1032
			endTime.HomeTime();
sl@0
  1033
			DoTestKill();
sl@0
  1034
			
sl@0
  1035
			timeTaken=endTime.MicroSecondsFrom(startTime);
sl@0
  1036
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
  1037
			}
sl@0
  1038
		}
sl@0
  1039
	
sl@0
  1040
	gWriting = ETrue; User::After(1000000);
sl@0
  1041
	PrintResult(aStep, 1, aN);
sl@0
  1042
	PrintResultTime(aStep, 2, timeTaken1);
sl@0
  1043
	PrintResultTime(aStep, 3, timeTaken2);
sl@0
  1044
	PrintResultTime(aStep, 4, timeTaken3);
sl@0
  1045
	gWriting = EFalse;
sl@0
  1046
	}
sl@0
  1047
sl@0
  1048
/** Delete last.txt file with two threads accessing different directories and 
sl@0
  1049
	creating/deleting a file in them 
sl@0
  1050
sl@0
  1051
	@param aN Number of files in the directory
sl@0
  1052
	@param aStep 	Test step
sl@0
  1053
*/
sl@0
  1054
LOCAL_C void DelFileMD2(TInt aN, TInt aStep) 
sl@0
  1055
	{
sl@0
  1056
	TBuf16<100> dir1;
sl@0
  1057
	TBuf16<100> dir2;
sl@0
  1058
	TBuf16<100> dir3;
sl@0
  1059
    TBuf16<100> dir4;
sl@0
  1060
    TBuf16<100> temp;
sl@0
  1061
	
sl@0
  1062
	TInt r = 0;
sl@0
  1063
	TTime startTime;
sl@0
  1064
	TTime endTime;
sl@0
  1065
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
  1066
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;  
sl@0
  1067
sl@0
  1068
	CFileMan* fMan=CFileMan::NewL(TheFs);
sl@0
  1069
	
sl@0
  1070
	dir1 = gSessionPath;
sl@0
  1071
	dir2 = gSessionPath;
sl@0
  1072
	dir3 = gSessionPath;
sl@0
  1073
	
sl@0
  1074
	dir4.Format(KDirMultipleName, 1, aN);
sl@0
  1075
	dir1.Append(dir4);
sl@0
  1076
	dir4.Format(KDirMultipleName, 2, aN);
sl@0
  1077
	dir2.Append(dir4);	
sl@0
  1078
	dir4.Format(KDirMultipleName, 3, aN);
sl@0
  1079
	dir3.Append(dir4);
sl@0
  1080
	
sl@0
  1081
	
sl@0
  1082
	temp=gSessionPath;
sl@0
  1083
	dir4.Format(KDirMultipleName, 3, 300);
sl@0
  1084
	temp.Append(dir4);
sl@0
  1085
	
sl@0
  1086
	if(aN <= gFilesLimit) 
sl@0
  1087
		{
sl@0
  1088
		if(gTypes >= 1) 
sl@0
  1089
			{
sl@0
  1090
			gDelEntryDir = dir1;
sl@0
  1091
			gDelEntryDir2=temp;
sl@0
  1092
			
sl@0
  1093
			dir1.Append(KCommonFile);
sl@0
  1094
			
sl@0
  1095
			DoTest(DeleteEntryAccess);
sl@0
  1096
			
sl@0
  1097
			startTime.HomeTime();
sl@0
  1098
			
sl@0
  1099
			r = fMan->Delete(dir1);
sl@0
  1100
			FailIfError(r);
sl@0
  1101
			
sl@0
  1102
			endTime.HomeTime();
sl@0
  1103
			DoTestKill();
sl@0
  1104
			
sl@0
  1105
			timeTaken=endTime.MicroSecondsFrom(startTime);
sl@0
  1106
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
  1107
			}
sl@0
  1108
sl@0
  1109
		if(gTypes >= 2) 
sl@0
  1110
			{	
sl@0
  1111
			dir4=dir2;
sl@0
  1112
			gDelEntryDir = dir4;
sl@0
  1113
sl@0
  1114
			dir2.Append(KCommonFile);
sl@0
  1115
			
sl@0
  1116
			DoTest(DeleteEntryAccess);
sl@0
  1117
sl@0
  1118
			startTime.HomeTime();
sl@0
  1119
sl@0
  1120
			r = fMan->Delete(dir2);
sl@0
  1121
			FailIfError(r);
sl@0
  1122
			
sl@0
  1123
			endTime.HomeTime();
sl@0
  1124
			timeTaken=endTime.MicroSecondsFrom(startTime);
sl@0
  1125
			DoTestKill();
sl@0
  1126
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
  1127
			}
sl@0
  1128
		if(gTypes >= 3) 
sl@0
  1129
			{
sl@0
  1130
			dir4=dir3;
sl@0
  1131
			gDelEntryDir = dir4;
sl@0
  1132
		
sl@0
  1133
			dir3.Append(KCommonFile);
sl@0
  1134
sl@0
  1135
			
sl@0
  1136
			DoTest(DeleteEntryAccess);
sl@0
  1137
sl@0
  1138
			startTime.HomeTime();
sl@0
  1139
sl@0
  1140
			r = fMan->Delete(dir3);
sl@0
  1141
			FailIfError(r);
sl@0
  1142
			
sl@0
  1143
			endTime.HomeTime();
sl@0
  1144
			DoTestKill();
sl@0
  1145
			
sl@0
  1146
			timeTaken=endTime.MicroSecondsFrom(startTime);
sl@0
  1147
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
  1148
			}
sl@0
  1149
		}
sl@0
  1150
	
sl@0
  1151
	delete fMan;
sl@0
  1152
sl@0
  1153
	gWriting = ETrue; User::After(1000000);
sl@0
  1154
	PrintResult(aStep, 1, aN);
sl@0
  1155
	PrintResultTime(aStep, 2, timeTaken1);
sl@0
  1156
	PrintResultTime(aStep, 3, timeTaken2);
sl@0
  1157
	PrintResultTime(aStep, 4, timeTaken3);
sl@0
  1158
	gWriting = EFalse;
sl@0
  1159
	}
sl@0
  1160
sl@0
  1161
/** Delete all files with two threads accessing different directories and 
sl@0
  1162
	creating/deleting a file in them using RFs::Delete
sl@0
  1163
sl@0
  1164
	@param aN Number of files in the directory
sl@0
  1165
	@param aStep 	Test step
sl@0
  1166
*/
sl@0
  1167
LOCAL_C void DelAllMD1(TInt aN, TInt aStep) 
sl@0
  1168
	{
sl@0
  1169
	TInt i = 0,r = 0;
sl@0
  1170
	
sl@0
  1171
	TBuf16<50> directory;
sl@0
  1172
	TBuf16<50> dirtemp;
sl@0
  1173
	TBuf16<50> temp;
sl@0
  1174
	TBuf16<50> dir4;
sl@0
  1175
sl@0
  1176
sl@0
  1177
	TBuf16<50> path;
sl@0
  1178
	TBuf16<50> buffer(50); 	
sl@0
  1179
sl@0
  1180
	TTime startTime;
sl@0
  1181
	TTime endTime;
sl@0
  1182
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
  1183
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;  
sl@0
  1184
sl@0
  1185
	
sl@0
  1186
	temp=gSessionPath;
sl@0
  1187
	dir4.Format(KDirMultipleName, 3, 300);
sl@0
  1188
	temp.Append(dir4);
sl@0
  1189
sl@0
  1190
	if(aN <= gFilesLimit) 
sl@0
  1191
		{
sl@0
  1192
		if(gTypes >= 1) 
sl@0
  1193
			{
sl@0
  1194
			// all 8.3 
sl@0
  1195
			dirtemp.Format(KDirMultipleName,1, aN);
sl@0
  1196
			directory = gSessionPath;
sl@0
  1197
			directory.Append(dirtemp);
sl@0
  1198
sl@0
  1199
			gDelEntryDir = directory;
sl@0
  1200
			gDelEntryDir2 = temp;
sl@0
  1201
sl@0
  1202
			i = 0;
sl@0
  1203
			
sl@0
  1204
			DoTest(DeleteEntryAccess);
sl@0
  1205
			
sl@0
  1206
			startTime.HomeTime();
sl@0
  1207
			while(i < aN) 
sl@0
  1208
				{
sl@0
  1209
				FileNamesGeneration(buffer, 8, i, i%3+1) ;
sl@0
  1210
				path = directory;
sl@0
  1211
				path.Append(buffer);
sl@0
  1212
				r = TheFs.Delete(path);
sl@0
  1213
				FailIfError(r);
sl@0
  1214
				i++;
sl@0
  1215
				}
sl@0
  1216
			endTime.HomeTime();
sl@0
  1217
			DoTestKill();
sl@0
  1218
			
sl@0
  1219
			timeTaken=endTime.MicroSecondsFrom(startTime);
sl@0
  1220
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
  1221
			}
sl@0
  1222
sl@0
  1223
		if(gTypes >= 2) 
sl@0
  1224
			{
sl@0
  1225
			// all 20.3 chars
sl@0
  1226
			dirtemp.Format(KDirMultipleName,2, aN);
sl@0
  1227
			directory = gSessionPath;
sl@0
  1228
			directory.Append(dirtemp);
sl@0
  1229
			gDelEntryDir = directory;
sl@0
  1230
			DoTest(DeleteEntryAccess);
sl@0
  1231
sl@0
  1232
			i = 0;
sl@0
  1233
			startTime.HomeTime();
sl@0
  1234
			while(i<aN) 
sl@0
  1235
				{
sl@0
  1236
				FileNamesGeneration(buffer, 20, i, i%3+1) ;
sl@0
  1237
				path = directory;
sl@0
  1238
				path.Append(buffer);
sl@0
  1239
				r = TheFs.Delete(path);
sl@0
  1240
				FailIfError(r);
sl@0
  1241
				i++;
sl@0
  1242
				}	
sl@0
  1243
			endTime.HomeTime();
sl@0
  1244
			DoTestKill();
sl@0
  1245
sl@0
  1246
			timeTaken=endTime.MicroSecondsFrom(startTime);
sl@0
  1247
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
  1248
			}
sl@0
  1249
		
sl@0
  1250
		if(gTypes >= 3) 
sl@0
  1251
			{
sl@0
  1252
			// 50/50 
sl@0
  1253
			dirtemp.Format(KDirMultipleName,3, aN);
sl@0
  1254
			directory = gSessionPath;
sl@0
  1255
			directory.Append(dirtemp);
sl@0
  1256
			
sl@0
  1257
			gDelEntryDir = directory;
sl@0
  1258
			DoTest(DeleteEntryAccess);
sl@0
  1259
			i = 0;
sl@0
  1260
			startTime.HomeTime();
sl@0
  1261
			while(i<aN) 
sl@0
  1262
				{
sl@0
  1263
				if(1==(i%2)) 	FileNamesGeneration(buffer, 8, i, i%3+1) ;
sl@0
  1264
				else  		FileNamesGeneration(buffer, 20, i, i%3+1) ;
sl@0
  1265
					
sl@0
  1266
				path = directory;
sl@0
  1267
				path.Append(buffer);
sl@0
  1268
				r = TheFs.Delete(path);
sl@0
  1269
				FailIfError(r);
sl@0
  1270
				i++;
sl@0
  1271
				}
sl@0
  1272
			endTime.HomeTime();
sl@0
  1273
			DoTestKill();
sl@0
  1274
sl@0
  1275
			timeTaken=endTime.MicroSecondsFrom(startTime);
sl@0
  1276
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
  1277
			}
sl@0
  1278
		}
sl@0
  1279
	
sl@0
  1280
	gWriting = ETrue; User::After(1000000);
sl@0
  1281
	PrintResult(aStep, 1, aN);
sl@0
  1282
	PrintResultTime(aStep, 2, timeTaken1);
sl@0
  1283
	PrintResultTime(aStep, 3, timeTaken2);
sl@0
  1284
	PrintResultTime(aStep, 4, timeTaken3);
sl@0
  1285
	gWriting = EFalse;
sl@0
  1286
	}
sl@0
  1287
sl@0
  1288
/** Delete all files with two threads accessing different directories and 
sl@0
  1289
	creating/deleting a file in them using CFileMan::Delete
sl@0
  1290
sl@0
  1291
	@param aN 		Number of files in the directory
sl@0
  1292
	@param aStep 	Test step
sl@0
  1293
*/
sl@0
  1294
LOCAL_C void DelAllMD2(TInt aN, TInt aStep) 
sl@0
  1295
	{
sl@0
  1296
	TInt r = 0;
sl@0
  1297
	TBuf16<50> directory;
sl@0
  1298
	TBuf16<50> dirtemp;
sl@0
  1299
	TBuf16<50> dir4;	
sl@0
  1300
	TBuf16<50> temp;	
sl@0
  1301
	
sl@0
  1302
sl@0
  1303
	TTime startTime;
sl@0
  1304
	TTime endTime;
sl@0
  1305
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
  1306
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;  
sl@0
  1307
	CFileMan* fMan=CFileMan::NewL(TheFs);
sl@0
  1308
sl@0
  1309
	
sl@0
  1310
	// Creating directory for being accessed by other thread
sl@0
  1311
	temp=gSessionPath;
sl@0
  1312
	dir4.Format(KDirMultipleName, 3, 300);
sl@0
  1313
	temp.Append(dir4);
sl@0
  1314
	gDelEntryDir2=temp;
sl@0
  1315
sl@0
  1316
	if(aN <= gFilesLimit) 
sl@0
  1317
		{
sl@0
  1318
		if(gTypes >= 1) 
sl@0
  1319
			{
sl@0
  1320
			// all 8.3 
sl@0
  1321
			dirtemp.Format(KDirMultipleName,1, aN);
sl@0
  1322
			directory = gSessionPath;
sl@0
  1323
			directory.Append(dirtemp);
sl@0
  1324
sl@0
  1325
			gDelEntryDir = directory;
sl@0
  1326
sl@0
  1327
			DoTest(DeleteEntryAccess);
sl@0
  1328
			
sl@0
  1329
			startTime.HomeTime();
sl@0
  1330
			directory.Append(_L("F*.*"));
sl@0
  1331
			r = fMan->Delete(directory);
sl@0
  1332
			FailIfError(r);	
sl@0
  1333
			
sl@0
  1334
			endTime.HomeTime();
sl@0
  1335
			timeTaken=endTime.MicroSecondsFrom(startTime);
sl@0
  1336
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
  1337
			DoTestKill();
sl@0
  1338
			}
sl@0
  1339
		
sl@0
  1340
		if(gTypes >= 2) 
sl@0
  1341
			{
sl@0
  1342
			// all 20.3 chars
sl@0
  1343
			dirtemp.Format(KDirMultipleName,2, aN);
sl@0
  1344
			directory = gSessionPath;
sl@0
  1345
			directory.Append(dirtemp);
sl@0
  1346
			gDelEntryDir = directory;
sl@0
  1347
sl@0
  1348
			DoTest(DeleteEntryAccess);
sl@0
  1349
sl@0
  1350
			startTime.HomeTime();
sl@0
  1351
			directory.Append(_L("F*.*"));
sl@0
  1352
			r = fMan->Delete(directory);
sl@0
  1353
			FailIfError(r);
sl@0
  1354
sl@0
  1355
			endTime.HomeTime();
sl@0
  1356
			DoTestKill();
sl@0
  1357
			
sl@0
  1358
			timeTaken=endTime.MicroSecondsFrom(startTime);
sl@0
  1359
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
  1360
			}
sl@0
  1361
		if(gTypes >= 3) 
sl@0
  1362
			{
sl@0
  1363
			// 50/50 
sl@0
  1364
			dirtemp.Format(KDirMultipleName,3, aN);
sl@0
  1365
			directory = gSessionPath;
sl@0
  1366
			directory.Append(dirtemp);
sl@0
  1367
			gDelEntryDir = directory;
sl@0
  1368
sl@0
  1369
			DoTest(DeleteEntryAccess);
sl@0
  1370
sl@0
  1371
			startTime.HomeTime();
sl@0
  1372
			directory.Append(_L("F*.*"));
sl@0
  1373
			r = fMan->Delete(directory);
sl@0
  1374
			FailIfError(r);
sl@0
  1375
			
sl@0
  1376
			endTime.HomeTime();
sl@0
  1377
			DoTestKill();
sl@0
  1378
			
sl@0
  1379
			timeTaken=endTime.MicroSecondsFrom(startTime);
sl@0
  1380
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
  1381
			}
sl@0
  1382
		}
sl@0
  1383
	
sl@0
  1384
	delete fMan;
sl@0
  1385
	
sl@0
  1386
	gWriting = ETrue; User::After(1000000);
sl@0
  1387
	PrintResult(aStep, 1, aN);
sl@0
  1388
	PrintResultTime(aStep, 2, timeTaken1);
sl@0
  1389
	PrintResultTime(aStep, 3, timeTaken2);
sl@0
  1390
	PrintResultTime(aStep, 4, timeTaken3);
sl@0
  1391
	gWriting = EFalse;
sl@0
  1392
	}
sl@0
  1393
sl@0
  1394
sl@0
  1395
/** Delete last.txt with RFs::Delete
sl@0
  1396
sl@0
  1397
	@param aN 		Number of files in the directory
sl@0
  1398
	@param aStep 	Test step
sl@0
  1399
*/
sl@0
  1400
LOCAL_C void DelFile1(TInt aN, TInt aStep) 
sl@0
  1401
	{
sl@0
  1402
	TBuf16<100> dir1;
sl@0
  1403
	TBuf16<100> dir2;
sl@0
  1404
	TBuf16<100> dir3;
sl@0
  1405
    TBuf16<100> dir4;
sl@0
  1406
	
sl@0
  1407
	TInt r = 0;
sl@0
  1408
	TTime startTime;
sl@0
  1409
	TTime endTime;
sl@0
  1410
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
  1411
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;  
sl@0
  1412
	
sl@0
  1413
	dir1 = gSessionPath;
sl@0
  1414
	dir2 = gSessionPath;
sl@0
  1415
	dir3 = gSessionPath;
sl@0
  1416
	
sl@0
  1417
	dir4.Format(KDirMultipleName, 1, aN);
sl@0
  1418
	dir1.Append(dir4);
sl@0
  1419
	dir4.Format(KDirMultipleName, 2, aN);
sl@0
  1420
	dir2.Append(dir4);	
sl@0
  1421
	dir4.Format(KDirMultipleName, 3, aN);
sl@0
  1422
	dir3.Append(dir4);
sl@0
  1423
sl@0
  1424
	dir1.Append(KCommonFile);
sl@0
  1425
	dir2.Append(KCommonFile);
sl@0
  1426
	dir3.Append(KCommonFile);
sl@0
  1427
sl@0
  1428
	if(aN <= gFilesLimit) 
sl@0
  1429
		{
sl@0
  1430
		if(gTypes >= 1) 
sl@0
  1431
			{
sl@0
  1432
			startTime.HomeTime();
sl@0
  1433
			
sl@0
  1434
			r = TheFs.Delete(dir1);
sl@0
  1435
			FailIfError(r);
sl@0
  1436
			
sl@0
  1437
			endTime.HomeTime();
sl@0
  1438
sl@0
  1439
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
  1440
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
  1441
			}
sl@0
  1442
		if(gTypes >= 2) 
sl@0
  1443
			{
sl@0
  1444
			startTime.HomeTime();
sl@0
  1445
sl@0
  1446
			r = TheFs.Delete(dir2);
sl@0
  1447
			FailIfError(r);
sl@0
  1448
			
sl@0
  1449
			endTime.HomeTime();
sl@0
  1450
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
  1451
			
sl@0
  1452
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
  1453
			}
sl@0
  1454
		if(gTypes >= 3) 
sl@0
  1455
			{
sl@0
  1456
			startTime.HomeTime();
sl@0
  1457
sl@0
  1458
			r = TheFs.Delete(dir3);
sl@0
  1459
			FailIfError(r);
sl@0
  1460
			
sl@0
  1461
			endTime.HomeTime();
sl@0
  1462
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
  1463
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
  1464
			}
sl@0
  1465
		}
sl@0
  1466
	
sl@0
  1467
	gWriting = ETrue; User::After(1000000);
sl@0
  1468
	PrintResult(aStep, 1, aN);
sl@0
  1469
	PrintResultTime(aStep, 2, timeTaken1);
sl@0
  1470
	PrintResultTime(aStep, 3, timeTaken2);
sl@0
  1471
	PrintResultTime(aStep, 4, timeTaken3);
sl@0
  1472
	gWriting = EFalse;
sl@0
  1473
	}
sl@0
  1474
sl@0
  1475
/** Delete last.txt with CFileMan::Delete
sl@0
  1476
sl@0
  1477
	@param aN Number of files in the directory
sl@0
  1478
	@param aStep 	Test step
sl@0
  1479
*/
sl@0
  1480
LOCAL_C void DelFile2(TInt aN, TInt aStep) 
sl@0
  1481
	{
sl@0
  1482
	TBuf16<100> dir1;
sl@0
  1483
	TBuf16<100> dir2;
sl@0
  1484
	TBuf16<100> dir3;
sl@0
  1485
	TBuf16<100> dir4;
sl@0
  1486
sl@0
  1487
	TInt r = 0;
sl@0
  1488
sl@0
  1489
	TTime startTime;
sl@0
  1490
	TTime endTime;
sl@0
  1491
	TTimeIntervalMicroSeconds timeTaken(0);
sl@0
  1492
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;  
sl@0
  1493
	
sl@0
  1494
	if(aN <= gFilesLimit) 
sl@0
  1495
		{
sl@0
  1496
		CFileMan* fMan = CFileMan::NewL(TheFs);
sl@0
  1497
		
sl@0
  1498
		dir1 = gSessionPath;
sl@0
  1499
		dir2 = gSessionPath;
sl@0
  1500
		dir3 = gSessionPath;
sl@0
  1501
sl@0
  1502
		dir4.Format(KDirMultipleName, 1, aN);
sl@0
  1503
		dir1.Append(dir4);
sl@0
  1504
		dir4.Format(KDirMultipleName, 2, aN);
sl@0
  1505
		dir2.Append(dir4);
sl@0
  1506
		dir4.Format(KDirMultipleName, 3, aN);
sl@0
  1507
		dir3.Append(dir4);
sl@0
  1508
			
sl@0
  1509
		dir1.Append(KCommonFile);
sl@0
  1510
		dir2.Append(KCommonFile);
sl@0
  1511
		dir3.Append(KCommonFile);
sl@0
  1512
sl@0
  1513
		if(gTypes >= 1) 
sl@0
  1514
			{
sl@0
  1515
			startTime.HomeTime();
sl@0
  1516
			
sl@0
  1517
			r = fMan->Delete(dir1);
sl@0
  1518
			FailIfError(r);
sl@0
  1519
			
sl@0
  1520
			endTime.HomeTime();
sl@0
  1521
sl@0
  1522
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
  1523
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
  1524
			}
sl@0
  1525
		
sl@0
  1526
		if(gTypes >= 2) 
sl@0
  1527
			{
sl@0
  1528
			startTime.HomeTime();
sl@0
  1529
sl@0
  1530
			r = fMan->Delete(dir2);
sl@0
  1531
			FailIfError(r);
sl@0
  1532
			
sl@0
  1533
			endTime.HomeTime();
sl@0
  1534
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
  1535
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit );
sl@0
  1536
			}
sl@0
  1537
sl@0
  1538
		if(gTypes >= 3) 
sl@0
  1539
			{
sl@0
  1540
			startTime.HomeTime();
sl@0
  1541
sl@0
  1542
			r = fMan->Delete(dir3);
sl@0
  1543
			FailIfError(r);
sl@0
  1544
			
sl@0
  1545
			endTime.HomeTime();
sl@0
  1546
			timeTaken = endTime.MicroSecondsFrom(startTime);
sl@0
  1547
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
sl@0
  1548
			} 
sl@0
  1549
		
sl@0
  1550
		delete fMan;
sl@0
  1551
		}
sl@0
  1552
	
sl@0
  1553
	gWriting = ETrue; User::After(1000000);
sl@0
  1554
	PrintResult(aStep, 1, aN);
sl@0
  1555
	PrintResultTime(aStep, 2, timeTaken1);
sl@0
  1556
	PrintResultTime(aStep, 3, timeTaken2);
sl@0
  1557
	PrintResultTime(aStep, 4, timeTaken3);
sl@0
  1558
	gWriting = EFalse;
sl@0
  1559
	}
sl@0
  1560
sl@0
  1561
/** Tests the deletion of one file with both API: RFs::Delete and CFileMan::Delete
sl@0
  1562
sl@0
  1563
	@param aSelector Configuration in case of manual execution
sl@0
  1564
*/
sl@0
  1565
LOCAL_C TInt TestDelEntry(TAny* aSelector)
sl@0
  1566
	{
sl@0
  1567
	// Precondition: the drive already filled with the right files
sl@0
  1568
sl@0
  1569
	TInt i = 100;
sl@0
  1570
	TInt testStep = 1;
sl@0
  1571
	
sl@0
  1572
	Validate(aSelector);
sl@0
  1573
sl@0
  1574
	test.Printf(_L("#~TS_Title_%d,%d: Delete last.txt, RFs::Delete\n"), gTestHarness, gTestCase);
sl@0
  1575
	
sl@0
  1576
	i = 100;
sl@0
  1577
	testStep = 1;
sl@0
  1578
	while(i <= KMaxFiles)
sl@0
  1579
		{
sl@0
  1580
		if(i == 100 || i == 1000 || i == 5000 || i == 10000)	
sl@0
  1581
			DelFile1(i, testStep++);
sl@0
  1582
		i += 100;
sl@0
  1583
		}
sl@0
  1584
	
sl@0
  1585
	ReCreateLast();
sl@0
  1586
	gTestCase++;
sl@0
  1587
	test.Printf(_L("#~TS_Title_%d,%d: Delete last.txt, CFileMan::Delete\n"), gTestHarness, gTestCase);
sl@0
  1588
		
sl@0
  1589
	i = 100;
sl@0
  1590
	testStep = 1;
sl@0
  1591
	while(i <= KMaxFiles)
sl@0
  1592
		{
sl@0
  1593
		if(i == 100 || i == 1000 || i == 5000 || i == 10000)
sl@0
  1594
			DelFile2(i, testStep++);
sl@0
  1595
		i += 100;
sl@0
  1596
		}
sl@0
  1597
	
sl@0
  1598
	gTestCase++;
sl@0
  1599
	
sl@0
  1600
	return(KErrNone);
sl@0
  1601
	}
sl@0
  1602
sl@0
  1603
/** Tests the deletion of all the files in a directory with both API: 
sl@0
  1604
	RFs::Delete and CFileMan::Delete
sl@0
  1605
sl@0
  1606
	@param aSelector Configuration in case of manual execution
sl@0
  1607
*/
sl@0
  1608
LOCAL_C TInt TestDelAllFiles(TAny* aSelector)
sl@0
  1609
	{
sl@0
  1610
	// Precondition: drive already filled with the right files
sl@0
  1611
sl@0
  1612
	TInt i = 100;
sl@0
  1613
	TInt testStep = 1;
sl@0
  1614
	
sl@0
  1615
	Validate(aSelector);
sl@0
  1616
sl@0
  1617
	test.Printf(_L("#~TS_Title_%d,%d: Delete all, RFs::Delete\n"), gTestHarness, gTestCase);
sl@0
  1618
	
sl@0
  1619
	testStep = 1;
sl@0
  1620
	while(i <= KMaxFiles)
sl@0
  1621
		{
sl@0
  1622
		if(i == 100 || i == 1000 || i == 5000 || i == 10000)
sl@0
  1623
			DelAllFiles1(i, testStep++);
sl@0
  1624
		i += 100;
sl@0
  1625
		}
sl@0
  1626
sl@0
  1627
	TestFileCreate(aSelector);
sl@0
  1628
	gTestCase++;
sl@0
  1629
	test.Printf(_L("#~TS_Title_%d,%d: Delete all, CFileMan::Delete\n"), gTestHarness, gTestCase);	
sl@0
  1630
sl@0
  1631
	
sl@0
  1632
	i = 100;
sl@0
  1633
	testStep = 1;
sl@0
  1634
	while(i <= KMaxFiles)
sl@0
  1635
		{
sl@0
  1636
		if(i == 100 || i == 1000 || i == 5000 || i == 10000)
sl@0
  1637
			DelAllFiles2(i, testStep++);
sl@0
  1638
		i += 100;
sl@0
  1639
		}
sl@0
  1640
sl@0
  1641
	gTestCase++;
sl@0
  1642
	return(KErrNone);
sl@0
  1643
	}
sl@0
  1644
sl@0
  1645
/** Tests the deletion of last.txt in a directory with both API: 
sl@0
  1646
	RFs::Delete and CFileMan::Delete while 2 other threads accessing the directory
sl@0
  1647
sl@0
  1648
	@param aSelector Configuration in case of manual execution
sl@0
  1649
*/
sl@0
  1650
LOCAL_C TInt TestDelMultSame(TAny* aSelector)
sl@0
  1651
	{
sl@0
  1652
	TInt i = 100;
sl@0
  1653
	TInt testStep = 1;
sl@0
  1654
sl@0
  1655
sl@0
  1656
	Validate(aSelector);
sl@0
  1657
sl@0
  1658
	TestFileCreate(aSelector);
sl@0
  1659
	
sl@0
  1660
	test.Printf(_L("#~TS_Title_%d,%d: Delete last.txt mult. clients del in same dir, RFs::Delete\n"), gTestHarness, gTestCase);
sl@0
  1661
	
sl@0
  1662
	testStep = 1;
sl@0
  1663
	while(i <= KMaxFiles)
sl@0
  1664
		{
sl@0
  1665
		if(i == 100 || i == 1000 || i == 5000 || i == 10000)
sl@0
  1666
			DelFileM1(i, testStep++);
sl@0
  1667
		i += 100;
sl@0
  1668
		}
sl@0
  1669
sl@0
  1670
	ReCreateLast();
sl@0
  1671
	gTestCase++;	
sl@0
  1672
	test.Printf(_L("#~TS_Title_%d,%d: Delete last.txt mult. clients del in same dir, CFileMan::Delete\n"), gTestHarness, gTestCase);
sl@0
  1673
	
sl@0
  1674
	i = 100;
sl@0
  1675
	testStep = 1;
sl@0
  1676
	while(i <= KMaxFiles)
sl@0
  1677
		{
sl@0
  1678
		if(i == 100 || i == 1000 || i == 5000 || i == 10000)
sl@0
  1679
			{
sl@0
  1680
			DelFileM2(i, testStep);
sl@0
  1681
			testStep++;
sl@0
  1682
			}
sl@0
  1683
		i += 100;	
sl@0
  1684
		}
sl@0
  1685
sl@0
  1686
	ReCreateLast();
sl@0
  1687
	gTestCase++;
sl@0
  1688
	test.Printf(_L("#~TS_Title_%d,%d: Delete all mult. clients del in same dir, RFs::Delete\n"), gTestHarness, gTestCase);
sl@0
  1689
	
sl@0
  1690
	i = 100;
sl@0
  1691
	testStep = 1;
sl@0
  1692
	while(i <= KMaxFiles)
sl@0
  1693
		{
sl@0
  1694
		if(i == 100 || i == 1000 || i == 5000 || i == 10000)
sl@0
  1695
			DelAllM1(i, testStep++);
sl@0
  1696
		i += 100;
sl@0
  1697
		}
sl@0
  1698
sl@0
  1699
	TestFileCreate(aSelector);
sl@0
  1700
	gTestCase++;
sl@0
  1701
	test.Printf(_L("#~TS_Title_%d,%d: Delete all mult. clients del in same dir, CFileMan::Delete\n"), gTestHarness, gTestCase);
sl@0
  1702
sl@0
  1703
	i = 100;
sl@0
  1704
	testStep = 1;
sl@0
  1705
	while(i <= KMaxFiles)
sl@0
  1706
		{
sl@0
  1707
		if(i == 100 || i == 1000 || i == 5000 || i == 10000)
sl@0
  1708
			DelAllM2(i, testStep++);
sl@0
  1709
		i += 100;
sl@0
  1710
		}
sl@0
  1711
sl@0
  1712
	gTestCase++;
sl@0
  1713
	
sl@0
  1714
	return(KErrNone);
sl@0
  1715
	}
sl@0
  1716
sl@0
  1717
sl@0
  1718
/** Tests the deletion of last.txt in a directory with both API: 
sl@0
  1719
	RFs::Delete and CFileMan::Delete while 2 threads accessing different directories 
sl@0
  1720
	(the current and one with 300 files)
sl@0
  1721
sl@0
  1722
	@param aSelector Configuration in case of manual execution
sl@0
  1723
*/
sl@0
  1724
LOCAL_C TInt TestDelMultDif(TAny* aSelector)
sl@0
  1725
	{
sl@0
  1726
	TInt i = 100;
sl@0
  1727
	TInt testStep = 1;
sl@0
  1728
	
sl@0
  1729
	Validate(aSelector);
sl@0
  1730
	
sl@0
  1731
	TestFileCreate(aSelector);
sl@0
  1732
	CreateDirWithNFiles(300, 3);
sl@0
  1733
	
sl@0
  1734
	test.Printf(_L("#~TS_Title_%d,%d: Delete last.txt mult. clients del in dif dirs, RFs::Delete\n"), gTestHarness, gTestCase);
sl@0
  1735
	
sl@0
  1736
	testStep = 1;
sl@0
  1737
	while(i <= KMaxFiles)
sl@0
  1738
		{
sl@0
  1739
		if(i == 100 || i == 1000 || i == 5000 || i == 10000)
sl@0
  1740
			DelFileMD1(i, testStep++);
sl@0
  1741
		i += 100;
sl@0
  1742
		}
sl@0
  1743
sl@0
  1744
	ReCreateLast();
sl@0
  1745
	gTestCase++;	
sl@0
  1746
	test.Printf(_L("#~TS_Title_%d,%d: Delete last.txt mult. clients del in dif dirs, CFileMan::Delete\n"), gTestHarness, gTestCase);
sl@0
  1747
	
sl@0
  1748
	i = 100;
sl@0
  1749
	testStep = 1;
sl@0
  1750
	while(i <= KMaxFiles)
sl@0
  1751
		{
sl@0
  1752
		if(i == 100 || i == 1000 || i == 5000 || i == 10000)
sl@0
  1753
			DelFileMD2(i, testStep++);
sl@0
  1754
		i += 100;
sl@0
  1755
		}
sl@0
  1756
sl@0
  1757
	ReCreateLast();
sl@0
  1758
	gTestCase++;		
sl@0
  1759
	test.Printf(_L("#~TS_Title_%d,%d: Delete all mult. clients del in dif dirs, RFs::Delete\n"), gTestHarness, gTestCase);
sl@0
  1760
	
sl@0
  1761
	i = 100;
sl@0
  1762
	testStep = 1;
sl@0
  1763
	while(i <= KMaxFiles)
sl@0
  1764
		{
sl@0
  1765
		if(i == 100 || i == 1000 || i == 5000 || i == 10000)
sl@0
  1766
			DelAllMD1(i, testStep++);
sl@0
  1767
		i += 100;
sl@0
  1768
		}
sl@0
  1769
sl@0
  1770
	TestFileCreate(aSelector);
sl@0
  1771
	gTestCase++;
sl@0
  1772
	test.Printf(_L("#~TS_Title_%d,%d: Delete all mult. clients del in dif dirs, CFileMan::Delete\n"), gTestHarness, gTestCase);
sl@0
  1773
sl@0
  1774
	
sl@0
  1775
	i = 100;
sl@0
  1776
	testStep = 1;
sl@0
  1777
	while(i <= KMaxFiles)
sl@0
  1778
		{
sl@0
  1779
		if(i == 100 || i == 1000 || i == 5000 || i == 10000)
sl@0
  1780
			DelAllMD2(i, testStep++);
sl@0
  1781
		i += 100;
sl@0
  1782
		}
sl@0
  1783
sl@0
  1784
	gTestCase++;
sl@0
  1785
	
sl@0
  1786
	return(KErrNone);
sl@0
  1787
	}
sl@0
  1788
sl@0
  1789
/** Goes automatically through all the options
sl@0
  1790
sl@0
  1791
	@param aSelector Configuration in case of manual execution
sl@0
  1792
*/
sl@0
  1793
LOCAL_C TInt TestAll(TAny* aSelector)
sl@0
  1794
	{
sl@0
  1795
	Validate(aSelector);
sl@0
  1796
	
sl@0
  1797
	gFormat=ETrue; 	// The card will be formatted after this test execution
sl@0
  1798
sl@0
  1799
	TestDelEntry(aSelector);
sl@0
  1800
	TestDelAllFiles(aSelector);
sl@0
  1801
	TestDelMultSame(aSelector);
sl@0
  1802
	TestDelMultDif(aSelector);
sl@0
  1803
	
sl@0
  1804
	return KErrNone;
sl@0
  1805
	}
sl@0
  1806
sl@0
  1807
/** Call all tests
sl@0
  1808
sl@0
  1809
*/
sl@0
  1810
GLDEF_C void CallTestsL()
sl@0
  1811
	{
sl@0
  1812
sl@0
  1813
	TInt r = client.CreateLocal(0);
sl@0
  1814
	FailIfError(r);
sl@0
  1815
	
sl@0
  1816
	// Each test case of the suite has an identifyer for parsing purposes of the results
sl@0
  1817
	gTestHarness = 1; 	
sl@0
  1818
	gTestCase = 1;
sl@0
  1819
	
sl@0
  1820
	PrintHeaders(1, _L("t_fsrdel. Deletion")); 
sl@0
  1821
		
sl@0
  1822
	RThread noisy; 
sl@0
  1823
	TBuf<20> buf = _L("Noisy");
sl@0
  1824
	r = noisy.Create(buf, noise, KDefaultStackSize, KHeapSize, KHeapSize, NULL);
sl@0
  1825
	FailIfError(r);
sl@0
  1826
	
sl@0
  1827
	noisy.Resume();
sl@0
  1828
sl@0
  1829
	CSelectionBox* TheSelector = CSelectionBox::NewL(test.Console());
sl@0
  1830
	
sl@0
  1831
	if(gMode == 0) 
sl@0
  1832
		{ // Manual
sl@0
  1833
		gSessionPath=_L("?:\\");
sl@0
  1834
		TCallBack createFiles(TestFileCreate,TheSelector);
sl@0
  1835
		TCallBack delFile(TestDelEntry,TheSelector);
sl@0
  1836
		TCallBack delAllFiles(TestDelAllFiles,TheSelector);
sl@0
  1837
		TCallBack delMultSame(TestDelMultSame,TheSelector);
sl@0
  1838
		TCallBack delMultDif(TestDelMultDif,TheSelector);
sl@0
  1839
		TCallBack delAll(TestAll,TheSelector);
sl@0
  1840
		TheSelector->AddDriveSelectorL(TheFs);
sl@0
  1841
		TheSelector->AddLineL(_L("Create all files"),createFiles);
sl@0
  1842
		TheSelector->AddLineL(_L("Delete one file from each dir"),delFile);
sl@0
  1843
		TheSelector->AddLineL(_L("Delete all files"),delAllFiles);
sl@0
  1844
		TheSelector->AddLineL(_L("Delete mult clients same dir"),delMultSame);
sl@0
  1845
		TheSelector->AddLineL(_L("Delete mult clients dif dir"),delMultDif);
sl@0
  1846
		TheSelector->AddLineL(_L("Execute all options"),delAll);
sl@0
  1847
		TheSelector->Run();
sl@0
  1848
		}
sl@0
  1849
	else 
sl@0
  1850
		{ // Automatic
sl@0
  1851
		TestAll(TheSelector);
sl@0
  1852
		}
sl@0
  1853
		
sl@0
  1854
	client.Close();
sl@0
  1855
	delete TheSelector;
sl@0
  1856
	
sl@0
  1857
	noisy.Kill(KErrNone);
sl@0
  1858
	noisy.Close();	
sl@0
  1859
sl@0
  1860
	test.Printf(_L("#~TestEnd_%d\n"), gTestHarness);
sl@0
  1861
	}