os/kernelhwsrv/kerneltest/f32test/cfileman/t_cfileman_aux.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2008-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\cfileman\t_cfileman_aux.h
    15 // 
    16 //
    17 
    18 #ifndef T_CFILEMAN_AUX_H
    19 #define T_CFILEMAN_AUX_H
    20 
    21 #include <f32file.h>
    22 #include <e32test.h>
    23 #include <hal.h>
    24 #include "t_server.h"
    25 
    26 void RmDir(const TDesC& aDirName);
    27 TBool CompareL(const TDesC& aDir1,const TDesC& aDir2);
    28 void SetupDirectories(TBool aCreateFiles, TFileName* aDestOtherDrive);
    29 void InitialiseL();
    30 void Cleanup();
    31 void CleanupFileHandles();
    32 
    33 struct TDirSetupFiles;
    34 
    35 void ParsingDirDataBlock(TInt aDataBlock[], RArray<TInt>& aFinalDirDataArray);
    36 void SetupDir(TDesC& aPath, TDirSetupFiles aDirSetupData);
    37 void SetupDirFiles(const TDesC& aPath, const TDirSetupFiles& aDirFiles);
    38 
    39 void PrintDir(const TDesC& aPath, const TChar& aDrv);
    40 
    41 ///////////////////////////////////////////////////////////////////////////////
    42 //	Files Setup Pattern Definitions
    43 ///////////////////////////////////////////////////////////////////////////////
    44 static TPtrC gDirPatterns[] = 
    45 	{
    46 	_L("FILE1.TXT"),			// 0
    47 	_L("FILE2.TXT"),			// 1
    48 	_L("FILE01.TXT"),			// 2
    49 	_L("FILE02.TXT"),			// 3
    50 	_L("FILE.TXT"),				// 4
    51 	_L("OTHER.TXT"),			// 5
    52 	_L("FILE.DAT"),				// 6
    53 	_L("FILE"),					// 7
    54 	
    55 	_L("DIR1\\"),				// 8
    56 	
    57 	_L("DIR1\\FILE1.TXT"),		// 9
    58 	_L("DIR1\\FILE2.TXT"),		// 10
    59 	_L("DIR1\\FILE01.TXT"),		// 11
    60 	_L("DIR1\\FILE02.TXT"),		// 12
    61 	_L("DIR1\\FILE.TXT"),		// 13
    62 	_L("DIR1\\OTHER.TXT"),		// 14
    63 	_L("DIR1\\FILE.DAT"),		// 15
    64 	_L("DIR1\\FILE"),			// 16
    65 	
    66 	_L("DIR2\\"),				// 17
    67 	
    68 	_L("DIR2\\FILE1.TXT"),		// 18
    69 	_L("DIR2\\FILE2.TXT"),		// 19
    70 	_L("DIR2\\FILE01.TXT"),		// 20
    71 	_L("DIR2\\FILE02.TXT"),		// 21
    72 	_L("DIR2\\FILE.TXT"),		// 22
    73 	_L("DIR2\\OTHER.TXT"),		// 23
    74 	_L("DIR2\\FILE.DAT"),		// 24
    75 	_L("DIR2\\FILE"),			// 25
    76 	
    77 	
    78 	_L("DIR1\\DIR11\\"),		// 26
    79 	
    80 	_L("DIR1\\DIR11\\FILE1.TXT"),	// 27
    81 	_L("DIR1\\DIR11\\FILE2.TXT"),	// 28
    82 	_L("DIR1\\DIR11\\FILE01.TXT"),	// 29
    83 	_L("DIR1\\DIR11\\FILE02.TXT"),	// 30
    84 	_L("DIR1\\DIR11\\FILE.TXT"),	// 31
    85 	_L("DIR1\\DIR11\\OTHER.TXT"),	// 32
    86 	_L("DIR1\\DIR11\\FILE.DAT"),	// 33
    87 	_L("DIR1\\DIR11\\FILE"),		// 34
    88 	
    89 		
    90 	_L("DIR1\\DIR12\\"),		// 35
    91 	
    92 	_L("DIR1\\DIR12\\FILE1.TXT"),	// 36
    93 	_L("DIR1\\DIR12\\FILE2.TXT"),	// 37
    94 	_L("DIR1\\DIR12\\FILE01.TXT"),	// 38
    95 	_L("DIR1\\DIR12\\FILE02.TXT"),	// 39
    96 	_L("DIR1\\DIR12\\FILE.TXT"),	// 40
    97 	_L("DIR1\\DIR12\\OTHER.TXT"),	// 41
    98 	_L("DIR1\\DIR12\\FILE.DAT"),	// 42
    99 	_L("DIR1\\DIR12\\FILE"),		// 43
   100 	
   101 	//Special
   102 	_L("RENAMED.TXT"),				//44
   103 	_L("RENAMED1.TXT"),				//45
   104 	_L("RENAMED2.TXT"),				//46
   105 	_L("RENAMED01.TXT"),			//47
   106 	_L("RENAMED02.TXT"),			//48
   107 	_L("RENAMED.DAT"),				//49
   108 	_L("RENAMED"),					//50
   109 	
   110 	_L("FILE1.REN"),			//51
   111 	_L("FILE2.REN"),			//52
   112 	_L("FILE01.REN"),			//53
   113 	_L("FILE02.REN"),			//54
   114 	_L("FILE.REN"),				//55
   115 	_L("OTHER.REN"),			//56
   116 	_L("RENAMED.REN"),			//57
   117 	_L("RENAMED1.REN"),			//58
   118 	_L("RENAMED2.REN"),			//59
   119 	_L("RENAMED01.REN"),		//60
   120 	_L("RENAMED02.REN"),		//61
   121 	_L("abcEtxt"),				//62
   122 	_L("DIR1\\RENAMED.TXT"),	//63
   123 	_L("DIR1\\RENAMED1.TXT"),	//64
   124 	_L("DIR1\\RENAMED2.TXT"),	//65
   125 	_L("DIR1\\RENAMED01.TXT"),	//66
   126 	_L("DIR1\\RENAMED02.TXT"),	//67
   127 	_L("DIR1\\DIR11\\RENAMED.TXT"),	//68
   128 	_L("DIR1\\DIR11\\RENAMED1.TXT"),	//69
   129 	_L("DIR1\\DIR11\\RENAMED2.TXT"),	//70
   130 	_L("DIR1\\DIR11\\RENAMED01.TXT"),	//71
   131 	_L("DIR1\\DIR11\\RENAMED02.TXT"),	//72
   132 	_L("DIR1\\DIR12\\RENAMED.TXT"),	//73
   133 	_L("DIR1\\DIR12\\RENAMED1.TXT"),	//74
   134 	_L("DIR1\\DIR12\\RENAMED2.TXT"),	//75
   135 	_L("DIR1\\DIR12\\RENAMED01.TXT"),	//76
   136 	_L("DIR1\\DIR12\\RENAMED02.TXT"),	//77
   137 	_L("DIR2\\RENAMED.TXT"),	//78
   138 	_L("DIR2\\RENAMED1.TXT"),	//79
   139 	_L("DIR2\\RENAMED2.TXT"),	//80
   140 	_L("DIR2\\RENAMED01.TXT"),	//81
   141 	_L("DIR2\\RENAMED02.TXT"),	//82
   142 	_L("DIR1\\FILE1.REN"),		//83
   143 	_L("DIR1\\FILE2.REN"),		//84
   144 	_L("DIR1\\FILE01.REN"),		//85
   145 	_L("DIR1\\FILE02.REN"),		//86
   146 	_L("DIR1\\FILE.REN"),		//87
   147 	_L("DIR1\\OTHER.REN"),		//88
   148 	_L("DIR1\\RENAMED.REN"),	//89
   149 	_L("DIR1\\RENAMED1.REN"),	//90
   150 	_L("DIR1\\RENAMED2.REN"),	//91
   151 	_L("DIR1\\RENAMED01.REN"),	//92
   152 	_L("DIR1\\RENAMED02.REN"),	//93
   153 	_L("DIR1\\DIR11\\FILE1.REN"),		//94
   154 	_L("DIR1\\DIR11\\FILE2.REN"),		//95
   155 	_L("DIR1\\DIR11\\FILE01.REN"),		//96
   156 	_L("DIR1\\DIR11\\FILE02.REN"),		//97
   157 	_L("DIR1\\DIR11\\FILE.REN"),		//98
   158 	_L("DIR1\\DIR11\\OTHER.REN"),		//99
   159 	_L("DIR1\\DIR11\\RENAMED.REN"),		//100
   160 	_L("DIR1\\DIR11\\RENAMED1.REN"),	//101
   161 	_L("DIR1\\DIR11\\RENAMED2.REN"),	//102
   162 	_L("DIR1\\DIR11\\RENAMED01.REN"),	//103
   163 	_L("DIR1\\DIR11\\RENAMED02.REN"),	//104
   164 	_L("DIR1\\DIR12\\FILE1.REN"),		//105
   165 	_L("DIR1\\DIR12\\FILE2.REN"),		//106
   166 	_L("DIR1\\DIR12\\FILE01.REN"),		//107
   167 	_L("DIR1\\DIR12\\FILE02.REN"),		//108
   168 	_L("DIR1\\DIR12\\FILE.REN"),		//109
   169 	_L("DIR1\\DIR12\\OTHER.REN"),		//110
   170 	_L("DIR1\\DIR12\\RENAMED.REN"),		//111
   171 	_L("DIR1\\DIR12\\RENAMED1.REN"),	//112
   172 	_L("DIR1\\DIR12\\RENAMED2.REN"),	//113
   173 	_L("DIR1\\DIR12\\RENAMED01.REN"),	//114
   174 	_L("DIR1\\DIR12\\RENAMED02.REN"),	//115
   175 	_L("DIR2\\FILE1.REN"),		//116
   176 	_L("DIR2\\FILE2.REN"),		//117
   177 	_L("DIR2\\FILE01.REN"),		//118
   178 	_L("DIR2\\FILE02.REN"),		//119
   179 	_L("DIR2\\FILE.REN"),		//120
   180 	_L("DIR2\\OTHER.REN"),		//121
   181 	_L("DIR2\\RENAMED.REN"),	//122
   182 	_L("DIR2\\RENAMED1.REN"),	//123
   183 	_L("DIR2\\RENAMED2.REN"),	//124
   184 	_L("DIR2\\RENAMED01.REN"),	//125
   185 	_L("DIR2\\RENAMED02.REN"),	//126
   186 	_L("DIR1\\RENAMED.DAT"),	//127
   187 	_L("DIR1\\DIR11\\RENAMED.DAT"),	//128
   188 	_L("DIR1\\DIR12\\RENAMED.DAT"),	//129
   189 	_L("DIR2\\RENAMED.DAT"),	//130
   190 	
   191 	};
   192 
   193 #define EOB 	-1			// 'End Of Block' tag
   194 #define CON 	(EOB - 1)	// 'Continue' tag
   195 #define LAST 	130 		// Last item's tag
   196 //...
   197 
   198 // Predefined dir data blocks for testing data setup:
   199 #define ALL			{0,CON,LAST,EOB}		// Block includes all items
   200 
   201 #define EMPTY		{EOB}					// Empty block
   202 
   203 #define BLOCK01		{0,CON,7,EOB}
   204 #define BLOCK02		{0,CON,4,EOB}
   205 #define BLOCK03		{0,CON,5,EOB}
   206 #define BLOCK04		{0,CON,7,9,CON,16,18,CON,25,27,CON,34,36,CON,43,EOB}// Src\\*
   207 #define BLOCK05		{0,CON,4,9,CON,13,18,CON,22,27,CON,31,36,CON,40,EOB}// Src\\FILE*.TXT
   208 #define BLOCK06		{0,1,9,10,18,19,27,28,36,37,EOB}// Src\\FILE?.TXT
   209 #define BLOCK07		{0,CON,5,9,CON,14,18,CON,23,27,CON,32,36,CON,41,EOB}//Src\\*.TXT
   210 #define BLOCK08		{4,6,13,15,22,24,31,33,40,42,55,EOB}//Src\\FILE.*
   211 #define BLOCK09		{8,CON,16,26,CON,43,EOB}
   212 #define BLOCK10     {26,CON,34,EOB}
   213 #define BLOCK11		{9,CON,16,26,CON,43,EOB}
   214 #define BLOCK12		{9,CON,16,EOB}
   215 #define BLOCK13		{0,CON,3,EOB}
   216 #define BLOCK14 	{0,1,EOB}
   217 #define BLOCK15		{0,1,8,9,10,17,18,19,26,27,28,35,36,37,EOB}
   218 #define BLOCK16		{5,8,14,17,23,26,32,35,41,EOB}
   219 #define BLOCK17		{3,8,12,17,21,26,30,35,39,EOB}
   220 #define BLOCK18		{8,CON,16,EOB}
   221 #define BLOCK19		{51,CON,61,EOB}
   222 #define BLOCK20		{0,CON,5,44,CON,48,EOB}
   223 #define BLOCK21		{0,CON,25,35,CON,61,EOB}
   224 #define BLOCK22		{9,CON,63,EOB}
   225 #define BLOCK23		{63,CON,71}
   226 #define BLOCK24		{0,CON,7,44,CON,62,EOB}
   227 #define BLOCK25		{0,CON,7,9,CON,16,18,CON,25,27,CON,34,36,CON,62,EOB}
   228 #define BLOCK26		{0,CON,5,9,CON,14,18,CON,23,27,CON,32,36,CON,41,44,CON,48,EOB}
   229 #define BLOCK27		{4,6,13,15,22,24,31,33,40,42,55,EOB}
   230 #define BLOCK28		{8,CON,43,EOB}
   231 #define BLOCK29		{0,CON,5,44,CON,48,EOB}
   232 #define BLOCK30		{44,8,63,17,68,26,73,35,78,EOB}
   233 #define BLOCK31	    {44,CON,48,63,CON,82,EOB}
   234 #define BLOCK32		{51,CON,61,83,CON,126,EOB}
   235 #define BLOCK33		{44,49,57,89,100,111,122,127,CON,130,EOB}
   236 #define BLOCK36     {0,CON,5,9,CON,14,18,CON,23,27,CON,32,36,CON,41,44,CON,48,63,CON,82,EOB}
   237 #define BLOCK37     {4,6,13,15,22,24,31,33,40,42,55,87,98,109,120,EOB}					
   238 #define BLOCK39		{8,CON,16,26,CON,43,63,CON,77,83,CON,115,127,CON,129,EOB}
   239 #define BLOCK45		{51,CON,61,83,CON,126,EOB}
   240 #define BLOCK46		{44,49,57,63,68,73,78,89,100,111,122,127,128,129,130,EOB}
   241 #define BLOCK47		{44,49,55,57,63,68,73,78,87,89,98,100,109,111,120,122,127,128,129,130,EOB}
   242 
   243 #define BLOCK34		{0,CON,5,9,CON,14,18,CON,23,27,CON,32,36,CON,41,44,CON,48,63,CON,82,EOB}
   244 #define BLOCK35		{4,6,13,15,22,24,31,33,40,42,55,87,98,109,120,EOB} 
   245 #define BLOCK40 	{44,49,57,63,68,73,78,89,100,111,122,127,CON,130,EOB} 
   246 #define BLOCK41		{8,CON,16,26,CON,43,63,CON,77,83,CON,115,127,CON,129,EOB}
   247 #define BLOCK42		{0,CON,7,44,CON,49,51,CON,61,EOB}
   248 #define BLOCK43 	{9,CON,16,26,CON,43,63,CON,77,83,CON,115,127,CON,129,EOB}
   249 
   250 ///////////////////////////////////////////////////////////////////////////////
   251 //	Data structures for building test case parameters
   252 ///////////////////////////////////////////////////////////////////////////////
   253 enum TTestingAPI
   254 	{ 
   255 	ECFMDelete,
   256 	ECFMMove,
   257 	ECFMRmDir,
   258 	ECFMCopy,
   259 	ECFMRename,
   260 	ECFMCopyHandle,
   261 	ECFMAttribs,
   262 	};
   263 
   264 struct TDirSetupFiles
   265 	{
   266 	TInt iAddingBlock[25];
   267 	TInt iDeductBlock[25];
   268 	};
   269 // Basic Testing Parameters
   270 struct TTestParamBasic
   271 	{
   272 	TUint 			iTestCaseID;
   273 	TTestingAPI		iAPI;
   274 	TUint 			iSwitch;
   275 	TInt			iSyncReturn;
   276 	TInt			iAsyncReturn;
   277 	TInt			iAsyncStatus;
   278 	};
   279 
   280 // Basic Presettings Parameters
   281 struct TTestParamBasicPrs
   282 	{
   283 	TChar* 			iDrvChar;
   284 	TText16*		iCmdPath;		
   285 	TText16*		iPrsPath;
   286 	TDirSetupFiles 	iPrsFiles;
   287 	TText16*		iCmpPath;
   288 	TDirSetupFiles 	iCmpFiles;
   289 	};
   290 
   291 // Presettings with file open mode
   292 struct TTestParamPrsFileOpen
   293 	{
   294 	TTestParamBasicPrs 	iBasicPrs;
   295 	TBool				iFileOpen;
   296 	};
   297 
   298 // Presettings with file attribs and modified time
   299 struct TTestParamPrsAttribsTime
   300 	{
   301 	TTestParamBasicPrs 	iBasicPrs;
   302 	TUint				iAttribsSet;
   303 	TTime				iTime;
   304 	};
   305 
   306 
   307 ///////////////////////////////////////////////////////////
   308 //	Test case data structures
   309 ///////////////////////////////////////////////////////////
   310 struct TTestCaseUnitaryBasic
   311 	{
   312 	TTestParamBasic 	iBasic;
   313 	TTestParamBasicPrs 	iSrcPrsBasic;
   314 	};
   315 
   316 struct TTestCaseBinaryBasic
   317 	{
   318 	TTestParamBasic 	iBasic;
   319 	TTestParamBasicPrs 	iSrcPrsBasic;
   320 	TTestParamBasicPrs 	iTrgPrsBasic;
   321 	};
   322 
   323 struct TTestCaseUnitaryFileOpen
   324 	{
   325 	TTestParamBasic 		iBasic;
   326 	TTestParamPrsFileOpen	iSrcPrsFO;
   327 	};
   328 
   329 struct TTestCaseBinaryFileOpen
   330 	{
   331 	TTestParamBasic 		iBasic;
   332 	TTestParamPrsFileOpen	iSrcPrsFO;
   333 	TTestParamPrsFileOpen	iTrgPrsFO;
   334 	};
   335 
   336 struct TTestCaseUnitaryAttribTime
   337 	{
   338 	TTestParamBasic 			iBasic;
   339 	TUint						iSetAttribs;
   340 	TUint						iClearAttribs;
   341 	TTestParamPrsAttribsTime	iSrcPrsAT;
   342 	};
   343 
   344 struct TTestCaseBinaryAttribTime
   345 	{
   346 	TTestParamBasic 			iBasic;
   347 	TTestParamPrsAttribsTime	iSrcPrsAT;
   348 	TTestParamPrsAttribsTime	iTrgPrsAT;
   349 	};
   350 
   351 ////////////////////////////////////////////////////////////
   352 //	An interface between test framework and test cases
   353 ////////////////////////////////////////////////////////////
   354 class TTestParamAll
   355 	{
   356 public:
   357 	TUint 			iTestCaseID;
   358 	TTestingAPI		iAPI;
   359 	TUint 			iSwitch;
   360 	TInt			iSyncReturn;
   361 	TInt			iAsyncReturn;
   362 	TInt			iAsyncStatus;
   363 
   364 	TUint			iSetAttribs;
   365 	TUint			iClearAttribs;
   366 	TTime			iSetModified;
   367 
   368 	TChar* 			iSrcDrvChar;
   369 	TPtrC			iSrcCmdPath;
   370 
   371 	TPtrC			iSrcPrsPath;
   372 	TDirSetupFiles 	iSrcPrsFiles;
   373 	TUint			iSrcPrsAttribs;
   374 	TTime			iSrcPrsTime;
   375 	TBool			iSrcPrsFileOpen;
   376 
   377 	TPtrC			iSrcCmpPath;
   378 	TDirSetupFiles 	iSrcCmpFiles;
   379 	TUint			iSrcCmpAttribs;
   380 	TTime			iSrcCmpTime;
   381 	TBool			iSrcCmpFileOpen;
   382 
   383 	TChar* 			iTrgDrvChar;
   384 	TPtrC			iTrgCmdPath;
   385 
   386 	TPtrC			iTrgPrsPath;
   387 	TDirSetupFiles 	iTrgPrsFiles;
   388 	TUint			iTrgPrsAttribs;
   389 	TTime			iTrgPrsTime;
   390 	TBool			iTrgPrsFileOpen;
   391 
   392 	TPtrC			iTrgCmpPath;
   393 	TDirSetupFiles 	iTrgCmpFiles;
   394 	TUint			iTrgCmpAttribs;
   395 	TTime			iTrgCmpTime;
   396 	TBool			iTrgCmpFileOpen;
   397 	};
   398 #endif /*T_CFILEMAN_AUX_H*/