os/kernelhwsrv/kerneltest/f32test/rofs/src/t_rofsdir.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/rofs/src/t_rofsdir.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,547 @@
     1.4 +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Test traversal of directories and locating files in directories
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#include <e32std.h>
    1.22 +#include <e32std_private.h>
    1.23 +#define __E32TEST_EXTENSION__
    1.24 +#include <e32test.h>
    1.25 +#include <f32file.h>
    1.26 +#include "utl.h"
    1.27 +
    1.28 +GLREF_D RFs TheFs;
    1.29 +
    1.30 +RTest	test( _L("T_ROFSDIR") );
    1.31 +
    1.32 +_LIT( KTestFile1, "root.txt" );
    1.33 +_LIT( KTestFile2, "Dir1\\level1.txt" );
    1.34 +_LIT( KTestFile3, "Dir1\\Dir2\\level2.txt" );
    1.35 +_LIT( KTestFile4, "Dir1\\Dir2\\Dir3\\level3.txt" );
    1.36 +_LIT( KTestFile5, "Dir1\\Dir2\\Dir3\\Dir4\\level4.txt" );
    1.37 +_LIT( KTestFile6, "Dir1\\Dir2\\Dir3\\Dir4\\Dir5\\level5.txt" );
    1.38 +_LIT( KTestFile7, "Dir1\\Dir2\\Dir3\\Dir4\\Dir5\\Dir6\\level6.txt" );
    1.39 +_LIT( KTestFile8, "Dir1\\Dir2\\Dir3\\Dir4\\Dir5\\Dir6\\Dir7\\level7.txt" );
    1.40 +_LIT( KTestFile9, "DeepDir1\\DeepDir2\\DeepDir3\\DeepDir4\\DeepDir5\\DeepDir6\\DeepDir7\\DeepDir8\\DeepDir9\\DeepDir10\\DeepDir11\\DeepDir12\\DeepDir13\\DeepDir14\\file.txt" );
    1.41 +_LIT( KTestFile10, "Parent\\parfile.txt" );
    1.42 +_LIT( KTestFile11, "Parent\\SubDir1A\\subfileA.txt" );
    1.43 +_LIT( KTestFile12, "Parent\\SubDir1B\\subfileB.txt" );
    1.44 +_LIT( KTestFile13, "Parent\\SubDir1C\\subfileC.txt" );
    1.45 +_LIT( KTestFile14, "Parent\\SubDir1D\\subfileD.txt" );
    1.46 +_LIT( KTestFile15, "Parent\\SubDir1E\\subfileE.txt" );
    1.47 +_LIT( KTestFile16, "Parent\\SubDir1F\\SubSubA\\subsub_a.txt" );
    1.48 +_LIT( KTestFile17, "Parent\\SubDir1F\\SubSubB\\subsub_b.txt" );
    1.49 +_LIT( KTestFile18, "Parent\\SubDir1F\\SubSubC\\subsub_c.txt" );
    1.50 +_LIT( KTestFile19, "Parent\\SubDir1F\\SubSubD\\subsub_d.txt" );
    1.51 +_LIT( KTestFile20, "Mixed\\par1.txt" );
    1.52 +_LIT( KTestFile21, "Mixed\\SubDir1\\sub1.txt" );
    1.53 +_LIT( KTestFile22, "Mixed\\SubDir2\\sub2.txt" );
    1.54 +_LIT( KTestFile23, "Mixed\\SubDir3\\sub3.txt" );
    1.55 +_LIT( KTestFile24, "Mixed\\SubDir4\\sub4.txt" );
    1.56 +_LIT( KTestFile25, "Mixed\\SubDir5\\sub5.txt" );
    1.57 +_LIT( KTestFile26, "Mixed\\SubDir6\\sub6.txt" );
    1.58 +_LIT( KTestFile27, "Mixed\\SubDir7\\sub7.txt" );
    1.59 +_LIT( KTestFile28, "Mixed\\SubDir8\\sub8.txt" );
    1.60 +_LIT( KTestFile29, "Mixed\\par2.txt" );
    1.61 +_LIT( KTestFile30, "Mixed\\par3.txt" );
    1.62 +_LIT( KTestFile31, "Mixed\\par4.txt" );
    1.63 +_LIT( KTestFile32, "Mixed\\par5.txt" );
    1.64 +_LIT( KTestFile33, "Mixed\\par6.txt" );
    1.65 +_LIT( KTestFile34, "Mixed\\par7.txt" );
    1.66 +_LIT( KTestFile35, "Mixed\\par8.txt" );
    1.67 +// required to test extension
    1.68 +_LIT( KTestFile36, "ext.txt" );
    1.69 +_LIT( KTestFile37, "Dir1\\ext.txt" );
    1.70 +_LIT( KTestFile38, "Dir1\\level1_ext.txt" );
    1.71 +//required to test the unique files 
    1.72 +//(Note: These file names depend on the mount ids. Hence change in mount order will affect the test)
    1.73 +_LIT( KTestFile39, "Exattrib\\test1.txt[02-00]" );
    1.74 +_LIT( KTestFile40, "Exattrib\\test1.txt[03-00]");
    1.75 +_LIT( KTestFile41, "Exattrib\\test2.txt[03-00]" );
    1.76 +_LIT( KTestFile42, "Exattrib\\test3-1.txt[02-00]");
    1.77 +_LIT( KTestFile43, "Exattrib\\test5-1.txt[x-y][03-00]");
    1.78 +
    1.79 +const TInt KRootDirEntryCount = 17;
    1.80 +
    1.81 +_LIT( KRootFile, "root.txt" );
    1.82 +_LIT( KRootFileExt, "ext.txt" );
    1.83 +_LIT( KRootDir1, "Dir1" );
    1.84 +_LIT( KRootDeepDir1, "DeepDir1" );
    1.85 +_LIT( KRootDirParent, "Parent" );
    1.86 +_LIT( KRootDirMixed, "Mixed" );
    1.87 +_LIT( KRootDirReadTest, "ReadTest" );
    1.88 +_LIT( KRootDirAttrib, "Attrib" );
    1.89 +_LIT( KRootDirExattrib, "Exattrib" );
    1.90 +_LIT( KRootDirResource, "Resource" );
    1.91 +_LIT( KRootImg, "Img" );
    1.92 +_LIT( KRootSys, "sys" );
    1.93 +_LIT( KRootSystem, "system" );
    1.94 +_LIT( KRootTest, "Test" );
    1.95 +_LIT( KRootDirMultiple, "Multiple" );
    1.96 +_LIT( KRootAutoexec, "autoexec.bat" );
    1.97 +
    1.98 +_LIT( KRootDirScripts, "scripts" );
    1.99 +
   1.100 +
   1.101 +_LIT( KSubDirOnlyBase, "Parent\\SubDir1F\\" );
   1.102 +_LIT( KSubSubPattern, "SubSub%c" );
   1.103 +const TInt KSubDirOnlyCount = 4;
   1.104 +
   1.105 +_LIT( KFilesOnlyBase, "Parent\\SubDir1F\\SubSubA\\" );
   1.106 +_LIT( KSubSubFilePattern, "subsub_%c.txt" );
   1.107 +const TInt KFilesOnlyCount = 1;
   1.108 +
   1.109 +_LIT( KMixedDirBase, "Mixed\\" );
   1.110 +_LIT( KMixedDirPattern, "SubDir%d" );
   1.111 +_LIT( KMixedFilePattern, "par%d.txt" );
   1.112 +const TInt KMixedSubDirCount = 8;
   1.113 +const TInt KMixedSubFileCount = 8;
   1.114 +
   1.115 +
   1.116 +const TInt KMultipleDirEntryCount=14;
   1.117 +_LIT( KMultipleFile1, "new1.txt" );
   1.118 +_LIT( KMultipleFile2, "new2.txt" );
   1.119 +_LIT( KMultipleFile3, "new3.txt" );
   1.120 +_LIT( KMultipleFile4, "replaceme1.txt" );
   1.121 +_LIT( KMultipleFile5, "replaceme2.txt" );
   1.122 +_LIT( KMultipleFile6, "replaceme3.txt" );
   1.123 +_LIT( KMultipleFile7, "replaceme4.txt" );
   1.124 +_LIT( KMultipleFile8, "rom.txt" );
   1.125 +_LIT( KMultipleFile9, "romreplace.txt" );
   1.126 +// required to test multiple rofs
   1.127 +_LIT( KMultipleFile10, "multirofs.txt" );
   1.128 +// files on user data fat partition
   1.129 +_LIT( KMultipleFile11, "new4.txt" );
   1.130 +_LIT( KMultipleFile12, "replaceme5.txt" );
   1.131 +_LIT( KMultipleFile13, "romreplacefat.txt" );
   1.132 +_LIT( KMultipleFile14, "t_file.cpp" );
   1.133 +
   1.134 +const TInt KExattribDirEntryCount = 11;
   1.135 +
   1.136 +_LIT( KExattribFile1, "test1.txt[02-00]" );
   1.137 +_LIT( KExattribFile2, "test1.txt[03-00]" );
   1.138 +_LIT( KExattribFile3, "test2.txt[03-00]" );
   1.139 +_LIT( KExattribFile4, "test3-1.txt[02-00]" );
   1.140 +_LIT( KExattribFile5, "test4-2.txt[03-00]" );
   1.141 +_LIT( KExattribFile6, "test5-1.txt[x-y][03-00]" );
   1.142 +_LIT( KExattribFile7, "test5-2.txt[x-y]" );
   1.143 +_LIT( KExattribFile8, "test8-1.txt[04-00]" );
   1.144 +_LIT( KExattribFile9, "test6-1.txt[04-00]" );
   1.145 +_LIT( KExattribFile10, "test7-1.txt[03-00]" );
   1.146 +_LIT( KExattribFile11, "test7-1.txt[04-00]" );
   1.147 +
   1.148 +_LIT( KDriveBase, " :\\" );
   1.149 +_LIT( KDriveMultiple, "Multiple\\" );
   1.150 +_LIT( KDriveExattrib, "Exattrib\\" );
   1.151 +_LIT( KWildCard, "*" );
   1.152 +
   1.153 +
   1.154 +enum TEntrySet
   1.155 +	{
   1.156 +	ERoot,
   1.157 +	ERootExtension,
   1.158 +	EMultiple,
   1.159 +	EExattrib,
   1.160 +	};
   1.161 +
   1.162 +LOCAL_C void TestOpenFilesL(TInt aDriveToTest, TBool aExtension, TBool aMultipleRofs)
   1.163 +//
   1.164 +// Tests that we can open files in various directories on the drive
   1.165 +//
   1.166 +	{
   1.167 +	TInt index = 35;
   1.168 +	if(aExtension)
   1.169 +		index=37;
   1.170 +	if(aMultipleRofs)
   1.171 +		index=42;
   1.172 +
   1.173 +	const TDesC* const fileArray[43] =
   1.174 +		{
   1.175 +		&KTestFile1, &KTestFile2, &KTestFile3, &KTestFile4, &KTestFile5,
   1.176 +		&KTestFile6, &KTestFile7, &KTestFile8, &KTestFile9, &KTestFile10,
   1.177 +		&KTestFile11, &KTestFile12, &KTestFile13, &KTestFile14, &KTestFile15,
   1.178 +		&KTestFile16, &KTestFile17, &KTestFile18, &KTestFile19, &KTestFile20,
   1.179 +		&KTestFile21, &KTestFile22, &KTestFile23, &KTestFile24, &KTestFile25,
   1.180 +		&KTestFile26, &KTestFile27, &KTestFile28, &KTestFile29, &KTestFile30,
   1.181 +		&KTestFile31, &KTestFile32, &KTestFile33, &KTestFile34, &KTestFile35,
   1.182 +		&KTestFile36, &KTestFile37, &KTestFile38, &KTestFile39, &KTestFile40,
   1.183 +		&KTestFile41, &KTestFile42, &KTestFile43
   1.184 +		};
   1.185 +
   1.186 +	test.Next( _L("Test opening files in directories") );
   1.187 +	TFileName name(KDriveBase);
   1.188 +	name[0] = TText('A' + aDriveToTest);
   1.189 +
   1.190 +	for( TInt i = 0; i < index; i++ )
   1.191 +		{
   1.192 +		name.SetLength( 3 );	// trim back to drive specifier
   1.193 +		if(aExtension && (i==1))
   1.194 +			name.Append( *fileArray[i+36] );
   1.195 +		else
   1.196 +			name.Append( *fileArray[i] );
   1.197 +		test.Printf( _L("Opening file %S\n"), &name );
   1.198 +		RFile file;
   1.199 +		TInt r = file.Open( TheFs, name, EFileRead );
   1.200 +		TEST_FOR_ERROR( r );
   1.201 +		file.Close();
   1.202 +		}
   1.203 +	}
   1.204 +
   1.205 +
   1.206 +LOCAL_C void TestScanDirL(TInt aDriveToTest, TEntrySet aEntrySet)
   1.207 +	//
   1.208 +	// Scan the root directory file
   1.209 +	//
   1.210 +	{
   1.211 +	const TDesC* const rootEntriesExt[ KRootDirEntryCount ] = 
   1.212 +		{
   1.213 +		&KRootFileExt, &KRootFile, &KRootDir1, &KRootDeepDir1, 
   1.214 +		&KRootDirParent, &KRootDirMixed, &KRootDirReadTest, &KRootDirAttrib, &KRootDirExattrib, 
   1.215 +		&KRootDirResource, &KRootImg, &KRootSys, &KRootSystem, &KRootTest, &KRootDirMultiple,
   1.216 +		&KRootDirScripts,
   1.217 +		&KRootAutoexec
   1.218 +		};
   1.219 +
   1.220 +	const TDesC* const rootEntries[ KRootDirEntryCount-1 ] = 
   1.221 +		{
   1.222 +		&KRootFile, &KRootDir1, &KRootDeepDir1, 
   1.223 +		&KRootDirParent, &KRootDirMixed, &KRootDirReadTest, &KRootDirAttrib, &KRootDirExattrib, 
   1.224 +		&KRootDirResource, &KRootImg, &KRootSys, &KRootSystem, &KRootTest, &KRootDirMultiple, 
   1.225 +		&KRootDirScripts,
   1.226 +		&KRootAutoexec
   1.227 +		};
   1.228 +
   1.229 +	const TDesC* const multipleEntries[ KMultipleDirEntryCount ] =
   1.230 +		{
   1.231 +		&KMultipleFile1, &KMultipleFile2, &KMultipleFile3, &KMultipleFile4, &KMultipleFile5,
   1.232 +		&KMultipleFile6, &KMultipleFile7, &KMultipleFile8, &KMultipleFile9, &KMultipleFile10,
   1.233 +		&KMultipleFile11, &KMultipleFile12, &KMultipleFile13, &KMultipleFile14
   1.234 +		};
   1.235 +
   1.236 +	const TDesC* const exattribEntries[ KExattribDirEntryCount ] =
   1.237 +		{
   1.238 +		&KExattribFile1, &KExattribFile2, &KExattribFile3, &KExattribFile4,
   1.239 +		&KExattribFile5, &KExattribFile6, &KExattribFile7, &KExattribFile8,
   1.240 +		&KExattribFile9, &KExattribFile10, &KExattribFile11
   1.241 +		};
   1.242 +
   1.243 +	const TDesC* const *entries = NULL;
   1.244 +	TInt DirCount=0;
   1.245 +	TBool seen[KRootDirEntryCount];
   1.246 +	memclr(seen, KRootDirEntryCount*sizeof(TBool));
   1.247 +	TFileName name(KDriveBase);
   1.248 +	name[0] = TText('A' + aDriveToTest);
   1.249 +	
   1.250 +	switch (aEntrySet)
   1.251 +		{
   1.252 +		case ERoot:
   1.253 +			DirCount=KRootDirEntryCount-1;
   1.254 +			entries=rootEntries;
   1.255 +			test.Next( _L("Scanning root directory") );
   1.256 +		break;
   1.257 +		case ERootExtension:
   1.258 +			DirCount=KRootDirEntryCount;
   1.259 +			entries=rootEntriesExt;
   1.260 +			test.Next( _L("Scanning root extension directory") );
   1.261 +		break;
   1.262 +		case EMultiple:
   1.263 +			DirCount=KMultipleDirEntryCount;
   1.264 +			entries=multipleEntries;
   1.265 +			name.Append(KDriveMultiple);
   1.266 +			test.Next( _L("Scanning multiple directory") );
   1.267 +		break;
   1.268 +		case EExattrib:
   1.269 +			DirCount=KExattribDirEntryCount;
   1.270 +			entries=exattribEntries;
   1.271 +			name.Append(KDriveExattrib);
   1.272 +			test.Next( _L("Scanning Exattrib directory") );
   1.273 +		break;
   1.274 +		default:
   1.275 +			test(EFalse);
   1.276 +		}
   1.277 +
   1.278 +	CDir* dir;
   1.279 +	TInt r = TheFs.GetDir( name, KEntryAttMaskSupported, ESortNone, dir );
   1.280 +	TEST_FOR_ERROR( r );
   1.281 +	
   1.282 +	TInt actualCount = dir->Count();
   1.283 +	for(TInt i = 0; i < actualCount; i++)
   1.284 +		{
   1.285 +		const TEntry& e = dir->operator[](i);
   1.286 +		TFileName lowerName(e.iName);
   1.287 +		lowerName.LowerCase();
   1.288 +		TBool found = EFalse;
   1.289 +		// try to find the name in our list
   1.290 +		for(TInt j = 0; j < DirCount && !found; j++)
   1.291 +			{
   1.292 +			TFileName expectedLower(*entries[j]);
   1.293 +			expectedLower.LowerCase();
   1.294 +			// Check the directory name is that expected.
   1.295 +			found = lowerName == expectedLower;
   1.296 +			if(found)
   1.297 +				{
   1.298 +				if(seen[j])
   1.299 +					{
   1.300 +					test.Printf( _L("ERROR: saw entry %S twice\n"), &e.iName );
   1.301 +					test( EFalse );
   1.302 +					}
   1.303 +				else
   1.304 +					{
   1.305 +					seen[j] = ETrue;
   1.306 +					}
   1.307 +				}
   1.308 +			}
   1.309 +		if (!found)
   1.310 +			{
   1.311 +			test.Printf( _L("ERROR: entry %S unknown\n"), &e.iName );
   1.312 +			test( EFalse );
   1.313 +			}
   1.314 +		}
   1.315 +	// All the entries are those expected but are there enough matching entries.
   1.316 +	// Allow the autoexe.bat to not be present so the test can pass when run 
   1.317 +	// when not part of an auto test rom.
   1.318 +	TInt tolerance = 1;
   1.319 +	if (aEntrySet == ERoot || aEntrySet == ERootExtension)
   1.320 +		{// The "scripts" directory is not present on all roms.
   1.321 +		tolerance++;
   1.322 +		}
   1.323 +	test_Value(actualCount, actualCount >= DirCount-tolerance);
   1.324 +	delete dir;
   1.325 +	}
   1.326 +
   1.327 +
   1.328 +
   1.329 +LOCAL_C void TestSubDirsOnlyL(TInt aDriveToTest)
   1.330 +	//
   1.331 +	// Tests that scanning a directory containing only subdirectories
   1.332 +	// only returns entries marked as directories
   1.333 +	//
   1.334 +	{
   1.335 +	test.Next( _L("Testing scan of dir containing only subdirs") );
   1.336 +	CDir* dir;
   1.337 +
   1.338 +	TFileName name(KDriveBase);
   1.339 +	name[0] = TText('A' + aDriveToTest);
   1.340 +	name.Append( KSubDirOnlyBase );
   1.341 +	name.Append( KWildCard );
   1.342 +
   1.343 +	TInt r = TheFs.GetDir( name, KEntryAttMaskSupported, ESortNone, dir );
   1.344 +	TEST_FOR_ERROR( r );
   1.345 +	
   1.346 +	TEST_FOR_MATCH( dir->Count(), KSubDirOnlyCount );
   1.347 +
   1.348 +	TBuf<32> subEntryName;
   1.349 +	for( TInt i = 0; i < KSubDirOnlyCount; i++ )
   1.350 +		{
   1.351 +		const TEntry& e = dir->operator[](i);
   1.352 +		subEntryName.Format( KSubSubPattern, 'A' + i );
   1.353 +		test.Printf( _L("Found entry %S\n"), &e.iName );
   1.354 +		test( e.iName == subEntryName );
   1.355 +		test( e.IsDir() );
   1.356 +		}
   1.357 +	delete dir;
   1.358 +	}
   1.359 +
   1.360 +
   1.361 +LOCAL_C void TestFilesOnlyL(TInt aDriveToTest)
   1.362 +	//
   1.363 +	// Tests that scanning a directory containing only files
   1.364 +	// does not return any entries marked as files
   1.365 +	//
   1.366 +	{
   1.367 +	test.Next( _L("Testing scan of dir containing only files") );
   1.368 +	CDir* dir;
   1.369 +
   1.370 +	TFileName name(KDriveBase);
   1.371 +	name[0] = TText('A' + aDriveToTest);
   1.372 +	name.Append( KFilesOnlyBase );
   1.373 +	name.Append( KWildCard );
   1.374 +
   1.375 +	TInt r = TheFs.GetDir( name, KEntryAttMaskSupported, ESortNone, dir );
   1.376 +	TEST_FOR_ERROR( r );
   1.377 +	
   1.378 +	TEST_FOR_MATCH( dir->Count(), KFilesOnlyCount );
   1.379 +
   1.380 +	TBuf<32> subEntryName;
   1.381 +	for( TInt i = 0; i < KFilesOnlyCount; i++ )
   1.382 +		{
   1.383 +		const TEntry& e = dir->operator[](i);
   1.384 +		subEntryName.Format( KSubSubFilePattern, 'a' + i );
   1.385 +		test.Printf( _L("Found entry %S\n"), &e.iName );
   1.386 +		test( e.iName == subEntryName );
   1.387 +		test( !e.IsDir() );
   1.388 +		}
   1.389 +	delete dir;
   1.390 +	}
   1.391 +
   1.392 +
   1.393 +LOCAL_C void TestMaskDirsL(TInt aDriveToTest)
   1.394 +	//
   1.395 +	// Test scanning a directory with masking to return only directories
   1.396 +	//
   1.397 +	{
   1.398 +	test.Next( _L("Testing scan of dir masking out files") );
   1.399 +	CDir* dir;
   1.400 +
   1.401 +	TFileName name(KDriveBase);
   1.402 +	name[0] = TText('A' + aDriveToTest);
   1.403 +	name.Append( KMixedDirBase );
   1.404 +	name.Append( KWildCard );
   1.405 +
   1.406 +	TInt r = TheFs.GetDir( name, KEntryAttMatchExclusive | KEntryAttDir, ESortNone, dir );
   1.407 +	TEST_FOR_ERROR( r );
   1.408 +	
   1.409 +	TEST_FOR_MATCH( dir->Count(), KMixedSubDirCount );
   1.410 +
   1.411 +	TBuf<32> subEntryName;
   1.412 +	for( TInt i = 0; i < KMixedSubDirCount; i++ )
   1.413 +		{
   1.414 +		const TEntry& e = dir->operator[](i);
   1.415 +		subEntryName.Format( KMixedDirPattern, i+1 );
   1.416 +		test.Printf( _L("Found entry %S\n"), &e.iName );
   1.417 +		test( e.iName == subEntryName );
   1.418 +		test( e.IsDir() );
   1.419 +		}
   1.420 +	delete dir;
   1.421 +	}
   1.422 +
   1.423 +LOCAL_C void TestMaskFilesL(TInt aDriveToTest)
   1.424 +	//
   1.425 +	// Test scanning a directory with masking to return only files
   1.426 +	//
   1.427 +	{
   1.428 +	test.Next( _L("Testing scan of dir masking out directories") );
   1.429 +	CDir* dir;
   1.430 +
   1.431 +	TFileName name(KDriveBase);
   1.432 +	name[0] = TText('A' + aDriveToTest);
   1.433 +	name.Append( KMixedDirBase );
   1.434 +	name.Append( KWildCard );
   1.435 +
   1.436 +	TInt r = TheFs.GetDir( name, KEntryAttMatchExclude | KEntryAttDir, ESortNone, dir );
   1.437 +	TEST_FOR_ERROR( r );
   1.438 +	
   1.439 +	TEST_FOR_MATCH( dir->Count(), KMixedSubFileCount );
   1.440 +
   1.441 +	TBuf<32> subEntryName;
   1.442 +	for( TInt i = 0; i < KMixedSubFileCount; i++ )
   1.443 +		{
   1.444 +		const TEntry& e = dir->operator[](i);
   1.445 +		subEntryName.Format( KMixedFilePattern, i+1 );
   1.446 +		test.Printf( _L("Found entry %S\n"), &e.iName );
   1.447 +		test( e.iName == subEntryName );
   1.448 +		test( !e.IsDir() );
   1.449 +		}
   1.450 +	delete dir;
   1.451 +	}
   1.452 +
   1.453 +LOCAL_C void TestGetDirL(TInt aDriveToTest)
   1.454 +//
   1.455 +// Test UID scanning of a directory
   1.456 +//
   1.457 +	{
   1.458 +	test.Next( _L("Testing scan of dir with UID bitmask") );
   1.459 +
   1.460 +	TFileName name(KDriveBase);
   1.461 +	name[0] = TText('A' + aDriveToTest);
   1.462 +	name.Append( KRootDirResource );
   1.463 +	name.Append(_L("\\"));
   1.464 +
   1.465 +	const TUid KUidInterfaceImplementationCollectionInfo = {0x101F747D};
   1.466 +	
   1.467 +	TUidType rscUidType(KNullUid,KUidInterfaceImplementationCollectionInfo,KNullUid);
   1.468 +
   1.469 +	CDir* dir;
   1.470 +	TInt r = TheFs.GetDir(name, rscUidType, ESortByUid, dir);
   1.471 +	test(r==KErrNone);
   1.472 +	TInt count = dir->Count();
   1.473 +	test(count==10);
   1.474 +	delete dir;
   1.475 +
   1.476 +	TUidType uidType2(TUid::Uid('X'),TUid::Uid('Y'),TUid::Uid('Z'));
   1.477 +	r = TheFs.GetDir(name, uidType2, ESortByUid, dir);
   1.478 +	test(r==KErrNone);
   1.479 +	count = dir->Count();
   1.480 +	test(count==1);
   1.481 +	delete dir;
   1.482 +	}
   1.483 +
   1.484 +
   1.485 +
   1.486 +//************************
   1.487 +// Entry point
   1.488 +
   1.489 +void DoTestL(TInt aDriveToTest)
   1.490 +	{
   1.491 +	test.Title();
   1.492 +	test.Start( _L("Testing ROFS directory structure") );
   1.493 +
   1.494 +	test.Printf( _L("Looking for ROFS extension..\n"));
   1.495 +	TBool extension = EFalse;
   1.496 +	TFileName name(KDriveBase);
   1.497 +	name[0] = TText('A' + aDriveToTest);
   1.498 +
   1.499 +	name.SetLength( 3 );	// trim back to drive specifier
   1.500 +	name.Append( KTestFile36 );
   1.501 +
   1.502 +	RFile file;
   1.503 +	test.Printf( _L("Attempt to open file %S.."), &name );
   1.504 +	TInt r = file.Open( TheFs, name, EFileRead );
   1.505 +	if(r==KErrNone)
   1.506 +		{
   1.507 +		extension=ETrue;
   1.508 +		file.Close();
   1.509 +		test.Printf( _L("ROFS extension found.\n"));
   1.510 +		}
   1.511 +	else if(r==KErrNotFound)
   1.512 +		{
   1.513 +		test.Printf( _L("Not found, ROFS extension not present.\n"));
   1.514 +		}
   1.515 +
   1.516 +	test.Printf( _L("Looking for multiple ROFS..\n"));
   1.517 +	TBool multipleRofs = EFalse;
   1.518 +	name.SetLength( 3 );	// trim back to drive specifier
   1.519 +	name.Append( KMultipleFile10 );
   1.520 +
   1.521 +	test.Printf( _L("Attempt to open file %S.."), &name );
   1.522 +	r = file.Open( TheFs, name, EFileRead );
   1.523 +	if(r==KErrNone)
   1.524 +		{
   1.525 +		multipleRofs=ETrue;
   1.526 +		file.Close();
   1.527 +		test.Printf( _L("Multiple ROFS found. %S is present.\n"), &name);
   1.528 +		}
   1.529 +	else if(r==KErrNotFound)
   1.530 +		{
   1.531 +		test.Printf( _L("No multiple ROFS found. %S is not present.\n"), &name);
   1.532 +		}
   1.533 +	
   1.534 +	TestOpenFilesL(aDriveToTest,extension,multipleRofs);
   1.535 +	TestScanDirL(aDriveToTest, extension?ERootExtension:ERoot);
   1.536 +	TestSubDirsOnlyL(aDriveToTest);
   1.537 +	TestFilesOnlyL(aDriveToTest);
   1.538 +	TestMaskDirsL(aDriveToTest);
   1.539 +	TestMaskFilesL(aDriveToTest);
   1.540 +	TestGetDirL(aDriveToTest);
   1.541 +
   1.542 +	// Test dir works for muliple rofs
   1.543 +	if (multipleRofs)
   1.544 +	{
   1.545 +		TestScanDirL(aDriveToTest, EMultiple);
   1.546 +		TestScanDirL(aDriveToTest, EExattrib);
   1.547 +	}
   1.548 +
   1.549 +	test.End();
   1.550 +	}