kerneltest/f32test/loader/t_ldrtst.cpp
changeset 109 b3a1d9898418
parent 0 a41df078684a
child 257 3e88ff8f41d5
child 285 ff5437e4337c
--- a/kerneltest/f32test/loader/t_ldrtst.cpp	Mon May 03 13:47:38 2010 +0300
+++ b/kerneltest/f32test/loader/t_ldrtst.cpp	Fri May 14 17:13:29 2010 +0300
@@ -338,7 +338,7 @@
 		}
 	TCodeSegCreateInfo info;
 	TInt r=iDev.GetCodeSegInfo(h, info);
-	test(r==KErrNone);
+	test_KErrNone(r);
 	TFileName fn;
 	fn.Copy(info.iFileName);
 	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);
@@ -418,21 +418,23 @@
 	test(expected == isCodePaged);
 #endif
 	if ((flags & KModuleFlagXIP) && mmtype!=EMemModelTypeEmul)
-		test(IsRomAddress(aInfo.iEntryPointAddress));
+		{
+		test_Value(aInfo.iEntryPointAddress, IsRomAddress(aInfo.iEntryPointAddress));
+		}
 	else
 		{
-		test(IsRamCodeAddress(aInfo.iEntryPointAddress));
+		test_Value(aInfo.iEntryPointAddress, IsRamCodeAddress(aInfo.iEntryPointAddress));
 		if(mmtype==EMemModelTypeFlexible)
 			{
 			// can't make assumtions about current processes address space
 			}
 		else if (mmtype==EMemModelTypeMultiple)
 			{
-			test(!AddressReadable(aInfo.iEntryPointAddress));
+			test_Value(aInfo.iEntryPointAddress, !AddressReadable(aInfo.iEntryPointAddress));
 			}
 		else
 			{
-			test(AddressReadable(aInfo.iEntryPointAddress));
+			test_Value(aInfo.iEntryPointAddress, AddressReadable(aInfo.iEntryPointAddress));
 			}
 		}
 
@@ -473,20 +475,20 @@
 				{
 				if (!(GetModuleFlags(deps[j])&KModuleFlagExe))
 					{
-					test(aList.iInfo[i].iDllNum==deps[j]);
+					test_Value(aList.iInfo[i].iDllNum, aList.iInfo[i].iDllNum==deps[j]);
 					++i;
 					}
 				++j;
 				}
 			else if (j==ndeps)
 				{
-				test(aList.iInfo[i].iDllNum==aRoot);
+				test_Value(aList.iInfo[i].iDllNum, aList.iInfo[i].iDllNum==aRoot);
 				++i;
 				++j;
 				}
 			else
 				{
-				test(aList.iInfo[i].iDllNum<0);
+				test_Value(aList.iInfo[i].iDllNum, aList.iInfo[i].iDllNum<0);
 				++i;
 				}
 			}
@@ -508,13 +510,17 @@
 		{
 		if (i<nd)
 			{
-			test(aList.iInfo[i].iDllNum>=0);
+			test_Value(aList.iInfo[i].iDllNum, aList.iInfo[i].iDllNum>=0);
 			ml.Remove(aList.iInfo[i].iDllNum);
 			}
 		else if (i==nd && !root_included)
-			test(aList.iInfo[i].iDllNum==aRoot);
+			{
+			test_Value(aList.iInfo[i].iDllNum, aList.iInfo[i].iDllNum == aRoot);
+			}
 		else
-			test(aList.iInfo[i].iDllNum<0);
+			{
+			test_Value(aList.iInfo[i].iDllNum, aList.iInfo[i].iDllNum<0);
+			}
 		}
 	test(ml.iCount==0);
 	}
