AI 146827: am: CL 146742 am: CL 146710 Splitting android.core.tests.apk into several smaller
  apks. Each libcore module gets one apk and luni gets 4.
  Original author: ursg
  Merged from: //branches/cupcake/...
  Original author: android-build

Automated import of CL 146827
diff --git a/tests/core/Android.mk b/tests/core/Android.mk
index c49a183..7a2a708 100644
--- a/tests/core/Android.mk
+++ b/tests/core/Android.mk
@@ -13,44 +13,7 @@
 # limitations under the License.
 
 LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
 
-LOCAL_MODULE_TAGS := ctstests
+BUILD_CTSCORE_PACKAGE:=$(LOCAL_PATH)/ctscore.mk
 
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-#LOCAL_NO_STANDARD_LIBRARIES=true
-LOCAL_JAVA_LIBRARIES := android.test.runner core-tests
-
-LOCAL_PACKAGE_NAME := android.core.tests
-
-include $(BUILD_PACKAGE)
-
-CORETESTS_INTERMEDIATES := $(call intermediates-dir-for,JAVA_LIBRARIES,core-tests,,COMMON)
-
-PACKAGE_INTERMEDIATES := $(intermediates)
-PACKAGE_RESOURCES := $(PACKAGE_INTERMEDIATES)/package_res.apk
-
-$(LOCAL_INSTALLED_MODULE): $(PACKAGE_RESOURCES)
-
-$(PACKAGE_RESOURCES): PRIVATE_INTERMEDIATES_COMMON := $(intermediates.COMMON)
-$(PACKAGE_RESOURCES): PRIVATE_CORETESTS_INTERMEDIATES_COMMON := $(CORETESTS_INTERMEDIATES)
-$(PACKAGE_RESOURCES): PRIVATE_INTERMEDIATES := $(intermediates)
-$(PACKAGE_RESOURCES): PRIVATE_MODULE_STEM := $(LOCAL_BUILT_MODULE_STEM)
-$(PACKAGE_RESOURCES): PRIVATE_RESOURCE_DIRS := $(call all-core-resource-dirs,test)
-$(PACKAGE_RESOURCES): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
-$(PACKAGE_RESOURCES): PRIVATE_PRIVATE_KEY := $(private_key)
-$(PACKAGE_RESOURCES): PRIVATE_CERTIFICATE := $(certificate)
-$(PACKAGE_RESOURCES): $(LOCAL_BUILT_MODULE) $(CORETESTS_INTERMEDIATES)/javalib.jar
-	@echo "Add resources to package ($@)"
-	@rm -rf $(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses
-# javalib.jar should only contain .dex files, but the harmony tests also include
-# some .class files, so get rid of them
-	$(call unzip-jar-files,$(PRIVATE_CORETESTS_INTERMEDIATES_COMMON)/javalib.jar,\
-		$(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses)
-	@find $(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses -type f -name "*.class" -delete
-	@cp $< $@
-	@jar uf $@ -C $(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses .
-	$(sign-package)
-	$(align-package)
-	$(hide) cp $@ $<
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/core/annotation/Android.mk b/tests/core/annotation/Android.mk
new file mode 100644
index 0000000..4778710
--- /dev/null
+++ b/tests/core/annotation/Android.mk
@@ -0,0 +1,32 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Annotation Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/annotation/src/test/java) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.annotation
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/annotation/AndroidManifest.xml
similarity index 89%
copy from tests/core/AndroidManifest.xml
copy to tests/core/annotation/AndroidManifest.xml
index 0c8a9dc..e6de6e6 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/annotation/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.annotation">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.annotation"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/archive/Android.mk b/tests/core/archive/Android.mk
new file mode 100644
index 0000000..3a74941
--- /dev/null
+++ b/tests/core/archive/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Archive Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/archive/src/test/java) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/tests/support) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.archive
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/archive/AndroidManifest.xml
similarity index 89%
copy from tests/core/AndroidManifest.xml
copy to tests/core/archive/AndroidManifest.xml
index 0c8a9dc..c9c64cc 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/archive/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.archive">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.archive"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/concurrent/Android.mk b/tests/core/concurrent/Android.mk
new file mode 100644
index 0000000..413272b
--- /dev/null
+++ b/tests/core/concurrent/Android.mk
@@ -0,0 +1,34 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Concurrent Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := ctstests
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/concurrent/src/test/java) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.concurrent
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/concurrent/AndroidManifest.xml
similarity index 89%
copy from tests/core/AndroidManifest.xml
copy to tests/core/concurrent/AndroidManifest.xml
index 0c8a9dc..c0c8c78 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/concurrent/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.concurrent">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.concurrent"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/crypto/Android.mk b/tests/core/crypto/Android.mk
new file mode 100644
index 0000000..2450ad1
--- /dev/null
+++ b/tests/core/crypto/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# crypto Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/crypto/src/test/java) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.crypto
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/crypto/AndroidManifest.xml
similarity index 90%
copy from tests/core/AndroidManifest.xml
copy to tests/core/crypto/AndroidManifest.xml
index 0c8a9dc..b326287 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/crypto/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.crypto">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.crypto"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/ctscore.mk b/tests/core/ctscore.mk
new file mode 100644
index 0000000..971fa74
--- /dev/null
+++ b/tests/core/ctscore.mk
@@ -0,0 +1,49 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_JAVA_LIBRARIES := android.test.runner
+
+include $(BUILD_PACKAGE)
+
+CORETESTS_INTERMEDIATES := $(call intermediates-dir-for,JAVA_LIBRARIES,core-tests,,COMMON)
+
+PACKAGE_INTERMEDIATES := $(intermediates)
+PACKAGE_RESOURCES := $(PACKAGE_INTERMEDIATES)/package_res.apk
+
+$(LOCAL_INSTALLED_MODULE): $(PACKAGE_RESOURCES)
+
+$(PACKAGE_RESOURCES): PRIVATE_INTERMEDIATES_COMMON := $(intermediates.COMMON)
+$(PACKAGE_RESOURCES): PRIVATE_CORETESTS_INTERMEDIATES_COMMON := $(CORETESTS_INTERMEDIATES)
+$(PACKAGE_RESOURCES): PRIVATE_INTERMEDIATES := $(intermediates)
+$(PACKAGE_RESOURCES): PRIVATE_MODULE_STEM := $(LOCAL_BUILT_MODULE_STEM)
+$(PACKAGE_RESOURCES): PRIVATE_RESOURCE_DIRS := $(call all-core-resource-dirs,test)
+$(PACKAGE_RESOURCES): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
+$(PACKAGE_RESOURCES): PRIVATE_PRIVATE_KEY := $(private_key)
+$(PACKAGE_RESOURCES): PRIVATE_CERTIFICATE := $(certificate)
+$(PACKAGE_RESOURCES): $(LOCAL_BUILT_MODULE) $(CORETESTS_INTERMEDIATES)/javalib.jar
+	@echo "Add resources to package ($@)"
+	@rm -rf $(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses
+# javalib.jar should only contain .dex files, but the harmony tests also include
+# some .class files, so get rid of them
+	$(call unzip-jar-files,$(PRIVATE_CORETESTS_INTERMEDIATES_COMMON)/javalib.jar,\
+		$(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses)
+	@find $(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses -type f -name "*.class" -delete
+	@rm $(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses/classes.dex
+	@cp $< $@
+	@jar uf $@ -C $(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses .
+	$(sign-package)
+	$(align-package)
+	$(hide) cp $@ $<
diff --git a/tests/core/dom/Android.mk b/tests/core/dom/Android.mk
new file mode 100644
index 0000000..47b3dbb
--- /dev/null
+++ b/tests/core/dom/Android.mk
@@ -0,0 +1,32 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# DOM Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/dom/src/test/java) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.dom
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/dom/AndroidManifest.xml
similarity index 90%
copy from tests/core/AndroidManifest.xml
copy to tests/core/dom/AndroidManifest.xml
index 0c8a9dc..a79efbe 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/dom/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.dom">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.dom"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/logging/Android.mk b/tests/core/logging/Android.mk
new file mode 100644
index 0000000..89d1ca9
--- /dev/null
+++ b/tests/core/logging/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Logging Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/logging/src/test/java) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.logging
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/logging/AndroidManifest.xml
similarity index 89%
copy from tests/core/AndroidManifest.xml
copy to tests/core/logging/AndroidManifest.xml
index 0c8a9dc..1d2a2b2 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/logging/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.logging">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.logging"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/luni-io/Android.mk b/tests/core/luni-io/Android.mk
new file mode 100644
index 0000000..f2aae36
--- /dev/null
+++ b/tests/core/luni-io/Android.mk
@@ -0,0 +1,36 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Luni-Io Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/tests/api/java/io) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/io) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/pkg1) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/pkg2) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/luni/AllTestsIo.java \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.luni.io
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/luni-io/AndroidManifest.xml
similarity index 89%
copy from tests/core/AndroidManifest.xml
copy to tests/core/luni-io/AndroidManifest.xml
index 0c8a9dc..1a18433 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/luni-io/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.luni.io">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.luni.io"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/luni-lang/Android.mk b/tests/core/luni-lang/Android.mk
new file mode 100644
index 0000000..225bdf9
--- /dev/null
+++ b/tests/core/luni-lang/Android.mk
@@ -0,0 +1,34 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Luni-Lang Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/lang) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/tests/api/java/lang) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/luni/AllTestsLang.java \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.luni.lang
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/luni-lang/AndroidManifest.xml
similarity index 89%
copy from tests/core/AndroidManifest.xml
copy to tests/core/luni-lang/AndroidManifest.xml
index 0c8a9dc..96f2e6b 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/luni-lang/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.luni.lang">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.luni.lang"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/luni-net/Android.mk b/tests/core/luni-net/Android.mk
new file mode 100644
index 0000000..1092ff1
--- /dev/null
+++ b/tests/core/luni-net/Android.mk
@@ -0,0 +1,36 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Luni-Net Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/net) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/tests/api/java/net) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/http) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/luni/AllTestsNet.java \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.luni.net
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/luni-net/AndroidManifest.xml
similarity index 89%
copy from tests/core/AndroidManifest.xml
copy to tests/core/luni-net/AndroidManifest.xml
index 0c8a9dc..869e80f 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/luni-net/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.luni.net">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.luni.net"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/luni-util/Android.mk b/tests/core/luni-util/Android.mk
new file mode 100644
index 0000000..101cde8
--- /dev/null
+++ b/tests/core/luni-util/Android.mk
@@ -0,0 +1,34 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Luni-Util Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/util) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/tests/api/java/util) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/luni/AllTestsUtil.java \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.luni.util
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/luni-util/AndroidManifest.xml
similarity index 89%
copy from tests/core/AndroidManifest.xml
copy to tests/core/luni-util/AndroidManifest.xml
index 0c8a9dc..4a26e3e 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/luni-util/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.luni.util">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.luni.util"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/luni/Android.mk b/tests/core/luni/Android.mk
new file mode 100644
index 0000000..47c943d
--- /dev/null
+++ b/tests/core/luni/Android.mk
@@ -0,0 +1,35 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Luni Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/tests/api/java/lang) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/tests/java/lang/StrictMath) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni-kernel/src/test/java/) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/luni/AllTests.java \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.luni
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/luni/AndroidManifest.xml
similarity index 90%
copy from tests/core/AndroidManifest.xml
copy to tests/core/luni/AndroidManifest.xml
index 0c8a9dc..fdd602a 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/luni/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.luni">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.luni"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/math/Android.mk b/tests/core/math/Android.mk
new file mode 100644
index 0000000..4c559cd
--- /dev/null
+++ b/tests/core/math/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Math Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/math/src/test/java) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.math
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/math/AndroidManifest.xml
similarity index 90%
copy from tests/core/AndroidManifest.xml
copy to tests/core/math/AndroidManifest.xml
index 0c8a9dc..d3d0bb4 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/math/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.math">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.math"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/nio/Android.mk b/tests/core/nio/Android.mk
new file mode 100644
index 0000000..6ebd1bc
--- /dev/null
+++ b/tests/core/nio/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Nio Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/nio/src/test/java) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.nio
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/nio/AndroidManifest.xml
similarity index 90%
copy from tests/core/AndroidManifest.xml
copy to tests/core/nio/AndroidManifest.xml
index 0c8a9dc..a4d0d7f 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/nio/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.nio">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.nio"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/nio_char/Android.mk b/tests/core/nio_char/Android.mk
new file mode 100644
index 0000000..e3b463a
--- /dev/null
+++ b/tests/core/nio_char/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# NioChar Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/nio_char/src/test/java) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.nio_char
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/nio_char/AndroidManifest.xml
similarity index 89%
copy from tests/core/AndroidManifest.xml
copy to tests/core/nio_char/AndroidManifest.xml
index 0c8a9dc..f6c8f39 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/nio_char/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.nio_char">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.nio_char"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/prefs/Android.mk b/tests/core/prefs/Android.mk
new file mode 100644
index 0000000..f8f225c
--- /dev/null
+++ b/tests/core/prefs/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Prefs Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/prefs/src/test/java) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.prefs
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/prefs/AndroidManifest.xml
similarity index 90%
copy from tests/core/AndroidManifest.xml
copy to tests/core/prefs/AndroidManifest.xml
index 0c8a9dc..462cc08 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/prefs/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.prefs">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.prefs"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/regex/Android.mk b/tests/core/regex/Android.mk
new file mode 100644
index 0000000..70927a0
--- /dev/null
+++ b/tests/core/regex/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Regex Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/regex/src/test/java) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.regex
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/regex/AndroidManifest.xml
similarity index 90%
rename from tests/core/AndroidManifest.xml
rename to tests/core/regex/AndroidManifest.xml
index 0c8a9dc..49d8229 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/regex/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.regex">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.regex"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/security/Android.mk b/tests/core/security/Android.mk
new file mode 100644
index 0000000..76c0ca5
--- /dev/null
+++ b/tests/core/security/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Security Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/security/src/test/java) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.security
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/security/AndroidManifest.xml
similarity index 89%
copy from tests/core/AndroidManifest.xml
copy to tests/core/security/AndroidManifest.xml
index 0c8a9dc..4a1a443 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/security/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.security">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.security"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/sql/Android.mk b/tests/core/sql/Android.mk
new file mode 100644
index 0000000..fe9b4cc
--- /dev/null
+++ b/tests/core/sql/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Sql Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/sql/src/test/java) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.sql
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/sql/AndroidManifest.xml
similarity index 90%
copy from tests/core/AndroidManifest.xml
copy to tests/core/sql/AndroidManifest.xml
index 0c8a9dc..8108e3f 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/sql/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.sql">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.sql"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/src/Dummy.java b/tests/core/src/Dummy.java
deleted file mode 100644
index a20a7bc..0000000
--- a/tests/core/src/Dummy.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * This dummy class is needed, because we can't build an APK with no source
- * files at all. The actual tests are being linked to by "uses-library".
- */
-class Dummy {
-    // This space intentionally left blank.
-}
diff --git a/tests/core/text/Android.mk b/tests/core/text/Android.mk
new file mode 100644
index 0000000..8b9fd1f
--- /dev/null
+++ b/tests/core/text/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Text Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/text/src/test/java) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.text
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/text/AndroidManifest.xml
similarity index 90%
copy from tests/core/AndroidManifest.xml
copy to tests/core/text/AndroidManifest.xml
index 0c8a9dc..41a74fe 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/text/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.text">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.text"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/xml/Android.mk b/tests/core/xml/Android.mk
new file mode 100644
index 0000000..6209841
--- /dev/null
+++ b/tests/core/xml/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Xml Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/xml/src/test/java) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.xml
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/xml/AndroidManifest.xml
similarity index 90%
copy from tests/core/AndroidManifest.xml
copy to tests/core/xml/AndroidManifest.xml
index 0c8a9dc..158d645 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/xml/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.xml">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.xml"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tests/core/xnet/Android.mk b/tests/core/xnet/Android.mk
new file mode 100644
index 0000000..2415f38
--- /dev/null
+++ b/tests/core/xnet/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+    $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+#
+# Xnet Tests
+##########################################################
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/x-net/src/test/java) \
+	$(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
+	$(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
+	../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+
+LOCAL_PACKAGE_NAME := android.core.tests.xnet
+
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/AndroidManifest.xml b/tests/core/xnet/AndroidManifest.xml
similarity index 90%
copy from tests/core/AndroidManifest.xml
copy to tests/core/xnet/AndroidManifest.xml
index 0c8a9dc..32e1b66 100644
--- a/tests/core/AndroidManifest.xml
+++ b/tests/core/xnet/AndroidManifest.xml
@@ -16,14 +16,14 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="android.core.tests">
+    package="android.core.tests.xnet">
     <uses-permission android:name="android.permission.INTERNET" />
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <instrumentation android:name="android.test.InstrumentationCoreTestRunner"
-                     android:targetPackage="android.core.tests"
+                     android:targetPackage="android.core.tests.xnet"
                      android:label="cts framework tests"/>
 
 </manifest>
diff --git a/tools/utils/CollectAllTests.java b/tools/utils/CollectAllTests.java
index e2b6ad1..76f7332 100644
--- a/tools/utils/CollectAllTests.java
+++ b/tools/utils/CollectAllTests.java
@@ -14,19 +14,18 @@
  * limitations under the License.
  */
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
 import java.io.BufferedReader;
-import java.io.FileReader;
-
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.lang.annotation.Annotation;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.LinkedHashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Set;
 
@@ -36,6 +35,7 @@
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestResult;
+import junit.textui.ResultPrinter;
 import junit.textui.TestRunner;
 
 import org.w3c.dom.Document;
@@ -43,10 +43,6 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-import java.lang.annotation.Annotation;
-import java.lang.ClassNotFoundException;
-import java.lang.NoSuchMethodException;
-
 public class CollectAllTests extends DescriptionGenerator {
 
     static final String ATTRIBUTE_RUNNER = "runner";
@@ -115,7 +111,7 @@
         } else {
             System.out.println("usage: \n" +
                 "\t... CollectAllTests <output-file> <manifest-file> <testsuite-class-name> <makefile-file>");
-            return;
+            System.exit(1);
         }
 
         if (ANDROID_MAKE_FILE.length() > 0) {
@@ -128,7 +124,7 @@
         } catch (Exception e) {
             System.err.println("cannot open manifest");
             e.printStackTrace();
-            return;
+            System.exit(1);;
         }
 
         Element documentElement = manifest.getDocumentElement();
@@ -146,7 +142,7 @@
         } catch (ClassNotFoundException e) {
             System.err.println("test class not found");
             e.printStackTrace();
-            return;
+            System.exit(1);;
         }
 
         Method method = null;
@@ -155,11 +151,11 @@
         } catch (SecurityException e) {
             System.err.println("failed to get suite method");
             e.printStackTrace();
-            return;
+            System.exit(1);;
         } catch (NoSuchMethodException e) {
             System.err.println("failed to get suite method");
             e.printStackTrace();
-            return;
+            System.exit(1);;
         }
 
         try {
@@ -167,21 +163,22 @@
         } catch (IllegalArgumentException e) {
             System.err.println("failed to get suite method");
             e.printStackTrace();
-            return;
+            System.exit(1);;
         } catch (IllegalAccessException e) {
             System.err.println("failed to get suite method");
             e.printStackTrace();
-            return;
+            System.exit(1);;
         } catch (InvocationTargetException e) {
             System.err.println("failed to get suite method");
             e.printStackTrace();
-            return;
+            System.exit(1);;
         }
 
         try {
             xmlGenerator = new MyXMLGenerator(OUTPUTFILE + ".xml");
         } catch (ParserConfigurationException e) {
             System.err.println("Can't initialize XML Generator");
+            System.exit(1);
         }
 
         testCases = new LinkedHashMap<String, TestClass>();
