[runtime] Fix "make distcheck"
[mono-project.git] / mono / tests / verifier / make_leave_test.sh
blob33a4efaa0425f99cd85c02bb940dd3fce428ace1
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_LEAVE_CODE=$4
12 TEST_EXTRA=$5
15 declare OPCODE_${TEST_POS}="$TEST_LEAVE_CODE"
16 declare OPCODE_EXTRA_${TEST_POS}="${TEST_EXTRA}"
18 TEST_NAME=${TEST_VALIDITY}_${TEST_NAME}
19 TEST_FILE=${TEST_NAME}_generated.il
20 echo $TEST_FILE
21 $SED -e "s/VALIDITY/${TEST_VALIDITY}/g" -e "s/OPCODE_EXTRA_1/${OPCODE_EXTRA_1}/g" -e "s/OPCODE_EXTRA_2/${OPCODE_EXTRA_2}/g" -e "s/OPCODE_EXTRA_3/${OPCODE_EXTRA_3}/g" -e "s/OPCODE_EXTRA_4/${OPCODE_EXTRA_4}/g" > $TEST_FILE <<//EOF
22 // VALIDITY
24 .assembly '${TEST_NAME}_generated'
26 .hash algorithm 0x00008004
27 .ver 0:0:0:0
30 .method public static int32 Main() cil managed
32 .entrypoint
33 .maxstack 8
34 .locals init (int32 V0)
36 OPCODE_EXTRA_1
37 ${OPCODE_1}
39 .try
41 newobj instance void class [mscorlib]System.Exception::.ctor()
42 throw
43 leave END
45 catch [mscorlib]System.Exception
47 pop
48 leave END
51 .try
53 newobj instance void class [mscorlib]System.Exception::.ctor()
54 throw
55 leave END
57 finally
59 nop
60 OPCODE_EXTRA_2
61 ${OPCODE_2}
62 END_2:
63 endfinally
66 .try
68 newobj instance void class [mscorlib]System.Exception::.ctor()
69 throw
70 leave END
72 filter
74 pop
75 OPCODE_EXTRA_3
76 ${OPCODE_3}
77 END_3:
78 ldc.i4.0
79 endfilter
82 nop
83 leave END
86 END:
87 ldc.i4.0
88 ret
90 //EOF