aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-06 20:21:33 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-07-06 20:21:33 +0000
commit74adda2d1c5e788586f1abf06a2b7f0d52f15806 (patch)
tree478c84ad437f2d4954f4a15f5fb8d06d235e1066
parentc488ad5f305be927d44631dc8404128bd67d4c24 (diff)
parent827f71bdd89aff2bd58c7c07bf2c08385f978941 (diff)
downloadlibcore-android-cts-12.0_r9.tar.gz
Merge "Snap for 10445396 from d62afabdbac70cd2dc09a53e1a05af2c77f61e79 to android12-tests-release" into android12-tests-releaseandroid-vts-12.0_r9android-cts-12.0_r9
-rw-r--r--TEST_MAPPING3
-rw-r--r--expectations/Android.bp5
-rw-r--r--expectations/skippedCtsTest.txt67
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/StringBufferTest.java12
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/StringBuilderTest.java4
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/java/net/MulticastSocketTest.java57
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/CharsetDecoderTest.java11
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/CharsetEncoderTest.java11
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ControlTest.java5
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ScannerTest.java2
-rw-r--r--luni/src/test/java/libcore/java/lang/StringTest.java4
-rw-r--r--luni/src/test/java/libcore/java/util/concurrent/ForkJoinPoolTest.java6
-rw-r--r--luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https/HttpsURLConnectionTest.java2
-rw-r--r--test-rules/src/main/java/libcore/test/annotation/NonCts.java47
-rw-r--r--test-rules/src/main/java/libcore/test/annotation/NonMts.java41
-rw-r--r--test-rules/src/main/java/libcore/test/annotation/NonVogar.java36
16 files changed, 256 insertions, 57 deletions
diff --git a/TEST_MAPPING b/TEST_MAPPING
index f3995942f63..8016e118ce7 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 2aadab932ee..2996f44f332 100644
--- a/expectations/Android.bp
+++ b/expectations/Android.bp
@@ -33,7 +33,10 @@ expectations_visibility = [
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 00000000000..a17b67cd36a
--- /dev/null
+++ b/expectations/skippedCtsTest.txt
@@ -0,0 +1,67 @@
+[
+{
+ 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 depends on internal APIs.",
+ result: EXEC_FAILED,
+ names: [
+ "test.java.time.TestClock_System#test_OffsetLimits",
+ "test.java.time.TestClock_System#test_OffsetRegular"
+ ]
+},
+{
+ 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.time.format.TestUnicodeExtension#test_localizedBy",
+ "test.java.util.TestFormatter#test"
+ ]
+}
+]
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/StringBufferTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/StringBufferTest.java
index 112e005ed0c..dc89a812b47 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/StringBufferTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/StringBufferTest.java
@@ -176,8 +176,8 @@ public class StringBufferTest extends TestCase {
StringBuffer obj = new StringBuffer();
try {
obj.append(new char[0], -1, -1);
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
+ fail("IndexOutOfBoundsException expected");
+ } catch (IndexOutOfBoundsException e) {
// expected
}
}
@@ -326,8 +326,8 @@ public class StringBufferTest extends TestCase {
StringBuffer obj = new StringBuffer();
try {
obj.insert(-1, ' ');
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
+ fail("IndexOutOfBoundsException expected");
+ } catch (IndexOutOfBoundsException e) {
// expected
}
}
@@ -457,8 +457,8 @@ public class StringBufferTest extends TestCase {
StringBuffer obj = new StringBuffer();
try {
obj.getChars(0, 0, new char[0], -1);
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
+ fail("IndexOutOfBoundsException expected");
+ } catch (IndexOutOfBoundsException e) {
// expected
}
}
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/StringBuilderTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/StringBuilderTest.java
index febdfc4e69b..8c3e93ef595 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/StringBuilderTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/StringBuilderTest.java
@@ -852,8 +852,8 @@ public class StringBuilderTest extends TestCase {
StringBuilder obj = new StringBuilder();
try {
obj.insert(-1, '?');
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
+ fail("IndexOutOfBoundsException expected");
+ } catch (IndexOutOfBoundsException e) {
// expected
}
}
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/MulticastSocketTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/MulticastSocketTest.java
index dab784af6e2..de0af3aacf3 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/MulticastSocketTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/MulticastSocketTest.java
@@ -697,47 +697,40 @@ public class MulticastSocketTest {
@Test
public void setNetworkInterfaceLjava_net_NetworkInterface_IPv4() throws Exception {
Assume.assumeTrue(supportsMulticast);
- check_setNetworkInterfaceLjava_net_NetworkInterface(GOOD_IPv4);
+ check_setNetworkInterfaceLjava_net_NetworkInterface(ipv4NetworkInterface, GOOD_IPv4);
}
@Test
public void setNetworkInterfaceLjava_net_NetworkInterface_IPv6() throws Exception {
Assume.assumeTrue(supportsMulticast);
- check_setNetworkInterfaceLjava_net_NetworkInterface(GOOD_IPv6);
+ check_setNetworkInterfaceLjava_net_NetworkInterface(ipv6NetworkInterface, GOOD_IPv6);
}
- private void check_setNetworkInterfaceLjava_net_NetworkInterface(InetAddress group)
+ private void check_setNetworkInterfaceLjava_net_NetworkInterface(
+ NetworkInterface networkInterface, InetAddress group)
throws IOException, InterruptedException {
// Set up the receiving socket and join the group.
- Enumeration theInterfaces = NetworkInterface.getNetworkInterfaces();
- while (theInterfaces.hasMoreElements()) {
- NetworkInterface thisInterface = (NetworkInterface) theInterfaces.nextElement();
- if (willWorkForMulticast(thisInterface)) {
- if ((!(thisInterface.getInetAddresses().nextElement()).isLoopbackAddress())) {
- MulticastSocket receivingSocket = createReceivingSocket(0);
- InetSocketAddress groupAddress =
- new InetSocketAddress(group, receivingSocket.getLocalPort());
- receivingSocket.joinGroup(groupAddress, thisInterface);
-
- // Send the packets on a particular interface. The source address in the
- // received packet should be one of the addresses for the interface set.
- MulticastSocket sendingSocket = new MulticastSocket(0);
- sendingSocket.setNetworkInterface(thisInterface);
- String msg = thisInterface.getName();
- DatagramPacket sdp = createSendDatagramPacket(groupAddress, msg);
- sendingSocket.send(sdp);
-
- DatagramPacket rdp = createReceiveDatagramPacket();
- receivingSocket.receive(rdp);
- String receivedMessage = extractMessage(rdp);
- assertEquals("Group member did not recv data sent on a specific interface",
- msg, receivedMessage);
- // Stop the server.
- receivingSocket.close();
- sendingSocket.close();
- }
- }
- }
+ MulticastSocket receivingSocket = createReceivingSocket(0);
+ InetSocketAddress groupAddress =
+ new InetSocketAddress(group, receivingSocket.getLocalPort());
+ receivingSocket.joinGroup(groupAddress, networkInterface);
+
+ // Send the packets on a particular interface. The source address in the
+ // received packet should be one of the addresses for the interface set.
+ MulticastSocket sendingSocket = new MulticastSocket(0);
+ sendingSocket.setNetworkInterface(networkInterface);
+ String msg = networkInterface.getName();
+ DatagramPacket sdp = createSendDatagramPacket(groupAddress, msg);
+ sendingSocket.send(sdp);
+
+ DatagramPacket rdp = createReceiveDatagramPacket();
+ receivingSocket.receive(rdp);
+ String receivedMessage = extractMessage(rdp);
+ assertEquals("Group member did not recv data sent on a specific interface",
+ msg, receivedMessage);
+ // Stop the server.
+ receivingSocket.close();
+ sendingSocket.close();
}
@Test
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/CharsetDecoderTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/CharsetDecoderTest.java
index e64b2b92430..4677b26708e 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/CharsetDecoderTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/CharsetDecoderTest.java
@@ -21,6 +21,7 @@ import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CoderMalfunctionError;
import java.nio.charset.CoderResult;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.MalformedInputException;
@@ -231,6 +232,7 @@ public class CharsetDecoderTest extends TestCase {
assertCharBufferValue(getString(), out);
}
+ @SuppressWarnings("TryFailThrowable")
public void testDecodeByteBufferException()
throws CharacterCodingException, UnsupportedEncodingException {
CharBuffer out;
@@ -289,8 +291,8 @@ public class CharsetDecoderTest extends TestCase {
// RuntimeException
try {
decoder.decode(getExceptionByteArray());
- fail("should throw runtime exception");
- } catch (RuntimeException e) {
+ fail("should throw");
+ } catch (RuntimeException | CoderMalfunctionError e) {
}
}
@@ -506,6 +508,7 @@ public class CharsetDecoderTest extends TestCase {
readOnly(getExceptionByteArray()), false);
}
+ @SuppressWarnings("TryFailThrowable")
void implTestDecodeCharBufferByteBufferException(ByteBuffer in,
boolean endOfInput) throws CharacterCodingException,
UnsupportedEncodingException {
@@ -513,8 +516,8 @@ public class CharsetDecoderTest extends TestCase {
decoder.reset();
try {
decoder.decode(in, out, endOfInput);
- fail("should throw runtime exception");
- } catch (RuntimeException e) {
+ fail("should throw");
+ } catch (RuntimeException | CoderMalfunctionError e) {
}
}
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/CharsetEncoderTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/CharsetEncoderTest.java
index c1c1e93a0fa..359b02069d0 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/CharsetEncoderTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/CharsetEncoderTest.java
@@ -21,6 +21,7 @@ import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderMalfunctionError;
import java.nio.charset.CoderResult;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.MalformedInputException;
@@ -623,6 +624,7 @@ public class CharsetEncoderTest extends TestCase {
return CharBuffer.wrap("runtime buffer");
}
+ @SuppressWarnings("TryFailThrowable")
public void testEncodeCharBufferException() throws CharacterCodingException {
ByteBuffer out;
CharBuffer in;
@@ -679,8 +681,8 @@ public class CharsetEncoderTest extends TestCase {
// RuntimeException
try {
encoder.encode(getExceptionCharBuffer());
- fail("should throw runtime exception");
- } catch (RuntimeException e) {
+ fail("should throw");
+ } catch (RuntimeException | CoderMalfunctionError e) {
}
}
@@ -825,6 +827,7 @@ public class CharsetEncoderTest extends TestCase {
return result;
}
+ @SuppressWarnings("TryFailThrowable")
protected void implTestEncodeCharBufferByteBufferbooleanException(
boolean endOfInput) throws CharacterCodingException {
ByteBuffer out = ByteBuffer.allocate(100);
@@ -890,8 +893,8 @@ public class CharsetEncoderTest extends TestCase {
// RuntimeException
try {
encoder.encode(getExceptionCharBuffer());
- fail("should throw runtime exception");
- } catch (RuntimeException e) {
+ fail("should throw");
+ } catch (RuntimeException | CoderMalfunctionError e) {
}
}
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ControlTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ControlTest.java
index 717e7d9bf90..b2ab8eaaf5f 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ControlTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ControlTest.java
@@ -118,11 +118,6 @@ public class ControlTest extends TestCase {
} catch (UnsupportedOperationException e) {
// expected
}
- Class<?> unmodifiableListClass = Collections.unmodifiableList(
- new ArrayList<String>()).getClass();
- assertEquals(FORMAT_CLASS.getClass(), unmodifiableListClass);
- assertEquals(FORMAT_DEFAULT.getClass(), unmodifiableListClass);
- assertEquals(FORMAT_PROPERTIES.getClass(), unmodifiableListClass);
assertEquals(-1L, TTL_DONT_CACHE);
assertEquals(-2L, TTL_NO_EXPIRATION_CONTROL);
}
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ScannerTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ScannerTest.java
index 85899f3f3c0..7c85b08960c 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ScannerTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ScannerTest.java
@@ -327,7 +327,7 @@ public class ScannerTest extends TestCase {
try {
s = new Scanner((PipedInputStream) null, "invalid charset");
fail();
- } catch (NullPointerException expected) {
+ } catch (NullPointerException | IllegalArgumentException expected) {
}
try {
diff --git a/luni/src/test/java/libcore/java/lang/StringTest.java b/luni/src/test/java/libcore/java/lang/StringTest.java
index 395209aa42c..e74eb1935e7 100644
--- a/luni/src/test/java/libcore/java/lang/StringTest.java
+++ b/luni/src/test/java/libcore/java/lang/StringTest.java
@@ -27,6 +27,7 @@ import java.nio.ReadOnlyBufferException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderMalfunctionError;
import java.nio.charset.CoderResult;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.StandardCharsets;
@@ -86,6 +87,7 @@ public class StringTest extends TestCase {
public CharsetDecoder newDecoder() { return new EvilCharsetDecoder(this); }
};
+ @SuppressWarnings("TryFailThrowable")
public void testGetBytes_MaliciousCharset() {
try {
String s = "hi";
@@ -93,7 +95,7 @@ public class StringTest extends TestCase {
// it was given.
s.getBytes(EVIL_CHARSET);
fail(); // We shouldn't have got here!
- } catch (ReadOnlyBufferException expected) {
+ } catch (ReadOnlyBufferException | CoderMalfunctionError expected) {
// We caught you trying to be naughty!
}
}
diff --git a/luni/src/test/java/libcore/java/util/concurrent/ForkJoinPoolTest.java b/luni/src/test/java/libcore/java/util/concurrent/ForkJoinPoolTest.java
index 578970e4bee..7fb9edf6df8 100644
--- a/luni/src/test/java/libcore/java/util/concurrent/ForkJoinPoolTest.java
+++ b/luni/src/test/java/libcore/java/util/concurrent/ForkJoinPoolTest.java
@@ -25,6 +25,7 @@ import java.util.concurrent.ForkJoinTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.CountDownLatch;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@@ -53,14 +54,19 @@ public class ForkJoinPoolTest {
final AtomicInteger value = new AtomicInteger(0);
final AtomicBoolean stop = new AtomicBoolean(false);
+ final CountDownLatch startPending = new CountDownLatch(1);
ForkJoinTask task = pool.submit(new Runnable() {
public void run() {
+ startPending.countDown();
while(!stop.get()) {
value.incrementAndGet();
}
stop.set(false);
}
});
+ while (startPending.getCount() > 0) {
+ Thread.yield();
+ }
assertEquals(1, pool.getRunningThreadCount());
stop.set(true);
task.join();
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https/HttpsURLConnectionTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https/HttpsURLConnectionTest.java
index b568eeb3b5c..4f0eefd47db 100644
--- a/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https/HttpsURLConnectionTest.java
+++ b/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https/HttpsURLConnectionTest.java
@@ -746,7 +746,7 @@ public class HttpsURLConnectionTest extends TestCase {
trustManagers = TestTrustManager.wrap(trustManagers);
}
- SSLContext ctx = SSLContext.getInstance("TLSv1");
+ SSLContext ctx = SSLContext.getInstance("TLS");
ctx.init(keyManagers, trustManagers, null);
return ctx;
}
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 00000000000..f028ee47d43
--- /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 00000000000..e06469cd6f5
--- /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 00000000000..1b8e418027d
--- /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();
+}