lowlevellibsandfws/apputils/tsrc/T_RSCARCHIVE.CPP
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 2006-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 "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 //
       
    15 
       
    16 #include <e32test.h>
       
    17 #include <bautils.h>
       
    18 #include <barsread2.h>
       
    19 #include <barsc2.h>
       
    20 #include <baspi.h>
       
    21 #include "BaArchiveImpl.h"
       
    22 
       
    23 
       
    24 LOCAL_D RTest TheTest(_L("T_RSCARCHIVE"));
       
    25 LOCAL_D RFs TheFs;
       
    26 
       
    27 //Test files
       
    28 _LIT(KXipSpiFile,"z:\\system\\data\\Spi_ECom.SPI");
       
    29 _LIT(KNonXipSpiFile, "c:\\system\\data\\Spi_ECom.SPI");
       
    30 
       
    31 
       
    32 //----------------------UTILITY FUNCTIONS----------------------------------
       
    33 LOCAL_C void CopyFileL(const TDesC& aFrom,const TDesC& aTo)
       
    34 	{
       
    35 	TheFs.Delete(aTo);
       
    36 	CFileMan* man=CFileMan::NewL(TheFs);
       
    37 	TInt r=man->Copy(aFrom,aTo, CFileMan::ERecurse);
       
    38 	delete man;
       
    39 	User::LeaveIfError(r);
       
    40 	User::LeaveIfError(TheFs.SetAtt(aTo,0,KEntryAttReadOnly)); // clear RO
       
    41 	}
       
    42 
       
    43 LOCAL_C void DeleteFile(const TDesC& aFileName)
       
    44 	{
       
    45 	// make sure the file is read/write
       
    46 	TInt err = TheFs.SetAtt(aFileName, 0, KEntryAttReadOnly);
       
    47 	if(err != KErrNone)
       
    48 		{
       
    49 		RDebug::Print(_L("error changing attributes file = %d"),err);
       
    50 		}
       
    51 	// delete the file
       
    52 	err = BaflUtils::DeleteFile(TheFs, aFileName);
       
    53 	if(err != KErrNone)
       
    54 		{
       
    55 		RDebug::Print(_L("error deleting file = %d"),err);
       
    56 		}
       
    57 	}
       
    58 
       
    59 LOCAL_C void DeleteTestFile()
       
    60 	{
       
    61 	DeleteFile(KNonXipSpiFile);
       
    62 	//Testcase 1 files
       
    63 	DeleteFile(_L("c:\\system\\data\\spi_ecom-0-0.spi"));
       
    64 	DeleteFile(_L("c:\\system\\data\\spi_ecom-1-0.spi"));
       
    65 	//Testcase 2 files
       
    66 	DeleteFile(_L("c:\\system\\data\\ecom-1-0.spi"));
       
    67 	DeleteFile(_L("c:\\system\\data\\ecom-1-0.s02"));
       
    68 	DeleteFile(_L("c:\\system\\data\\ecom-2-0.spi"));
       
    69 	DeleteFile(_L("c:\\system\\data\\ecom-2-0.s02"));
       
    70 	//Testcase 3 files
       
    71 	DeleteFile(_L("c:\\system\\data\\cecom-0-0.spi"));
       
    72 	DeleteFile(_L("c:\\system\\data\\cecom-1-0.spi"));
       
    73 	//Testcase 5 files
       
    74 	DeleteFile(_L("c:\\system\\data\\spi_ecom_case-0-0.spi"));
       
    75 	DeleteFile(_L("c:\\system\\data\\spi_ecom_case-1-0.spi"));
       
    76 	}
       
    77 
       
    78 LOCAL_C void CopyTestFile()
       
    79 	{
       
    80 	CopyFileL(KXipSpiFile,KNonXipSpiFile);
       
    81 	//Testcase1 files
       
    82 	CopyFileL(_L("z:\\system\\data\\spi_ecom-0-0.spi"),_L("c:\\system\\data\\spi_ecom-0-0.spi"));
       
    83 	CopyFileL(_L("z:\\system\\data\\spi_ecom-1-0.spi"),_L("c:\\system\\data\\spi_ecom-1-0.spi"));
       
    84 	//Testcase2 files
       
    85 	CopyFileL(_L("z:\\system\\data\\ecom-1-0.spi"),_L("c:\\system\\data\\ecom-1-0.spi"));
       
    86 	CopyFileL(_L("z:\\system\\data\\ecom-1-0.s02"),_L("c:\\system\\data\\ecom-1-0.s02"));
       
    87 	CopyFileL(_L("z:\\system\\data\\ecom-2-0.spi"),_L("c:\\system\\data\\ecom-2-0.spi"));
       
    88 	CopyFileL(_L("z:\\system\\data\\ecom-2-0.s02"),_L("c:\\system\\data\\ecom-2-0.s02"));
       
    89 	//Testcase 3 files
       
    90 	CopyFileL(_L("z:\\system\\data\\cecom-0-0.spi"),_L("c:\\system\\data\\cecom-0-0.spi"));
       
    91 	CopyFileL(_L("z:\\system\\data\\cecom-1-0.spi"),_L("c:\\system\\data\\cecom-1-0.spi"));
       
    92 	//Testcase 5 files
       
    93 	CopyFileL(_L("z:\\system\\data\\spi_ecom_case-0-0.spi"),_L("c:\\system\\data\\spi_ecom_case-0-0.spi"));
       
    94 	CopyFileL(_L("z:\\system\\data\\spi_ecom_case-1-0.spi"),_L("c:\\system\\data\\spi_ecom_case-1-0.spi"));
       
    95 	}
       
    96 
       
    97 //Test macroses and functions
       
    98 LOCAL_C void Check(TInt aValue, TInt aLine)
       
    99 	{
       
   100 	if(!aValue)
       
   101 		{
       
   102 		::DeleteTestFile();
       
   103 		TheTest(EFalse, aLine);
       
   104 		}
       
   105 	}
       
   106 
       
   107 #define TEST(arg) ::Check((arg), __LINE__)
       
   108 
       
   109 //---------------------TEST CASE for RResoureArchive------------------
       
   110 class RStaticPluginInfoTest
       
   111 	{
       
   112 public:
       
   113 	static void TestCase1L(const TDesC& aPath);
       
   114 	static void TestCase2L(const TDesC& aPath);
       
   115 	static void TestCase3L(const TDesC& aPath);
       
   116 	static void TestCase4L(const TDesC& aPath);
       
   117 	static void TestCase5L(const TDesC& aPath);
       
   118 	};
       
   119 
       
   120 typedef void (*FunctionPtr)(const TDesC&);
       
   121 
       
   122 static void DoBasicTestingL(FunctionPtr aFunctionPtr,const TDesC& aPath,const TDesC& aDescription)
       
   123 {
       
   124 	TheTest.Next(aDescription);
       
   125 	__UHEAP_MARK;
       
   126 	TInt startProcessHandleCount;
       
   127 	TInt startThreadHandleCount;
       
   128 	RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
       
   129 
       
   130 	aFunctionPtr(aPath);
       
   131 
       
   132 	TInt endProcessHandleCount;
       
   133 	TInt endThreadHandleCount;
       
   134 	RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
       
   135 
       
   136 	TEST(startProcessHandleCount == endProcessHandleCount);
       
   137 	TEST(startThreadHandleCount  == endThreadHandleCount);
       
   138 
       
   139 	__UHEAP_MARKEND;
       
   140 }
       
   141 
       
   142 
       
   143 static void DoOOMTestingL(FunctionPtr aFunctionPtr,const TDesC& aPath,const TDesC& aDescription)
       
   144 {
       
   145 	TheTest.Next(aDescription);
       
   146 	TInt err;
       
   147 	TInt tryCount = 0;
       
   148 	do
       
   149 		{
       
   150 		__UHEAP_MARK;
       
   151   		// find out the number of open handles
       
   152 		TInt startProcessHandleCount;
       
   153 		TInt startThreadHandleCount;
       
   154 		RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
       
   155 		__UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount);
       
   156 
       
   157 		TRAP(err,aFunctionPtr(aPath));
       
   158 
       
   159 		__UHEAP_SETFAIL(RHeap::ENone, 0);
       
   160 
       
   161 		//Add ReleaseLanguage for Test4
       
   162 		BaflUtils::ReleaseIdealLanguage();
       
   163 
       
   164 		// check that no handles have leaked
       
   165 		TInt endProcessHandleCount;
       
   166 		TInt endThreadHandleCount;
       
   167 		RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
       
   168 
       
   169 		TEST(startProcessHandleCount == endProcessHandleCount);
       
   170 		TEST(startThreadHandleCount  == endThreadHandleCount);
       
   171 		__UHEAP_MARKEND;
       
   172 		} while(err == KErrNoMemory);
       
   173 	RDebug::Print(_L("Success at count=%d\n"),tryCount);
       
   174 }
       
   175 
       
   176 /**
       
   177 @SYMTestCaseID SYSLIB-BAFL-UT-1698
       
   178 @SYMTestCaseDesc Test for creating and deleting newly added constructor for CResourceArchiveImpl
       
   179 @SYMTestPriority High
       
   180 @SYMTestActions
       
   181 -create and delete CResourceArchiveImpl
       
   182 -check for the resource file entry from multiple spi files
       
   183 -and test for the replacing/hiding feature
       
   184 files used
       
   185 -----------------------------------------------------------
       
   186 spi_ecom-0-0.spi |	spi_ecom-1-0.spi  |	Visible resources
       
   187 -----------------------------------------------------------
       
   188 Spi_EComRsc1	 |	hide Spi_EComRsc1 |	Spi_EComRsc2(id=1)
       
   189 Spi_EComRsc2	 |	Spi_EComRsc2	  |	Spi_EComRsc3(id=0)
       
   190 Spi_EComRsc3	 |	Spi_EComRsc4	  |	Spi_EComRsc4(id=1)
       
   191 @SYMTestExpectedResults The test must not fail.
       
   192 @SYMREQ CR0759
       
   193 */
       
   194 void RStaticPluginInfoTest::TestCase1L(const TDesC& aPath)
       
   195 	{
       
   196 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-UT-1698 "));
       
   197 	//create and delete
       
   198 	CResourceArchiveImpl* impl=CResourceArchiveImpl::NewL(TheFs,aPath,_L("Spi_ECom"));
       
   199 	delete impl;
       
   200 
       
   201 	//check and read resource entry
       
   202 	impl=CResourceArchiveImpl::NewL(TheFs,aPath,_L("Spi_ECom"));
       
   203 	CleanupStack::PushL(impl);
       
   204 	HBufC* rscName=NULL;
       
   205 	CResourceFile* rscFile=NULL;
       
   206 	TInt count=0;
       
   207 	while (impl->NextResourceExist())
       
   208 		{
       
   209 		TFileName expectedFile;
       
   210 		expectedFile.Append(aPath);
       
   211 		//test the rsc entry file association
       
   212 		if (count==0 || count==2)
       
   213 			{
       
   214 			expectedFile.Append(_L("spi_ecom-1-0.spi"));
       
   215 			TEST(impl->iRscList[count].iFileNamePtr.Compare(expectedFile)==0);
       
   216 			}
       
   217 		else
       
   218 			{
       
   219 			expectedFile.Append(_L("spi_ecom-0-0.spi"));
       
   220 			TEST(impl->iRscList[count].iFileNamePtr.Compare(expectedFile)==0);
       
   221 			}
       
   222 		count++;
       
   223 		rscFile=impl->NextL(rscName);
       
   224 		TEST(rscFile!=NULL);
       
   225 		TEST(rscName!=NULL);
       
   226 		TBuf<12> buf;
       
   227 		TInt temp=count+1;
       
   228 		buf.AppendFormat(_L("Spi_EComRsc%d"),temp);
       
   229 		TEST(rscName->Compare(buf)==0);
       
   230 		delete rscName;
       
   231 		rscName=NULL;
       
   232 		delete rscFile;
       
   233 		rscFile=NULL;
       
   234 		}
       
   235 	TEST(count==3);
       
   236 
       
   237 	//Testing Reset
       
   238 	TEST(!impl->NextResourceExist());
       
   239 	impl->Reset();
       
   240 	TEST(impl->NextResourceExist());
       
   241 
       
   242 	//Testing Type
       
   243 	const TUid KEcomSpiFileTypeUid = {0x10205C2C};
       
   244 	TEST(impl->Type()==KEcomSpiFileTypeUid);
       
   245 
       
   246 	CleanupStack::PopAndDestroy();
       
   247 	}
       
   248 
       
   249 
       
   250 /**
       
   251 @SYMTestCaseID SYSLIB-BAFL-CT-1695
       
   252 @SYMTestCaseDesc Test that loading of multiple localised spis return a correct list
       
   253 of resource files
       
   254 @SYMTestPriority High
       
   255 @SYMTestActions  Set different language downgrade path before using CResourceArchiveImpl
       
   256 to open a path containing a mix of spi files. Check that the list returned when
       
   257 calling NextL contains the expected resource files.
       
   258 -------------------------------------------------------------------------------
       
   259 Ecom-1-0.spi | Ecom-1-0.s02 | Ecom-2-0.spi | Ecom-2-0.s02  |DGP(1)   | DGP(2-1)
       
   260 ROFS(1)	     | (ROFS1)      | (ROFS2)	   | (ROFS2)       |
       
   261 -------------------------------------------------------------------------------
       
   262 A.RSC		 |	A.R02		|   B.RSC	   |  Hide D.R02   |A.RSC(1) | A.R02(1)
       
   263 B.RSC	     |	D.R02		|			   |  C.R02        |B.RSC(2) | B.RSC(2)
       
   264 C.RSC        |              |              |               |C.RSC(1) | C.R02(2)
       
   265 -------------------------------------------------------------------------------
       
   266 @SYMTestExpectedResults The test must not fail.
       
   267 @SYMREQ CR0759
       
   268 */
       
   269 void RStaticPluginInfoTest::TestCase2L(const TDesC& aPath)
       
   270 	{
       
   271 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-1695 "));
       
   272 	//Language DownGradePath(1)
       
   273 	CResourceArchiveImpl* impl=CResourceArchiveImpl::NewL(TheFs,aPath,_L("ECom"));
       
   274 	CleanupStack::PushL(impl);
       
   275 	HBufC* rscName=NULL;
       
   276 	CResourceFile* rscFile=NULL;
       
   277 	TInt count=0;
       
   278 	while (impl->NextResourceExist())
       
   279 		{
       
   280 		TFileName expectedFile;
       
   281 		expectedFile.Append(aPath);
       
   282 		rscFile=impl->NextL(rscName);
       
   283 		if (count==0)
       
   284 			{
       
   285 			TEST(rscName->Compare(_L("Spi_EComRscA"))==0);
       
   286 			//also testing the spi file association of the resource entry
       
   287 			expectedFile.Append(_L("ecom-1-0.spi"));
       
   288 			TEST(impl->iRscList[count].iFileNamePtr.Compare(expectedFile)==0);
       
   289 			}
       
   290 		if (count==1)
       
   291 			{
       
   292 			TEST(rscName->Compare(_L("Spi_EComRscB"))==0);
       
   293 			expectedFile.Append(_L("ecom-2-0.spi"));
       
   294 			TEST(impl->iRscList[count].iFileNamePtr.Compare(expectedFile)==0);
       
   295 			}
       
   296 		if (count==2)
       
   297 			{
       
   298 			TEST(rscName->Compare(_L("Spi_EComRscC"))==0);
       
   299 			expectedFile.Append(_L("ecom-1-0.spi"));
       
   300 			TEST(impl->iRscList[count].iFileNamePtr.Compare(expectedFile)==0);
       
   301 			}
       
   302 		count++;
       
   303 		delete rscName;
       
   304 		rscName=NULL;
       
   305 		delete rscFile;
       
   306 		rscFile=NULL;
       
   307 		}
       
   308 	TEST(count==3);
       
   309 	CleanupStack::PopAndDestroy();
       
   310 
       
   311 	//Language DownGradePath(2-1)
       
   312 	User::LeaveIfError(BaflUtils::SetIdealLanguage(ELangFrench));
       
   313 	impl=CResourceArchiveImpl::NewL(TheFs,aPath,_L("ECom"));
       
   314 	CleanupStack::PushL(impl);
       
   315 	rscName=NULL;
       
   316 	rscFile=NULL;
       
   317 	count=0;
       
   318 	while (impl->NextResourceExist())
       
   319 		{
       
   320 		TFileName expectedFile;
       
   321 		expectedFile.Append(aPath);
       
   322 		rscFile=impl->NextL(rscName);
       
   323 		if (count==0)
       
   324 			{
       
   325 			TEST(rscName->Compare(_L("Spi_EComRscA"))==0);
       
   326 			//also testing the spi file association of the resource entry
       
   327 			expectedFile.Append(_L("ecom-1-0.s02"));
       
   328 			TEST(impl->iRscList[count].iFileNamePtr.Compare(expectedFile)==0);
       
   329 			}
       
   330 		if (count==1)
       
   331 			{
       
   332 			TEST(rscName->Compare(_L("Spi_EComRscB"))==0);
       
   333 			expectedFile.Append(_L("ecom-2-0.spi"));
       
   334 			TEST(impl->iRscList[count].iFileNamePtr.Compare(expectedFile)==0);
       
   335 			}
       
   336 		if (count==2)
       
   337 			{
       
   338 			TEST(rscName->Compare(_L("Spi_EComRscC"))==0);
       
   339 			expectedFile.Append(_L("ecom-2-0.s02"));
       
   340 			TEST(impl->iRscList[count].iFileNamePtr.Compare(expectedFile)==0);
       
   341 			}
       
   342 		count++;
       
   343 		delete rscName;
       
   344 		rscName=NULL;
       
   345 		delete rscFile;
       
   346 		rscFile=NULL;
       
   347 		}
       
   348 	TEST(count==3);
       
   349 	CleanupStack::PopAndDestroy();
       
   350 
       
   351 	BaflUtils::ReleaseIdealLanguage();
       
   352 	}
       
   353 
       
   354 /**
       
   355 @SYMTestCaseID SYSLIB-BAFL-CT-1696
       
   356 @SYMTestCaseDesc Test opening corrupt file and an inconsistent list of spi files
       
   357 @SYMTestPriority High
       
   358 @SYMTestActions  Try to open an invalid/corrupt spi file. Try to open a list
       
   359 of spi files where one of them has a different spi type, expect this to leave
       
   360 with KErrCorrupt.
       
   361 @SYMTestExpectedResults The test must not fail.
       
   362 @SYMREQ CR0759
       
   363 */
       
   364 //negative testing using cecom-0-0.spi(Corrupt) and cecom-1-0.spi(OK)
       
   365 void RStaticPluginInfoTest::TestCase3L(const TDesC& aPath)
       
   366 	{
       
   367 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-1696 "));
       
   368 	TInt err=KErrNone;
       
   369 	CResourceArchiveImpl* impl=NULL;
       
   370 	//Testing opening single corrupt spi file
       
   371 	TFileName filename;
       
   372 	filename.Append(aPath);
       
   373 	filename.Append(_L("cecom-0-0.spi"));
       
   374 	TRAP(err,impl=CResourceArchiveImpl::NewL(TheFs,filename));
       
   375 	if (err==KErrNoMemory)
       
   376 		User::LeaveNoMemory();
       
   377 	TEST(err==KErrCorrupt);
       
   378 	delete impl;
       
   379 
       
   380 	//Testing opening spi files where one is not a valid spi file
       
   381 	TRAP(err,impl=CResourceArchiveImpl::NewL(TheFs,aPath,_L("CECom")));
       
   382 	if (err==KErrNoMemory)
       
   383 		User::LeaveNoMemory();
       
   384 	TEST(err==KErrCorrupt);
       
   385 	delete impl;
       
   386 	}
       
   387 
       
   388 /**
       
   389 @SYMTestCaseID SYSLIB-BAFL-CT-1697
       
   390 @SYMTestCaseDesc Test opening file which does not exist
       
   391 @SYMTestPriority High
       
   392 @SYMTestActions  Try to open spi files in a specified path but there
       
   393 is no file that matches the specified pattern to look for.
       
   394 @SYMTestExpectedResults The test must not fail.
       
   395 @SYMREQ CR0759
       
   396 */
       
   397 void RStaticPluginInfoTest::TestCase4L(const TDesC& aPath)
       
   398 	{
       
   399 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-1697 "));
       
   400 	TInt err=KErrNone;
       
   401 	TRAP(err,CResourceArchiveImpl* impl=CResourceArchiveImpl::NewL(TheFs,aPath,_L("SpiECom")));
       
   402 	if (err==KErrNoMemory)
       
   403 		User::LeaveNoMemory();
       
   404 	TEST(err==KErrNotFound);
       
   405 	}
       
   406 
       
   407 /**
       
   408 @SYMTestCaseID SYSLIB-BAFL-UT-3473
       
   409 @SYMTestCaseDesc Test that resource selection is case insensitive
       
   410 @SYMTestPriority High
       
   411 @SYMTestActions
       
   412 -create a CResourceArchiveImpl
       
   413 -check the correct resource file entry is chosen from multiple spi files
       
   414 ------------------------------------------------------------------
       
   415 Spi_ECom_Case-0-0.spi |	Spi_ECom_Case-1-0.spi  | Visible resources
       
   416 ------------------------------------------------------------------
       
   417 Spi_EComRsc1	      |	Spi_ECOMRSC1           | Spi_ECOMRSC1(id=1)
       
   418 Spi_ECOMRSC2	      |	Spi_EComRsc2	       | Spi_EComRsc2(id=1)
       
   419 ------------------------------------------------------------------
       
   420 @SYMTestExpectedResults The overridden resource is chosen regardless of case.
       
   421 @SYMDEF DEF105972
       
   422 @SYMUnit CResourceArchiveImpl::ProcessEntryL()
       
   423 */
       
   424 void RStaticPluginInfoTest::TestCase5L(const TDesC& aPath)
       
   425 	{
       
   426 	//check and read resource entry
       
   427 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-UT-3473 "));
       
   428 	CResourceArchiveImpl* impl=CResourceArchiveImpl::NewL(TheFs,aPath,_L("Spi_ECom_Case"));
       
   429 	CleanupStack::PushL(impl);
       
   430 	HBufC* rscName=NULL;
       
   431 	CResourceFile* rscFile=NULL;
       
   432 	TInt count=0;
       
   433 	while (impl->NextResourceExist())
       
   434 		{
       
   435 		TFileName expectedFile;
       
   436 		expectedFile.Append(aPath);
       
   437 		//test that the overridden resource is always chosen
       
   438 		expectedFile.Append(_L("spi_ecom_case-1-0.spi"));
       
   439 		TEST(impl->iRscList[count].iFileNamePtr.CompareF(expectedFile)==0);
       
   440 
       
   441 		count++;
       
   442 		rscFile=impl->NextL(rscName);
       
   443 		TEST(rscFile!=NULL);
       
   444 		TEST(rscName!=NULL);
       
   445 		delete rscName;
       
   446 		rscName=NULL;
       
   447 		delete rscFile;
       
   448 		rscFile=NULL;
       
   449 		}
       
   450 	TEST(count==2);
       
   451 
       
   452 	impl->Reset();
       
   453 	CleanupStack::PopAndDestroy();
       
   454 	}
       
   455 
       
   456 LOCAL_C void DoAllTestsL()
       
   457 	{
       
   458 	CleanupClosePushL(TheFs);
       
   459 	User::LeaveIfError(TheFs.Connect());
       
   460 
       
   461 	TheTest.Printf(_L("Copying SPI files to RAM\r\n"));
       
   462 
       
   463 	//Copying test spi file and individual rsc files that are included inside spi
       
   464 	CopyTestFile();
       
   465 
       
   466 	//Basic Test
       
   467 	DoBasicTestingL(RStaticPluginInfoTest::TestCase1L,_L("z:\\system\\data\\"),_L("Test Case 1 Basic Xip"));
       
   468 	DoBasicTestingL(RStaticPluginInfoTest::TestCase1L,_L("c:\\system\\data\\"),_L("Test Case 1 Basic Non-Xip"));
       
   469 	DoBasicTestingL(RStaticPluginInfoTest::TestCase2L,_L("z:\\system\\data\\"),_L("Test Case 2 Basic Xip"));
       
   470 	DoBasicTestingL(RStaticPluginInfoTest::TestCase2L,_L("c:\\system\\data\\"),_L("Test Case 2 Basic Non-Xip"));
       
   471 	DoBasicTestingL(RStaticPluginInfoTest::TestCase3L,_L("z:\\system\\data\\"),_L("Test Case 3 Basic Xip"));
       
   472 	DoBasicTestingL(RStaticPluginInfoTest::TestCase3L,_L("c:\\system\\data\\"),_L("Test Case 3 Basic Non-Xip"));
       
   473 	DoBasicTestingL(RStaticPluginInfoTest::TestCase4L,_L("z:\\system\\data\\"),_L("Test Case 4 Basic Xip"));
       
   474 	DoBasicTestingL(RStaticPluginInfoTest::TestCase4L,_L("c:\\system\\data\\"),_L("Test Case 4 Basic Non-Xip"));
       
   475 	DoBasicTestingL(RStaticPluginInfoTest::TestCase5L,_L("z:\\system\\data\\"),_L("Test Case 5 Basic Xip"));
       
   476 	DoBasicTestingL(RStaticPluginInfoTest::TestCase5L,_L("c:\\system\\data\\"),_L("Test Case 5 Basic Non-Xip"));
       
   477 
       
   478 	//OOM Test
       
   479 	DoOOMTestingL(RStaticPluginInfoTest::TestCase1L,_L("z:\\system\\data\\"),_L("Test Case 1 OOM Xip"));
       
   480 	DoOOMTestingL(RStaticPluginInfoTest::TestCase1L,_L("c:\\system\\data\\"),_L("Test Case 1 OOM Non-Xip"));
       
   481 	DoOOMTestingL(RStaticPluginInfoTest::TestCase2L,_L("z:\\system\\data\\"),_L("Test Case 2 OOM Xip"));
       
   482 	DoOOMTestingL(RStaticPluginInfoTest::TestCase2L,_L("c:\\system\\data\\"),_L("Test Case 2 OOM Non-Xip"));
       
   483 	DoOOMTestingL(RStaticPluginInfoTest::TestCase3L,_L("z:\\system\\data\\"),_L("Test Case 3 OOM Xip"));
       
   484 	DoOOMTestingL(RStaticPluginInfoTest::TestCase3L,_L("c:\\system\\data\\"),_L("Test Case 3 OOM Non-Xip"));
       
   485 	DoOOMTestingL(RStaticPluginInfoTest::TestCase4L,_L("z:\\system\\data\\"),_L("Test Case 4 OOM Xip"));
       
   486 	DoOOMTestingL(RStaticPluginInfoTest::TestCase4L,_L("c:\\system\\data\\"),_L("Test Case 4 OOM Non-Xip"));
       
   487 	DoOOMTestingL(RStaticPluginInfoTest::TestCase5L,_L("z:\\system\\data\\"),_L("Test Case 5 OOM Xip"));
       
   488 	DoOOMTestingL(RStaticPluginInfoTest::TestCase5L,_L("c:\\system\\data\\"),_L("Test Case 5 OOM Non-Xip"));
       
   489 
       
   490 	//Clearing all the test files we have copied to C
       
   491 	DeleteTestFile();
       
   492 
       
   493 	CleanupStack::PopAndDestroy(1, &TheFs);
       
   494 	}
       
   495 
       
   496 GLDEF_C TInt E32Main()
       
   497 	{
       
   498     __UHEAP_MARK;
       
   499     CTrapCleanup *cleanup=CTrapCleanup::New();
       
   500 	TheTest.Title();
       
   501 	TheTest.Start(_L("Testing RResourceArchive internal class"));
       
   502     TRAPD(err,DoAllTestsL());
       
   503     TheTest.Printf(_L("Error code is %d\n"),err);
       
   504     TEST(err==KErrNone);
       
   505     TheTest.End();
       
   506     TheTest.Close();
       
   507     delete cleanup;
       
   508     __UHEAP_MARKEND;
       
   509 	return(0);
       
   510     }
       
   511