equal
deleted
inserted
replaced
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" |
131 |
132 |
132 LOCAL_D RTest test(_L("T_SHAREDIO")); |
133 LOCAL_D RTest test(_L("T_SHAREDIO")); |
133 |
134 |
134 const TInt KTestBufferSize = 0x100000; |
135 const TInt KTestBufferSize = 0x100000; |
135 |
136 |
347 |
348 |
348 void CreateWithOOMCheck(TInt aSize, TBool aPhysicalAddress) |
349 void CreateWithOOMCheck(TInt aSize, TBool aPhysicalAddress) |
349 { |
350 { |
350 TInt failResult=KErrGeneral; |
351 TInt failResult=KErrGeneral; |
351 |
352 |
|
353 TInt freeRam = FreeRam(); //This will also add a delay |
|
354 |
352 for(TInt failCount=1; failCount<1000; failCount++) |
355 for(TInt failCount=1; failCount<1000; failCount++) |
353 { |
356 { |
354 test.Printf(_L("alloc fail count = %d\n"),failCount); |
357 test.Printf(_L("alloc fail count = %d\n"),failCount); |
355 |
358 |
356 User::__DbgSetAllocFail(ETrue,RAllocator::EFailNext,failCount); |
359 User::__DbgSetAllocFail(ETrue,RAllocator::EFailNext,failCount); |
364 if(failResult==KErrNone) |
367 if(failResult==KErrNone) |
365 break; |
368 break; |
366 |
369 |
367 test(failResult==KErrNoMemory); |
370 test(failResult==KErrNoMemory); |
368 __KHEAP_MARKEND; |
371 __KHEAP_MARKEND; |
369 } |
372 |
370 |
373 test(freeRam == FreeRam()); //This will also add a delay |
|
374 } |
|
375 User::__DbgSetAllocFail(ETrue,RAllocator::ENone,0); |
371 __KHEAP_RESET; |
376 __KHEAP_RESET; |
372 |
377 |
373 test.Next(_L("Destroy buffer")); |
378 test.Next(_L("Destroy buffer")); |
374 if (aPhysicalAddress) |
379 if (aPhysicalAddress) |
375 ldd.DestroyBufferPhysAddr(); |
380 ldd.DestroyBufferPhysAddr(); |
376 else |
381 else |
377 ldd.DestroyBuffer(); |
382 ldd.DestroyBuffer(); |
378 |
383 |
379 __KHEAP_MARKEND; |
384 test(freeRam == FreeRam()); //This will also add a delay |
380 } |
385 } |
381 |
386 |
382 GLDEF_C TInt E32Main() |
387 GLDEF_C TInt E32Main() |
383 { |
388 { |
384 TBuf16<512> cmd; |
389 TBuf16<512> cmd; |