[runtime] Fix "make distcheck"
[mono-project.git] / mono / tests / verifier / make_switch_test.sh
blob1767aa4816631a4d8c28061df434dab841a41e45
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_POS=$3
11 TEST_EXTRA=$4
12 TEST_OP=$5
13 TEST_FIN=$6
15 if [ "$TEST_FIN" == "" ]; then
16 TEST_FIN="finally";
19 declare BRANCH_${TEST_POS}="$TEST_OP"
20 declare BRANCH_EXTRA_${TEST_POS}="$TEST_EXTRA"
22 TEST_NAME=${TEST_VALIDITY}_${TEST_NAME}
23 TEST_FILE=${TEST_NAME}_generated.il
24 echo $TEST_FILE
26 $SED -e "s/VALIDITY/${TEST_VALIDITY}/g" -e "s/OPCODE/${TEST_OP}/g" -e "s/FINALLY/${TEST_FIN}/g" > $TEST_FILE <<//EOF
28 // VALIDITY CIL which breaks the ECMA-335 rules.
29 // this CIL should fail verification by a conforming CLI verifier.
31 .assembly '${TEST_NAME}_generated'
33 .hash algorithm 0x00008004
34 .ver 0:0:0:0
37 .class ClassA
38 extends [mscorlib]System.Object
42 .class sealed MyValueType
43 extends [mscorlib]System.ValueType
45 .field private int32 v
48 .class public Template\`1<T>
49 extends [mscorlib]System.Object
53 .class sealed public ValueTypeTemplate\`1<T>
54 extends [mscorlib]System.ValueType
56 .field private int32 v
59 .method public static int32 Main() cil managed
61 .entrypoint
62 .maxstack 8
63 .locals init ( int32 V0, native int V1)
65 ${BRANCH_EXTRA_1}
66 ${BRANCH_1}
67 ldc.i4 0x7FFFFFFF
68 pop
70 ldloca 0
71 unaligned. 1
72 AFTER_FIRST_PREFIX:
73 volatile.
74 AFTER_SECOND_PREFIX:
75 ldind.i4
76 pop
78 nop
79 ldc.i4.0
80 INVALID_MERGE_POINT:
81 nop
82 pop
85 BLOCK_1:
86 nop
87 BLOCK_1_B:
88 nop
89 .try {
90 nop
91 ${BRANCH_EXTRA_2}
92 ${BRANCH_2}
93 nop
94 IN_TRY:
96 BLOCK_2:
97 nop
98 BLOCK_2_B:
99 nop
100 leave END
101 } catch [mscorlib]System.Exception {
103 ${BRANCH_EXTRA_3}
104 ${BRANCH_3}
106 IN_CATCH:
107 BLOCK_3:
109 BLOCK_3_B:
111 leave END
114 .try {
115 leave END
116 } FINALLY {
118 ${BRANCH_EXTRA_4}
119 ${BRANCH_4}
121 IN_FINALLY:
122 BLOCK_4:
124 BLOCK_4_B:
126 endfinally
129 .try {
130 leave END
131 } filter {
134 ${BRANCH_EXTRA_5}
135 ${BRANCH_5}
137 IN_FILTER:
138 BLOCK_5:
140 BLOCK_5_B:
142 ldc.i4.0
143 endfilter
148 ${BRANCH_EXTRA_6}
149 ${BRANCH_6}
151 IN_HANDLER:
152 BLOCK_6:
154 BLOCK_6_B:
156 leave END
159 END:
160 ldc.i4.0
163 //EOF