diff options
Diffstat (limited to 'test/674-hiddenapi/src-art/Main.java')
-rw-r--r-- | test/674-hiddenapi/src-art/Main.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/674-hiddenapi/src-art/Main.java b/test/674-hiddenapi/src-art/Main.java index 9773e0a9ca..56a644f637 100644 --- a/test/674-hiddenapi/src-art/Main.java +++ b/test/674-hiddenapi/src-art/Main.java @@ -35,18 +35,19 @@ public class Main { // The expectation is that hidden members in parent should be visible to // the child. doTest(false, false); + doUnloading(); // Now append parent dex file to boot class path and run again. This time // the child dex file should not be able to access private APIs of the parent. appendToBootClassLoader(DEX_PARENT_BOOT); doTest(true, false); + doUnloading(); // And finally append to child to boot class path as well. With both in the // boot class path, access should be granted. appendToBootClassLoader(DEX_CHILD); doTest(true, true); - - System.out.println("Done"); + doUnloading(); } private static void doTest(boolean parentInBoot, boolean childInBoot) throws Exception { @@ -129,6 +130,14 @@ public class Main { return tempFile.getAbsolutePath(); } + private static void doUnloading() { + // Do multiple GCs to prevent rare flakiness if some other thread is keeping the + // classloader live. + for (int i = 0; i < 5; ++i) { + Runtime.getRuntime().gc(); + } + } + private static String nativeLibFileName; private static final String DEX_PARENT = |