diff options
author | 2018-01-31 07:45:20 -0800 | |
---|---|---|
committer | 2018-01-31 07:55:22 -0800 | |
commit | 45caa1d80a16e51a2a84db751eff4908a62ae864 (patch) | |
tree | 315c135acc0fd16563c6041954cea7ede6f21d90 /test/044-proxy/src | |
parent | f346af51a5d44ee0a3cd26e7e0e1b28ec1c5579f (diff) |
Make test 044-proxy less flaky
Stop the JIT before filling up the heap.
Bug: 69836158
Test: test-art-host
Change-Id: Idb488b645cbab1eb3b2eb64f316b79b1bf4e61af
Diffstat (limited to 'test/044-proxy/src')
-rw-r--r-- | test/044-proxy/src/Main.java | 4 | ||||
-rw-r--r-- | test/044-proxy/src/OOMEOnDispatch.java | 18 |
2 files changed, 11 insertions, 11 deletions
diff --git a/test/044-proxy/src/Main.java b/test/044-proxy/src/Main.java index e44c122e3d..7b70e65b8c 100644 --- a/test/044-proxy/src/Main.java +++ b/test/044-proxy/src/Main.java @@ -54,4 +54,8 @@ public class Main { private static final HashMap<String, String> proxyClassNameMap = new HashMap<String, String>(); private static int uniqueTestProxyClassNum = 0; + + static native void startJit(); + static native void stopJit(); + static native void waitForCompilation(); } diff --git a/test/044-proxy/src/OOMEOnDispatch.java b/test/044-proxy/src/OOMEOnDispatch.java index 94f267980d..2ee57926ae 100644 --- a/test/044-proxy/src/OOMEOnDispatch.java +++ b/test/044-proxy/src/OOMEOnDispatch.java @@ -32,6 +32,11 @@ public class OOMEOnDispatch implements InvocationHandler { OOMEInterface.class.getClassLoader(), new Class[] { OOMEInterface.class }, handler); + // Stop the JIT to be sure nothing is running that could be resolving classes or causing + // verification. + Main.stopJit(); + Main.waitForCompilation(); + int l = 1024 * 1024; while (l > 8) { try { @@ -40,17 +45,6 @@ public class OOMEOnDispatch implements InvocationHandler { l = l/2; } } - // Have an extra run with the exact size of Method objects. The above loop should have - // filled with enough large objects for simplicity and speed, but ensure exact allocation - // size. - final int methodAsByteArrayLength = 40 - 12; // Method size - byte array overhead. - for (;;) { - try { - storage.add(new byte[methodAsByteArrayLength]); - } catch (OutOfMemoryError e) { - break; - } - } try { inf.foo(); @@ -60,6 +54,8 @@ public class OOMEOnDispatch implements InvocationHandler { storage.clear(); System.out.println("Received OOME"); } + + Main.startJit(); } public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { |