OSDN Git Service

AI 144390: am: CL 144230 am: CL 144229 Modifying build of core-tests.jar version for
authorJorg Pleumann <>
Fri, 3 Apr 2009 05:35:50 +0000 (22:35 -0700)
committerThe Android Open Source Project <initial-contribution@android.com>
Fri, 3 Apr 2009 05:35:50 +0000 (22:35 -0700)
  the RI so that the required test annotation
  classes are copied over from core.jar. Means
  we don't have to maintain duplicate versions
  of these classes (and there will be less
  verifier complaints), so these are going away
  in the process.
  Original author: jorgp
  Merged from: //branches/cupcake/...
  Original author: android-build

Automated import of CL 144390

libcore/Android.mk
libcore/dalvik/src/test/java/dalvik/annotation/AndroidOnly.java [deleted file]
libcore/dalvik/src/test/java/dalvik/annotation/KnownFailure.java [deleted file]
libcore/dalvik/src/test/java/dalvik/annotation/SideEffect.java [deleted file]
libcore/dalvik/src/test/java/dalvik/annotation/TestLevel.java [deleted file]
libcore/dalvik/src/test/java/dalvik/annotation/TestTargetClass.java [deleted file]
libcore/dalvik/src/test/java/dalvik/annotation/TestTargetNew.java [deleted file]
libcore/dalvik/src/test/java/dalvik/annotation/TestTargets.java [deleted file]
libcore/dalvik/src/test/java/dalvik/annotation/VirtualTestTarget.java [deleted file]
libcore/run-core-tests-on-ri [new file with mode: 0755]

index c12ce9a..b22b4c0 100644 (file)
@@ -29,7 +29,7 @@ LOCAL_MODULE := core
 
 include $(BUILD_JAVA_LIBRARY)
 
-
+core-intermediates := ${intermediates}
 
 # Definitions to make the core-tests library.
 
@@ -47,9 +47,43 @@ LOCAL_MODULE := core-tests
 
 include $(BUILD_JAVA_LIBRARY)
 
