summaryrefslogtreecommitdiffstats
path: root/test/104-growth-limit
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2015-04-23 16:32:54 -0700
committerMathieu Chartier <mathieuc@google.com>2015-04-23 17:21:26 -0700
commita61894d88fabe45677f491c9f6bde30059a49026 (patch)
treeb9d8b09e5f90792867b6720a1fb4ab5c76cdfa5f /test/104-growth-limit
parent4ceed922d44b68c3fa7cbe670014c9e2e003b92b (diff)
downloadart-a61894d88fabe45677f491c9f6bde30059a49026.zip
art-a61894d88fabe45677f491c9f6bde30059a49026.tar.gz
art-a61894d88fabe45677f491c9f6bde30059a49026.tar.bz2
Fix reflection handling and test flakiness
Fixed reflection invoke to handle exceptions which occur from FindClass or NewObject by throwing these instead of the expected InvocationTargetException. Added test case to 080 for this reflection invoke. Fixed println throwing OOM in 104-growth-limit. Change-Id: I65766e7c3478e299da06fdc3a521fe3f3e8fdba9
Diffstat (limited to 'test/104-growth-limit')
-rw-r--r--test/104-growth-limit/src/Main.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/104-growth-limit/src/Main.java b/test/104-growth-limit/src/Main.java
index d666377..d31cbf1 100644
--- a/test/104-growth-limit/src/Main.java
+++ b/test/104-growth-limit/src/Main.java
@@ -29,26 +29,28 @@ public class Main {
final Method get_runtime = vm_runtime.getDeclaredMethod("getRuntime");
final Object runtime = get_runtime.invoke(null);
final Method clear_growth_limit = vm_runtime.getDeclaredMethod("clearGrowthLimit");
+ List<byte[]> l = new ArrayList<byte[]>();
try {
- List<byte[]> l = new ArrayList<byte[]>();
while (true) {
// Allocate a MB at a time
l.add(new byte[1048576]);
alloc1++;
}
} catch (OutOfMemoryError e) {
+ l = null;
}
// Expand the heap to the maximum size.
clear_growth_limit.invoke(runtime);
int alloc2 = 1;
+ l = new ArrayList<byte[]>();
try {
- List<byte[]> l = new ArrayList<byte[]>();
while (true) {
// Allocate a MB at a time
l.add(new byte[1048576]);
alloc2++;
}
} catch (OutOfMemoryError e2) {
+ l = null;
if (alloc1 > alloc2) {
System.out.println("ERROR: Allocated less memory after growth" +
"limit cleared (" + alloc1 + " MBs > " + alloc2 + " MBs");