diff options
-rw-r--r-- | test/674-hiddenapi/check | 5 | ||||
-rw-r--r-- | test/674-hiddenapi/expected.txt | 5 | ||||
-rw-r--r-- | test/674-hiddenapi/src-art/Main.java | 13 |
3 files changed, 15 insertions, 8 deletions
diff --git a/test/674-hiddenapi/check b/test/674-hiddenapi/check index 660643f1a0..c319a0ae97 100644 --- a/test/674-hiddenapi/check +++ b/test/674-hiddenapi/check @@ -15,6 +15,9 @@ # limitations under the License. # Remove pid and date from the log messages. -grep -vE '^dalvikvm(32|64) E [^]]+]' "$2" | grep -v JNI_OnUnload > "$2.tmp" +grep -vE '^dalvikvm(32|64) E [^]]+]' "$2" \ + | grep -v JNI_OnLoad \ + | grep -v JNI_OnUnload \ + > "$2.tmp" ./default-check "$1" "$2.tmp" diff --git a/test/674-hiddenapi/expected.txt b/test/674-hiddenapi/expected.txt index 727a061248..e69de29bb2 100644 --- a/test/674-hiddenapi/expected.txt +++ b/test/674-hiddenapi/expected.txt @@ -1,5 +0,0 @@ -JNI_OnLoad called -JNI_OnLoad called -JNI_OnLoad called -JNI_OnLoad called -Done 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 = |