Author: kumpera
Date: 2007-10-09 14:36:34 -0400 (Tue, 09 Oct 2007)
New Revision: 87208

Added:
   trunk/mono/mono/tests/verifier/make_newobj_test.sh
Modified:
   trunk/mono/mono/tests/verifier/ChangeLog
   trunk/mono/mono/tests/verifier/make_tests.sh
   trunk/mono/mono/tests/verifier/make_unary_test.sh
Log:
2007-10-09 Rodrigo Kumpera <[EMAIL PROTECTED]>

        * make_unary_test.sh: fixed an invalid struct that has no fields,
        this was not the subject of the tests.
        * make_newobj_test.sh: added, generate tests for newobj.
        * make_tests.sh: added the new tests for newobj and some corner
        cases of local/arg load/store.




Modified: trunk/mono/mono/tests/verifier/ChangeLog
===================================================================
--- trunk/mono/mono/tests/verifier/ChangeLog    2007-10-09 18:04:42 UTC (rev 
87207)
+++ trunk/mono/mono/tests/verifier/ChangeLog    2007-10-09 18:36:34 UTC (rev 
87208)
@@ -1,3 +1,12 @@
+2007-10-09 Rodrigo Kumpera <[EMAIL PROTECTED]>
+
+       * make_unary_test.sh: fixed an invalid struct that has no fields,
+       this was not the subject of the tests.
+       * make_newobj_test.sh: added, generate tests for newobj.
+       * make_tests.sh: added the new tests for newobj and some corner
+       cases of local/arg load/store.
+
+
 2007-10-04 Rodrigo Kumpera <[EMAIL PROTECTED]>
 
        * make_store_indirect_test.sh: added, generate tests for stind.X.

