Tracking merge of dalvik-dev to master
git cherry-pick --no-commit 4ba5d9c906047ae96045390e8e2e67b8bf64c7fb
git cherry-pick --no-commit d6cf903af4c5b3f6bb107d4c1a6c34713ee1ff46
git cherry-pick --no-commit 47cbcfe2e49420bcd59499cdd4cfb32fbf062e68
git cherry-pick --no-commit a83d47ae665bccf94dc7720b0b05bf4215af6863
git cherry-pick --no-commit c51299d2e2f43c13fa7514c1fb9c0089ed9a9ad8
git cherry-pick --no-commit 523fa6ab3943e18979bc9df99787a77b15177f5d
git cherry-pick --no-commit bf0712aba9e7b1114ff224fa30da159067868ef1
Change-Id: I7c0d213126b6dd8981b912b588803fd7ac382396
diff --git a/tests/core/ctscore.mk b/tests/core/ctscore.mk
index 33fc6f3..7131e82 100644
--- a/tests/core/ctscore.mk
+++ b/tests/core/ctscore.mk
@@ -18,7 +18,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_JAVA_LIBRARIES := android.test.runner bouncycastle
-LOCAL_STATIC_JAVA_LIBRARIES := CtsTestAnnotationsLib
+LOCAL_STATIC_JAVA_LIBRARIES += CtsTestAnnotationsLib
LOCAL_PROGUARD_ENABLED := disabled
@@ -40,16 +40,14 @@
$(PACKAGE_RESOURCES): PRIVATE_PRIVATE_KEY := $(private_key)
$(PACKAGE_RESOURCES): PRIVATE_CERTIFICATE := $(certificate)
$(PACKAGE_RESOURCES): $(LOCAL_BUILT_MODULE) $(CORETESTS_INTERMEDIATES)/javalib.jar
+# Remove .class files from javalib.jar, we only want the resources
@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 -f $(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses/classes.dex
- @cp $< $@
- @jar uf $@ -C $(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses .
+ $(hide) cp $< $@
+ $(hide) jar uf $@ -C $(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses .
$(sign-package)
$(align-package)
$(hide) cp $@ $<
diff --git a/tests/core/dom/AndroidManifest.xml b/tests/core/dom/AndroidManifest.xml
deleted file mode 100644
index 8fa00e3..0000000
--- a/tests/core/dom/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.
- -->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- 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.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/dom/Android.mk b/tests/core/libcore/Android.mk
similarity index 67%
rename from tests/core/dom/Android.mk
rename to tests/core/libcore/Android.mk
index 69d4af3..5b59965 100644
--- a/tests/core/dom/Android.mk
+++ b/tests/core/libcore/Android.mk
@@ -19,17 +19,12 @@
endif
#
-# DOM Tests
+# libcore tests
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/dom/src/test/java) \
- $(call all-java-files-under,../../../../libcore/junit/src/test/java/junit) \
- $(call all-java-files-under,../../../../libcore/support/src/test/java/)
-
-LOCAL_PACKAGE_NAME := android.core.tests.dom
-
-# for java.* javax.* support classes in libcore/support/src/test/java
-LOCAL_DX_FLAGS := --core-library
+LOCAL_SRC_FILES := src/Dummy.java
+LOCAL_PACKAGE_NAME := android.core.tests.libcore
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/xml/AndroidManifest.xml b/tests/core/libcore/AndroidManifest.xml
similarity index 96%
rename from tests/core/xml/AndroidManifest.xml
rename to tests/core/libcore/AndroidManifest.xml
index 0f6085e..d0ce941 100644
--- a/tests/core/xml/AndroidManifest.xml
+++ b/tests/core/libcore/AndroidManifest.xml
@@ -16,7 +16,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="android.core.tests.xml">
+ package="android.core.tests.libcore">
<uses-permission android:name="android.permission.INTERNET" />
<application>
<uses-library android:name="android.test.runner" />
diff --git a/tests/core/libcore/src/Dummy.java b/tests/core/libcore/src/Dummy.java
new file mode 100644
index 0000000..cfe0c81
--- /dev/null
+++ b/tests/core/libcore/src/Dummy.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+/**
+ * We really just want the core-tests classes from the static java
+ * library, but the build system currently needs at least one input
+ * file, not just becuase its a sanity check, but because the static
+ * class files and resources are included in the output of the local
+ * java compilation.
+ */
+public final class Dummy {}
diff --git a/tests/core/luni-io/Android.mk b/tests/core/luni-io/Android.mk
deleted file mode 100644
index 6669c6a..0000000
--- a/tests/core/luni-io/Android.mk
+++ /dev/null
@@ -1,38 +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.
-
-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,../../../../libcore/luni/src/test/java/tests/api/java/io) \
- $(call all-java-files-under,../../../../libcore/luni/src/test/java/libcore/java/io) \
- $(call all-java-files-under,../../../../libcore/support/src/test/java/) \
- $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/pkg1) \
- $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/pkg2) \
- ../../../../libcore/luni/src/test/java/tests/luni/AllTestsIo.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.luni.io
-
-# for java.* javax.* support classes in libcore/support/src/test/java
-LOCAL_DX_FLAGS := --core-library
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/luni-io/AndroidManifest.xml b/tests/core/luni-io/AndroidManifest.xml
deleted file mode 100644
index 1224aa5..0000000
--- a/tests/core/luni-io/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.
- -->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- 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.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/luni-lang/Android.mk b/tests/core/luni-lang/Android.mk
deleted file mode 100644
index c3528ec..0000000
--- a/tests/core/luni-lang/Android.mk
+++ /dev/null
@@ -1,36 +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.
-
-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,../../../../libcore/luni/src/test/java/tests/api/java/lang) \
- $(call all-java-files-under,../../../../libcore/support/src/test/java/) \
- ../../../../libcore/luni/src/test/java/tests/luni/AllTestsLang.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.luni.lang
-
-# for java.* javax.* support classes in libcore/support/src/test/java
-LOCAL_DX_FLAGS := --core-library
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/luni-lang/AndroidManifest.xml b/tests/core/luni-lang/AndroidManifest.xml
deleted file mode 100644
index cb79f5f..0000000
--- a/tests/core/luni-lang/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.
- -->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- 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.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/luni-net/Android.mk b/tests/core/luni-net/Android.mk
deleted file mode 100644
index 8a6508c..0000000
--- a/tests/core/luni-net/Android.mk
+++ /dev/null
@@ -1,39 +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.
-
-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,../../../../libcore/luni/src/test/java/libcore/java/net) \
- $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/http) \
- $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https) \
- $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/net) \
- $(call all-java-files-under,../../../../libcore/support/src/test/java/) \
- ../../../../libcore/luni/src/test/java/tests/luni/AllTestsNet.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.luni.net
-
-# for java.* javax.* support classes in libcore/support/src/test/java
-LOCAL_DX_FLAGS := --core-library
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/luni-net/AndroidManifest.xml b/tests/core/luni-net/AndroidManifest.xml
deleted file mode 100644
index ca0d17a..0000000
--- a/tests/core/luni-net/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.
- -->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- 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.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/luni-util/Android.mk b/tests/core/luni-util/Android.mk
deleted file mode 100644
index 5468c17..0000000
--- a/tests/core/luni-util/Android.mk
+++ /dev/null
@@ -1,36 +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.
-
-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,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/util) \
- $(call all-java-files-under,../../../../libcore/luni/src/test/java/tests/api/java/util) \
- $(call all-java-files-under,../../../../libcore/support/src/test/java/) \
- ../../../../libcore/luni/src/test/java/tests/luni/AllTestsUtil.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.luni.util
-
-# for java.* javax.* support classes in libcore/support/src/test/java
-LOCAL_DX_FLAGS := --core-library
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/luni-util/AndroidManifest.xml b/tests/core/luni-util/AndroidManifest.xml
deleted file mode 100644
index 8b4daad..0000000
--- a/tests/core/luni-util/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.
- -->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- 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.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/xml/Android.mk b/tests/core/xml/Android.mk
deleted file mode 100644
index 0f643a0..0000000
--- a/tests/core/xml/Android.mk
+++ /dev/null
@@ -1,41 +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.
-
-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,../../../../libcore/xml/src/test/java) \
- $(call all-java-files-under,../../../../libcore/dom/src/test) \
- $(call all-java-files-under,../../../../libcore/junit/src/test/java/junit) \
- $(call all-java-files-under,../../../../libcore/luni/src/test/java/tests/api/javax/xml/parsers) \
- $(call all-java-files-under,../../../../libcore/luni/src/test/java/tests/api/org/xml/sax) \
- $(call all-java-files-under,../../../../libcore/luni/src/test/java/tests/api/org/xml/sax/support) \
- $(call all-java-files-under,../../../../libcore/luni/src/test/java/tests/org/w3c/dom) \
- $(call all-java-files-under,../../../../libcore/luni/src/test/java/tests/xml) \
- $(call all-java-files-under,../../../../libcore/support/src/test/java)
-
-LOCAL_PACKAGE_NAME := android.core.tests.xml
-
-# for java.* javax.* support classes in libcore/support/src/test/java
-LOCAL_DX_FLAGS := --core-library
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/tests/os/src/android/os/cts/ProcessTest.java b/tests/tests/os/src/android/os/cts/ProcessTest.java
index 6216f06..e810f05 100644
--- a/tests/tests/os/src/android/os/cts/ProcessTest.java
+++ b/tests/tests/os/src/android/os/cts/ProcessTest.java
@@ -26,7 +26,6 @@
import android.test.AndroidTestCase;
import android.util.Log;
import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestStatus;
import dalvik.annotation.TestTargetNew;
import dalvik.annotation.TestLevel;
import dalvik.annotation.TestTargetClass;
diff --git a/tools/dasm/src/dasm/DAsm.java b/tools/dasm/src/dasm/DAsm.java
index 2b58705..e5f5ead 100644
--- a/tools/dasm/src/dasm/DAsm.java
+++ b/tools/dasm/src/dasm/DAsm.java
@@ -16,6 +16,7 @@
package dasm;
+import com.android.dx.dex.DexOptions;
import com.android.dx.dex.code.ArrayData;
import com.android.dx.dex.code.CodeAddress;
import com.android.dx.dex.code.CstInsn;
@@ -82,6 +83,9 @@
// number of errors reported in a file.
int errors;
+ // options for dex output
+ DexOptions dexOptions = new DexOptions();
+
// file being processed
DexFile dexFile;
int line_num;
@@ -1517,7 +1521,7 @@
*/
private void createOutputFinisher() {
if (output_finisher == null)
- output_finisher = new OutputFinisher(5, regs_count);
+ output_finisher = new OutputFinisher(dexOptions, 5, regs_count);
}
/**
diff --git a/tools/dasm/src/dasm/DopInfo.java b/tools/dasm/src/dasm/DopInfo.java
index 8939399..c6a0aa7 100644
--- a/tools/dasm/src/dasm/DopInfo.java
+++ b/tools/dasm/src/dasm/DopInfo.java
@@ -16,7 +16,6 @@
package dasm;
-import com.android.dx.dex.code.DalvOps;
import com.android.dx.dex.code.Dop;
import com.android.dx.dex.code.Dops;
import com.android.dx.dex.code.InsnFormat;
@@ -44,6 +43,7 @@
import com.android.dx.dex.code.form.Form35c;
import com.android.dx.dex.code.form.Form3rc;
import com.android.dx.dex.code.form.Form51l;
+import com.android.dx.io.Opcodes;
import java.util.Hashtable;
@@ -135,24 +135,24 @@
if (format instanceof Form21h) return ARG_REG_LITERAL;
if (format instanceof Form21c) {
switch (dop.getOpcode()) {
- case DalvOps.CONST_CLASS:
- case DalvOps.CHECK_CAST:
- case DalvOps.NEW_INSTANCE:
+ case Opcodes.CONST_CLASS:
+ case Opcodes.CHECK_CAST:
+ case Opcodes.NEW_INSTANCE:
return ARG_REG_TYPE;
- case DalvOps.SGET:
- case DalvOps.SGET_WIDE:
- case DalvOps.SGET_OBJECT:
- case DalvOps.SGET_BOOLEAN:
- case DalvOps.SGET_BYTE:
- case DalvOps.SGET_CHAR:
- case DalvOps.SGET_SHORT:
- case DalvOps.SPUT:
- case DalvOps.SPUT_WIDE:
- case DalvOps.SPUT_OBJECT:
- case DalvOps.SPUT_BOOLEAN:
- case DalvOps.SPUT_BYTE:
- case DalvOps.SPUT_CHAR:
- case DalvOps.SPUT_SHORT:
+ case Opcodes.SGET:
+ case Opcodes.SGET_WIDE:
+ case Opcodes.SGET_OBJECT:
+ case Opcodes.SGET_BOOLEAN:
+ case Opcodes.SGET_BYTE:
+ case Opcodes.SGET_CHAR:
+ case Opcodes.SGET_SHORT:
+ case Opcodes.SPUT:
+ case Opcodes.SPUT_WIDE:
+ case Opcodes.SPUT_OBJECT:
+ case Opcodes.SPUT_BOOLEAN:
+ case Opcodes.SPUT_BYTE:
+ case Opcodes.SPUT_CHAR:
+ case Opcodes.SPUT_SHORT:
return ARG_REG_FIELD;
default:
return ARG_REG_STRING;
@@ -164,23 +164,23 @@
if (format instanceof Form22s) return ARG_REG_REG_LITERAL;
if (format instanceof Form22c) {
switch (dop.getOpcode()) {
- case DalvOps.INSTANCE_OF:
- case DalvOps.NEW_ARRAY:
+ case Opcodes.INSTANCE_OF:
+ case Opcodes.NEW_ARRAY:
return ARG_REG_REG_TYPE;
- case DalvOps.IGET:
- case DalvOps.IGET_WIDE:
- case DalvOps.IGET_OBJECT:
- case DalvOps.IGET_BOOLEAN:
- case DalvOps.IGET_BYTE:
- case DalvOps.IGET_CHAR:
- case DalvOps.IGET_SHORT:
- case DalvOps.IPUT:
- case DalvOps.IPUT_WIDE:
- case DalvOps.IPUT_OBJECT:
- case DalvOps.IPUT_BOOLEAN:
- case DalvOps.IPUT_BYTE:
- case DalvOps.IPUT_CHAR:
- case DalvOps.IPUT_SHORT:
+ case Opcodes.IGET:
+ case Opcodes.IGET_WIDE:
+ case Opcodes.IGET_OBJECT:
+ case Opcodes.IGET_BOOLEAN:
+ case Opcodes.IGET_BYTE:
+ case Opcodes.IGET_CHAR:
+ case Opcodes.IGET_SHORT:
+ case Opcodes.IPUT:
+ case Opcodes.IPUT_WIDE:
+ case Opcodes.IPUT_OBJECT:
+ case Opcodes.IPUT_BOOLEAN:
+ case Opcodes.IPUT_BYTE:
+ case Opcodes.IPUT_CHAR:
+ case Opcodes.IPUT_SHORT:
return ARG_REG_REG_FIELD;
default:
return ARG_REG_REG_STRING;
@@ -193,12 +193,12 @@
if (format instanceof Form31c) return ARG_REG_STRING;
if (format instanceof Form35c) {
switch (dop.getOpcode()) {
- case DalvOps.INVOKE_VIRTUAL:
- case DalvOps.INVOKE_SUPER:
- case DalvOps.INVOKE_DIRECT:
- case DalvOps.INVOKE_STATIC:
+ case Opcodes.INVOKE_VIRTUAL:
+ case Opcodes.INVOKE_SUPER:
+ case Opcodes.INVOKE_DIRECT:
+ case Opcodes.INVOKE_STATIC:
return ARG_REGLIST_METHOD;
- case DalvOps.INVOKE_INTERFACE:
+ case Opcodes.INVOKE_INTERFACE:
return ARG_REGLIST_INTFMETHOD;
default:
return ARG_REGLIST_TYPE;
@@ -206,9 +206,9 @@
}
if (format instanceof Form3rc) {
switch (dop.getOpcode()) {
- case DalvOps.FILLED_NEW_ARRAY_RANGE:
+ case Opcodes.FILLED_NEW_ARRAY_RANGE:
return ARG_REGRANGE_TYPE;
- case DalvOps.INVOKE_INTERFACE_RANGE:
+ case Opcodes.INVOKE_INTERFACE_RANGE:
return ARG_REGRANGE_INTFMETHOD;
default:
return ARG_REGRANGE_METHOD;
@@ -228,7 +228,7 @@
static {
dopsTable = new Hashtable<String, DopInfo>();
- for (int i = 0; i < DalvOps.MAX_VALUE - DalvOps.MIN_VALUE + 1; i++) {
+ for (int i = 0; i < Opcodes.MAX_VALUE - Opcodes.MIN_VALUE + 1; i++) {
try {
Dop dop = Dops.get(i);
add(dop.getName(), dop, getArgsFormat(dop));
diff --git a/tools/utils/CollectAllTests.java b/tools/utils/CollectAllTests.java
index c443db2..883d70e 100644
--- a/tools/utils/CollectAllTests.java
+++ b/tools/utils/CollectAllTests.java
@@ -32,13 +32,17 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -73,7 +77,6 @@
private static String jarPath;
private static Map<String,TestClass> testCases;
- private static Set<String> failed = new HashSet<String>();
private static class MyXMLGenerator extends XMLGenerator {
@@ -99,32 +102,30 @@
}
}
- private static String OUTPUTFILE = "";
- private static String MANIFESTFILE = "";
- private static String TESTSUITECLASS = "";
+ private static String OUTPUTFILE;
+ private static String MANIFESTFILE;
+ private static String JARFILE;
+ private static String LIBCORE_EXPECTATION_DIR;
private static String ANDROID_MAKE_FILE = "";
- private static String LIBCORE_EXPECTATION_DIR = null;
-
- private static Test TESTSUITE;
static XMLGenerator xmlGenerator;
private static ExpectationStore libcoreVogarExpectationStore;
private static ExpectationStore ctsVogarExpectationStore;
public static void main(String[] args) {
- if (args.length > 2) {
+ if (args.length >= 3 && args.length <= 5) {
OUTPUTFILE = args[0];
- MANIFESTFILE = args [1];
- TESTSUITECLASS = args[2];
- if (args.length > 3) {
+ MANIFESTFILE = args[1];
+ JARFILE = args[2];
+ if (args.length >= 4) {
LIBCORE_EXPECTATION_DIR = args[3];
- }
- if (args.length > 4) {
- ANDROID_MAKE_FILE = args[4];
+ if (args.length >= 5) {
+ ANDROID_MAKE_FILE = args[4];
+ }
}
} else {
- System.out.println("usage: \n" +
- "\t... CollectAllTests <output-file> <manifest-file> <testsuite-class-name> <makefile-file> <expectation-dir>");
+ System.err.println("usage: CollectAllTests <output-file> <manifest-file> <jar-file>"
+ + "[expectation-dir [makefile-file]]");
System.exit(1);
}
@@ -134,11 +135,12 @@
Document manifest = null;
try {
- manifest = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new FileInputStream(MANIFESTFILE));
+ manifest = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
+ new FileInputStream(MANIFESTFILE));
} catch (Exception e) {
- System.err.println("cannot open manifest");
+ System.err.println("cannot open manifest " + MANIFESTFILE);
e.printStackTrace();
- System.exit(1);;
+ System.exit(1);
}
Element documentElement = manifest.getDocumentElement();
@@ -150,73 +152,76 @@
packageName = documentElement.getAttribute("package");
target = getElementAttribute(documentElement, "instrumentation", "android:targetPackage");
- Class<?> testClass = null;
- try {
- testClass = Class.forName(TESTSUITECLASS);
- } catch (ClassNotFoundException e) {
- System.err.println("test class not found");
- e.printStackTrace();
- System.exit(1);;
- }
-
- Method method = null;
- try {
- method = testClass.getMethod("suite", new Class<?>[0]);
- } catch (SecurityException e) {
- System.err.println("failed to get suite method");
- e.printStackTrace();
- System.exit(1);;
- } catch (NoSuchMethodException e) {
- System.err.println("failed to get suite method");
- e.printStackTrace();
- System.exit(1);;
- }
-
- try {
- TESTSUITE = (Test) method.invoke(null, (Object[])null);
- } catch (IllegalArgumentException e) {
- System.err.println("failed to get suite method");
- e.printStackTrace();
- System.exit(1);;
- } catch (IllegalAccessException e) {
- System.err.println("failed to get suite method");
- e.printStackTrace();
- System.exit(1);;
- } catch (InvocationTargetException e) {
- System.err.println("failed to get suite method");
- e.printStackTrace();
- System.exit(1);;
- }
-
try {
xmlGenerator = new MyXMLGenerator(OUTPUTFILE + ".xml");
} catch (ParserConfigurationException e) {
- System.err.println("Can't initialize XML Generator");
+ System.err.println("Can't initialize XML Generator " + OUTPUTFILE + ".xml");
System.exit(1);
}
try {
- libcoreVogarExpectationStore = VogarUtils.provideExpectationStore(LIBCORE_EXPECTATION_DIR);
+ libcoreVogarExpectationStore
+ = VogarUtils.provideExpectationStore(LIBCORE_EXPECTATION_DIR);
ctsVogarExpectationStore = VogarUtils.provideExpectationStore(CTS_EXPECTATION_DIR);
} catch (IOException e) {
- System.err.println("Can't initialize vogar expectation store");
+ System.err.println("Can't initialize vogar expectation store from "
+ + LIBCORE_EXPECTATION_DIR);
e.printStackTrace(System.err);
System.exit(1);
}
- testCases = new LinkedHashMap<String, TestClass>();
- CollectAllTests cat = new CollectAllTests();
- cat.compose();
-
- if (!failed.isEmpty()) {
- System.err.println("The following classes have no default constructor");
- for (Iterator<String> iterator = failed.iterator(); iterator.hasNext();) {
- String type = iterator.next();
- System.err.println(type);
- }
+ JarFile jarFile = null;
+ try {
+ jarFile = new JarFile(JARFILE);
+ } catch (Exception e) {
+ System.err.println("cannot open jarfile " + JARFILE);
+ e.printStackTrace();
System.exit(1);
}
+ testCases = new LinkedHashMap<String, TestClass>();
+
+ Enumeration<JarEntry> jarEntries = jarFile.entries();
+ while (jarEntries.hasMoreElements()) {
+ JarEntry jarEntry = jarEntries.nextElement();
+ String name = jarEntry.getName();
+ if (!name.endsWith(".class")) {
+ continue;
+ }
+ String className
+ = name.substring(0, name.length() - ".class".length()).replace('/', '.');
+ try {
+ Class<?> klass = Class.forName(className,
+ false,
+ CollectAllTests.class.getClassLoader());
+ if (!TestCase.class.isAssignableFrom(klass)) {
+ continue;
+ }
+ if (Modifier.isAbstract(klass.getModifiers())) {
+ continue;
+ }
+ if (!Modifier.isPublic(klass.getModifiers())) {
+ continue;
+ }
+ try {
+ klass.getConstructor(new Class<?>[] { String.class } );
+ addToTests(klass.asSubclass(TestCase.class));
+ continue;
+ } catch (NoSuchMethodException e) {
+ }
+ try {
+ klass.getConstructor(new Class<?>[0]);
+ addToTests(klass.asSubclass(TestCase.class));
+ continue;
+ } catch (NoSuchMethodException e) {
+ }
+ } catch (ClassNotFoundException e) {
+ System.out.println("class not found " + className);
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+
for (Iterator<TestClass> iterator = testCases.values().iterator(); iterator.hasNext();) {
TestClass type = iterator.next();
xmlGenerator.addTestClass(type);
@@ -225,7 +230,7 @@
try {
xmlGenerator.dump();
} catch (Exception e) {
- System.err.println("cannot dump xml");
+ System.err.println("cannot dump xml to " + OUTPUTFILE + ".xml");
e.printStackTrace();
System.exit(1);
}
@@ -261,7 +266,9 @@
}
}
- private static String getElementAttribute(Element element, String elementName, String attributeName) {
+ private static String getElementAttribute(Element element,
+ String elementName,
+ String attributeName) {
Element e = getElement(element, elementName);
if (e != null) {
return e.getAttribute(attributeName);
@@ -270,65 +277,32 @@
}
}
- public void compose() {
- TestRunner runner = new TestRunner() {
- @Override
- protected TestResult createTestResult() {
- return new TestResult() {
- @Override
- protected void run(TestCase test) {
- addToTests(test);
- }
- };
- }
-
- @Override
- public TestResult doRun(Test test) {
- return super.doRun(test);
- }
-
-
-
- };
-
- 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 Class<? extends TestCase> testClass,
+ private static String getKnownFailure(final Class<? extends TestCase> testClass,
final String testName) {
return getAnnotation(testClass, testName, KNOWN_FAILURE);
}
- private boolean isKnownFailure(final Class<? extends TestCase> testClass,
+ private static boolean isKnownFailure(final Class<? extends TestCase> testClass,
final String testName) {
return getAnnotation(testClass, testName, KNOWN_FAILURE) != null;
}
- private boolean isBrokenTest(final Class<? extends TestCase> testClass,
+ private static boolean isBrokenTest(final Class<? extends TestCase> testClass,
final String testName) {
return getAnnotation(testClass, testName, BROKEN_TEST) != null;
}
- private boolean isSuppressed(final Class<? extends TestCase> testClass,
+ private static boolean isSuppressed(final Class<? extends TestCase> testClass,
final String testName) {
return getAnnotation(testClass, testName, SUPPRESSED_TEST) != null;
}
- private boolean hasSideEffects(final Class<? extends TestCase> testClass,
+ private static boolean hasSideEffects(final Class<? extends TestCase> testClass,
final String testName) {
return getAnnotation(testClass, testName, SIDE_EFFECT) != null;
}
- private String getAnnotation(final Class<? extends TestCase> testClass,
+ private static String getAnnotation(final Class<? extends TestCase> testClass,
final String testName, final String annotationName) {
try {
Method testMethod = testClass.getMethod(testName, (Class[])null);
@@ -360,40 +334,66 @@
return null;
}
- private void addToTests(TestCase test) {
-
- String testClassName = test.getClass().getName();
- String testName = test.getName();
- String knownFailure = getKnownFailure(test.getClass(), testName);
-
- if (isKnownFailure(test.getClass(), testName)) {
- System.out.println("ignoring known failure: " + test);
- return;
- } else if (isBrokenTest(test.getClass(), testName)) {
- System.out.println("ignoring broken test: " + test);
- return;
- } else if (isSuppressed(test.getClass(), testName)) {
- System.out.println("ignoring suppressed test: " + test);
- return;
- } else if (hasSideEffects(test.getClass(), testName)) {
- System.out.println("ignoring test with side effects: " + test);
- return;
- } else if (VogarUtils.isVogarKnownFailure(libcoreVogarExpectationStore, test.getClass().getName(), testName)) {
- System.out.println("ignoring libcore expectation known failure: " + test);
- return;
- } else if (VogarUtils.isVogarKnownFailure(ctsVogarExpectationStore, test.getClass().getName(), testName)) {
- System.out.println("ignoring cts expectation known failure: " + test);
- return;
- }
-
- if (!testName.startsWith("test")) {
- try {
- test.runBare();
- } catch (Throwable e) {
- e.printStackTrace();
- return;
+ private static void addToTests(Class<? extends TestCase> test) {
+ Class testClass = test;
+ Set<String> testNames = new HashSet<String>();
+ while (TestCase.class.isAssignableFrom(testClass)) {
+ Method[] testMethods = testClass.getDeclaredMethods();
+ for (Method testMethod : testMethods) {
+ String testName = testMethod.getName();
+ if (testNames.contains(testName)) {
+ continue;
+ }
+ if (!testName.startsWith("test")) {
+ continue;
+ }
+ if (testMethod.getParameterTypes().length != 0) {
+ continue;
+ }
+ if (!testMethod.getReturnType().equals(Void.TYPE)) {
+ continue;
+ }
+ if (!Modifier.isPublic(testMethod.getModifiers())) {
+ continue;
+ }
+ testNames.add(testName);
+ addToTests(test, testName);
}
+ testClass = testClass.getSuperclass();
}
+ }
+
+ private static void addToTests(Class<? extends TestCase> test, String testName) {
+
+ String testClassName = test.getName();
+ String knownFailure = getKnownFailure(test, testName);
+
+ if (isKnownFailure(test, testName)) {
+ System.out.println("ignoring known failure: " + test + "#" + testName);
+ return;
+ } else if (isBrokenTest(test, testName)) {
+ System.out.println("ignoring broken test: " + test + "#" + testName);
+ return;
+ } else if (isSuppressed(test, testName)) {
+ System.out.println("ignoring suppressed test: " + test + "#" + testName);
+ return;
+ } else if (hasSideEffects(test, testName)) {
+ System.out.println("ignoring test with side effects: " + test + "#" + testName);
+ return;
+ } else if (VogarUtils.isVogarKnownFailure(libcoreVogarExpectationStore,
+ testClassName,
+ testName)) {
+ System.out.println("ignoring libcore expectation known failure: " + test
+ + "#" + testName);
+ return;
+ } else if (VogarUtils.isVogarKnownFailure(ctsVogarExpectationStore,
+ testClassName,
+ testName)) {
+ System.out.println("ignoring cts expectation known failure: " + test
+ + "#" + testName);
+ return;
+ }
+
TestClass testClass = null;
if (testCases.containsKey(testClassName)) {
testClass = testCases.get(testClassName);
@@ -403,13 +403,5 @@
}
testClass.mCases.add(new TestMethod(testName, "", "", knownFailure, false, false));
-
- try {
- test.getClass().getConstructor(new Class<?>[0]);
- } catch (SecurityException e) {
- failed.add(test.getClass().getName());
- } catch (NoSuchMethodException e) {
- failed.add(test.getClass().getName());
- }
}
}
diff --git a/tools/vm-tests/src/util/build/DexBuildStep.java b/tools/vm-tests/src/util/build/DexBuildStep.java
index cc65af9..6aba51c 100644
--- a/tools/vm-tests/src/util/build/DexBuildStep.java
+++ b/tools/vm-tests/src/util/build/DexBuildStep.java
@@ -17,6 +17,7 @@
package util.build;
import com.android.dx.command.dexer.Main;
+import java.io.IOException;
public class DexBuildStep extends BuildStep {
@@ -39,7 +40,13 @@
args.outName = outputFile.fileName.getAbsolutePath();
- int result = Main.run(args);
+ int result = 0;
+ try {
+ result = Main.run(args);
+ } catch (IOException e) {
+ e.printStackTrace();
+ return false;
+ }
if (result == 0) {
if (deleteInputFileAfterBuild) {