kerneltest/f32test/loader/t_ldrtst.cpp
changeset 109 b3a1d9898418
parent 0 a41df078684a
child 257 3e88ff8f41d5
child 285 ff5437e4337c
equal deleted inserted replaced
102:ef2a444a7410 109:b3a1d9898418
   336 		test(!(flags & KModuleFlagData));
   336 		test(!(flags & KModuleFlagData));
   337 		return;
   337 		return;
   338 		}
   338 		}
   339 	TCodeSegCreateInfo info;
   339 	TCodeSegCreateInfo info;
   340 	TInt r=iDev.GetCodeSegInfo(h, info);
   340 	TInt r=iDev.GetCodeSegInfo(h, info);
   341 	test(r==KErrNone);
   341 	test_KErrNone(r);
   342 	TFileName fn;
   342 	TFileName fn;
   343 	fn.Copy(info.iFileName);
   343 	fn.Copy(info.iFileName);
   344 	test.Printf(_L("DCodeSeg@%08x Data=%08x+%x,%x File %S,attr=0x%x\n"),h,info.iDataRunAddress,info.iDataSize,info.iBssSize,&fn,info.iAttr);
   344 	test.Printf(_L("DCodeSeg@%08x Data=%08x+%x,%x File %S,attr=0x%x\n"),h,info.iDataRunAddress,info.iDataSize,info.iBssSize,&fn,info.iAttr);
   345 	TInt total_data_size=info.iDataSize+info.iBssSize;
   345 	TInt total_data_size=info.iDataSize+info.iBssSize;
   346 #ifndef __WINS__
   346 #ifndef __WINS__
   416 		}
   416 		}
   417 
   417 
   418 	test(expected == isCodePaged);
   418 	test(expected == isCodePaged);
   419 #endif
   419 #endif
   420 	if ((flags & KModuleFlagXIP) && mmtype!=EMemModelTypeEmul)
   420 	if ((flags & KModuleFlagXIP) && mmtype!=EMemModelTypeEmul)
   421 		test(IsRomAddress(aInfo.iEntryPointAddress));
   421 		{
       
   422 		test_Value(aInfo.iEntryPointAddress, IsRomAddress(aInfo.iEntryPointAddress));
       
   423 		}
   422 	else
   424 	else
   423 		{
   425 		{
   424 		test(IsRamCodeAddress(aInfo.iEntryPointAddress));
   426 		test_Value(aInfo.iEntryPointAddress, IsRamCodeAddress(aInfo.iEntryPointAddress));
   425 		if(mmtype==EMemModelTypeFlexible)
   427 		if(mmtype==EMemModelTypeFlexible)
   426 			{
   428 			{
   427 			// can't make assumtions about current processes address space
   429 			// can't make assumtions about current processes address space
   428 			}
   430 			}
   429 		else if (mmtype==EMemModelTypeMultiple)
   431 		else if (mmtype==EMemModelTypeMultiple)
   430 			{
   432 			{
   431 			test(!AddressReadable(aInfo.iEntryPointAddress));
   433 			test_Value(aInfo.iEntryPointAddress, !AddressReadable(aInfo.iEntryPointAddress));
   432 			}
   434 			}
   433 		else
   435 		else
   434 			{
   436 			{
   435 			test(AddressReadable(aInfo.iEntryPointAddress));
   437 			test_Value(aInfo.iEntryPointAddress, AddressReadable(aInfo.iEntryPointAddress));
   436 			}
   438 			}
   437 		}
   439 		}
   438 
   440 
   439 	if (total_data_size!=0)
   441 	if (total_data_size!=0)
   440 		test(CheckDataAddress(info.iDataRunAddress, aInfo.iDllNum, aExeNum));
   442 		test(CheckDataAddress(info.iDataRunAddress, aInfo.iDllNum, aExeNum));
   471 			{
   473 			{
   472 			if (j<ndeps)
   474 			if (j<ndeps)
   473 				{
   475 				{
   474 				if (!(GetModuleFlags(deps[j])&KModuleFlagExe))
   476 				if (!(GetModuleFlags(deps[j])&KModuleFlagExe))
   475 					{
   477 					{
   476 					test(aList.iInfo[i].iDllNum==deps[j]);
   478 					test_Value(aList.iInfo[i].iDllNum, aList.iInfo[i].iDllNum==deps[j]);
   477 					++i;
   479 					++i;
   478 					}
   480 					}
   479 				++j;
   481 				++j;
   480 				}
   482 				}
   481 			else if (j==ndeps)
   483 			else if (j==ndeps)
   482 				{
   484 				{
   483 				test(aList.iInfo[i].iDllNum==aRoot);
   485 				test_Value(aList.iInfo[i].iDllNum, aList.iInfo[i].iDllNum==aRoot);
   484 				++i;
   486 				++i;
   485 				++j;
   487 				++j;
   486 				}
   488 				}
   487 			else
   489 			else
   488 				{
   490 				{
   489 				test(aList.iInfo[i].iDllNum<0);
   491 				test_Value(aList.iInfo[i].iDllNum, aList.iInfo[i].iDllNum<0);
   490 				++i;
   492 				++i;
   491 				}
   493 				}
   492 			}
   494 			}
   493 		}
   495 		}
   494 	TModuleSet ml;
   496 	TModuleSet ml;
   506 	test(ml.iCount==nd);
   508 	test(ml.iCount==nd);
   507 	for (i=0; i<KNumModules; ++i)
   509 	for (i=0; i<KNumModules; ++i)
   508 		{
   510 		{
   509 		if (i<nd)
   511 		if (i<nd)
   510 			{
   512 			{
   511 			test(aList.iInfo[i].iDllNum>=0);
   513 			test_Value(aList.iInfo[i].iDllNum, aList.iInfo[i].iDllNum>=0);
   512 			ml.Remove(aList.iInfo[i].iDllNum);
   514 			ml.Remove(aList.iInfo[i].iDllNum);
   513 			}
   515 			}
   514 		else if (i==nd && !root_included)
   516 		else if (i==nd && !root_included)
   515 			test(aList.iInfo[i].iDllNum==aRoot);
   517 			{
       
   518 			test_Value(aList.iInfo[i].iDllNum, aList.iInfo[i].iDllNum == aRoot);
       
   519 			}
   516 		else
   520 		else
   517 			test(aList.iInfo[i].iDllNum<0);
   521 			{
       
   522 			test_Value(aList.iInfo[i].iDllNum, aList.iInfo[i].iDllNum<0);
       
   523 			}
   518 		}
   524 		}
   519 	test(ml.iCount==0);
   525 	test(ml.iCount==0);
   520 	}
   526 	}
   521 
   527 
   522 LoaderTest::LoaderTest()
   528 LoaderTest::LoaderTest()
   534 
   540 
   535 void LoaderTest::Init()
   541 void LoaderTest::Init()
   536 	{
   542 	{
   537 	test.Next(_L("Load device driver"));
   543 	test.Next(_L("Load device driver"));
   538 	TInt r=User::LoadLogicalDevice(_L("D_LDRTST"));
   544 	TInt r=User::LoadLogicalDevice(_L("D_LDRTST"));
   539 	test(r==KErrNone || r==KErrAlreadyExists);
   545 	test_Value(r, r==KErrNone || r==KErrAlreadyExists);
   540 	r=iDev.Open();
   546 	r=iDev.Open();
   541 	test(r==KErrNone);
   547 	test_KErrNone(r);
   542 	r=iFs.Connect();
   548 	r=iFs.Connect();
   543 	test(r==KErrNone);
   549 	test_KErrNone(r);
   544 
   550 
   545 	TBuf<256> cmdline;
   551 	TBuf<256> cmdline;
   546 	User::CommandLine(cmdline);
   552 	User::CommandLine(cmdline);
   547 	TLex lex(cmdline);
   553 	TLex lex(cmdline);
   548 	TInt i;
   554 	TInt i;
   597 		RProcess p;
   603 		RProcess p;
   598 		TUint32 tt;
   604 		TUint32 tt;
   599 		r=LoadExe(x, 0, p, tt);
   605 		r=LoadExe(x, 0, p, tt);
   600 		test.Printf(_L("LoadExe(%d)->%d\n"),x,r);
   606 		test.Printf(_L("LoadExe(%d)->%d\n"),x,r);
   601 		test.Printf(_L("BENCHMARK: LoadExe(%d)->%dms\n"),x,tt);
   607 		test.Printf(_L("BENCHMARK: LoadExe(%d)->%dms\n"),x,tt);
   602 		test(r==KErrNone);
   608 		test_KErrNone(r);
   603 		RLoaderTest lt;
   609 		RLoaderTest lt;
   604 		r=lt.Connect(x);
   610 		r=lt.Connect(x);
   605 		test.Printf(_L("Connect(%d)->%d\n"),x,r);
   611 		test.Printf(_L("Connect(%d)->%d\n"),x,r);
   606 		test(r==KErrNone);
   612 		test_KErrNone(r);
   607 		TModuleList exe_info;
   613 		TModuleList exe_info;
   608 		r=lt.GetExeDepList(exe_info.iInfo);
   614 		r=lt.GetExeDepList(exe_info.iInfo);
   609 		test(r==KErrNone);
   615 		test_KErrNone(r);
   610 		exe_info.SetCount();
   616 		exe_info.SetCount();
   611 		DumpModuleList(exe_info, x);
   617 		DumpModuleList(exe_info, x);
   612 		CheckModuleList(x, exe_info);
   618 		CheckModuleList(x, exe_info);
   613 
   619 
   614 		TInt m;
   620 		TInt m;
   673 				test.Printf(_L("DLL %d RBlkI->%d\n"),m,r);
   679 				test.Printf(_L("DLL %d RBlkI->%d\n"),m,r);
   674 				y=ModuleRBlkIParams[m][1]+ModuleRBlkIParams[m][0]*DLLNUMOFFSET;
   680 				y=ModuleRBlkIParams[m][1]+ModuleRBlkIParams[m][0]*DLLNUMOFFSET;
   675 				test(r==y);
   681 				test(r==y);
   676 				r=lt.CloseDll(h);
   682 				r=lt.CloseDll(h);
   677 				test.Printf(_L("CloseDll(%d)->%d\n"),h,r);
   683 				test.Printf(_L("CloseDll(%d)->%d\n"),h,r);
   678 				test(r==KErrNone);
   684 				test_KErrNone(r);
   679 				test(lt.GetCDList(dll_d_info.iInfo)==KErrNone);
   685 				test(lt.GetCDList(dll_d_info.iInfo)==KErrNone);
   680 				dll_d_info.SetCount();
   686 				dll_d_info.SetCount();
   681 				dll_d_info.Display(_L("Destruct:  "));
   687 				dll_d_info.Display(_L("Destruct:  "));
   682 				test(dll_d_info.iCount==dll_c_info.iCount);
   688 				test(dll_d_info.iCount==dll_c_info.iCount);
   683 				for (i=0; i<dll_d_info.iCount; ++i)
   689 				for (i=0; i<dll_d_info.iCount; ++i)
   742 		TModuleList exe_info2;
   748 		TModuleList exe_info2;
   743 		TUint32 tt;
   749 		TUint32 tt;
   744 		r=LoadExe(x, 0, p1, tt);
   750 		r=LoadExe(x, 0, p1, tt);
   745 		test.Printf(_L("LoadExe1(%d)->%d\n"),x,r);
   751 		test.Printf(_L("LoadExe1(%d)->%d\n"),x,r);
   746 		test.Printf(_L("BENCHMARK: LoadExe1(%d)->%dms\n"),x,tt);
   752 		test.Printf(_L("BENCHMARK: LoadExe1(%d)->%dms\n"),x,tt);
   747 		test(r==KErrNone);
   753 		test_KErrNone(r);
   748 		r=lt1.Connect(x, 0);
   754 		r=lt1.Connect(x, 0);
   749 		test.Printf(_L("Connect1(%d)->%d\n"),x,r);
   755 		test.Printf(_L("Connect1(%d)->%d\n"),x,r);
   750 		test(r==KErrNone);
   756 		test_KErrNone(r);
   751 		TInt s=DetermineLoadExe2Result(x);
   757 		TInt s=DetermineLoadExe2Result(x);
   752 		r=LoadExe(x, 1, p2, tt);
   758 		r=LoadExe(x, 1, p2, tt);
   753 		test.Printf(_L("LoadExe2(%d)->%d (%d)\n"),x,r,s);
   759 		test.Printf(_L("LoadExe2(%d)->%d (%d)\n"),x,r,s);
   754 		if (s==KErrNone)
   760 		if (s==KErrNone)
   755 			test.Printf(_L("BENCHMARK: LoadExe2(%d)->%dms\n"),x,tt);
   761 			test.Printf(_L("BENCHMARK: LoadExe2(%d)->%dms\n"),x,tt);
   757 
   763 
   758 		if (r==KErrNone)
   764 		if (r==KErrNone)
   759 			{
   765 			{
   760 			r=lt2.Connect(x, 1);
   766 			r=lt2.Connect(x, 1);
   761 			test.Printf(_L("Connect2(%d)->%d\n"),x,r);
   767 			test.Printf(_L("Connect2(%d)->%d\n"),x,r);
   762 			test(r==KErrNone);
   768 			test_KErrNone(r);
   763 			r=lt1.GetExeDepList(exe_info1.iInfo);
   769 			r=lt1.GetExeDepList(exe_info1.iInfo);
   764 			test(r==KErrNone);
   770 			test_KErrNone(r);
   765 			exe_info1.SetCount();
   771 			exe_info1.SetCount();
   766 			DumpModuleList(exe_info1, x);
   772 			DumpModuleList(exe_info1, x);
   767 			r=lt2.GetExeDepList(exe_info2.iInfo);
   773 			r=lt2.GetExeDepList(exe_info2.iInfo);
   768 			test(r==KErrNone);
   774 			test_KErrNone(r);
   769 			exe_info2.SetCount();
   775 			exe_info2.SetCount();
   770 			DumpModuleList(exe_info2, x);
   776 			DumpModuleList(exe_info2, x);
   771 
   777 
   772 			test(exe_info1.iCount==exe_info2.iCount);
   778 			test(exe_info1.iCount==exe_info2.iCount);
   773 			if (s==1)
   779 			if (s==1)
   850 								test(dll_init_info1.iInfo[i].iModuleHandle==dll_init_info2.iInfo[i].iModuleHandle);
   856 								test(dll_init_info1.iInfo[i].iModuleHandle==dll_init_info2.iInfo[i].iModuleHandle);
   851 							}
   857 							}
   852 
   858 
   853 						r=lt2.CloseDll(h2);
   859 						r=lt2.CloseDll(h2);
   854 						test.Printf(_L("CloseDll2(%d)->%d\n"),h2,r);
   860 						test.Printf(_L("CloseDll2(%d)->%d\n"),h2,r);
   855 						test(r==KErrNone);
   861 						test_KErrNone(r);
   856 						test(lt2.GetCDList(dll_d_info2.iInfo)==KErrNone);
   862 						test(lt2.GetCDList(dll_d_info2.iInfo)==KErrNone);
   857 						dll_d_info2.SetCount();
   863 						dll_d_info2.SetCount();
   858 						dll_d_info2.Display(_L("Destruct2:  "));
   864 						dll_d_info2.Display(_L("Destruct2:  "));
   859 						test(dll_d_info2.iCount==dll_c_info2.iCount);
   865 						test(dll_d_info2.iCount==dll_c_info2.iCount);
   860 						for (i=0; i<dll_d_info2.iCount; ++i)
   866 						for (i=0; i<dll_d_info2.iCount; ++i)
   861 							test(dll_d_info2.iInfo[i].iDllNum==dll_c_info2.iInfo[dll_c_info2.iCount-i-1].iDllNum);
   867 							test(dll_d_info2.iInfo[i].iDllNum==dll_c_info2.iInfo[dll_c_info2.iCount-i-1].iDllNum);
   862 						}
   868 						}
   863 
   869 
   864 					r=lt1.CloseDll(h1);
   870 					r=lt1.CloseDll(h1);
   865 					test.Printf(_L("CloseDll1(%d)->%d\n"),h1,r);
   871 					test.Printf(_L("CloseDll1(%d)->%d\n"),h1,r);
   866 					test(r==KErrNone);
   872 					test_KErrNone(r);
   867 					test(lt1.GetCDList(dll_d_info1.iInfo)==KErrNone);
   873 					test(lt1.GetCDList(dll_d_info1.iInfo)==KErrNone);
   868 					dll_d_info1.SetCount();
   874 					dll_d_info1.SetCount();
   869 					dll_d_info1.Display(_L("Destruct1:  "));
   875 					dll_d_info1.Display(_L("Destruct1:  "));
   870 					test(dll_d_info1.iCount==dll_c_info1.iCount);
   876 					test(dll_d_info1.iCount==dll_c_info1.iCount);
   871 					for (i=0; i<dll_d_info1.iCount; ++i)
   877 					for (i=0; i<dll_d_info1.iCount; ++i)
  1008 		RLoaderTest lt;
  1014 		RLoaderTest lt;
  1009 		while(loom.Iterate(r))
  1015 		while(loom.Iterate(r))
  1010 			{
  1016 			{
  1011 			r=LoadExe(x, 0, p, tt);
  1017 			r=LoadExe(x, 0, p, tt);
  1012 			test.Printf(_L("LoadExe(%d)->%d\n"),x,r);
  1018 			test.Printf(_L("LoadExe(%d)->%d\n"),x,r);
  1013 			test(r==KErrNone || (loom.iState!=TLoopOOM::ERFsError && r==KErrNoMemory) || 
  1019 			test_Value(r, r==KErrNone || (loom.iState!=TLoopOOM::ERFsError && r==KErrNoMemory) || 
  1014 				(loom.iState==TLoopOOM::ERFsError && r==KRFsError));
  1020 				(loom.iState==TLoopOOM::ERFsError && r==KRFsError));
  1015 			if (r==KErrNone)
  1021 			if (r != KErrNone)
  1016 				{
  1022 				continue;
  1017 				TInt s=lt.Connect(x);
  1023 			r = lt.Connect(x);
  1018 				test.Printf(_L("Connect(%d)->%d\n"),x,s);
  1024 			test_KErrNone(r);
  1019 				test(s==KErrNone);
  1025 			lt.Exit();
  1020 				lt.Exit();
  1026 			p.Close();
  1021 				p.Close();
       
  1022 				}
       
  1023 			}
  1027 			}
  1024 		SetLoaderFail(0,0);
  1028 		SetLoaderFail(0,0);
  1025 		r=LoadExe(x, 0, p, tt);
  1029 		r=LoadExe(x, 0, p, tt);
  1026 		test(r==KErrNone);
  1030 		test_KErrNone(r);
  1027 		r=lt.Connect(x);
  1031 		r=lt.Connect(x);
  1028 		test(r==KErrNone);
  1032 		test_KErrNone(r);
  1029 		const TInt* tests=TC_DllOOM;
  1033 		const TInt* tests=TC_DllOOM;
  1030 		TInt ntests=*tests++;
  1034 		TInt ntests=*tests++;
  1031 		TModuleList list;
  1035 		TModuleList list;
  1032 		while(ntests--)
  1036 		while(ntests--)
  1033 			{
  1037 			{
  1043 				{
  1047 				{
  1044 				TInt h=lt.LoadDll(m, list.iInfo);
  1048 				TInt h=lt.LoadDll(m, list.iInfo);
  1045 				r=Min(h,0);
  1049 				r=Min(h,0);
  1046 				test.Printf(_L("%d:LoadDll(%d)->%d\n"),x,m,h);
  1050 				test.Printf(_L("%d:LoadDll(%d)->%d\n"),x,m,h);
  1047 				
  1051 				
  1048 				test(r==KErrNone || r==KErrNotSupported || KErrNoMemory || 
  1052 				test_Value(r, r==KErrNone || r==KErrNotSupported || r==KErrNoMemory || 
  1049 					(loom.iState==TLoopOOM::ERFsError && r==KRFsError) );
  1053 					(loom.iState==TLoopOOM::ERFsError && r==KRFsError) );
  1050 					
  1054 				if (r!=KErrNone)
  1051 				if (r==KErrNone)
  1055 					continue;
  1052 					{
  1056 
  1053 					TInt s=lt.CloseDll(h);
  1057 				r=lt.CloseDll(h);
  1054 					test(s==KErrNone);
  1058 				test_KErrNone(r);
  1055 					}
       
  1056 				}
  1059 				}
  1057 			}
  1060 			}
  1058 		lt.Exit();
  1061 		lt.Exit();
  1059 		p.Close();
  1062 		p.Close();
  1060 		if (x==iCmdLine[1])
  1063 		if (x==iCmdLine[1])
  1118 
  1121 
  1119 		RProcess p;
  1122 		RProcess p;
  1120 		TUint32 tt;
  1123 		TUint32 tt;
  1121 		r=LoadExe(x, 0, p, tt);
  1124 		r=LoadExe(x, 0, p, tt);
  1122 		test.Printf(_L("LoadCorruptExe(%d)->%d\n"),x,r);
  1125 		test.Printf(_L("LoadCorruptExe(%d)->%d\n"),x,r);
  1123 		test(r==KErrCorrupt);
  1126 		test_Value(r,r==KErrCorrupt);
  1124 		}
  1127 		}
  1125 	}
  1128 	}
  1126 
  1129 
  1127 // -------- copying files to non-ROM media --------
  1130 // -------- copying files to non-ROM media --------
  1128 
  1131 
  1151 	TBuf<12> hashDir;
  1154 	TBuf<12> hashDir;
  1152 	hashDir = KSysHash;
  1155 	hashDir = KSysHash;
  1153 	hashDir[0] = (TUint8) RFs::GetSystemDriveChar();
  1156 	hashDir[0] = (TUint8) RFs::GetSystemDriveChar();
  1154 
  1157 
  1155 	TInt r = Fs.MkDirAll(hashDir);
  1158 	TInt r = Fs.MkDirAll(hashDir);
  1156 	test(r == KErrNone || r == KErrAlreadyExists);
  1159 	test_Value(r, r == KErrNone || r == KErrAlreadyExists);
  1157 
  1160 
  1158 	for (TInt d = 0; d <= (TInt)sizeof(SpecialDriveList); ++d)
  1161 	for (TInt d = 0; d <= (TInt)sizeof(SpecialDriveList); ++d)
  1159 		{
  1162 		{
  1160 		TInt dr = SpecialDriveList[d];
  1163 		TInt dr = SpecialDriveList[d];
  1161 		TDriveInfo di;
  1164 		TDriveInfo di;
  1188 		TFileName fn;
  1191 		TFileName fn;
  1189 		fn.Append(ch);
  1192 		fn.Append(ch);
  1190 		fn.Append(_L(":\\sys\\bin\\"));
  1193 		fn.Append(_L(":\\sys\\bin\\"));
  1191 		r = Fs.MkDirAll(fn);
  1194 		r = Fs.MkDirAll(fn);
  1192 		test.Printf(_L("MkDirAll %S returns %d\n"), &fn, r);
  1195 		test.Printf(_L("MkDirAll %S returns %d\n"), &fn, r);
  1193 		test(r == KErrNone || r == KErrAlreadyExists);
  1196 		test_Value(r, r == KErrNone || r == KErrAlreadyExists);
  1194 		}
  1197 		}
  1195 	}
  1198 	}
  1196 
  1199 
  1197 void GetNonZFileName(const TDesC& aOrigName, TDes& aNonZName)
  1200 void GetNonZFileName(const TDesC& aOrigName, TDes& aNonZName)
  1198 /**
  1201 /**
  1277 
  1280 
  1278 #ifdef __WINS__
  1281 #ifdef __WINS__
  1279 		const TParsePtrC sppc(fnSrc);
  1282 		const TParsePtrC sppc(fnSrc);
  1280 		TBuf<MAX_PATH> sName;
  1283 		TBuf<MAX_PATH> sName;
  1281 		r = MapEmulatedFileName(sName, sppc.NameAndExt());
  1284 		r = MapEmulatedFileName(sName, sppc.NameAndExt());
  1282 		test(r == KErrNone);
  1285 		test_KErrNone(r);
  1283 
  1286 
  1284 		TBuf<MAX_PATH> dName;
  1287 		TBuf<MAX_PATH> dName;
  1285 		r = MapEmulatedFileName(dName, fnDest);
  1288 		r = MapEmulatedFileName(dName, fnDest);
  1286 		test(r == KErrNone);
  1289 		test_KErrNone(r);
  1287 
  1290 
  1288 		BOOL b = Emulator::CopyFile((LPCTSTR)sName.PtrZ(),(LPCTSTR)dName.PtrZ(),FALSE);
  1291 		BOOL b = Emulator::CopyFile((LPCTSTR)sName.PtrZ(),(LPCTSTR)dName.PtrZ(),FALSE);
  1289 		test(b);
  1292 		test(b);
  1290 #else
  1293 #else
  1291 		r = fm->Copy(fnSrc, fnDest);
  1294 		r = fm->Copy(fnSrc, fnDest);
  1292 		test(r == KErrNone);
  1295 		test_KErrNone(r);
  1293 #endif
  1296 #endif
  1294 
  1297 
  1295 		r = Fs.SetAtt(fnDest, 0, KEntryAttReadOnly);
  1298 		r = Fs.SetAtt(fnDest, 0, KEntryAttReadOnly);
  1296 		test.Printf(_L("CopyExecutables:setatt=%d\n"), r);
  1299 		test.Printf(_L("CopyExecutables:setatt=%d\n"), r);
  1297 		User::LeaveIfError(r);
  1300 		User::LeaveIfError(r);
  1437 		
  1440 		
  1438 		TInt r;
  1441 		TInt r;
  1439 
  1442 
  1440 		r = Fs.Delete(fnDest);
  1443 		r = Fs.Delete(fnDest);
  1441 		test.Printf(_L("DeleteExecutables:fnDest=%S,del=%d\n"), &fnDest, r);
  1444 		test.Printf(_L("DeleteExecutables:fnDest=%S,del=%d\n"), &fnDest, r);
  1442 		test(r == KErrNone);
  1445 		test_KErrNone(r);
  1443 
  1446 
  1444 		// only need to delete hash files for binaries copied to removable media,
  1447 		// only need to delete hash files for binaries copied to removable media,
  1445 		// but simpler to delete and test for KErrNotFound
  1448 		// but simpler to delete and test for KErrNotFound
  1446 		TFileName fnHash;
  1449 		TFileName fnHash;
  1447 		GetHashFileName(fnDest, fnHash);
  1450 		GetHashFileName(fnDest, fnHash);
  1448 		r = Fs.Delete(fnHash);
  1451 		r = Fs.Delete(fnHash);
  1449 		test.Printf(_L("DeleteExecutables,h=%S,hdel=%d\n"), &fnHash, r);
  1452 		test.Printf(_L("DeleteExecutables,h=%S,hdel=%d\n"), &fnHash, r);
  1450 		test(r == KErrPathNotFound || r == KErrNotFound || r == KErrNone);
  1453 		test_Value(r, r == KErrPathNotFound || r == KErrNotFound || r == KErrNone);
  1451 
  1454 
  1452 		if (aCorruptMode)
  1455 		if (aCorruptMode)
  1453 			++numCorruptFiles;
  1456 			++numCorruptFiles;
  1454 		}
  1457 		}
  1455 	}
  1458 	}
  1481 
  1484 
  1482 	// allocate a cleanup stack so can call CFileMan::NewL in CopyExecutables
  1485 	// allocate a cleanup stack so can call CFileMan::NewL in CopyExecutables
  1483 	test.Printf(_L("CopyExecutablesL()\n"));
  1486 	test.Printf(_L("CopyExecutablesL()\n"));
  1484 	CTrapCleanup* cleanup=CTrapCleanup::New();
  1487 	CTrapCleanup* cleanup=CTrapCleanup::New();
  1485 	TRAPD(r, CopyExecutablesL());
  1488 	TRAPD(r, CopyExecutablesL());
  1486 	test(r == KErrNone);
  1489 	test_KErrNone(r);
  1487 	delete cleanup;
  1490 	delete cleanup;
  1488 
  1491 
  1489 	if (tm&1)
  1492 	if (tm&1)
  1490 		pL->TestOneByOne();
  1493 		pL->TestOneByOne();
  1491 	if (tm&2)
  1494 	if (tm&2)