Move GrowthLimit to a run-test.

Change-Id: I33853625e095f35cc0cf6310c5e4401980322623
diff --git a/build/Android.common.mk b/build/Android.common.mk
index 5d9fc4b..314b25a 100644
--- a/build/Android.common.mk
+++ b/build/Android.common.mk
@@ -429,7 +429,6 @@
 	HelloWorld \
 	\
 	ExceptionTest \
-	GrowthLimit \
 	IntMath \
 	Invoke \
 	ParallelGC \
diff --git a/test/104-growth-limit/expected.txt b/test/104-growth-limit/expected.txt
new file mode 100644
index 0000000..f75da10
--- /dev/null
+++ b/test/104-growth-limit/expected.txt
@@ -0,0 +1 @@
+Test complete
diff --git a/test/104-growth-limit/info.txt b/test/104-growth-limit/info.txt
new file mode 100644
index 0000000..adef4ed
--- /dev/null
+++ b/test/104-growth-limit/info.txt
@@ -0,0 +1,3 @@
+Tests that the growth limit, used to impose the small and large Android
+conventions, can be cleared and the resulting heap is at least as large
+as the growth limited heap.
diff --git a/test/GrowthLimit/GrowthLimit.java b/test/104-growth-limit/src/Main.java
similarity index 73%
rename from test/GrowthLimit/GrowthLimit.java
rename to test/104-growth-limit/src/Main.java
index 32537d6..55469db 100644
--- a/test/GrowthLimit/GrowthLimit.java
+++ b/test/104-growth-limit/src/Main.java
@@ -14,14 +14,11 @@
  * limitations under the License.
  */
 
+import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
-public class GrowthLimit {
+public class Main {
 
     public static void main(String[] args) throws Exception {
 
@@ -35,8 +32,13 @@
             }
         } catch (OutOfMemoryError e) {
         }
-        // Expand the heap to the maximum size
-        dalvik.system.VMRuntime.getRuntime().clearGrowthLimit();
+        // Expand the heap to the maximum size.
+        // Reflective equivalent of: dalvik.system.VMRuntime.getRuntime().clearGrowthLimit();
+        Class<?> vm_runtime = Class.forName("dalvik.system.VMRuntime");
+        Method get_runtime = vm_runtime.getDeclaredMethod("getRuntime");
+        Object runtime = get_runtime.invoke(null);
+        Method clear_growth_limit = vm_runtime.getDeclaredMethod("clearGrowthLimit");
+        clear_growth_limit.invoke(runtime);
 
         int alloc2 = 1;
         try {
@@ -53,5 +55,6 @@
                 System.exit(1);
             }
         }
+        System.out.println("Test complete");
     }
 }