kerneltest/e32test/mmu/t_shbuf.cpp
branchRCL_3
changeset 43 c1f20ce4abcf
parent 21 e7d2d738d3c2
child 44 3e88ff8f41d5
--- a/kerneltest/e32test/mmu/t_shbuf.cpp	Thu Aug 19 11:14:22 2010 +0300
+++ b/kerneltest/e32test/mmu/t_shbuf.cpp	Tue Aug 31 16:34:26 2010 +0300
@@ -39,6 +39,8 @@
 
 const TInt* PtrBufSize;
 
+static TInt ThreadCounter = 0;
+
 RShBufTestChannel Ldd;
 
 _LIT(KTestSlave, "SLAVE");
@@ -622,12 +624,14 @@
 		{
 		RShBuf buf;
 		r = buf.Alloc(aPool);
+		RDebug::Printf("alloc buf %d returned %d", bufarray.Count(), r);
 		if (r==KErrNoMemory && KTestPoolSizeInBufs>bufarray.Count())
 			{
 			// try again after a delay, to allow for background resource allocation
 			
 			User::After(1000000);
 			r = buf.Alloc(aPool);
+			RDebug::Printf("re-alloc buf %d returned %d", bufarray.Count(), r);
 			}
 		if (!r)
 			{
@@ -645,6 +649,7 @@
 		{
 		bufarray[--n].Close();
 		}
+	RDebug::Printf("closed bufs");
 
 	User::After(500000);
 
@@ -653,11 +658,13 @@
 	while (n<bufarray.Count())
 		{
 		r = bufarray[n].Alloc(aPool);
+		RDebug::Printf("alloc buf %d returned %d", n, r);
 		if (r==KErrNoMemory)
 			{
 			// try again after a delay, to allow for background resource allocation
 			User::After(1000000);
 			r = bufarray[n].Alloc(aPool);
+			RDebug::Printf("re-alloc buf %d returned %d", n, r);
 			}
 		test_Assert(r == KErrNone, test.Printf(_L("n=%d r=%d\n"), n, r));
 		if(aligned)
@@ -667,12 +674,14 @@
 
 	RShBuf extrabuf;
 	r = extrabuf.Alloc(aPool);
+	RDebug::Printf("alloc extra buf returned %d", r);
 	test_Equal(KErrNoMemory, r);
 
 	while (n)
 		{
 		bufarray[--n].Close();
 		}
+	RDebug::Printf("closed bufs");
 
 	bufarray.Close();
 	}
@@ -1872,9 +1881,9 @@
  */
 void RequestLowSpacePanic(RShPool& aPool, TUint aThreshold1, TUint aThreshold2, TTestLowSpaceType aType, TInt aLine)
 	{
-	static TInt count = 0;
-	count++;
-	test.Printf(_L("RequestLowSpacePanic@%d(%d)\n"), aLine, count);
+	TBuf<40> threadname;
+	threadname.Format(_L("ThreadLowSpacePanic%d"), ++ThreadCounter);
+	test.Printf(_L("RequestLowSpacePanic@%d(%S)\n"), aLine, &threadname);
 	TBool jit = User::JustInTime();
 	User::SetJustInTime(EFalse);
 	TInt expectedpaniccode = KErrNone;	// Initialised to silence compiler warnings
@@ -1897,8 +1906,6 @@
 	RThread threadpanic;
 	TRequestStatus threadpanicrs;
 	TInt r;
-	TBuf<30> threadname;
-	threadname.Format(_L("ThreadLowSpacePanic%d"), count);
 	r = threadpanic.Create(threadname, ThreadLowSpacePanic, KDefaultStackSize, KMinHeapSize, 1 << 20, (TAny*) &targs);
 	test_KErrNone(r);
 	threadpanic.Logon(threadpanicrs);
@@ -1925,7 +1932,10 @@
 	test_KErrNone(r);
 	RThread thread;
 	TRequestStatus threadrs;
-	r = thread.Create(_L("ThreadNotifications"), ThreadNotifications, KDefaultStackSize, KMinHeapSize, 1 << 20, (TAny*) &aPool);
+	TBuf<40> threadname;
+	threadname.Format(_L("ThreadNotifications%d"), ++ThreadCounter);
+	test.Printf(_L("Create %S\n"), &threadname);
+	r = thread.Create(threadname, ThreadNotifications, KDefaultStackSize, KMinHeapSize, 1 << 20, (TAny*) &aPool);
 	test_KErrNone(r);
 	thread.SetPriority(EPriorityMore);
 	thread.Logon(threadrs);
@@ -2077,9 +2087,13 @@
 	RSemaphore sem;
 	r = sem.CreateGlobal(KTestLowSpaceSemaphore, 0);
 	test_KErrNone(r);
+
+	TBuf<40> threadname;
+	threadname.Format(_L("ThreadCancelNotifications%d"), ++ThreadCounter);
+	test.Printf(_L("Create %S\n"), &threadname);
 	RThread thread;
 	TRequestStatus threadrs;
-	r = thread.Create(_L("ThreadCancelNotifications"), ThreadNotifications, KDefaultStackSize, KMinHeapSize, 1 << 20, (TAny*) &aPool);
+	r = thread.Create(threadname, ThreadNotifications, KDefaultStackSize, KMinHeapSize, 1 << 20, (TAny*) &aPool);
 	test_KErrNone(r);
 	thread.SetPriority(EPriorityLess);
 	thread.Logon(threadrs);