Author: kumpera
Date: 2007-12-27 12:09:31 -0500 (Thu, 27 Dec 2007)
New Revision: 91956

Added:
   trunk/mono/mono/tests/verifier/invalid_catch_block_starts_after_prefix.il
   trunk/mono/mono/tests/verifier/make_exception_overlap_test.sh
Modified:
   trunk/mono/mono/tests/verifier/ChangeLog
   trunk/mono/mono/tests/verifier/make_tests.sh
Log:
2007-12-27 Rodrigo Kumpera <[EMAIL PROTECTED]>

        * make_exception_overlap_test.sh: new test generator.

        * make_tests.sh: new tests for exception clause restrictions
        enumerated in P1 12.4.2.7.

        * invalid_catch_block_starts_after_prefix.il: new test
        for a catch block that starts in the middle of an instruction.



Modified: trunk/mono/mono/tests/verifier/ChangeLog
===================================================================
--- trunk/mono/mono/tests/verifier/ChangeLog    2007-12-27 17:06:52 UTC (rev 
91955)
+++ trunk/mono/mono/tests/verifier/ChangeLog    2007-12-27 17:09:31 UTC (rev 
91956)
@@ -1,3 +1,13 @@
+2007-12-27 Rodrigo Kumpera <[EMAIL PROTECTED]>
+
+       * make_exception_overlap_test.sh: new test generator.
+
+       * make_tests.sh: new tests for exception clause restrictions
+       enumerated in P1 12.4.2.7.
+
+       * invalid_catch_block_starts_after_prefix.il: new test
+       for a catch block that starts in the middle of an instruction.
+
 2007-12-24 Rodrigo Kumpera <[EMAIL PROTECTED]>
 
        * make_switch_test.sh: new test generator.

Added: trunk/mono/mono/tests/verifier/invalid_catch_block_starts_after_prefix.il
===================================================================
--- trunk/mono/mono/tests/verifier/invalid_catch_block_starts_after_prefix.il   
2007-12-27 17:06:52 UTC (rev 91955)
+++ trunk/mono/mono/tests/verifier/invalid_catch_block_starts_after_prefix.il   
2007-12-27 17:09:31 UTC (rev 91956)
@@ -0,0 +1,41 @@
+// INVALID CIL
+
+
+.assembly 
'invalid_overlap_exception_blocks_catch_block_start_in_the_middle_or_a_instruction_generated.il'
+{
+  .hash algorithm 0x00008004
+  .ver  0:0:0:0
+}
+
+.method public static int32 Main() cil managed
+{
+        .entrypoint
+        .maxstack 8
+       .locals init (object _X0, int32 V0)
+ 
+TRY_BLOCK_1:
+       nop
+TRY_BLOCK_1_A:
+       nop
+       newobj instance void class [mscorlib]System.Exception::.ctor()
+       throw
+       nop
+       leave END
+TRY_BLOCK_1_END:
+
+       volatile.       
+AFTER_PREFIX_2:
+       unaligned. 1
+       ldind.i4
+       stloc.1
+
+       nop
+       leave END
+CATCH_BLOCK_1_END:
+
+END:
+        ldloc.1
+        ret
+
+       .try TRY_BLOCK_1 to TRY_BLOCK_1_END catch [mscorlib]System.Exception 
handler AFTER_PREFIX_2 to CATCH_BLOCK_1_END
+}