-$(LOCAL_INSTALLED_MODULE): run-core-tests
-
+# This one's tricky. One of our tests needs to have a
+# resource with a "#" in its name, but Perforce doesn't
+# allow us to submit such a file. So we create it here
+# on-the-fly.
+TMP_RESOURCE_DIR := /tmp/
+TMP_RESOURCE_FILE := org/apache/harmony/luni/tests/java/lang/test\#.properties
+
+$(TMP_RESOURCE_DIR)$(TMP_RESOURCE_FILE):
+       @mkdir -p $(dir $@)
+       @echo "Hello, world!" > $@
+
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args) -C $(TMP_RESOURCE_DIR) $(TMP_RESOURCE_FILE)
+$(LOCAL_INTERMEDIATE_TARGETS): $(TMP_RESOURCE_DIR)$(TMP_RESOURCE_FILE)
+
+# Definitions for building a version of the core-tests.jar
+# that is suitable for execution on the RI. This JAR would
+# be better located in $HOST_OUT_JAVA_LIBRARIES, but it is
+# not possible to refer to that from a shell script (the
+# variable is not exported from envsetup.sh). There is also
+# some trickery involved: we need to include some classes
+# that reside in core.jar, but since we cannot incldue the
+# whole core.jar in the RI classpath, we copy those classses
+# over to our new file.
+HOST_CORE_JAR := $(HOST_COMMON_OUT_ROOT)/core-tests.jar
+
+$(HOST_CORE_JAR): PRIVATE_LOCAL_BUILT_MODULE := $(LOCAL_BUILT_MODULE)
+$(HOST_CORE_JAR): PRIVATE_CORE_INTERMEDIATES := $(core-intermediates)
+$(HOST_CORE_JAR): $(LOCAL_BUILT_MODULE)
+       @rm -rf $(dir $<)/hostctsclasses
+       $(call unzip-jar-files,$(dir $<)classes.jar,$(dir $<)hostctsclasses)
+       @unzip -qx -o $(PRIVATE_CORE_INTERMEDIATES)/classes.jar dalvik/annotation/* -d $(dir $<)hostctsclasses
+       @cp $< $@
+       @jar uf $@ -C $(dir $<)hostctsclasses .
+
+$(LOCAL_INSTALLED_MODULE): $(HOST_CORE_JAR)
 
+$(LOCAL_INSTALLED_MODULE): run-core-tests
 
 # Definitions to copy the core-tests runner script.
 
@@ -60,7 +94,13 @@ LOCAL_MODULE_TAGS := tests
 LOCAL_MODULE := run-core-tests
 include $(BUILD_PREBUILT)
 
-
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := run-core-tests-on-ri
+LOCAL_IS_HOST_MODULE := true
+LOCAL_MODULE_CLASS := EXECUTABLES
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE := run-core-tests-on-ri
+include $(BUILD_PREBUILT)
 
 # Build all of the native code, if any is present.
 
diff --git a/libcore/dalvik/src/test/java/dalvik/annotation/AndroidOnly.java b/libcore/dalvik/src/test/java/dalvik/annotation/AndroidOnly.java
deleted file mode 100644 (file)
index e6a28c8..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-package dalvik.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.METHOD, ElementType.TYPE })
-public @interface AndroidOnly {
-
-    /**
-     * Plain text reason for adding this annotation.
-     */
-    String value();
-
-}
diff --git a/libcore/dalvik/src/test/java/dalvik/annotation/KnownFailure.java b/libcore/dalvik/src/test/java/dalvik/annotation/KnownFailure.java
deleted file mode 100644 (file)
index 6a40ee7..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-package dalvik.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.METHOD })
-public @interface KnownFailure {
-
-    /**
-     * Plain text reason for adding this annotation.
-     */
-    String value();
-
-}
diff --git a/libcore/dalvik/src/test/java/dalvik/annotation/SideEffect.java b/libcore/dalvik/src/test/java/dalvik/annotation/SideEffect.java
deleted file mode 100644 (file)
index 2688a17..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-package dalvik.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Marks a test-case as either having a side-effect that other tests might
- * notice or suffering from such a side effect. Such tests should be run in an
- * isolated manner.
- * 
- * @hide
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.METHOD, ElementType.TYPE })
-public @interface SideEffect {
-
-    /**
-     * Plain text reason for adding this annotation.
-     */
-    String value();
-
-}
diff --git a/libcore/dalvik/src/test/java/dalvik/annotation/TestLevel.java b/libcore/dalvik/src/test/java/dalvik/annotation/TestLevel.java
deleted file mode 100644 (file)
index a4e41fd..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-package dalvik.annotation;
-
-/**
- * Defines an enumeration of possible states a test case can be in.
- * 
- * @since Android 1.0
- */
-public enum TestLevel {
-    
-    /**
-     * Indicates that a test method completely tests its target API method.
-     */    
-    COMPLETE,
-    
-    /**
-     * Indicates that a test method partially tests its target API method and
-     * that together with all other {@code PARTIAL_COMPLETE} tests for the same
-     * method it is sufficient.
-     */
-    PARTIAL_COMPLETE,
-
-    /**
-     * Indicates that a test method partially tests its target API method. It
-     * needs a second review phase to find out if the sum of all partial tests
-     * is sufficient for completely testing the target API method. If yes, the
-     * level has to be changed to {@code PARTIAL_COMPLETE}.
-     */
-    PARTIAL, 
-    
-    /**
-     * Indicates that a test method is known to not completely test an API
-     * method but the missing test steps are too complex and costly to
-     * implement. This level is positioned somewhere between {@code PARTIAL}
-     * and {@code COMPLETE}.
-     */
-    SUFFICIENT,
-    
-    /**
-     * Indicates that a test method provides additional testing for an API
-     * method for which there already exists one {@code COMPLETE} or a set of 
-     * {@code PARTIAL_COMPLETE} tests. This level may also be used for test
-     * methods that test a concept which can not be directly attributed to 
-     * the specification of an API method or class.
-     */
-    ADDITIONAL, 
-    
-    /**
-     * Indicates that there is nothing to test in an API method, for example if
-     * the specification states that a method does nothing.
-     */
-    NOT_NECESSARY,
-    
-    /**
-     * Indicates that it is very hard or impossible to test an API method.
-     */
-    NOT_FEASIBLE,
-    
-    /**
-     * Indicates that the tests is either insufficient or wrong. Something needs
-     * to be done about it.
-     */
-    TODO,
-        
-}
diff --git a/libcore/dalvik/src/test/java/dalvik/annotation/TestTargetClass.java b/libcore/dalvik/src/test/java/dalvik/annotation/TestTargetClass.java
deleted file mode 100644 (file)
index faa4e4b..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-package dalvik.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import dalvik.annotation.TestTargetNew;
-
-/**
- * Defines an annotation for test classes that allows to link them to the class
- * that is being tested. The current assumption is that the test are somewhat
- * organized according to the API classes they test. Might be too strict for
- * some cases.
- * 
- * @since Android 1.0
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.TYPE })
-public @interface TestTargetClass {
-    
-    /**
-     * Specifies the class being tested.
-     */
-    Class<?> value();
-    
-    /**
-     * Option to specify untested methods for the class.
-     */
-    TestTargetNew[] untestedMethods() default {};
-}
\ No newline at end of file
diff --git a/libcore/dalvik/src/test/java/dalvik/annotation/TestTargetNew.java b/libcore/dalvik/src/test/java/dalvik/annotation/TestTargetNew.java
deleted file mode 100644 (file)
index 9a85997..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-
-package dalvik.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Defines an annotation used be used within the TestInfo annotation. It
- * specifies a single method target for the test (but can be used multiple
- * times).
- * 
- * @since Android 1.0
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD })
-public @interface TestTargetNew {
-    
-    /**
-     * Specifies the name of the API method that is being tested. This field
-     * may be left empty if the test target is a concept implemented in a
-     * class rather than a concrete API method.
-     */
-    String method() default "";
-
-    /**
-     * Specifies the signature of the API method that is being tested, in terms
-     * of Java classes.
-     */
-    Class<?>[] args() default {};
-
-    /**
-     * Specifies the class to which the tested method belongs. If this value is
-     * not provided, the class identified in @TestTargetClass is used by the
-     * test progress doclet.
-     */
-    Class<?> clazz() default void.class;
-    /**
-     * Specifies the level of coverage the tested API method has.
-     */
-    TestLevel level();
-    
-    /**
-     * Specifies noteworthy plain-text information about the test, for example
-     * if something is NOT covered by the test method.
-     */
-    String notes() default "";
-}
diff --git a/libcore/dalvik/src/test/java/dalvik/annotation/TestTargets.java b/libcore/dalvik/src/test/java/dalvik/annotation/TestTargets.java
deleted file mode 100644 (file)
index a4e0892..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-package dalvik.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import dalvik.annotation.TestTargetNew;
-
-/**
- * Defines an annotation for test classes that allows to link them to the class
- * that is being tested. The current assumption is that the test are somewhat
- * organized according to the API classes they test. Might be too strict for
- * some cases.
- * 
- * @since Android 1.0
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.METHOD })
-public @interface TestTargets {
-    
-    /**
-     * Specifies the API methods that are tested by the annotated test method.
-     */
-    TestTargetNew[] value();
-}
\ No newline at end of file
diff --git a/libcore/dalvik/src/test/java/dalvik/annotation/VirtualTestTarget.java b/libcore/dalvik/src/test/java/dalvik/annotation/VirtualTestTarget.java
deleted file mode 100644 (file)
index b6f95ff..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-package dalvik.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for "virtual" implementation classes. These are classes that have
- * the following attributes:
- * <ul>
- * <li>they implement a public interface or are a concrete implementation of a
- * public abstract class,</li>
- * <li>they are not public,</li>
- * <li>instances can only be retrieved through some kind of factory method.</li>
- * </ul>
- * <p>
- * Example: {@code MessageDigest} is an abstract class. Concrete implementations
- * of message digest algorithms such as MD5 and SHA-1 can only be retrieved
- * through one of the static {@code getInstance} methods of
- * {@code MessageDigest}, which accept the desired algorithm as a string
- * parameter and return an implementation accordingly.
- * </p>
- * <p>
- * Even though the concrete implementation class for a message digest algorithm
- * is not known, we need to be able to indicate that such a class exists and that
- * it must be tested. This is done by defining corresponding classes and
- * annotating them with {@code @VirtualTestTarget}. This class can then be
- * used in the {@code @TestTargetClass} annotation with which we annotate 
- * {@code TestCase} subclasses.
- * 
- * @since Android 1.0
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.TYPE })
-public @interface VirtualTestTarget {
-    
-    /**
-     * Field for comments.
-     */
-    String value() default "";
-}
\ No newline at end of file
diff --git a/libcore/run-core-tests-on-ri b/libcore/run-core-tests-on-ri
new file mode 100755 (executable)
index 0000000..466994c
--- /dev/null
@@ -0,0 +1,23 @@
+#
+# 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.
+
+# Run all the tests contained in the core-tests library on an RI that
+# is supposed to be in the path.
+
+top=$ANDROID_BUILD_TOP
+
+java -cp $top/cts/tools/utils/lib/junit.jar:$top/out/host/common/core-tests.jar \
+     -Xmx16M \
+     com.google.coretests.Main "$@"