Update cts tests to be compatible for both art and dalvik.
- Removes tests that check that certain integral types can't be put into
other integral types, ie. an int value of 2 put into a boolean. Dalvik
disallows this, but art allows this. However, the instruction type must
still match the array or field type.
- Changed how some invoke tests are run to trigger a runtime exception
expected in art, as well as a verification error expected in dalvik.
- Changed some invoke tests to allow NoSuchMethodError expected in dalvik
and VerifyError expected in art, with art being closer to the RI.
- Fixed various bytecodes to have proper arguments because art has
stricter checks.
Bug: 10135051
Change-Id: I48fbf24d5f07faf23bb404685998bd358846b76b
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_static/Test_invoke_static.java b/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_static/Test_invoke_static.java
index c7b77aa..02793fd 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_static/Test_invoke_static.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_static/Test_invoke_static.java
@@ -26,6 +26,7 @@
import dot.junit.opcodes.invoke_static.d.T_invoke_static_18;
import dot.junit.opcodes.invoke_static.d.T_invoke_static_19;
import dot.junit.opcodes.invoke_static.d.T_invoke_static_2;
+import dot.junit.opcodes.invoke_static.d.T_invoke_static_24;
import dot.junit.opcodes.invoke_static.d.T_invoke_static_4;
import dot.junit.opcodes.invoke_static.d.T_invoke_static_5;
import dot.junit.opcodes.invoke_static.d.T_invoke_static_6;
@@ -156,8 +157,9 @@
public void testVFE5() {
try {
new T_invoke_static_19().run();
- fail("expected IncompatibleClassChangeError");
- } catch (IncompatibleClassChangeError t) {
+ fail("expected a verification exception");
+ } catch (Throwable t) {
+ DxUtil.checkVerifyException(t);
}
}
@@ -260,8 +262,9 @@
* @title attempt to invoke interface method
*/
public void testVFE18() {
+ //@uses dot.junit.opcodes.invoke_static.d.T_invoke_static_24
try {
- Class.forName("dot.junit.opcodes.invoke_static.d.T_invoke_static_24");
+ new T_invoke_static_24().run();
fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_static/d/T_invoke_static_24.java b/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_static/d/T_invoke_static_24.java
new file mode 100644
index 0000000..90e404d
--- /dev/null
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/invoke_static/d/T_invoke_static_24.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2012 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 dot.junit.opcodes.invoke_static.d;
+
+public class T_invoke_static_24 {
+ public void run() {
+ }
+}