Added: trunk/mono/mono/tests/verifier/make_exception_overlap_test.sh
===================================================================
--- trunk/mono/mono/tests/verifier/make_exception_overlap_test.sh       
2007-12-27 17:06:52 UTC (rev 91955)
+++ trunk/mono/mono/tests/verifier/make_exception_overlap_test.sh       
2007-12-27 17:09:31 UTC (rev 91956)
@@ -0,0 +1,159 @@
+#! /bin/sh
+
+TEST_NAME=$1
+TEST_VALIDITY=$2
+TEST_BLOCK_1=$3
+TEST_BLOCK_2=$4
+TEST_WITH_FILTER_BLOCK=$5
+TEST_WITH_FINALLY_BLOCK=$6
+
+if [ "$TEST_WITH_FILTER_BLOCK" == "yes" ]; then
+       FILTER_BLOCK="
+FILTER_BLOCK_3:
+       nop
+
+       ldloca 1
+       volatile.
+AFTER_PREFIX_3:
+       unaligned. 1
+       ldind.i4
+       pop
+
+FILTER_BLOCK_3_A:
+       stloc.0 
+       nop
+       nop
+       ldc.i4.0
+       endfilter
+FILTER_BLOCK_3_END:"
+else
+       FILTER_BLOCK="";
+fi
+
+if [ "$TEST_WITH_FINALLY_BLOCK" == "yes" ]; then
+       FINALLY_BLOCK="
+FINALLY_BLOCK_1:
+       nop
+
+       ldloca 1
+       volatile.
+AFTER_PREFIX_6:
+       unaligned. 1
+       ldind.i4
+       pop
+
+FINALLY_BLOCK_1_A:
+       stloc.0 
+       nop
+       nop
+       ldc.i4.0
+       endfinally
+FINALLY_BLOCK_1_END:"
+else
+       FINALLY_BLOCK="";
+fi
+
+
+TEST_FILE=${TEST_VALIDITY}_${TEST_NAME}_generated.il
+echo $TEST_FILE
+
+sed -e "s/EXCEPTION_BLOCK_1/${TEST_BLOCK_1}/g" -e 
"s/EXCEPTION_BLOCK_2/${TEST_BLOCK_2}/g" > $TEST_FILE <<//EOF
+// VALIDITY CIL
+
+.assembly '${TEST_VALIDITY}_${TEST_NAME}_generated'
+{
+  .hash algorithm 0x00008004
+  .ver  0:0:0:0
+}
+
+.method public static int32 Main() cil managed
+{
+        .entrypoint
+        .maxstack 8
+       .locals init (object _X0, int32 V0)
+ 
+       ldloca 1
+       volatile.
+AFTER_PREFIX_1:
+       unaligned. 1
+       ldind.i4
+       pop
+
+       
+TRY_BLOCK_1:
+       nop
+TRY_BLOCK_1_A:
+       nop
+       newobj instance void class [mscorlib]System.Exception::.ctor()
+       throw
+       nop
+       leave END
+TRY_BLOCK_1_END:
+
+       ldloca 1
+       volatile.
+AFTER_PREFIX_4:
+       unaligned. 1
+       ldind.i4
+       pop
+       leave END
+
+
+${FILTER_BLOCK}
+${FINALLY_BLOCK}
+
+
+CATCH_BLOCK_1:
+       nop
+CATCH_BLOCK_1_A:
+       stloc.0 
+       nop
+
+       ldloca 1
+       volatile.
+AFTER_PREFIX_2:
+       unaligned. 1
+       ldind.i4
+       pop
+
+       nop
+       leave END
+CATCH_BLOCK_1_END:
+
+       ldloca 1
+       volatile.
+AFTER_PREFIX_5:
+       unaligned. 1
+       ldind.i4
+       pop
+       leave END
+
+TRY_BLOCK_2:
+       nop
+TRY_BLOCK_2_A:
+       nop
+       newobj instance void class [mscorlib]System.Exception::.ctor()
+       throw
+       nop
+       leave END
+TRY_BLOCK_2_END:
+
+
+CATCH_BLOCK_2:
+       nop
+CATCH_BLOCK_2_A:
+       stloc.0 
+       nop
+       nop
+       leave END
+CATCH_BLOCK_2_END:
+
+
+END:
+        ldc.i4.0
+        ret
+
+       EXCEPTION_BLOCK_1
+       EXCEPTION_BLOCK_2
+}
+//EOF


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

Modified: trunk/mono/mono/tests/verifier/make_tests.sh
===================================================================
--- trunk/mono/mono/tests/verifier/make_tests.sh        2007-12-27 17:06:52 UTC 
(rev 91955)
+++ trunk/mono/mono/tests/verifier/make_tests.sh        2007-12-27 17:09:31 UTC 
(rev 91956)
@@ -3345,3 +3345,49 @@
 ./make_switch_test.sh switch_target_bad_merge_point invalid 1 "ldloc.1" 
