From ffcac1a127687a0ff14099e1b20010bd120c4a9f Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 10 Jan 2011 12:57:36 -0800 Subject: Remove tests for dead API. We removed the implementation, so there's no point trying to test it. (The methods are still there for binary compatibility, which is why this still compiled.) Change-Id: I51f392f3dab542fca0c80fab4974354e2c689b9e --- tests/CoreTests/android/core/HeapTest.java | 90 ------------------------------ 1 file changed, 90 deletions(-) (limited to 'tests') diff --git a/tests/CoreTests/android/core/HeapTest.java b/tests/CoreTests/android/core/HeapTest.java index 6116f5e..98cb28a 100644 --- a/tests/CoreTests/android/core/HeapTest.java +++ b/tests/CoreTests/android/core/HeapTest.java @@ -540,94 +540,4 @@ public class HeapTest extends TestCase { objSize = (objSize * 4) / 5; } } - - // TODO: flaky test - //@SmallTest - public void testExternalOomeLarge() { - /* Just shy of the typical max heap size so that it will actually - * try to allocate it instead of short-circuiting. - */ - final int HUGE_SIZE = (16 * 1024 * 1024 - 32); - - assertFalse(VMRuntime.getRuntime().trackExternalAllocation(HUGE_SIZE)); - } - - /** - * "Allocates" external memory in progressively smaller chunks until there's - * only roughly 16 bytes left. - * - * @return the number of bytes allocated - */ - private long allocateMaxExternal() { - final VMRuntime runtime = VMRuntime.getRuntime(); - final int SIXTEEN_MB = (16 * 1024 * 1024); - final int MIN_SIZE = 16; - long totalAllocated = 0; - boolean success; - - success = false; - try { - /* "Allocate" progressively smaller chunks to "fill up" the entire heap. - */ - int objSize = 1 * 1024 * 1024; - while (objSize >= MIN_SIZE) { - boolean sawFailure = false; - for (int i = 0; i < SIXTEEN_MB / objSize; i++) { - if (runtime.trackExternalAllocation(objSize)) { - totalAllocated += objSize; - } else { - sawFailure = true; - break; - } - } - - if (!sawFailure) { - throw new RuntimeException("Test failed: " + - "no failure while filling heap"); - } - - objSize = (objSize * 4) / 5; - } - success = true; - } finally { - if (!success) { - runtime.trackExternalFree(totalAllocated); - totalAllocated = 0; - } - } - return totalAllocated; - } - - public void xxtest00ExternalOomeSmall() { - VMRuntime.getRuntime().trackExternalFree(allocateMaxExternal()); - } - - /** - * Allocates as much external memory as possible, then allocates from the heap - * until an OOME is caught. - * - * It's nice to run this test while the real heap is small, hence the '00' in its - * name to force it to run before testOomeSmall(). - */ - public void xxtest00CombinedOomeSmall() { - long totalAllocated = 0; - boolean sawEx = false; - try { - totalAllocated = allocateMaxExternal(); - LinkedList list = new LinkedList(); - try { - while (true) { - list.add((Object)new byte[8192]); - } - /*NOTREACHED*/ - } catch (OutOfMemoryError oom) { - sawEx = true; - } - } finally { - VMRuntime.getRuntime().trackExternalFree(totalAllocated); - } - assertTrue(sawEx); - } - - //TODO: test external alloc debugging/inspection } -- cgit v1.1