[runtime] Fix "make distcheck"
[mono-project.git] / mono / tests / verifier / make_exception_overlap_test.sh
blob284fadfd7e6d81c92e8bfb7c4ef7dc0887bbe103
1 #! /bin/sh
3 SED="sed"
4 if [ `which gsed 2> /dev/null` ] ; then
5 SED="gsed"
6 fi
8 TEST_NAME=$1
9 TEST_VALIDITY=$2
10 TEST_BLOCK_1=$3
11 TEST_BLOCK_2=$4
12 TEST_WITH_FILTER_BLOCK=$5
13 TEST_WITH_FINALLY_BLOCK=$6
15 if [ "$TEST_WITH_FILTER_BLOCK" == "yes" ]; then
16 FILTER_BLOCK="
17 FILTER_BLOCK_3:
18 nop
20 ldloca 1
21 volatile.
22 AFTER_PREFIX_3:
23 unaligned. 1
24 ldind.i4
25 pop
27 FILTER_BLOCK_3_A:
28 stloc.0
29 nop
30 nop
31 ldc.i4.0
32 endfilter
33 FILTER_BLOCK_3_END:"
34 else
35 FILTER_BLOCK="";
38 if [ "$TEST_WITH_FINALLY_BLOCK" == "yes" ]; then
39 FINALLY_BLOCK="
40 FINALLY_BLOCK_1:
41 nop
43 ldloca 1
44 volatile.
45 AFTER_PREFIX_6:
46 unaligned. 1
47 ldind.i4
48 pop
50 FINALLY_BLOCK_1_A:
51 stloc.0
52 nop
53 nop
54 ldc.i4.0
55 endfinally
56 FINALLY_BLOCK_1_END:"
57 else
58 FINALLY_BLOCK="";
62 TEST_FILE=${TEST_VALIDITY}_${TEST_NAME}_generated.il
63 echo $TEST_FILE
65 $SED -e "s/EXCEPTION_BLOCK_1/${TEST_BLOCK_1}/g" -e "s/EXCEPTION_BLOCK_2/${TEST_BLOCK_2}/g" > $TEST_FILE <<//EOF
66 // VALIDITY CIL
68 .assembly '${TEST_VALIDITY}_${TEST_NAME}_generated'
70 .hash algorithm 0x00008004
71 .ver 0:0:0:0
74 .method public static int32 Main() cil managed
76 .entrypoint
77 .maxstack 8
78 .locals init (object _X0, int32 V0)
80 ldloca 1
81 volatile.
82 AFTER_PREFIX_1:
83 unaligned. 1
84 ldind.i4
85 pop
88 TRY_BLOCK_1:
89 nop
90 TRY_BLOCK_1_A:
91 nop
92 newobj instance void class [mscorlib]System.Exception::.ctor()
93 throw
94 nop
95 leave END
96 TRY_BLOCK_1_END:
98 ldloca 1
99 volatile.
100 AFTER_PREFIX_4:
101 unaligned. 1
102 ldind.i4
104 leave END
107 ${FILTER_BLOCK}
108 ${FINALLY_BLOCK}
111 CATCH_BLOCK_1:
113 CATCH_BLOCK_1_A:
114 stloc.0
117 ldloca 1
118 volatile.
119 AFTER_PREFIX_2:
120 unaligned. 1
121 ldind.i4
125 leave END
126 CATCH_BLOCK_1_END:
128 ldloca 1
129 volatile.
130 AFTER_PREFIX_5:
131 unaligned. 1
132 ldind.i4
134 leave END
136 TRY_BLOCK_2:
138 TRY_BLOCK_2_A:
140 newobj instance void class [mscorlib]System.Exception::.ctor()
141 throw
143 leave END
144 TRY_BLOCK_2_END:
147 CATCH_BLOCK_2:
149 CATCH_BLOCK_2_A:
150 stloc.0
153 leave END
154 CATCH_BLOCK_2_END:
157 END:
158 ldc.i4.0
161 EXCEPTION_BLOCK_1
162 EXCEPTION_BLOCK_2
164 //EOF