[interp] disable some tests that fail on CI only
[mono.git] / mono / tests / bug-333798-tb.2.cs
1 using System;
2 using System.Threading;
3 using System.Reflection;
4 using System.Reflection.Emit;
5 using System.IO;
6 using System.Security;
7 using System.Security.Permissions;
8 using System.Runtime.InteropServices;
9 using System.Collections.Generic;
10
11 public class Gen<T> {
12         public static Gen<T>[] newSelfArr () {
13                 return null;
14         }
15 }
16
17 public class Driver {
18         public static void Test () {
19                 Gen<int>.newSelfArr ();
20         }
21 }
22
23 public class GenericsTests
24 {
25         static AssemblyBuilder assembly;
26         static ModuleBuilder module;
27
28         static void SetUp ()
29         {
30                 AssemblyName assemblyName = new AssemblyName ();
31                 assemblyName.Name = "TestAssembly";
32                 assembly = 
33                         Thread.GetDomain ().DefineDynamicAssembly (
34                                 assemblyName, AssemblyBuilderAccess.RunAndSave, ".");
35                 module = assembly.DefineDynamicModule ("module1", "TestModuleSS.dll");
36     }
37
38         public static int Main () {
39                 SetUp ();
40                 TypeBuilder tb = module.DefineType ("Gen", TypeAttributes.Public);
41                 Type[] args = tb.DefineGenericParameters ("T");
42                 Type oi = tb.MakeGenericType (args);
43
44                 MethodBuilder mb = tb.DefineMethod ("Test", MethodAttributes.Public | MethodAttributes.Static, oi.MakeArrayType (), new Type [0]);
45         
46                 ILGenerator il = mb.GetILGenerator();
47                 il.Emit (OpCodes.Ldnull);
48                 il.Emit (OpCodes.Ret);
49                 tb.CreateType ();
50
51                 TypeBuilder main = module.DefineType ("Driver", TypeAttributes.Public);
52                 MethodBuilder mb2 = main.DefineMethod ("Test", MethodAttributes.Public | MethodAttributes.Static);
53
54                 il = mb2.GetILGenerator();
55                 il.Emit (OpCodes.Call, TypeBuilder.GetMethod (tb.MakeGenericType (typeof (int)), mb));
56                 il.Emit (OpCodes.Pop);
57                 il.Emit (OpCodes.Ret);
58                 Type tt = main.CreateType ();
59
60                 tt.GetMethod ("Test").Invoke (null, null);
61                 //typeof (Driver).GetMethod ("Test").Invoke (null, null);
62                 return 0;
63         }
64 }