summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2019-04-17 09:46:47 -0700
committer Andreas Gampe <agampe@google.com> 2019-04-17 09:46:47 -0700
commit1e8c3995c6260953ed3e09ba8f6188210b9f96c0 (patch)
treec86a69823ccebc21a3898bc27b9fdb4d140200bd
parentc771bfebe14a331e5ed4d72d95978e3074eb8ff9 (diff)
PreloadCheck: Add some comments
Test: m Change-Id: I61039d4fc64f0958bc3f81a49f3a78620c86e34c
-rw-r--r--tools/preload-check/device/src/com/android/preload/check/Initialized.java3
-rw-r--r--tools/preload-check/device/src/com/android/preload/check/IntegrityCheck.java6
-rw-r--r--tools/preload-check/device/src/com/android/preload/check/NotInitialized.java3
-rw-r--r--tools/preload-check/device/src/com/android/preload/check/NotInitializedRegex.java8
4 files changed, 19 insertions, 1 deletions
diff --git a/tools/preload-check/device/src/com/android/preload/check/Initialized.java b/tools/preload-check/device/src/com/android/preload/check/Initialized.java
index b21b5f6e024e..81c074c04d4c 100644
--- a/tools/preload-check/device/src/com/android/preload/check/Initialized.java
+++ b/tools/preload-check/device/src/com/android/preload/check/Initialized.java
@@ -16,6 +16,9 @@
package com.android.preload.check;
+/**
+ * Test that the given boot classpath class is initialized.
+ */
public class Initialized {
public static void main(String[] args) throws Exception {
Util.assertInitialized(args[0], null);
diff --git a/tools/preload-check/device/src/com/android/preload/check/IntegrityCheck.java b/tools/preload-check/device/src/com/android/preload/check/IntegrityCheck.java
index 6cc3946d5be6..1c1e927c54c4 100644
--- a/tools/preload-check/device/src/com/android/preload/check/IntegrityCheck.java
+++ b/tools/preload-check/device/src/com/android/preload/check/IntegrityCheck.java
@@ -16,13 +16,16 @@
package com.android.preload.check;
+/**
+ * Test that a helper class is first seen as uninitialized, then initialized after forced.
+ */
public class IntegrityCheck {
public static void main(String[] args) throws Exception {
ClassLoader loader = IntegrityCheck.class.getClassLoader();
Util.assertNotInitialized("com.android.preload.check.IntegrityCheck$StatusHelper", loader);
- Class<?> klass = Class.forName("com.android.preload.check.IntegrityCheck$StatusHelper",
+ Class.forName("com.android.preload.check.IntegrityCheck$StatusHelper",
/* initialize */ true, loader);
Util.assertInitialized("com.android.preload.check.IntegrityCheck$StatusHelper", loader);
@@ -30,6 +33,7 @@ public class IntegrityCheck {
System.out.println("OK");
}
+ @SuppressWarnings("unused")
private static class StatusHelper {
private final static Object defer = new Object();
}
diff --git a/tools/preload-check/device/src/com/android/preload/check/NotInitialized.java b/tools/preload-check/device/src/com/android/preload/check/NotInitialized.java
index d2e98fe205a2..c3d2c7737c7d 100644
--- a/tools/preload-check/device/src/com/android/preload/check/NotInitialized.java
+++ b/tools/preload-check/device/src/com/android/preload/check/NotInitialized.java
@@ -16,6 +16,9 @@
package com.android.preload.check;
+/**
+ * Test that the given boot classpath class is not initialized.
+ */
public class NotInitialized {
public static void main(String[] args) throws Exception {
Util.assertNotInitialized(args[0], null);
diff --git a/tools/preload-check/device/src/com/android/preload/check/NotInitializedRegex.java b/tools/preload-check/device/src/com/android/preload/check/NotInitializedRegex.java
index 261024b030f0..d942bad9b6a8 100644
--- a/tools/preload-check/device/src/com/android/preload/check/NotInitializedRegex.java
+++ b/tools/preload-check/device/src/com/android/preload/check/NotInitializedRegex.java
@@ -23,7 +23,15 @@ import java.util.Enumeration;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+/**
+ * Test boot classpath classes that satisfy a given regular expression to be not initialized.
+ * Optionally check that at least one class was matched.
+ */
public class NotInitializedRegex {
+ /**
+ * First arg (mandatory): regular exception. Second arg (optional): boolean to denote a
+ * required match.
+ */
public static void main(String[] args) throws Exception {
Matcher m = Pattern.compile(args[0]).matcher("");
boolean requiresMatch = args.length > 1 ? Boolean.parseBoolean(args[1]) : false;