kerneltest/e32test/mmu/t_sharedio.cpp
changeset 109 b3a1d9898418
parent 0 a41df078684a
child 257 3e88ff8f41d5
child 293 0659d0e1a03c
equal deleted inserted replaced
102:ef2a444a7410 109:b3a1d9898418
   126 #include <u32hal.h>
   126 #include <u32hal.h>
   127 #include <e32svr.h>
   127 #include <e32svr.h>
   128 #include <f32dbg.h>
   128 #include <f32dbg.h>
   129 #include <e32def.h>
   129 #include <e32def.h>
   130 #include <e32def_private.h>
   130 #include <e32def_private.h>
   131 #include "freeram.h"
       
   132 
   131 
   133 LOCAL_D RTest test(_L("T_SHAREDIO"));
   132 LOCAL_D RTest test(_L("T_SHAREDIO"));
   134 
   133 
   135 const TInt KTestBufferSize = 0x100000;
   134 const TInt KTestBufferSize = 0x100000;
   136 
   135 
   348 
   347 
   349 void CreateWithOOMCheck(TInt aSize, TBool aPhysicalAddress)
   348 void CreateWithOOMCheck(TInt aSize, TBool aPhysicalAddress)
   350 	{
   349 	{
   351 	TInt failResult=KErrGeneral;
   350 	TInt failResult=KErrGeneral;
   352 
   351 
   353 	TInt freeRam = FreeRam(); //This will also add a delay
       
   354 
       
   355 	for(TInt failCount=1; failCount<1000; failCount++)
   352 	for(TInt failCount=1; failCount<1000; failCount++)
   356 		{
   353 		{
   357 		test.Printf(_L("alloc fail count = %d\n"),failCount);
   354 		test.Printf(_L("alloc fail count = %d\n"),failCount);
   358 
   355 
   359 		User::__DbgSetAllocFail(ETrue,RAllocator::EFailNext,failCount);
   356 		User::__DbgSetAllocFail(ETrue,RAllocator::EFailNext,failCount);
   367 		if(failResult==KErrNone)
   364 		if(failResult==KErrNone)
   368 			break;
   365 			break;
   369 
   366 
   370 		test(failResult==KErrNoMemory);
   367 		test(failResult==KErrNoMemory);
   371 		__KHEAP_MARKEND;
   368 		__KHEAP_MARKEND;
   372 
   369 		}
   373 		test(freeRam == FreeRam());  //This will also add a delay
   370 
   374 		}
       
   375 	User::__DbgSetAllocFail(ETrue,RAllocator::ENone,0);
       
   376 	__KHEAP_RESET;
   371 	__KHEAP_RESET;
   377 
   372 
   378 	test.Next(_L("Destroy buffer"));
   373 	test.Next(_L("Destroy buffer"));
   379 	if (aPhysicalAddress)
   374 	if (aPhysicalAddress)
   380 		ldd.DestroyBufferPhysAddr();
   375 		ldd.DestroyBufferPhysAddr();
   381 	else
   376 	else
   382 		ldd.DestroyBuffer();
   377 		ldd.DestroyBuffer();
   383 	
   378 	
   384 	test(freeRam == FreeRam());  //This will also add a delay
   379 	__KHEAP_MARKEND;
   385 	}
   380 	}
   386 
   381 
   387 GLDEF_C TInt E32Main()
   382 GLDEF_C TInt E32Main()
   388     {
   383     {
   389 	TBuf16<512> cmd;
   384 	TBuf16<512> cmd;