Update vm-tests to ART behavior
ART is more compliant with respect to standard behavior.
Bug: 16956477
Change-Id: Ifec1fa2a9ac99ea49759f9436ee917df734fb2e8
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_direct/Test_invoke_direct.java b/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_direct/Test_invoke_direct.java
index 1772f22..c5402b3 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_direct/Test_invoke_direct.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_direct/Test_invoke_direct.java
@@ -111,8 +111,9 @@
//@uses dot.junit.opcodes.invoke_direct.TSuper
try {
new T_invoke_direct_6();
- fail("expected NoSuchMethodError");
- } catch (NoSuchMethodError t) {
+ fail("expected a verification exception");
+ } catch (Throwable t) {
+ DxUtil.checkVerifyException(t);
}
}
@@ -241,14 +242,22 @@
/**
* @constraint n/a
* @title Attempt to invoke static method. Java throws IncompatibleClassChangeError
- * on first access but Dalvik throws VerifyError on class loading.
+ * on first access. Dalvik threw VerifyError on class loading.
*/
public void testVFE15() {
try {
- Class.forName("dot.junit.opcodes.invoke_direct.d.T_invoke_direct_11");
- fail("expected a verification exception");
+ Class<?> c = Class.forName("dot.junit.opcodes.invoke_direct.d.T_invoke_direct_11");
+ // Attempt to instantiate and run.
+ Object o = c.newInstance();
+ java.lang.reflect.Method m = c.getDeclaredMethod("run");
+ m.invoke(o);
+ fail("expected an invocation target exception with an incompatible class change error");
+ } catch (java.lang.reflect.InvocationTargetException ite) {
+ if (!(ite.getCause() instanceof IncompatibleClassChangeError)) {
+ fail("expected an incompatible class change error");
+ }
} catch (Throwable t) {
- DxUtil.checkVerifyException(t);
+ throw new RuntimeException(t);
}
}
@@ -277,8 +286,7 @@
//@uses dot.junit.opcodes.invoke_direct.TAbstract
try {
new T_invoke_direct_13().run();
- fail("expected NoSuchMethodError or verification exception");
- } catch (NoSuchMethodError t) {
+ fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_direct/d/T_invoke_direct_7.d b/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_direct/d/T_invoke_direct_7.d
index 2c1b99b..13432bd 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_direct/d/T_invoke_direct_7.d
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_direct/d/T_invoke_direct_7.d
@@ -27,7 +27,7 @@
.method public run()I
.limit regs 3
- invoke-direct {v1}, dot/junit/opcodes/invoke_direct/d/T_invoke_direct_7/toInt()I
+ invoke-direct {v2}, dot/junit/opcodes/invoke_direct/d/T_invoke_direct_7/toInt()I
const v0, 0
return v0
.end method
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_direct_range/Test_invoke_direct_range.java b/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_direct_range/Test_invoke_direct_range.java
index d4f194b..1fe95c2 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_direct_range/Test_invoke_direct_range.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_direct_range/Test_invoke_direct_range.java
@@ -111,8 +111,9 @@
//@uses dot.junit.opcodes.invoke_direct_range.TSuper
try {
new T_invoke_direct_range_6();
- fail("expected NoSuchMethodError");
- } catch (NoSuchMethodError t) {
+ fail("expected a verification exception");
+ } catch (Throwable t) {
+ DxUtil.checkVerifyException(t);
}
}
@@ -241,14 +242,22 @@
/**
* @constraint n/a
* @title Attempt to invoke static method. Java throws IncompatibleClassChangeError
- * on first access but Dalvik throws VerifyError on class loading.
+ * on first access. Dalvik threw VerifyError on class loading.
*/
public void testVFE15() {
try {
- Class.forName("dot.junit.opcodes.invoke_direct_range.d.T_invoke_direct_range_11");
- fail("expected a verification exception");
+ Class<?> c = Class.forName("dot.junit.opcodes.invoke_direct_range.d.T_invoke_direct_range_11");
+ // Attempt to instantiate and run.
+ Object o = c.newInstance();
+ java.lang.reflect.Method m = c.getDeclaredMethod("run");
+ m.invoke(o);
+ fail("expected an invocation target exception with an incompatible class change error");
+ } catch (java.lang.reflect.InvocationTargetException ite) {
+ if (!(ite.getCause() instanceof IncompatibleClassChangeError)) {
+ fail("expected an incompatible class change error");
+ }
} catch (Throwable t) {
- DxUtil.checkVerifyException(t);
+ throw new RuntimeException(t);
}
}
@@ -278,8 +287,7 @@
//@uses dot.junit.opcodes.invoke_direct_range.TAbstract
try {
new T_invoke_direct_range_13().run();
- fail("expected NoSuchMethodError or verification exception");
- } catch (NoSuchMethodError t) {
+ fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_direct_range/d/T_invoke_direct_range_7.d b/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_direct_range/d/T_invoke_direct_range_7.d
index f0254f4..0e7aab0 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_direct_range/d/T_invoke_direct_range_7.d
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_direct_range/d/T_invoke_direct_range_7.d
@@ -27,7 +27,7 @@
.method public run()I
.limit regs 3
- invoke-direct/range {v1}, dot/junit/opcodes/invoke_direct_range/d/T_invoke_direct_range_7/toInt()I
+ invoke-direct/range {v2}, dot/junit/opcodes/invoke_direct_range/d/T_invoke_direct_range_7/toInt()I
const v0, 0
return v0
.end method
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_interface/Test_invoke_interface.java b/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_interface/Test_invoke_interface.java
index f846374..69c54e1 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_interface/Test_invoke_interface.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_interface/Test_invoke_interface.java
@@ -166,8 +166,7 @@
public void testVFE2() {
try {
new T_invoke_interface_4().run();
- fail("expected NoSuchMethodError or IncompatibleClassChangeError");
- } catch (NoSuchMethodError t) {
+ fail("expected an IncompatibleClassChangeError");
} catch (IncompatibleClassChangeError e) {
}
}
@@ -220,8 +219,7 @@
//@uses dot.junit.opcodes.invoke_interface.d.T_invoke_interface_18
try {
new T_invoke_interface_18().run(new ITestImpl());
- fail("expected NoSuchMethodError or verification exception");
- } catch (NoSuchMethodError t) {
+ fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
}
@@ -236,8 +234,7 @@
//@uses dot.junit.opcodes.invoke_interface.ITestImpl
try {
new T_invoke_interface_20().run(new ITestImpl());
- fail("expected NoSuchMethodError or verification exception");
- } catch (NoSuchMethodError t) {
+ fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_interface_range/Test_invoke_interface_range.java b/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_interface_range/Test_invoke_interface_range.java
index 9f98d4c..5af318a 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_interface_range/Test_invoke_interface_range.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_interface_range/Test_invoke_interface_range.java
@@ -143,8 +143,7 @@
public void testVFE2() {
try {
new T_invoke_interface_range_4().run();
- fail("expected NoSuchMethodError or IncompatibleClassChangeError");
- } catch (NoSuchMethodError t) {
+ fail("expected an IncompatibleClassChangeError");
} catch (IncompatibleClassChangeError e) {
}
}
@@ -197,8 +196,7 @@
//@uses dot.junit.opcodes.invoke_interface_range.d.T_invoke_interface_range_18
try {
new T_invoke_interface_range_18().run(new ITestImpl());
- fail("expected NoSuchMethodError or verification exception");
- } catch (NoSuchMethodError t) {
+ fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
}
@@ -213,8 +211,7 @@
//@uses dot.junit.opcodes.invoke_interface_range.ITestImpl
try {
new T_invoke_interface_range_20().run(new ITestImpl());
- fail("expected NoSuchMethodError or verification exception");
- } catch (NoSuchMethodError t) {
+ fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
}