diff options
| -rw-r--r-- | test/098-ddmc/src/Main.java | 14 | ||||
| -rw-r--r-- | test/Android.run-test.mk | 7 |
2 files changed, 16 insertions, 5 deletions
diff --git a/test/098-ddmc/src/Main.java b/test/098-ddmc/src/Main.java index f74a17e0ac..4914ba2289 100644 --- a/test/098-ddmc/src/Main.java +++ b/test/098-ddmc/src/Main.java @@ -43,7 +43,9 @@ public class Main { System.out.println("Confirm when we overflow, we don't roll over to zero. b/17392248"); final int overflowAllocations = 64 * 1024; // Won't fit in unsigned 16-bit value. - // Keep the new objects live so they are not garbage collected. + // TODO: Temporary fix. Keep the new objects live so they are not garbage collected. + // This will cause OOM exception for GC stress tests. The root cause is changed behaviour of + // getRecentAllocations(). Working on restoring its old behaviour. b/20037135 Object[] objects = new Object[overflowAllocations]; for (int i = 0; i < overflowAllocations; i++) { objects[i] = new Object(); @@ -53,6 +55,12 @@ public class Main { System.out.println("after > before=" + (after.numberOfEntries > before.numberOfEntries)); System.out.println("after.numberOfEntries=" + after.numberOfEntries); + // TODO: Temporary fix as above. b/20037135 + objects = null; + Runtime.getRuntime().gc(); + final int fillerStrings = 16 * 1024; + String[] strings = new String[fillerStrings]; + System.out.println("Disable and confirm back to empty"); DdmVmInternal.enableRecentAllocations(false); System.out.println("status=" + DdmVmInternal.getRecentAllocationStatus()); @@ -68,8 +76,8 @@ public class Main { System.out.println("Confirm we can reenable twice in a row without losing allocations"); DdmVmInternal.enableRecentAllocations(true); System.out.println("status=" + DdmVmInternal.getRecentAllocationStatus()); - for (int i = 0; i < 16 * 1024; i++) { - objects[i] = new String("fnord"); + for (int i = 0; i < fillerStrings; i++) { + strings[i] = new String("fnord"); } Allocations first = new Allocations(DdmVmInternal.getRecentAllocations()); DdmVmInternal.enableRecentAllocations(true); diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk index e95f147e65..ecea91c5c6 100644 --- a/test/Android.run-test.mk +++ b/test/Android.run-test.mk @@ -230,12 +230,15 @@ endif TEST_ART_BROKEN_NO_RELOCATE_TESTS := # Tests that are broken with GC stress. -TEST_ART_BROKEN_GCSTRESS_RUN_TESTS := +# TODO: remove 098-ddmc from the list once the old behavior of getRecentAllocation() of DDMS +# is restored. b/20037135 +TEST_ART_BROKEN_GCSTRESS_RUN_TESTS := \ + 098-ddmc ifneq (,$(filter gcstress,$(GC_TYPES))) ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \ $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),gcstress,$(JNI_TYPES), \ - $(IMAGE_TYPES), $(PICTEST_TYPES), $(DBEUGGABLE_TYPES), $(TEST_ART_BROKEN_GCSTRESS_RUN_TESTS), $(ALL_ADDRESS_SIZES)) + $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_GCSTRESS_RUN_TESTS), $(ALL_ADDRESS_SIZES)) endif TEST_ART_BROKEN_GCSTRESS_RUN_TESTS := |