Loading core/java/android/os/Parcel.java +0 −2 Original line number Diff line number Diff line Loading @@ -465,9 +465,7 @@ public final class Parcel { private static native byte[] nativeMarshall(long nativePtr); private static native void nativeUnmarshall( long nativePtr, byte[] data, int offset, int length); @RavenwoodThrow private static native int nativeCompareData(long thisNativePtr, long otherNativePtr); @RavenwoodThrow private static native boolean nativeCompareDataInRange( long ptrA, int offsetA, long ptrB, int offsetB, int length); private static native void nativeAppendFrom( Loading core/tests/coretests/src/android/os/BundleTest.java +0 −4 Original line number Diff line number Diff line Loading @@ -197,7 +197,6 @@ public class BundleTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void kindofEquals_bothParcelled_same() { Bundle bundle1 = new Bundle(); bundle1.putString("StringKey", "S"); Loading @@ -215,7 +214,6 @@ public class BundleTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void kindofEquals_bothParcelled_different() { Bundle bundle1 = new Bundle(); bundle1.putString("StringKey", "S"); Loading Loading @@ -247,7 +245,6 @@ public class BundleTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void kindofEquals_lazyValues() { Parcelable p1 = new CustomParcelable(13, "Tiramisu"); Parcelable p2 = new CustomParcelable(13, "Tiramisu"); Loading Loading @@ -281,7 +278,6 @@ public class BundleTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void kindofEquals_lazyValuesWithIdenticalParcels_returnsTrue() { Parcelable p1 = new CustomParcelable(13, "Tiramisu"); Parcelable p2 = new CustomParcelable(13, "Tiramisu"); Loading core/tests/coretests/src/android/os/ParcelTest.java +0 −6 Original line number Diff line number Diff line Loading @@ -132,7 +132,6 @@ public class ParcelTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCompareDataInRange_whenSameData() { Parcel pA = Parcel.obtain(); int iA = pA.dataPosition(); Loading Loading @@ -169,7 +168,6 @@ public class ParcelTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCompareDataInRange_whenDifferentData() { Parcel pA = Parcel.obtain(); int iA = pA.dataPosition(); Loading @@ -186,7 +184,6 @@ public class ParcelTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCompareDataInRange_whenLimitOutOfBounds_throws() { Parcel pA = Parcel.obtain(); int iA = pA.dataPosition(); Loading @@ -213,7 +210,6 @@ public class ParcelTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCompareDataInRange_whenLengthZero() { Parcel pA = Parcel.obtain(); int iA = pA.dataPosition(); Loading @@ -232,7 +228,6 @@ public class ParcelTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCompareDataInRange_whenNegativeLength_throws() { Parcel pA = Parcel.obtain(); int iA = pA.dataPosition(); Loading @@ -248,7 +243,6 @@ public class ParcelTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCompareDataInRange_whenNegativeOffset_throws() { Parcel pA = Parcel.obtain(); int iA = pA.dataPosition(); Loading ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java +70 −9 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.platform.test.ravenwood; import static org.junit.Assert.fail; import android.platform.test.annotations.IgnoreUnderRavenwood; import org.junit.Assume; Loading @@ -36,6 +38,15 @@ public class RavenwoodRule implements TestRule { private static final boolean IS_UNDER_RAVENWOOD = RavenwoodRuleImpl.isUnderRavenwood(); /** * When probing is enabled, all tests will be unconditionally run under Ravenwood to detect * cases where a test is able to pass despite being marked as {@code IgnoreUnderRavenwood}. * * This is typically helpful for internal maintainers discovering tests that had previously * been ignored, but now have enough Ravenwood-supported functionality to be enabled. */ private static final boolean ENABLE_PROBE_IGNORED = false; // DO NOT SUBMIT WITH TRUE private static final int SYSTEM_UID = 1000; private static final int NOBODY_UID = 9999; private static final int FIRST_APPLICATION_UID = 10000; Loading Loading @@ -97,26 +108,76 @@ public class RavenwoodRule implements TestRule { return IS_UNDER_RAVENWOOD; } /** * Test if the given {@link Description} has been marked with an {@link IgnoreUnderRavenwood} * annotation, either at the method or class level. */ private static boolean hasIgnoreUnderRavenwoodAnnotation(Description description) { if (description.getTestClass().getAnnotation(IgnoreUnderRavenwood.class) != null) { return true; } else if (description.getAnnotation(IgnoreUnderRavenwood.class) != null) { return true; } else { return false; } } @Override public Statement apply(Statement base, Description description) { if (ENABLE_PROBE_IGNORED) { return applyProbeIgnored(base, description); } else { return applyDefault(base, description); } } /** * Run the given {@link Statement} with no special treatment. */ private Statement applyDefault(Statement base, Description description) { return new Statement() { @Override public void evaluate() throws Throwable { if (description.getTestClass().getAnnotation(IgnoreUnderRavenwood.class) != null) { Assume.assumeFalse(IS_UNDER_RAVENWOOD); } if (description.getAnnotation(IgnoreUnderRavenwood.class) != null) { if (hasIgnoreUnderRavenwoodAnnotation(description)) { Assume.assumeFalse(IS_UNDER_RAVENWOOD); } if (IS_UNDER_RAVENWOOD) { RavenwoodRuleImpl.init(RavenwoodRule.this); try { base.evaluate(); } finally { RavenwoodRuleImpl.reset(RavenwoodRule.this); } } }; } /** * Run the given {@link Statement} with probing enabled. All tests will be unconditionally * run under Ravenwood to detect cases where a test is able to pass despite being marked as * {@code IgnoreUnderRavenwood}. */ private Statement applyProbeIgnored(Statement base, Description description) { return new Statement() { @Override public void evaluate() throws Throwable { RavenwoodRuleImpl.init(RavenwoodRule.this); try { base.evaluate(); } catch (Throwable t) { if (hasIgnoreUnderRavenwoodAnnotation(description)) { // This failure is expected, so eat the exception and report the // assumption failure that test authors expect Assume.assumeFalse(IS_UNDER_RAVENWOOD); } throw t; } finally { if (IS_UNDER_RAVENWOOD) { RavenwoodRuleImpl.reset(RavenwoodRule.this); } if (hasIgnoreUnderRavenwoodAnnotation(description) && IS_UNDER_RAVENWOOD) { fail("Test was annotated with IgnoreUnderRavenwood, but it actually " + "passed under Ravenwood; consider removing the annotation"); } } }; Loading ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java +2 −4 Original line number Diff line number Diff line Loading @@ -22,12 +22,10 @@ public class RavenwoodRuleImpl { } public static void init(RavenwoodRule rule) { // Must be provided by impl to reference runtime internals throw new UnsupportedOperationException(); // No-op when running on a real device } public static void reset(RavenwoodRule rule) { // Must be provided by impl to reference runtime internals throw new UnsupportedOperationException(); // No-op when running on a real device } } Loading
core/java/android/os/Parcel.java +0 −2 Original line number Diff line number Diff line Loading @@ -465,9 +465,7 @@ public final class Parcel { private static native byte[] nativeMarshall(long nativePtr); private static native void nativeUnmarshall( long nativePtr, byte[] data, int offset, int length); @RavenwoodThrow private static native int nativeCompareData(long thisNativePtr, long otherNativePtr); @RavenwoodThrow private static native boolean nativeCompareDataInRange( long ptrA, int offsetA, long ptrB, int offsetB, int length); private static native void nativeAppendFrom( Loading
core/tests/coretests/src/android/os/BundleTest.java +0 −4 Original line number Diff line number Diff line Loading @@ -197,7 +197,6 @@ public class BundleTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void kindofEquals_bothParcelled_same() { Bundle bundle1 = new Bundle(); bundle1.putString("StringKey", "S"); Loading @@ -215,7 +214,6 @@ public class BundleTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void kindofEquals_bothParcelled_different() { Bundle bundle1 = new Bundle(); bundle1.putString("StringKey", "S"); Loading Loading @@ -247,7 +245,6 @@ public class BundleTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void kindofEquals_lazyValues() { Parcelable p1 = new CustomParcelable(13, "Tiramisu"); Parcelable p2 = new CustomParcelable(13, "Tiramisu"); Loading Loading @@ -281,7 +278,6 @@ public class BundleTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void kindofEquals_lazyValuesWithIdenticalParcels_returnsTrue() { Parcelable p1 = new CustomParcelable(13, "Tiramisu"); Parcelable p2 = new CustomParcelable(13, "Tiramisu"); Loading
core/tests/coretests/src/android/os/ParcelTest.java +0 −6 Original line number Diff line number Diff line Loading @@ -132,7 +132,6 @@ public class ParcelTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCompareDataInRange_whenSameData() { Parcel pA = Parcel.obtain(); int iA = pA.dataPosition(); Loading Loading @@ -169,7 +168,6 @@ public class ParcelTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCompareDataInRange_whenDifferentData() { Parcel pA = Parcel.obtain(); int iA = pA.dataPosition(); Loading @@ -186,7 +184,6 @@ public class ParcelTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCompareDataInRange_whenLimitOutOfBounds_throws() { Parcel pA = Parcel.obtain(); int iA = pA.dataPosition(); Loading @@ -213,7 +210,6 @@ public class ParcelTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCompareDataInRange_whenLengthZero() { Parcel pA = Parcel.obtain(); int iA = pA.dataPosition(); Loading @@ -232,7 +228,6 @@ public class ParcelTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCompareDataInRange_whenNegativeLength_throws() { Parcel pA = Parcel.obtain(); int iA = pA.dataPosition(); Loading @@ -248,7 +243,6 @@ public class ParcelTest { } @Test @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCompareDataInRange_whenNegativeOffset_throws() { Parcel pA = Parcel.obtain(); int iA = pA.dataPosition(); Loading
ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java +70 −9 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.platform.test.ravenwood; import static org.junit.Assert.fail; import android.platform.test.annotations.IgnoreUnderRavenwood; import org.junit.Assume; Loading @@ -36,6 +38,15 @@ public class RavenwoodRule implements TestRule { private static final boolean IS_UNDER_RAVENWOOD = RavenwoodRuleImpl.isUnderRavenwood(); /** * When probing is enabled, all tests will be unconditionally run under Ravenwood to detect * cases where a test is able to pass despite being marked as {@code IgnoreUnderRavenwood}. * * This is typically helpful for internal maintainers discovering tests that had previously * been ignored, but now have enough Ravenwood-supported functionality to be enabled. */ private static final boolean ENABLE_PROBE_IGNORED = false; // DO NOT SUBMIT WITH TRUE private static final int SYSTEM_UID = 1000; private static final int NOBODY_UID = 9999; private static final int FIRST_APPLICATION_UID = 10000; Loading Loading @@ -97,26 +108,76 @@ public class RavenwoodRule implements TestRule { return IS_UNDER_RAVENWOOD; } /** * Test if the given {@link Description} has been marked with an {@link IgnoreUnderRavenwood} * annotation, either at the method or class level. */ private static boolean hasIgnoreUnderRavenwoodAnnotation(Description description) { if (description.getTestClass().getAnnotation(IgnoreUnderRavenwood.class) != null) { return true; } else if (description.getAnnotation(IgnoreUnderRavenwood.class) != null) { return true; } else { return false; } } @Override public Statement apply(Statement base, Description description) { if (ENABLE_PROBE_IGNORED) { return applyProbeIgnored(base, description); } else { return applyDefault(base, description); } } /** * Run the given {@link Statement} with no special treatment. */ private Statement applyDefault(Statement base, Description description) { return new Statement() { @Override public void evaluate() throws Throwable { if (description.getTestClass().getAnnotation(IgnoreUnderRavenwood.class) != null) { Assume.assumeFalse(IS_UNDER_RAVENWOOD); } if (description.getAnnotation(IgnoreUnderRavenwood.class) != null) { if (hasIgnoreUnderRavenwoodAnnotation(description)) { Assume.assumeFalse(IS_UNDER_RAVENWOOD); } if (IS_UNDER_RAVENWOOD) { RavenwoodRuleImpl.init(RavenwoodRule.this); try { base.evaluate(); } finally { RavenwoodRuleImpl.reset(RavenwoodRule.this); } } }; } /** * Run the given {@link Statement} with probing enabled. All tests will be unconditionally * run under Ravenwood to detect cases where a test is able to pass despite being marked as * {@code IgnoreUnderRavenwood}. */ private Statement applyProbeIgnored(Statement base, Description description) { return new Statement() { @Override public void evaluate() throws Throwable { RavenwoodRuleImpl.init(RavenwoodRule.this); try { base.evaluate(); } catch (Throwable t) { if (hasIgnoreUnderRavenwoodAnnotation(description)) { // This failure is expected, so eat the exception and report the // assumption failure that test authors expect Assume.assumeFalse(IS_UNDER_RAVENWOOD); } throw t; } finally { if (IS_UNDER_RAVENWOOD) { RavenwoodRuleImpl.reset(RavenwoodRule.this); } if (hasIgnoreUnderRavenwoodAnnotation(description) && IS_UNDER_RAVENWOOD) { fail("Test was annotated with IgnoreUnderRavenwood, but it actually " + "passed under Ravenwood; consider removing the annotation"); } } }; Loading
ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java +2 −4 Original line number Diff line number Diff line Loading @@ -22,12 +22,10 @@ public class RavenwoodRuleImpl { } public static void init(RavenwoodRule rule) { // Must be provided by impl to reference runtime internals throw new UnsupportedOperationException(); // No-op when running on a real device } public static void reset(RavenwoodRule rule) { // Must be provided by impl to reference runtime internals throw new UnsupportedOperationException(); // No-op when running on a real device } }