@@ -194,6 +191,7 @@
                 String type = iterator.next();
                 System.err.println(type);
             }
+            System.exit(1);
         }
 
         for (Iterator<TestClass> iterator = testCases.values().iterator(); iterator.hasNext();) {
@@ -206,6 +204,7 @@
         } catch (Exception e) {
             System.err.println("cannot dump xml");
             e.printStackTrace();
+            System.exit(1);
         }
     }
 
@@ -249,8 +248,7 @@
     }
 
     public void compose() {
-        System.out.println("Collecting all junit tests...");
-        new TestRunner() {
+        TestRunner runner = new TestRunner() {
             @Override
             protected TestResult createTestResult() {
                 return new TestResult() {
@@ -265,22 +263,47 @@
             public TestResult doRun(Test test) {
                 return super.doRun(test);
             }
-        }.doRun(TESTSUITE);
+            
+            
+            
+        };
+        
+        runner.setPrinter(new ResultPrinter(System.out) {
+            @Override
+            protected void printFooter(TestResult result) {
+            }
+            
+            @Override
+            protected void printHeader(long runTime) {
+            }
+        });
+        runner.doRun(TESTSUITE);
     }
-
-    private String getKnownFailure(final String testClassName, final String testName) {
+    
+    private String getKnownFailure(final Class<? extends TestCase> testClass,
+            final String testName) {
+        return getAnnotation(testClass, testName, KNOWN_FAILURE);
+    }
+    
+    private boolean isBrokenTest(final Class<? extends TestCase> testClass,
+            final String testName)  {
+        return getAnnotation(testClass, testName, BROKEN_TEST) != null;
+    }
+    
+    private String getAnnotation(final Class<? extends TestCase> testClass,
+            final String testName, final String annotationName) {
         try {
-            Class<?> testClass = Class.forName(testClassName);
-            Method testMethod = testClass.getMethod(testName, null);
+            Method testMethod = testClass.getMethod(testName, (Class[])null);
             Annotation[] annotations = testMethod.getAnnotations();
             for (Annotation annot : annotations) {
 
-                if (annot.annotationType().getName().equals(KNOWN_FAILURE)) {
+                if (annot.annotationType().getName().equals(annotationName)) {
                     String annotStr = annot.toString();
                     String knownFailure = null;
                     if (annotStr.contains("(value=")) {
                         knownFailure =
-                            annotStr.substring(annotStr.indexOf("=") + 1, annotStr.length() - 1);
+                            annotStr.substring(annotStr.indexOf("=") + 1,
+                                    annotStr.length() - 1);
 
                     }
 
@@ -293,22 +316,23 @@
 
             }
 
-        } catch (java.lang.ClassNotFoundException e) {
         } catch (java.lang.NoSuchMethodException e) {
         }
 
         return null;
     }
 
-    private void println(final String message) {
-        System.out.println(message);
-    }
-
     private void addToTests(TestCase test) {
 
         String testClassName = test.getClass().getName();
         String testName = test.getName();
-        String knownFailure = getKnownFailure(testClassName, testName);
+        String knownFailure = getKnownFailure(test.getClass(), testName);
+        
+        if (isBrokenTest(test.getClass(), testName)) {
+            System.out.println("ignoring broken test: " + test);
+            return;
+        }
+            
 
         if (!testName.startsWith("test")) {
             try {
diff --git a/tools/utils/DescriptionGenerator.java b/tools/utils/DescriptionGenerator.java
index 8a21c83..e81e6d6 100644
--- a/tools/utils/DescriptionGenerator.java
+++ b/tools/utils/DescriptionGenerator.java
@@ -64,6 +64,7 @@
 public class DescriptionGenerator extends Doclet {
     static final String HOST_CONTROLLER = "dalvik.annotation.HostController";
     static final String KNOWN_FAILURE = "dalvik.annotation.KnownFailure";
+    static final String BROKEN_TEST = "dalvik.annotation.BrokenTest";
 
     static final String JUNIT_TEST_CASE_CLASS_NAME = "junit.framework.testcase";
     static final String TAG_PACKAGE = "TestPackage";
diff --git a/tools/utils/genDefaultTestPlan.sh b/tools/utils/genDefaultTestPlan.sh
index ebfa914..dc170af 100644
--- a/tools/utils/genDefaultTestPlan.sh
+++ b/tools/utils/genDefaultTestPlan.sh
@@ -271,7 +271,7 @@
 SIGNATURE_TESTS="android.tests.sigtest"
 SIGNATURE_CHECK_PATH="${CASE_REPOSITORY}/${SIGNATURE_TEST_NAME}.xml"
 
-ANDROID_CORE_TESTS="android.core.tests"
+ANDROID_CORE_TESTS="android.core.tests.annotation android.core.tests.archive android.core.tests.concurrent android.core.tests.crypto android.core.tests.dom android.core.tests.logging android.core.tests.luni android.core.tests.luni.io android.core.tests.luni.lang android.core.tests.luni.net android.core.tests.luni.util android.core.tests.math android.core.tests.nio android.core.tests.nio_char android.core.tests.prefs android.core.tests.regex android.core.tests.security android.core.tests.sql android.core.tests.text android.core.tests.xml android.core.tests.xnet"
 ANDROID_CORE_VM_TESTS="android.core.vm-tests"
 
 #Creating Signature check description xml file, if not existed.