Added: trunk/mono/mono/tests/verifier/make_newobj_test.sh
===================================================================
--- trunk/mono/mono/tests/verifier/make_newobj_test.sh  2007-10-09 18:04:42 UTC 
(rev 87207)
+++ trunk/mono/mono/tests/verifier/make_newobj_test.sh  2007-10-09 18:36:34 UTC 
(rev 87208)
@@ -0,0 +1,124 @@
+#! /bin/sh
+
+TEST_NAME=$1
+TEST_VALIDITY=$2
+TEST_OP=$3
+TEST1_TYPE=$4
+TEST2_TYPE=$5
+
+TEST_NAME=${TEST_VALIDITY}_${TEST_NAME}
+TEST_FILE=${TEST_NAME}_generated.il
+echo $TEST_FILE
+sed -e "s/VALIDITY/${TEST_VALIDITY}/g" -e "s/TYPE1/${TEST1_TYPE}/g" -e 
"s/TYPE2/${TEST2_TYPE}/g" -e "s/OPCODE/${TEST_OP}/g" > $TEST_FILE <<//EOF
+
+// VALIDITY CIL which breaks the ECMA-335 rules. 
+// this CIL should fail verification by a conforming CLI verifier.
+
+.assembly '${TEST_NAME}_generated'
+{
+  .hash algorithm 0x00008004
+  .ver  0:0:0:0
+}
+
+.assembly extern mscorlib
+{
+  .ver 1:0:5000:0
+  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+
+.class ClassA extends [mscorlib]System.Object
+{
+       .method public hidebysig  specialname  rtspecialname instance default 
void .ctor ()  cil managed 
+       {
+               .maxstack 8
+               ldarg.0 
+               call instance void object::.ctor()
+               ret 
+       }
+
+       .method public hidebysig  specialname  rtspecialname instance default 
void .ctor (TYPE2 tp)  cil managed 
+       {
+               .maxstack 8
+               ldarg.0 
+               call instance void object::.ctor()
+               ret 
+       }
+
+       .method public hidebysig  specialname  rtspecialname instance default 
void .ctor (TYPE2 a1, TYPE2 a2)  cil managed 
+       {
+               .maxstack 8
+               ldarg.0 
+               call instance void object::.ctor()
+               ret 
+       }
+
+       .method public instance void ctor(TYPE2 tp)
+       {
+               .maxstack 8
+               ret
+       }
+
+       .method public static void sctor(TYPE2 tp)
+       {
+               .maxstack 8
+               ret
+       }
+
+       .method public hidebysig  specialname  rtspecialname static default 
void .cctor ()  cil managed 
+       {
+               .maxstack 8
+               ret 
+       }
+
+       .method public instance void Method1()
+       {
+               .maxstack 8
+               ret
+       }
+
+       .method public instance void Method2(int32 arg)
+       {
+               .maxstack 8
+               ret
+       }
+}
+
+.class interface abstract InterfaceA
+{
+}
+
+.class abstract AbsClass extends [mscorlib]System.Object
+{
+       .method public hidebysig  specialname  rtspecialname instance default 
void .ctor ()  cil managed 
+       {
+               .maxstack 8
+               ldarg.0 
+               call instance void object::.ctor()
+               ret 
+       }
+}
+
+.class sealed ValueType extends [mscorlib]System.ValueType
+{
+       .field private int32 v
+
+       .method public hidebysig specialname rtspecialname instance default 
void .ctor ()  cil managed 
+       {
+               .maxstack 8
+               ret 
+       }
+}
+
+.method public static void Main() cil managed
+{
+       .entrypoint
+       .maxstack 4
+       .locals init (
+           TYPE1 V_0
+       )
+       ldloc.0
+       OPCODE //VALIDITY
+       pop
+       ret
+}
+//EOF


Property changes on: trunk/mono/mono/tests/verifier/make_newobj_test.sh
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/mono/mono/tests/verifier/make_tests.sh
===================================================================
--- trunk/mono/mono/tests/verifier/make_tests.sh        2007-10-09 18:04:42 UTC 
(rev 87207)
+++ trunk/mono/mono/tests/verifier/make_tests.sh        2007-10-09 18:36:34 UTC 
(rev 87208)
@@ -438,7 +438,41 @@
        I=`expr $I + 1`
 done
 
+#test for unverifiable types
 
+I=1
+for OP in "stloc.0" "starg 0"
+do
+  ./make_store_test.sh misc_types_store_1_${I} valid "$OP" typedref typedref
+  ./make_store_test.sh misc_types_store_2_${I} unverifiable "$OP" "int32*" 
"int32*"
+  ./make_store_test.sh misc_types_store_3_${I} unverifiable "$OP" "method 
int32 *(int32)" "method int32 *(int32)"
+
+  ./make_store_test.sh misc_types_store_4_${I} unverifiable "$OP" "method 
int32 *(int32)" "method void *(int32)"
+  ./make_store_test.sh misc_types_store_5_${I} unverifiable "$OP" "int32*" 
"int8*"
+  ./make_store_test.sh misc_types_store_6_${I} unverifiable "$OP" typedref 
"native int&"
+
+
+  ./make_store_test.sh managed_pointer_store_1_${I} valid "$OP" "int32&" 
"int32&"
+  ./make_store_test.sh managed_pointer_store_2_${I} valid "$OP" "int32&" 
"native int&"
+  ./make_store_test.sh managed_pointer_store_3_${I} valid "$OP" "int32&" 
"unsigned int32&"
+  ./make_store_test.sh managed_pointer_store_4_${I} valid "$OP" "native int&" 
"int32&"
+  ./make_store_test.sh managed_pointer_store_5_${I} unverifiable "$OP" 
"int32&" "int16&"
+
+  ./make_store_test.sh managed_pointer_store_6_${I} valid "$OP" "int8&" 
"unsigned int8&"
+  ./make_store_test.sh managed_pointer_store_7_${I} valid "$OP" "int8&" "bool&"
+  ./make_store_test.sh managed_pointer_store_8_${I} unverifiable "$OP" "int8&" 
"int16&"
+
+  ./make_store_test.sh managed_pointer_store_9_${I} valid "$OP" "int16&" 
"unsigned int16&"
+  ./make_store_test.sh managed_pointer_store_10_${I} valid "$OP" "int16&" 
"char&"
+  ./make_store_test.sh managed_pointer_store_11_${I} unverifiable "$OP" 
"int16&" "int32&"
+
+  ./make_store_test.sh managed_pointer_store_12_${I} unverifiable "$OP" 
"float32&" "float64&"
+  ./make_store_test.sh managed_pointer_store_13_${I} unverifiable "$OP" 
"float64&" "float32&"
+
+  I=`expr $I + 1`
+done
+
+
 function fix () {
        if [ "$3" != "" ]; then
                A=$3;
@@ -2507,3 +2541,59 @@
        I=`expr $I + 1`
 done
 
+
+#TODO validate delegate construction (Wait for ldftn, ldvirtftn and calli to 
be fully checking)
+#underflow
+./make_newobj_test.sh newobj_underflow invalid "newobj instance void class 
ClassA::.ctor(int32,int32)" "int32" "int32"
+
+#good simple cases
+./make_newobj_test.sh newobj_good_instantiation_1 valid "newobj instance void 
class ClassA::.ctor(int32)" "int32" "int32"
+./make_newobj_test.sh newobj_good_instantiation_2 valid "newobj instance void 
class ClassA::.ctor(int32)" "native int" "int32"
+./make_newobj_test.sh newobj_good_instantiation_3 valid "newobj instance void 
class ClassA::.ctor(native int)" "int32" "native int"
+./make_newobj_test.sh newobj_good_instantiation_4 valid "newobj instance void 
class ClassA::.ctor(native int)" "int32" "native int"
+./make_newobj_test.sh newobj_good_instantiation_5 valid "ldloc.0\n\tnewobj 
instance void int32[,]::.ctor(int32, int32)" "int32" "native int"
+./make_newobj_test.sh newobj_good_instantiation_6 valid "newobj instance void 
class ClassA::.ctor(typedref)" "typedref" "typedref"
+
+#unverifable types
+./make_newobj_test.sh newobj_unverifiable_types_1 unverifiable "newobj 
instance void class ClassA::.ctor(int32*)" "int32*" "int32*"
+./make_newobj_test.sh newobj_unverifiable_types_2 unverifiable "newobj 
instance void class ClassA::.ctor(method int32 *(int32))" "method int32 
*(int32)" "method int32 *(int32)"
+
+
+
+#abstract type
+./make_newobj_test.sh newobj_bad_inst_1 unverifiable "newobj instance void 
class AbsClass::.ctor()" "int32" "int32"
+
+#bad types
+./make_newobj_test.sh newobj_bad_args_1 unverifiable "newobj instance void 
class ClassA::.ctor(int32)" "int64" "int32"
+./make_newobj_test.sh newobj_bad_args_2 unverifiable "newobj instance void 
class ClassA::.ctor(int32)" "object" "int32"
+./make_newobj_test.sh newobj_bad_args_3 unverifiable "newobj instance void 
class ClassA::.ctor(int32)" "int32\&" "int32"
+./make_newobj_test.sh newobj_bad_args_4 unverifiable "newobj instance void 
class ClassA::.ctor(int32)" "float32" "int32"
+
+./make_newobj_test.sh newobj_bad_args_5 unverifiable "newobj instance void 
class ClassA::.ctor(int64)" "int32" "int64"
+./make_newobj_test.sh newobj_bad_args_6 unverifiable "newobj instance void 
class ClassA::.ctor(int64)" "object" "int64"
+./make_newobj_test.sh newobj_bad_args_7 unverifiable "newobj instance void 
class ClassA::.ctor(int64)" "int32\&" "int64"
+./make_newobj_test.sh newobj_bad_args_8 unverifiable "newobj instance void 
class ClassA::.ctor(int64)" "float32" "int64"
+
+./make_newobj_test.sh newobj_bad_args_9 unverifiable "newobj instance void 
class ClassA::.ctor(object)" "int64" "object"
+./make_newobj_test.sh newobj_bad_args_10 unverifiable "newobj instance void 
class ClassA::.ctor(object)" "int32" "object"
+./make_newobj_test.sh newobj_bad_args_11 unverifiable "newobj instance void 
class ClassA::.ctor(object)" "int32\&" "object"
+./make_newobj_test.sh newobj_bad_args_12 unverifiable "newobj instance void 
class ClassA::.ctor(object)" "float32" "object"
+
+./make_newobj_test.sh newobj_bad_args_13 unverifiable "newobj instance void 
class ClassA::.ctor(float32)" "int64" "float32"
+./make_newobj_test.sh newobj_bad_args_14 unverifiable "newobj instance void 
class ClassA::.ctor(float32)" "object" "float32"
+./make_newobj_test.sh newobj_bad_args_15 unverifiable "newobj instance void 
class ClassA::.ctor(float32)" "int32\&" "float32"
+./make_newobj_test.sh newobj_bad_args_16 unverifiable "newobj instance void 
class ClassA::.ctor(float32)" "int32" "float32"
+
+./make_newobj_test.sh newobj_bad_args_17 unverifiable "newobj instance void 
class ClassA::.ctor(typedref)" "int32" "typedref"
+./make_newobj_test.sh newobj_bad_args_18 unverifiable "newobj instance void 
class ClassA::.ctor(typedref)" "object" "typedref"
+./make_newobj_test.sh newobj_bad_args_19 unverifiable "newobj instance void 
class ClassA::.ctor(typedref)" "int32\&" "typedref"
+./make_newobj_test.sh newobj_bad_args_20 unverifiable "newobj instance void 
class ClassA::.ctor(typedref)" "float32" "typedref"
+
+
+#calling something that it's not an instance constructor
+
+./make_newobj_test.sh newobj_method_not_ctor_1 invalid "newobj instance void 
class ClassA::ctor(int32)" "int32" "int32"
+./make_newobj_test.sh newobj_method_not_ctor_2 invalid "newobj instance void 
class ClassA::sctor(int32)" "int32" "int32"
+./make_newobj_test.sh newobj_method_not_ctor_1 invalid "pop\n\tnewobj instance 
void class ClassA::.cctor()" "int32" "int32"
+
+

Modified: trunk/mono/mono/tests/verifier/make_unary_test.sh
===================================================================
--- trunk/mono/mono/tests/verifier/make_unary_test.sh   2007-10-09 18:04:42 UTC 
(rev 87207)
+++ trunk/mono/mono/tests/verifier/make_unary_test.sh   2007-10-09 18:36:34 UTC 
(rev 87208)
@@ -32,6 +32,7 @@
 .class public auto ansi sealed MyStruct
        extends [mscorlib]System.ValueType
 {
+    .field public int32 valid
 }
 
 .class public auto ansi sealed Int8Enum

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to