"switch (INVALID_MERGE_POINT, BLOCK_1)";
 
 
+#TESTS for exception clauses. As described in P1 12.4.2.7.
+#regions must not overlap with each other
+./make_exception_overlap_test.sh exception_entry_overlap_separate_1 valid 
".try TRY_BLOCK_1 to TRY_BLOCK_1_END catch [mscorlib]System.Exception handler 
CATCH_BLOCK_1 to CATCH_BLOCK_1_END" ".try TRY_BLOCK_2 to TRY_BLOCK_2_END catch 
[mscorlib]System.Exception handler CATCH_BLOCK_2 to CATCH_BLOCK_2_END"
+
+./make_exception_overlap_test.sh exception_entry_overlap_separate_2 valid 
".try TRY_BLOCK_2 to TRY_BLOCK_2_END catch [mscorlib]System.Exception handler 
CATCH_BLOCK_2 to CATCH_BLOCK_2_END" ".try TRY_BLOCK_1 to TRY_BLOCK_1_END catch 
[mscorlib]System.Exception handler CATCH_BLOCK_1 to CATCH_BLOCK_1_END" 
+
+./make_exception_overlap_test.sh exception_entry_overlap_try_over_catch 
invalid ".try TRY_BLOCK_1 to CATCH_BLOCK_1_A catch [mscorlib]System.Exception 
handler CATCH_BLOCK_1 to CATCH_BLOCK_1_END" ".try TRY_BLOCK_2 to 
TRY_BLOCK_2_END catch [mscorlib]System.Exception handler CATCH_BLOCK_2 to 
CATCH_BLOCK_2_END"
+
+./make_exception_overlap_test.sh exception_entry_overlap_try_over_filter 
invalid ".try TRY_BLOCK_1 to FILTER_BLOCK_3_A filter FILTER_BLOCK_3 handler 
CATCH_BLOCK_1 to CATCH_BLOCK_1_END" ".try TRY_BLOCK_2 to TRY_BLOCK_2_END catch 
[mscorlib]System.Exception handler CATCH_BLOCK_2 to CATCH_BLOCK_2_END" "yes"
+
+#blocks start in the middle of an intruction
+./make_exception_overlap_test.sh 
try_block_start_in_the_middle_of_a_instruction invalid ".try AFTER_PREFIX_1 to 
TRY_BLOCK_1_END catch [mscorlib]System.Exception handler CATCH_BLOCK_1 to 
CATCH_BLOCK_1_END" ".try TRY_BLOCK_2 to TRY_BLOCK_2_END catch 
[mscorlib]System.Exception handler CATCH_BLOCK_2 to CATCH_BLOCK_2_END"
+
+./make_exception_overlap_test.sh 
catch_block_start_in_the_middle_of_a_instruction invalid ".try TRY_BLOCK_1 to 
TRY_BLOCK_1_END catch [mscorlib]System.Exception handler AFTER_PREFIX_2 to 
CATCH_BLOCK_1_END" ".try TRY_BLOCK_2 to TRY_BLOCK_2_END catch 
[mscorlib]System.Exception handler CATCH_BLOCK_2 to CATCH_BLOCK_2_END"
+
+./make_exception_overlap_test.sh 
filter_block_start_in_the_middle_of_a_instructior invalid ".try TRY_BLOCK_1 to 
TRY_BLOCK_1_END filter AFTER_PREFIX_4 handler CATCH_BLOCK_1 to 
CATCH_BLOCK_1_END" ".try TRY_BLOCK_2 to TRY_BLOCK_2_END catch 
[mscorlib]System.Exception handler CATCH_BLOCK_2 to CATCH_BLOCK_2_END" "yes"
+
+
+#block end in the middle of an instruction
+./make_exception_overlap_test.sh try_block_end_in_the_middle_of_a_instruction 
invalid ".try TRY_BLOCK_1 to AFTER_PREFIX_4 catch [mscorlib]System.Exception 
handler CATCH_BLOCK_1 to CATCH_BLOCK_1_END" ".try TRY_BLOCK_2 to 
TRY_BLOCK_2_END catch [mscorlib]System.Exception handler CATCH_BLOCK_2 to 
CATCH_BLOCK_2_END"
+
+./make_exception_overlap_test.sh 
catch_block_end_in_the_middle_of_a_instruction invalid ".try TRY_BLOCK_1 to 
TRY_BLOCK_1_END catch [mscorlib]System.Exception handler CATCH_BLOCK_1 to 
AFTER_PREFIX_5" ".try TRY_BLOCK_2 to TRY_BLOCK_2_END catch 
[mscorlib]System.Exception handler CATCH_BLOCK_2 to CATCH_BLOCK_2_END"
+
+
+#regions are disjoint
+./make_exception_overlap_test.sh exception_entry_overlap_disjoint_1 valid 
".try TRY_BLOCK_1 to TRY_BLOCK_1_END catch [mscorlib]System.Exception handler 
CATCH_BLOCK_2 to CATCH_BLOCK_2_END" ".try TRY_BLOCK_2 to TRY_BLOCK_2_END catch 
[mscorlib]System.Exception handler CATCH_BLOCK_1 to CATCH_BLOCK_1_END"
+
+./make_exception_overlap_test.sh exception_entry_overlap_disjoint_2 valid 
".try TRY_BLOCK_2 to TRY_BLOCK_2_END catch [mscorlib]System.Exception handler 
CATCH_BLOCK_1 to CATCH_BLOCK_1_END" ".try TRY_BLOCK_1 to TRY_BLOCK_1_END catch 
[mscorlib]System.Exception handler CATCH_BLOCK_2 to CATCH_BLOCK_2_END"
+
+#nesting
+./make_exception_overlap_test.sh nested_exception_entry_comes_first valid 
".try TRY_BLOCK_1_A to TRY_BLOCK_1_END catch [mscorlib]System.Exception handler 
CATCH_BLOCK_1 to CATCH_BLOCK_1_END" ".try TRY_BLOCK_1 to TRY_BLOCK_2_END catch 
[mscorlib]System.Exception handler CATCH_BLOCK_2 to CATCH_BLOCK_2_END"
+
+./make_exception_overlap_test.sh nested_exception_entry_comes_after invalid 
".try TRY_BLOCK_1 to TRY_BLOCK_2_END catch [mscorlib]System.Exception handler 
CATCH_BLOCK_2 to CATCH_BLOCK_2_END" ".try TRY_BLOCK_1_A to TRY_BLOCK_1_END 
catch [mscorlib]System.Exception handler CATCH_BLOCK_1 to CATCH_BLOCK_1_END"
+
+
+#mutual protectiong
+./make_exception_overlap_test.sh exception_same_try valid ".try TRY_BLOCK_1 to 
TRY_BLOCK_1_END catch [mscorlib]System.Exception handler CATCH_BLOCK_1 to 
CATCH_BLOCK_1_END" ".try TRY_BLOCK_1 to TRY_BLOCK_1_END catch 
[mscorlib]System.Exception handler CATCH_BLOCK_2 to CATCH_BLOCK_2_END"
+
+./make_exception_overlap_test.sh exception_same_catch invalid ".try 
TRY_BLOCK_1 to TRY_BLOCK_1_END catch [mscorlib]System.Exception handler 
CATCH_BLOCK_1 to CATCH_BLOCK_1_END" ".try TRY_BLOCK_2 to TRY_BLOCK_2_END catch 
[mscorlib]System.Exception handler CATCH_BLOCK_1 to CATCH_BLOCK_1_END"
+
+./make_exception_overlap_test.sh exception_same_try_with_catch_and_filter 
valid ".try TRY_BLOCK_1 to TRY_BLOCK_1_END catch [mscorlib]System.Exception 
handler CATCH_BLOCK_2 to CATCH_BLOCK_2_END" ".try TRY_BLOCK_1 to 
TRY_BLOCK_1_END filter FILTER_BLOCK_3 handler CATCH_BLOCK_1 to 
CATCH_BLOCK_1_END" "yes"
+
+./make_exception_overlap_test.sh exception_same_try_with_catch_and_finally 
invalid ".try TRY_BLOCK_1 to TRY_BLOCK_1_END finally handler FINALLY_BLOCK_1 to 
FINALLY_BLOCK_1_END" ".try TRY_BLOCK_1 to TRY_BLOCK_1_END catch 
[mscorlib]System.Exception handler CATCH_BLOCK_1 to CATCH_BLOCK_1_END" "no" 
"yes"
+
+./make_exception_overlap_test.sh exception_same_try_with_catch_and_fault 
invalid ".try TRY_BLOCK_1 to TRY_BLOCK_1_END fault handler FINALLY_BLOCK_1 to 
FINALLY_BLOCK_1_END" ".try TRY_BLOCK_1 to TRY_BLOCK_1_END catch 
[mscorlib]System.Exception handler CATCH_BLOCK_1 to CATCH_BLOCK_1_END" "no" 
"yes"
+

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

Reply via email to