@@ -536,11 +542,11 @@
 	{
 	test.Next(_L("Load device driver"));
 	TInt r=User::LoadLogicalDevice(_L("D_LDRTST"));
-	test(r==KErrNone || r==KErrAlreadyExists);
+	test_Value(r, r==KErrNone || r==KErrAlreadyExists);
 	r=iDev.Open();
-	test(r==KErrNone);
+	test_KErrNone(r);
 	r=iFs.Connect();
-	test(r==KErrNone);
+	test_KErrNone(r);
 
 	TBuf<256> cmdline;
 	User::CommandLine(cmdline);
@@ -599,14 +605,14 @@
 		r=LoadExe(x, 0, p, tt);
 		test.Printf(_L("LoadExe(%d)->%d\n"),x,r);
 		test.Printf(_L("BENCHMARK: LoadExe(%d)->%dms\n"),x,tt);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		RLoaderTest lt;
 		r=lt.Connect(x);
 		test.Printf(_L("Connect(%d)->%d\n"),x,r);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		TModuleList exe_info;
 		r=lt.GetExeDepList(exe_info.iInfo);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		exe_info.SetCount();
 		DumpModuleList(exe_info, x);
 		CheckModuleList(x, exe_info);
@@ -675,7 +681,7 @@
 				test(r==y);
 				r=lt.CloseDll(h);
 				test.Printf(_L("CloseDll(%d)->%d\n"),h,r);
-				test(r==KErrNone);
+				test_KErrNone(r);
 				test(lt.GetCDList(dll_d_info.iInfo)==KErrNone);
 				dll_d_info.SetCount();
 				dll_d_info.Display(_L("Destruct:  "));
@@ -744,10 +750,10 @@
 		r=LoadExe(x, 0, p1, tt);
 		test.Printf(_L("LoadExe1(%d)->%d\n"),x,r);
 		test.Printf(_L("BENCHMARK: LoadExe1(%d)->%dms\n"),x,tt);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		r=lt1.Connect(x, 0);
 		test.Printf(_L("Connect1(%d)->%d\n"),x,r);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		TInt s=DetermineLoadExe2Result(x);
 		r=LoadExe(x, 1, p2, tt);
 		test.Printf(_L("LoadExe2(%d)->%d (%d)\n"),x,r,s);
@@ -759,13 +765,13 @@
 			{
 			r=lt2.Connect(x, 1);
 			test.Printf(_L("Connect2(%d)->%d\n"),x,r);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			r=lt1.GetExeDepList(exe_info1.iInfo);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			exe_info1.SetCount();
 			DumpModuleList(exe_info1, x);
 			r=lt2.GetExeDepList(exe_info2.iInfo);
-			test(r==KErrNone);
+			test_KErrNone(r);
 			exe_info2.SetCount();
 			DumpModuleList(exe_info2, x);
 
@@ -852,7 +858,7 @@
 
 						r=lt2.CloseDll(h2);
 						test.Printf(_L("CloseDll2(%d)->%d\n"),h2,r);
-						test(r==KErrNone);
+						test_KErrNone(r);
 						test(lt2.GetCDList(dll_d_info2.iInfo)==KErrNone);
 						dll_d_info2.SetCount();
 						dll_d_info2.Display(_L("Destruct2:  "));
@@ -863,7 +869,7 @@
 
 					r=lt1.CloseDll(h1);
 					test.Printf(_L("CloseDll1(%d)->%d\n"),h1,r);
-					test(r==KErrNone);
+					test_KErrNone(r);
 					test(lt1.GetCDList(dll_d_info1.iInfo)==KErrNone);
 					dll_d_info1.SetCount();
 					dll_d_info1.Display(_L("Destruct1:  "));
@@ -1010,22 +1016,20 @@
 			{
 			r=LoadExe(x, 0, p, tt);
 			test.Printf(_L("LoadExe(%d)->%d\n"),x,r);
-			test(r==KErrNone || (loom.iState!=TLoopOOM::ERFsError && r==KErrNoMemory) || 
+			test_Value(r, r==KErrNone || (loom.iState!=TLoopOOM::ERFsError && r==KErrNoMemory) || 
 				(loom.iState==TLoopOOM::ERFsError && r==KRFsError));
-			if (r==KErrNone)
-				{
-				TInt s=lt.Connect(x);
-				test.Printf(_L("Connect(%d)->%d\n"),x,s);
-				test(s==KErrNone);
-				lt.Exit();
-				p.Close();
-				}
+			if (r != KErrNone)
+				continue;
+			r = lt.Connect(x);
+			test_KErrNone(r);
+			lt.Exit();
+			p.Close();
 			}
 		SetLoaderFail(0,0);
 		r=LoadExe(x, 0, p, tt);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		r=lt.Connect(x);
-		test(r==KErrNone);
+		test_KErrNone(r);
 		const TInt* tests=TC_DllOOM;
 		TInt ntests=*tests++;
 		TModuleList list;
@@ -1045,14 +1049,13 @@
 				r=Min(h,0);
 				test.Printf(_L("%d:LoadDll(%d)->%d\n"),x,m,h);
 				
-				test(r==KErrNone || r==KErrNotSupported || KErrNoMemory || 
+				test_Value(r, r==KErrNone || r==KErrNotSupported || r==KErrNoMemory || 
 					(loom.iState==TLoopOOM::ERFsError && r==KRFsError) );
-					
-				if (r==KErrNone)
-					{
-					TInt s=lt.CloseDll(h);
-					test(s==KErrNone);
-					}
+				if (r!=KErrNone)
+					continue;
+
+				r=lt.CloseDll(h);
+				test_KErrNone(r);
 				}
 			}
 		lt.Exit();
@@ -1120,7 +1123,7 @@
 		TUint32 tt;
 		r=LoadExe(x, 0, p, tt);
 		test.Printf(_L("LoadCorruptExe(%d)->%d\n"),x,r);
-		test(r==KErrCorrupt);
+		test_Value(r,r==KErrCorrupt);
 		}
 	}
 
