Fix opcode tests for sput_short
Bug 3147582
Change-Id: Icde18c91b5d34557fdb4fdf7e388c3c28f6eb82c
diff --git a/tools/vm-tests/src/dot/junit/opcodes/sput_short/Test_sput_short.java b/tools/vm-tests/src/dot/junit/opcodes/sput_short/Test_sput_short.java
index c566401..f14c4a7 100644
--- a/tools/vm-tests/src/dot/junit/opcodes/sput_short/Test_sput_short.java
+++ b/tools/vm-tests/src/dot/junit/opcodes/sput_short/Test_sput_short.java
@@ -19,10 +19,16 @@
import dot.junit.DxTestCase;
import dot.junit.DxUtil;
import dot.junit.opcodes.sput_short.d.T_sput_short_1;
+import dot.junit.opcodes.sput_short.d.T_sput_short_10;
import dot.junit.opcodes.sput_short.d.T_sput_short_11;
import dot.junit.opcodes.sput_short.d.T_sput_short_12;
import dot.junit.opcodes.sput_short.d.T_sput_short_13;
import dot.junit.opcodes.sput_short.d.T_sput_short_14;
+import dot.junit.opcodes.sput_short.d.T_sput_short_15;
+import dot.junit.opcodes.sput_short.d.T_sput_short_17;
+import dot.junit.opcodes.sput_short.d.T_sput_short_7;
+import dot.junit.opcodes.sput_short.d.T_sput_short_8;
+import dot.junit.opcodes.sput_short.d.T_sput_short_9;
public class Test_sput_short extends DxTestCase {
/**
@@ -35,7 +41,7 @@
assertEquals(77, T_sput_short_1.st_i1);
}
-
+
/**
* @title modification of final field
*/
@@ -73,7 +79,7 @@
}
/**
- * @constraint A12
+ * @constraint A12
* @title constant pool index
*/
public void testVFE1() {
@@ -86,8 +92,8 @@
}
/**
- *
- * @constraint A23
+ *
+ * @constraint A23
* @title number of registers
*/
public void testVFE2() {
@@ -101,23 +107,22 @@
/**
- *
- * @constraint B13
- * @title put short into long field - only field with same name but
+ *
+ * @constraint B13
+ * @title put short into long field - only field with same name but
* different type exists
*/
public void testVFE5() {
try {
- Class.forName("dot.junit.opcodes.sput_short.d.T_sput_short_17");
- fail("expected a verification exception");
- } catch (Throwable t) {
- DxUtil.checkVerifyException(t);
+ new T_sput_short_17().run();
+ fail("expected NoSuchFieldError");
+ } catch (NoSuchFieldError t) {
}
}
-
+
/**
- *
- * @constraint B13
+ *
+ * @constraint B13
* @title put value '66000' into byte field
*/
public void testVFE6() {
@@ -130,9 +135,9 @@
}
/**
- *
- * @constraint B13
- * @title type of field doesn't match opcode - attempt to modify double
+ *
+ * @constraint B13
+ * @title type of field doesn't match opcode - attempt to modify double
* field with single-width register
*/
public void testVFE7() {
@@ -143,87 +148,77 @@
DxUtil.checkVerifyException(t);
}
}
-
+
/**
- *
- * @constraint A12
- * @title Attempt to set non-static field. Java throws IncompatibleClassChangeError
- * on first access but Dalvik throws VerifyError on class loading.
+ *
+ * @constraint A12
+ * @title Attempt to set non-static field.
*/
public void testVFE8() {
try {
- Class.forName("dot.junit.opcodes.sput_short.d.T_sput_short_7");
- fail("expected a verification exception");
- } catch (Throwable t) {
- DxUtil.checkVerifyException(t);
+ new T_sput_short_7().run();
+ fail("expected IncompatibleClassChangeError");
+ } catch (IncompatibleClassChangeError t) {
}
}
-
+
/**
* @constraint n/a
- * @title Attempt to modify inaccessible field. Java throws IllegalAccessError
- * on first access but Dalvik throws VerifyError on class loading.
+ * @title Attempt to modify inaccessible field.
*/
public void testVFE9() {
//@uses dot.junit.opcodes.sput_short.TestStubs
//@uses dot.junit.opcodes.sput_short.d.T_sput_short_8
try {
- Class.forName("dot.junit.opcodes.sput_short.d.T_sput_short_8");
- fail("expected a verification exception");
- } catch (Throwable t) {
- DxUtil.checkVerifyException(t);
+ new T_sput_short_8().run();
+ fail("expected IllegalAccessError");
+ } catch (IllegalAccessError t) {
}
}
/**
* @constraint n/a
- * @title Attempt to modify field of undefined class. Java throws NoClassDefFoundError
- * on first access but Dalvik throws VerifyError on class loading.
+ * @title Attempt to modify field of undefined class.
*/
public void testVFE10() {
try {
- Class.forName("dot.junit.opcodes.sput_short.d.T_sput_short_9");
- fail("expected a verification exception");
- } catch (Throwable t) {
- DxUtil.checkVerifyException(t);
+ new T_sput_short_9().run();
+ fail("expected NoClassDefFoundError");
+ } catch (NoClassDefFoundError t) {
}
}
/**
* @constraint n/a
- * @title Attempt to modify undefined field. Java throws NoSuchFieldError
- * on first access but Dalvik throws VerifyError on class loading.
+ * @title Attempt to modify undefined field.
*/
public void testVFE11() {
try {
- Class.forName("dot.junit.opcodes.sput_short.d.T_sput_short_10");
- fail("expected a verification exception");
- } catch (Throwable t) {
- DxUtil.checkVerifyException(t);
+ new T_sput_short_10().run();
+ fail("expected NoSuchFieldError");
+ } catch (NoSuchFieldError t) {
}
}
-
-
-
+
+
+
/**
* @constraint n/a
- * @title Attempt to modify superclass' private field from subclass. Java
- * throws IllegalAccessError on first access but Dalvik throws VerifyError on class loading.
+ * @title Attempt to modify superclass' private field from subclass.
*/
public void testVFE12() {
//@uses dot.junit.opcodes.sput_short.d.T_sput_short_1
//@uses dot.junit.opcodes.sput_short.d.T_sput_short_15
try {
- Class.forName("dot.junit.opcodes.sput_short.d.T_sput_short_15");
- fail("expected a verification exception");
- } catch (Throwable t) {
- DxUtil.checkVerifyException(t);
+ new T_sput_short_15().run();
+ fail("expected IllegalAccessError");
+ } catch (IllegalAccessError t) {
}
}
-
-
+
+
/**
- * @constraint B1
+ * @constraint B1
* @title sput-short shall not work for wide numbers
*/
public void testVFE13() {
@@ -234,10 +229,10 @@
DxUtil.checkVerifyException(t);
}
}
-
+
/**
- *
- * @constraint B1
+ *
+ * @constraint B1
* @title sput-short shall not work for reference fields
*/
public void testVFE14() {
@@ -248,10 +243,10 @@
DxUtil.checkVerifyException(t);
}
}
-
+
/**
- *
- * @constraint B1
+ *
+ * @constraint B1
* @title sput-short shall not work for char fields
*/
public void testVFE15() {
@@ -262,10 +257,10 @@
DxUtil.checkVerifyException(t);
}
}
-
+
/**
- *
- * @constraint B1
+ *
+ * @constraint B1
* @title sput-short shall not work for int fields
*/
public void testVFE16() {
@@ -276,10 +271,10 @@
DxUtil.checkVerifyException(t);
}
}
-
+
/**
- *
- * @constraint B1
+ *
+ * @constraint B1
* @title sput-short shall not work for byte fields
*/
public void testVFE17() {
@@ -290,10 +285,10 @@
DxUtil.checkVerifyException(t);
}
}
-
+
/**
- *
- * @constraint B1
+ *
+ * @constraint B1
* @title sput-short shall not work for boolean fields
*/
public void testVFE18() {
@@ -313,10 +308,9 @@
//@uses dot.junit.opcodes.sput_short.TestStubs
//@uses dot.junit.opcodes.sput_short.d.T_sput_short_11
try {
- Class.forName("dot.junit.opcodes.sput_short.d.T_sput_short_11");
- fail("expected a verification exception");
- } catch (Throwable t) {
- DxUtil.checkVerifyException(t);
+ new T_sput_short_11().run();
+ fail("expected IllegalAccessError");
+ } catch (IllegalAccessError t) {
}
}
}
diff --git a/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_10.java b/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_10.java
new file mode 100644
index 0000000..3af3f04
--- /dev/null
+++ b/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_10.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010 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.sput_short.d;
+
+public class T_sput_short_10 {
+ public void run() {
+ }
+}
diff --git a/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_15.java b/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_15.java
new file mode 100644
index 0000000..04f6a7c
--- /dev/null
+++ b/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_15.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010 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.sput_short.d;
+
+public class T_sput_short_15 {
+ public void run() {
+ }
+}
diff --git a/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_17.java b/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_17.java
new file mode 100644
index 0000000..fa56416
--- /dev/null
+++ b/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_17.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010 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.sput_short.d;
+
+public class T_sput_short_17 {
+ public void run() {
+ }
+}
diff --git a/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_7.java b/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_7.java
new file mode 100644
index 0000000..cbecc44
--- /dev/null
+++ b/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_7.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010 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.sput_short.d;
+
+public class T_sput_short_7 {
+ public void run() {
+ }
+}
diff --git a/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_8.java b/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_8.java
new file mode 100644
index 0000000..852263e
--- /dev/null
+++ b/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_8.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010 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.sput_short.d;
+
+public class T_sput_short_8 {
+ public void run() {
+ }
+}
diff --git a/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_9.java b/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_9.java
new file mode 100644
index 0000000..e950c1d
--- /dev/null
+++ b/tools/vm-tests/src/dot/junit/opcodes/sput_short/d/T_sput_short_9.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010 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.sput_short.d;
+
+public class T_sput_short_9 {
+ public void run() {
+ }
+}