[runtime] Fix "make distcheck"
[mono-project.git] / mono / tests / verifier / make_initobj_test.sh
blob3382ff99d6e279d332f4f7e4e5b312ca3a35330d
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_TYPE1=$3
11 TEST_TYPE2=$4
12 TEST_EXTRA=$5
13 ZZ=`echo $TEST_TYPE1 | grep "\&"`
14 T1_REF=$?
16 LOCAL_INIT="";
17 if [ "$T1_REF" == "0" ]; then
18 T1_NO_REF=`echo $TEST_TYPE1 | cut -d '\' -f 1`
19 INIT_LOCS=", $T1_NO_REF V_0"
20 INIT_IL="ldloca.s 1\n\tstloc.0"
23 TEST_FILE=`echo ${TEST_VALIDITY}_${TEST_NAME} | $SED -e 's/ /_/g' -e 's/\./_/g' -e 's/&/mp/g' -e 's/\[/_/g' -e 's/\]/_/g'`_generated.il
24 echo $TEST_FILE
25 $SED -e "s/TYPE1/${TEST_TYPE1}/g" -e "s/VALIDITY/${TEST_VALIDITY}/g" -e "s/TYPE2/${TEST_TYPE2}/g" -e "s/INIT_LOCS/${INIT_LOCS}/g" -e "s/INIT_IL/${INIT_IL}/g" -e "s/EXTRA/${TEST_EXTRA}/g"> $TEST_FILE <<//EOF
27 .assembly extern mscorlib
29 .ver 2:0:0:0
30 .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
33 .assembly 'initobj_test'
35 .hash algorithm 0x00008004
36 .ver 0:0:0:0
39 .module ldobj.exe
42 .class Class extends [mscorlib]System.Object
44 .field public int32 valid
47 .class public Template\`1<T>
48 extends [mscorlib]System.Object
52 .class sealed public StructTemplate\`1<T>
53 extends [mscorlib]System.ValueType
55 .field public !0 t
58 .class sealed public StructTemplate2\`1<T>
59 extends [mscorlib]System.ValueType
61 .field public !0 t
65 .class public auto ansi sealed MyStruct
66 extends [mscorlib]System.ValueType
68 .field public int32 foo
72 .class public auto ansi sealed MyStruct2
73 extends [mscorlib]System.ValueType
75 .field public int32 foo
78 .method public static int32 Main ()
80 .entrypoint
81 .maxstack 8
82 .locals init (TYPE1 V_0 INIT_LOCS)
83 INIT_IL
84 ldloc.0
85 EXTRA
86 initobj TYPE2 // VALIDITY
88 ldc.i4.0
89 ret
92 //EOF