Deprecate use of BrokenTest and SideEffect
Use expectations files instead.
(cherry picked from commit 6a6b612286976cc185c898803fe51e4e062bd9eb)
Bug: 12924356
Change-Id: I9b7e71805a80176c873cffe46bed65f81de1903d
diff --git a/dalvik/src/main/java/dalvik/annotation/BrokenTest.java b/dalvik/src/main/java/dalvik/annotation/BrokenTest.java
index 401d652..16788d0 100644
--- a/dalvik/src/main/java/dalvik/annotation/BrokenTest.java
+++ b/dalvik/src/main/java/dalvik/annotation/BrokenTest.java
@@ -25,6 +25,8 @@
* Marks a test case as broken. This means the test case should be fixed.
*
* @hide
+ *
+ * @deprecated - use expectations/brokentests.txt instead
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD })
diff --git a/dalvik/src/main/java/dalvik/annotation/SideEffect.java b/dalvik/src/main/java/dalvik/annotation/SideEffect.java
index b92e9bc..2d691e3 100644
--- a/dalvik/src/main/java/dalvik/annotation/SideEffect.java
+++ b/dalvik/src/main/java/dalvik/annotation/SideEffect.java
@@ -27,6 +27,8 @@
* isolated manner.
*
* @hide
+ *
+ * @deprecated - use expectations/brokentests.txt instead
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE })
diff --git a/expectations/brokentests.txt b/expectations/brokentests.txt
index c108c6b..5cebb63 100644
--- a/expectations/brokentests.txt
+++ b/expectations/brokentests.txt
@@ -96,5 +96,71 @@
names: [
"org.apache.harmony.tests.java.util.ControlTest#test_needsReload_LStringLLocaleLStringLClassLoaderResourceBundleJ"
]
+},
+{
+ description: "Fails in CTS, passes in CoreTestRunner.",
+ result: EXEC_FAILED,
+ names: [
+ "org.apache.harmony.tests.java.net.URLConnection#test_getContentEncoding",
+ "libcore.java.text.OldNumberFormatTest#test_parseLjava_lang_String",
+ "libcore.java.nio.channels.OldSocketChannelTest#test_writeLjava_nio_ByteBuffer_Nonblocking_HugeData",
+ "org.apache.harmony.tests.java.lang.ProcessManagerTest#testSleep",
+ "libcore.java.security.cert.OldPKIXParametersTest#testPKIXParametersKeyStore04"
+ ]
+},
+{
+ description: "Suffers from DH slowness, disabling for now.",
+ result: EXEC_FAILED,
+ names: [
+ "libcore.java.security.OldDHTest#testDHGen",
+ "libcore.java.security.OldKeyPairGeneratorTestDH#testKeyPairGenerator",
+ "libcore.javax.crypto.spec.KeyPairGeneratorTestDH#testKeyPairGenerator",
+ "libcore.javax.crypto.spec.AlgorithmParametersTestDH#testAlgorithmParameters",
+ "libcore.javax.crypto.spec.AlgorithmParameterGeneratorTestDH#testAlgorithmParameterGenerator"
+ ]
+},
+{
+ description: "Destroys MD5 provider, hurts succeeding tests",
+ result: EXEC_FAILED,
+ names: [
+ "tests.api.javax.security.cert.X509CertificateTest#testVerifyPublicKey",
+ "tests.api.javax.security.cert.X509CertificateTest#testVerifyPublicKeyString"
+ ]
+},
+{
+ description: "Suffers from side effect of other, currently unknown test",
+ result: EXEC_FAILED,
+ names: [
+ "org.apache.harmony.luni.tests.internal.net.www.protocol.http.HttpURLConnectionTest#testProxyAuthorization"
+ ]
+},
+{
+ description: "Support_TestWebServer requires isolation.",
+ result: EXEC_FAILED,
+ names: [
+ "libcore.java.net.OldURLClassLoaderTest#test_findResourceLjava_lang_String"
+ ]
+},
+{
+ description: "This test affects tests that are run after this one due to caching in URLConnection.",
+ result: EXEC_FAILED,
+ names: [
+ "org.apache.harmony.luni.tests.java.net.ContentHandlerFactoryTest#test_createContentHandler"
+ ]
+},
+{
+ description: "Causes OutOfMemoryError to test finalization",
+ result: EXEC_FAILED,
+ names: [
+ "org.apache.harmony.tests.java.lang.ref.SoftReferenceTest#test_get_SoftReference",
+ "org.apache.harmony.crypto.tests.javax.crypto#ExemptionMechanismTest#test_finalize"
+ ]
+},
+{
+ description: "Causes open dex file error",
+ result: EXEC_FAILED,
+ names: [
+ "org.apache.harmony.tests.java.lang.reflect.GenericSignatureFormatErrorTest#test_signatureFormatError"
+ ]
}
]
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ProcessManagerTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ProcessManagerTest.java
index 3930b59..9f7474a 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ProcessManagerTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ProcessManagerTest.java
@@ -16,8 +16,6 @@
package org.apache.harmony.tests.java.lang;
-import dalvik.annotation.BrokenTest;
-
import junit.framework.TestCase;
import java.io.BufferedReader;
@@ -47,7 +45,7 @@
assertEquals(greeting, readLine(process));
}
- @BrokenTest("Sporadic failures in CTS, but not in CoreTestRunner")
+ // BrokenTest: Sporadic failures in CTS, but not in CoreTestRunner
public void testSleep() throws IOException {
String[] commands = { "sleep", "1" };
process = Runtime.getRuntime().exec(commands, null, null);
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ref/SoftReferenceTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ref/SoftReferenceTest.java
index cfc5d0d..f66cbbf 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ref/SoftReferenceTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ref/SoftReferenceTest.java
@@ -16,8 +16,6 @@
*/
package org.apache.harmony.tests.java.lang.ref;
-import dalvik.annotation.SideEffect;
-
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
@@ -79,7 +77,7 @@
assertTrue("Same object not returned.", bool == sr.get());
}
- @SideEffect("Causes OutOfMemoryError to test finalization")
+ // SideEffect: Causes OutOfMemoryError to test finalization
public void test_get_SoftReference() {
class TestObject {
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/GenericSignatureFormatErrorTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/GenericSignatureFormatErrorTest.java
index 9cd4947..0cad681 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/GenericSignatureFormatErrorTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/GenericSignatureFormatErrorTest.java
@@ -1,7 +1,6 @@
package org.apache.harmony.tests.java.lang.reflect;
import dalvik.annotation.AndroidOnly;
-import dalvik.annotation.SideEffect;
import dalvik.system.DexFile;
import junit.framework.TestCase;
@@ -34,9 +33,9 @@
@AndroidOnly("Uses Android specific class dalvik.system.DexFile " +
"for loading classes.")
- @SideEffect("strange issue (exception: 'could not open dex file', " +
- "dalvikvm: 'waitpid failed' log msg - only occurs when @SideEffect is removed " +
- "and this test is run via running tests.luni.AllTestsLang TestSuite")
+ // SideEffect: strange issue (exception: 'could not open dex file',
+ // dalvikvm: 'waitpid failed' log msg - only occurs when @SideEffect is removed
+ // and this test is run via running tests.luni.AllTestsLang TestSuite
public void test_signatureFormatError() throws Exception {
/*
* dex1.bytes is a jar file with a classes.dex in it.
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/security/cert/X509CertificateTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/security/cert/X509CertificateTest.java
index e937db9..64bfbb3 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/security/cert/X509CertificateTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/security/cert/X509CertificateTest.java
@@ -22,9 +22,6 @@
package tests.api.javax.security.cert;
-import dalvik.annotation.BrokenTest;
-import dalvik.annotation.SideEffect;
-
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -661,7 +658,7 @@
* @throws CertificateException
* {@link Certificate#verify(PublicKey)}
*/
- @SideEffect("Destroys MD5 provider, hurts succeeding tests")
+ // Side Effect: Destroys MD5 provider, hurts succeeding tests
public void testVerifyPublicKey() throws InvalidKeyException,
NoSuchAlgorithmException, NoSuchProviderException,
SignatureException, CertificateException {
@@ -744,7 +741,7 @@
* @throws CertificateException
* {@link Certificate#verify(PublicKey, String)}
*/
- @SideEffect("Destroys MD5 provider, hurts succeeding tests")
+ // SideEffect: Destroys MD5 provider, hurts succeeding tests
public void testVerifyPublicKeyString() throws InvalidKeyException,
java.security.cert.CertificateException, NoSuchAlgorithmException,
NoSuchProviderException, SignatureException, IOException,
diff --git a/luni/src/test/java/libcore/java/net/OldURLClassLoaderTest.java b/luni/src/test/java/libcore/java/net/OldURLClassLoaderTest.java
index 3a5608c..38a0f95 100644
--- a/luni/src/test/java/libcore/java/net/OldURLClassLoaderTest.java
+++ b/luni/src/test/java/libcore/java/net/OldURLClassLoaderTest.java
@@ -17,7 +17,6 @@
package libcore.java.net;
-import dalvik.annotation.SideEffect;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -207,7 +206,7 @@
}
}
- @SideEffect("Support_TestWebServer requires isolation.")
+ // SideEffect: Support_TestWebServer requires isolation.
public void test_findResourceLjava_lang_String() throws Exception {
File tmp = File.createTempFile("test", ".txt");
@@ -232,7 +231,7 @@
/**
* Regression for Harmony-2237
*/
- @SideEffect("Support_TestWebServer requires isolation.")
+ // SideEffect: Support_TestWebServer requires isolation.
public void test_findResource_String() throws Exception {
File tempFile1 = File.createTempFile("textFile", ".txt");
tempFile1.createNewFile();
diff --git a/luni/src/test/java/libcore/java/nio/channels/OldSocketChannelTest.java b/luni/src/test/java/libcore/java/nio/channels/OldSocketChannelTest.java
index 0d0c69f..f849c33 100644
--- a/luni/src/test/java/libcore/java/nio/channels/OldSocketChannelTest.java
+++ b/luni/src/test/java/libcore/java/nio/channels/OldSocketChannelTest.java
@@ -17,7 +17,6 @@
package libcore.java.nio.channels;
-import dalvik.annotation.BrokenTest;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
@@ -235,7 +234,7 @@
return connected;
}
- @BrokenTest("Occasionally fail in CTS, but works in CoreTestRunner")
+ // Broken Test: Occasionally fail in CTS, but works in CoreTestRunner
public void test_writeLjava_nio_ByteBuffer_Nonblocking_HugeData() throws IOException {
// initialize write content
ByteBuffer writeContent = ByteBuffer.allocate(CAPACITY_HUGE);
diff --git a/luni/src/test/java/libcore/java/security/OldDHTest.java b/luni/src/test/java/libcore/java/security/OldDHTest.java
index 421d153..58d96ed 100644
--- a/luni/src/test/java/libcore/java/security/OldDHTest.java
+++ b/luni/src/test/java/libcore/java/security/OldDHTest.java
@@ -15,7 +15,6 @@
*/
package libcore.java.security;
-import dalvik.annotation.BrokenTest;
import java.security.AlgorithmParameterGenerator;
import java.security.AlgorithmParameters;
import java.security.KeyPair;
@@ -27,7 +26,7 @@
public class OldDHTest extends TestCase {
- @BrokenTest("Suffers from DH slowness, disabling for now")
+ // BrokenTest Suffers from DH slowness, disabling for now
public void testDHGen() throws Exception {
KeyPairGenerator gen = null;
try {
diff --git a/luni/src/test/java/libcore/java/security/OldKeyPairGeneratorTestDH.java b/luni/src/test/java/libcore/java/security/OldKeyPairGeneratorTestDH.java
index f39705b..9be282d 100644
--- a/luni/src/test/java/libcore/java/security/OldKeyPairGeneratorTestDH.java
+++ b/luni/src/test/java/libcore/java/security/OldKeyPairGeneratorTestDH.java
@@ -15,7 +15,6 @@
*/
package libcore.java.security;
-import dalvik.annotation.BrokenTest;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
@@ -24,7 +23,7 @@
public class OldKeyPairGeneratorTestDH extends TestCase {
- @BrokenTest("Takes ages due to DH computations. Disabling for now.")
+ // Broken Test: Takes ages due to DH computations. Disabling for now.
public void testKeyPairGenerator() throws NoSuchAlgorithmException {
KeyPairGenerator generator = KeyPairGenerator.getInstance("DH");
diff --git a/luni/src/test/java/libcore/java/security/cert/OldPKIXParametersTest.java b/luni/src/test/java/libcore/java/security/cert/OldPKIXParametersTest.java
index d69e0e2..0832dae 100644
--- a/luni/src/test/java/libcore/java/security/cert/OldPKIXParametersTest.java
+++ b/luni/src/test/java/libcore/java/security/cert/OldPKIXParametersTest.java
@@ -22,7 +22,6 @@
package libcore.java.security.cert;
-import dalvik.annotation.BrokenTest;
import java.io.ByteArrayInputStream;
import java.security.InvalidAlgorithmParameterException;
import java.security.KeyStore;
@@ -176,7 +175,7 @@
* @throws InvalidAlgorithmParameterException
* @throws KeyStoreException
*/
- @BrokenTest("Fails in CTS environment, but passes in CoreTestRunner")
+ // Broken Test: Fails in CTS environment, but passes in CoreTestRunner
public final void testPKIXParametersKeyStore04() throws Exception {
diff --git a/luni/src/test/java/libcore/java/text/OldNumberFormatTest.java b/luni/src/test/java/libcore/java/text/OldNumberFormatTest.java
index 356d0a9..d281a91 100644
--- a/luni/src/test/java/libcore/java/text/OldNumberFormatTest.java
+++ b/luni/src/test/java/libcore/java/text/OldNumberFormatTest.java
@@ -16,7 +16,6 @@
*/
package libcore.java.text;
-import dalvik.annotation.BrokenTest;
import java.text.ChoiceFormat;
import java.text.DecimalFormat;
import java.text.FieldPosition;
@@ -733,7 +732,7 @@
+ " instead of Integer.MIN_VALUE", result == 0);
}
- @BrokenTest("Fails in CTS, passes in CoreTestRunner")
+ // Broken Test: Fails in CTS, passes in CoreTestRunner
public void test_parseLjava_lang_String() {
NumberFormat nf1 = NumberFormat.getInstance();
try {
diff --git a/luni/src/test/java/libcore/javax/crypto/spec/AlgorithmParameterGeneratorTestDH.java b/luni/src/test/java/libcore/javax/crypto/spec/AlgorithmParameterGeneratorTestDH.java
index 578ee6b..e64fb9e 100644
--- a/luni/src/test/java/libcore/javax/crypto/spec/AlgorithmParameterGeneratorTestDH.java
+++ b/luni/src/test/java/libcore/javax/crypto/spec/AlgorithmParameterGeneratorTestDH.java
@@ -26,7 +26,7 @@
super("DH", new AlgorithmParameterKeyAgreementHelper("DH"));
}
- @BrokenTest("Suffers from DH slowness, disabling for now")
+ // Broken Test: Suffers from DH slowness, disabling for now
public void testAlgorithmParameterGenerator() {
super.testAlgorithmParameterGenerator();
}
diff --git a/luni/src/test/java/libcore/javax/crypto/spec/AlgorithmParametersTestDH.java b/luni/src/test/java/libcore/javax/crypto/spec/AlgorithmParametersTestDH.java
index 165daa1..897e62b 100644
--- a/luni/src/test/java/libcore/javax/crypto/spec/AlgorithmParametersTestDH.java
+++ b/luni/src/test/java/libcore/javax/crypto/spec/AlgorithmParametersTestDH.java
@@ -15,7 +15,6 @@
*/
package libcore.javax.crypto.spec;
-import dalvik.annotation.BrokenTest;
import java.math.BigInteger;
import javax.crypto.spec.DHParameterSpec;
import tests.security.AlgorithmParameterKeyAgreementHelper;
@@ -61,7 +60,7 @@
}
- @BrokenTest("Suffers from DH slowness, disabling for now")
+ // Broken Test: Suffers from DH slowness, disabling for now
public void testAlgorithmParameters() {
super.testAlgorithmParameters();
}
diff --git a/luni/src/test/java/libcore/javax/crypto/spec/KeyPairGeneratorTestDH.java b/luni/src/test/java/libcore/javax/crypto/spec/KeyPairGeneratorTestDH.java
index c4322ff..8e500e1 100644
--- a/luni/src/test/java/libcore/javax/crypto/spec/KeyPairGeneratorTestDH.java
+++ b/luni/src/test/java/libcore/javax/crypto/spec/KeyPairGeneratorTestDH.java
@@ -15,7 +15,6 @@
*/
package libcore.javax.crypto.spec;
-import dalvik.annotation.BrokenTest;
import java.security.NoSuchAlgorithmException;
import tests.security.KeyAgreementHelper;
import tests.security.KeyPairGeneratorTest;
@@ -26,7 +25,7 @@
super("DH", new KeyAgreementHelper("DH"));
}
- @BrokenTest("Takes ages due to DH computations. Disabling for now.")
+ // Broken Test: Takes ages due to DH computations. Disabling for now.
public void testKeyPairGenerator() throws NoSuchAlgorithmException {
super.testKeyPairGenerator();
}
diff --git a/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/ExemptionMechanismTest.java b/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/ExemptionMechanismTest.java
index f617adb..87b2913 100644
--- a/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/ExemptionMechanismTest.java
+++ b/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/ExemptionMechanismTest.java
@@ -17,8 +17,6 @@
package org.apache.harmony.crypto.tests.javax.crypto;
-import dalvik.annotation.SideEffect;
-
import java.math.BigInteger;
import java.security.AlgorithmParameters;
import java.security.InvalidAlgorithmParameterException;
@@ -186,7 +184,7 @@
}
}
- @SideEffect("Causes OutOfMemoryError to test finalization")
+ // Side Effect: Causes OutOfMemoryError to test finalization
public void test_finalize () {
Mock_ExemptionMechanism mem = new Mock_ExemptionMechanism(null, null, "Name");
assertNotNull(mem);
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
index 5d8c621..290ae9a 100644
--- a/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
+++ b/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
@@ -17,8 +17,6 @@
package org.apache.harmony.luni.tests.internal.net.www.protocol.http;
-import dalvik.annotation.SideEffect;
-
import java.io.IOException;
import java.net.Authenticator;
import java.net.HttpURLConnection;
@@ -270,7 +268,7 @@
ProxySelector.setDefault(defPS);
}
}
- @SideEffect("Suffers from side effect of other, currently unknown test")
+ // SideEffect: Suffers from side effect of other, currently unknown test
public void testProxyAuthorization() throws Exception {
// Set up test Authenticator
Authenticator.setDefault(new Authenticator() {
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/ContentHandlerFactoryTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/ContentHandlerFactoryTest.java
index 74b2276..f3d5518 100644
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/ContentHandlerFactoryTest.java
+++ b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/ContentHandlerFactoryTest.java
@@ -1,7 +1,5 @@
package org.apache.harmony.luni.tests.java.net;
-import dalvik.annotation.SideEffect;
-
import junit.framework.TestCase;
import tests.support.Support_Configuration;
@@ -24,9 +22,9 @@
boolean isGetContentCalled = false;
boolean isCreateContentHandlerCalled = false;
- @SideEffect("This test affects tests that are run after this one." +
- " The reason are side effects due to caching in URLConnection." +
- " Maybe this test needs to be run in isolation.")
+ // SideEffect: This test affects tests that are run after this one.
+ // The reason are side effects due to caching in URLConnection.
+ // Maybe this test needs to be run in isolation.
public void test_createContentHandler() throws IOException {
TestContentHandlerFactory factory = new TestContentHandlerFactory();
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java
index e2a3a47..d3da174 100644
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java
+++ b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java
@@ -16,7 +16,6 @@
package org.apache.harmony.luni.tests.java.net;
-import dalvik.annotation.BrokenTest;
import junit.framework.TestCase;
import tests.support.Support_Configuration;
import tests.support.Support_TestWebData;
@@ -442,7 +441,7 @@
* @throws IOException
* {@link java.net.URLConnection#getContentEncoding()}
*/
- @BrokenTest("Fails in CTS, passes in CoreTestRunner")
+ // broken test - Fails in CTS, passes in CoreTestRunner
public void test_getContentEncoding() throws IOException {
// faulty setup
try {