Merge "Update debug stripping tests for Dalvik 4.4.4."
diff --git a/src/test/java/com/android/tools/r8/graph/TargetLookupTest.java b/src/test/java/com/android/tools/r8/graph/TargetLookupTest.java
index e7718e1..c01ef70 100644
--- a/src/test/java/com/android/tools/r8/graph/TargetLookupTest.java
+++ b/src/test/java/com/android/tools/r8/graph/TargetLookupTest.java
@@ -8,6 +8,8 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import com.android.tools.r8.ToolHelper;
+import com.android.tools.r8.ToolHelper.DexVm;
import com.android.tools.r8.smali.SmaliTestBase;
import com.android.tools.r8.utils.InternalOptions;
import com.google.common.collect.ImmutableList;
@@ -67,7 +69,17 @@
assertNull(appInfo.lookupDirectTarget(method.method));
assertNotNull(appInfo.lookupStaticTarget(method.method));
- assertEquals("OK", runArt(application, new InternalOptions()));
+ if (ToolHelper.getDexVm() == DexVm.ART_4_4_4) {
+ // Dalvik rejects at verification time instead of producing the
+ // expected IncompatibleClassChangeError.
+ try {
+ runArt(application, new InternalOptions());
+ } catch (AssertionError e) {
+ assert e.toString().contains("VerifyError");
+ }
+ } else {
+ assertEquals("OK", runArt(application, new InternalOptions()));
+ }
}
@Test
diff --git a/src/test/java/com/android/tools/r8/jasmin/FillBooleanArrayTruncation.java b/src/test/java/com/android/tools/r8/jasmin/FillBooleanArrayTruncation.java
index b5b2a3c..a03f8a5 100644
--- a/src/test/java/com/android/tools/r8/jasmin/FillBooleanArrayTruncation.java
+++ b/src/test/java/com/android/tools/r8/jasmin/FillBooleanArrayTruncation.java
@@ -5,17 +5,41 @@
import static org.junit.Assert.assertEquals;
+import com.android.tools.r8.ToolHelper;
+import com.android.tools.r8.ToolHelper.DexVm;
import com.google.common.collect.ImmutableList;
import org.junit.Test;
public class FillBooleanArrayTruncation extends JasminTestBase {
+ private void runOnDalvikCheckVerifyError(JasminBuilder builder, String main) throws Exception {
+ try {
+ runOnArt(builder, main);
+ } catch (AssertionError e) {
+ assert e.toString().contains("VerifyError");
+ }
+ }
+
+ private void runOnDalvikDxCheckVerifyError(JasminBuilder builder, String main) throws Exception {
+ try {
+ runOnArtDx(builder, main);
+ } catch (AssertionError e) {
+ assert e.toString().contains("VerifyError");
+ }
+ }
+
private void runTest(JasminBuilder builder, String main) throws Exception {
String javaResult = runOnJava(builder, main);
- String artResult = runOnArt(builder, main);
- assertEquals(javaResult, artResult);
- String dxArtResult = runOnArtDx(builder, main);
- assertEquals(javaResult, dxArtResult);
+ if (ToolHelper.getDexVm() == DexVm.ART_4_4_4) {
+ // On dalvik the need for truncation is treated as a verification error.
+ runOnDalvikCheckVerifyError(builder, main);
+ runOnDalvikDxCheckVerifyError(builder, main);
+ } else {
+ String artResult = runOnArt(builder, main);
+ assertEquals(javaResult, artResult);
+ String dxArtResult = runOnArtDx(builder, main);
+ assertEquals(javaResult, dxArtResult);
+ }
}
@Test