Introduce @NonMTS, @NonCts, @NonVogar annotations
expectations/skippedCtsTest.txt is currently manually written.
It will be generated once all such tests are annotated.
"cts-tradefed" and "atest" should use the default core-test-mode,
i.e. CTS mode.
"mts-tradefed mts-art" is expected to use the MTS mode. It's configured
in the mts-*.xml file.
"atest --test-mapping libcore/" is expected to run in presubmit mode.
It's configured in the libcore/TEST_MAPPING file.
Bug: 287042293
Bug: 286802267
Bug: 287231726
Test: cts-tradefed run cts-dev -m CtsLibcoreTestCases
Test: atest CtsLibcoreTestCases
Merged-In: Ie22b321494cc5ad06d5eec21bc4ac34bff277b93
Change-Id: Ie22b321494cc5ad06d5eec21bc4ac34bff277b93
diff --git a/TEST_MAPPING b/TEST_MAPPING
index f399594..8016e11 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -4,6 +4,9 @@
"name": "CtsLibcoreTestCases",
"options": [
{
+ "instrumentation-arg": "core-test-mode:=presubmit"
+ },
+ {
"exclude-filter": "com.android.org.conscrypt.java.security.AlgorithmParameterGeneratorTestDH"
},
{
diff --git a/expectations/Android.bp b/expectations/Android.bp
index 2aadab9..2996f44 100644
--- a/expectations/Android.bp
+++ b/expectations/Android.bp
@@ -33,7 +33,10 @@
java_library {
name: "libcore-expectations-knownfailures-jar",
visibility: expectations_visibility,
- java_resources: ["knownfailures.txt"],
+ java_resources: [
+ "knownfailures.txt",
+ "skippedCtsTest.txt",
+ ],
sdk_version: "core_current",
}
diff --git a/expectations/skippedCtsTest.txt b/expectations/skippedCtsTest.txt
new file mode 100644
index 0000000..11f1613
--- /dev/null
+++ b/expectations/skippedCtsTest.txt
@@ -0,0 +1,57 @@
+[
+{
+ bug: 287231726,
+ description: "This test doesn't test public APIs.",
+ result: EXEC_FAILED,
+ names: [
+ "libcore.libcore.icu.DateIntervalFormatTest",
+ "libcore.libcore.icu.ICUTest",
+ "libcore.libcore.icu.LocaleDataTest",
+ "libcore.sun.misc.SharedSecretsTest"
+ ]
+},
+{
+ bug: 287231726,
+ description: "The test asserts buggy or non-breaking behaviors, but the behavior has been fixed / changed in the future ART module version.",
+ result: EXEC_FAILED,
+ names: [
+ "libcore.java.lang.ClassTest#test_toGenericString",
+ "libcore.java.util.CurrencyTest#test_localeExtension",
+ "libcore.java.text.OldDecimalFormatSymbolsTest#test_RIHarmony_compatible",
+ "libcore.java.text.OldNumberFormatTest#test_getCurrencyInstanceLjava_util_Locale",
+ "org.apache.harmony.tests.java.util.ArrayDequeTest#test_forEachRemaining_CME",
+ "org.apache.harmony.tests.java.util.ArrayDequeTest#test_iterator",
+ "org.apache.harmony.tests.java.lang.Character_UnicodeBlockTest#test_ofC",
+ "org.apache.harmony.tests.java.lang.Character_UnicodeBlockTest#test_ofI",
+ "org.apache.harmony.tests.java.util.PriorityQueueTest#test_remove_Ljava_lang_Object_not_Compatible",
+ "org.apache.harmony.tests.java.util.PriorityQueueTest#test_spliterator_CME",
+ "org.apache.harmony.regex.tests.java.util.regex.PatternTest#testSplitAsStream"
+ ]
+},
+{
+ bug: 287231726,
+ description: "The test depends on locale, but manufacturers / CLDR improves the locale data over time",
+ result: EXEC_FAILED,
+ names: [
+ "libcore.java.text.DecimalFormatTest#testLocaleGroupingSeparator",
+ "libcore.java.text.DecimalFormatTest#testSetGroupingSeparator"
+ ]
+},
+{
+ bug: 286802267,
+ description: "The test asserts buggy or non-breaking behaviors, but the behavior has been fixed / changed in the future ART module version.",
+ result: EXEC_FAILED,
+ names: [
+ "tck.java.time.TCKYear#factory_parse_fail",
+ "tck.java.time.format.TCKDateTimeParseResolver#test_resolveAmPm"
+ ]
+},
+{
+ bug: 286802267,
+ description: "The test depends on locale, but manufacturers / CLDR improves the locale data over time",
+ result: EXEC_FAILED,
+ names: [
+ "test.java.util.TestFormatter#test"
+ ]
+}
+]
diff --git a/test-rules/src/main/java/libcore/test/annotation/NonCts.java b/test-rules/src/main/java/libcore/test/annotation/NonCts.java
new file mode 100644
index 0000000..f028ee4
--- /dev/null
+++ b/test-rules/src/main/java/libcore/test/annotation/NonCts.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2023 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 libcore.test.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Test with this annotation doesn't run in CTS.
+ *
+ * Note that every annotation element below should be associated to a field in
+ * {@link vogar.expect.Expectation}, because it will be de- and serialized by
+ * {@link vogar.expect.ExpectationStore} for back-porting to an older branch.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD})
+public @interface NonCts {
+ /**
+ * Optional bug id showing why this test fails / shouldn't run in MTS.
+ *
+ * The associated field is {@link vogar.expect.Expectation#bug}.
+ */
+ long bug() default -1;
+
+ /**
+ * Reason why the test shouldn't run in CTS.
+ *
+ * The associated field is {@link vogar.expect.Expectation#description}.
+ */
+ String reason();
+}
diff --git a/test-rules/src/main/java/libcore/test/annotation/NonMts.java b/test-rules/src/main/java/libcore/test/annotation/NonMts.java
new file mode 100644
index 0000000..e06469c
--- /dev/null
+++ b/test-rules/src/main/java/libcore/test/annotation/NonMts.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2023 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 libcore.test.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Test with this annotation doesn't run in MTS.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD})
+public @interface NonMts {
+
+ /** Optional bug id showing why this test fails / shouldn't run in MTS. */
+ long bug() default -1;
+
+ /** Reason why the test shouldn't run in MTS. */
+ String reason();
+
+ /**
+ * If this value is specified, the test will run on Sdk version equal to or above this value.
+ */
+ int disabledUntilSdk() default Integer.MAX_VALUE;
+}
diff --git a/test-rules/src/main/java/libcore/test/annotation/NonVogar.java b/test-rules/src/main/java/libcore/test/annotation/NonVogar.java
new file mode 100644
index 0000000..1b8e418
--- /dev/null
+++ b/test-rules/src/main/java/libcore/test/annotation/NonVogar.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2023 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 libcore.test.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Test with this annotation doesn't run when invoked by vogar.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD})
+public @interface NonVogar {
+
+ /** Optional bug id showing why this test fails / shouldn't run by vogar. */
+ long bug() default -1;
+
+ /** Reason why the test shouldn't run by vogar. */
+ String reason();
+}