@@ -1153,7 +1156,7 @@
 	hashDir[0] = (TUint8) RFs::GetSystemDriveChar();
 
 	TInt r = Fs.MkDirAll(hashDir);
-	test(r == KErrNone || r == KErrAlreadyExists);
+	test_Value(r, r == KErrNone || r == KErrAlreadyExists);
 
 	for (TInt d = 0; d <= (TInt)sizeof(SpecialDriveList); ++d)
 		{
@@ -1190,7 +1193,7 @@
 		fn.Append(_L(":\\sys\\bin\\"));
 		r = Fs.MkDirAll(fn);
 		test.Printf(_L("MkDirAll %S returns %d\n"), &fn, r);
-		test(r == KErrNone || r == KErrAlreadyExists);
+		test_Value(r, r == KErrNone || r == KErrAlreadyExists);
 		}
 	}
 
@@ -1279,17 +1282,17 @@
 		const TParsePtrC sppc(fnSrc);
 		TBuf<MAX_PATH> sName;
 		r = MapEmulatedFileName(sName, sppc.NameAndExt());
-		test(r == KErrNone);
+		test_KErrNone(r);
 
 		TBuf<MAX_PATH> dName;
 		r = MapEmulatedFileName(dName, fnDest);
-		test(r == KErrNone);
+		test_KErrNone(r);
 
 		BOOL b = Emulator::CopyFile((LPCTSTR)sName.PtrZ(),(LPCTSTR)dName.PtrZ(),FALSE);
 		test(b);
 #else
 		r = fm->Copy(fnSrc, fnDest);
-		test(r == KErrNone);
+		test_KErrNone(r);
 #endif
 
 		r = Fs.SetAtt(fnDest, 0, KEntryAttReadOnly);
@@ -1439,7 +1442,7 @@
 
 		r = Fs.Delete(fnDest);
 		test.Printf(_L("DeleteExecutables:fnDest=%S,del=%d\n"), &fnDest, r);
-		test(r == KErrNone);
+		test_KErrNone(r);
 
 		// only need to delete hash files for binaries copied to removable media,
 		// but simpler to delete and test for KErrNotFound
@@ -1447,7 +1450,7 @@
 		GetHashFileName(fnDest, fnHash);
 		r = Fs.Delete(fnHash);
 		test.Printf(_L("DeleteExecutables,h=%S,hdel=%d\n"), &fnHash, r);
-		test(r == KErrPathNotFound || r == KErrNotFound || r == KErrNone);
+		test_Value(r, r == KErrPathNotFound || r == KErrNotFound || r == KErrNone);
 
 		if (aCorruptMode)
 			++numCorruptFiles;
@@ -1483,7 +1486,7 @@
 	test.Printf(_L("CopyExecutablesL()\n"));
 	CTrapCleanup* cleanup=CTrapCleanup::New();
 	TRAPD(r, CopyExecutablesL());
-	test(r == KErrNone);
+	test_KErrNone(r);
 	delete cleanup;
 
 	if (tm&1)