X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2FTestHelpers.cs;h=26f8d1276d5988c753e34f8afb3da0f7e03cc142;hb=c67775554f4ff295bac4605d9aa44a83b82eb4a7;hp=01ed13532a10f65d0289c64e66cee1b94d5214da;hpb=284268561399bc605a0620ed073b5ddb23e46c55;p=mono.git diff --git a/mono/mini/TestHelpers.cs b/mono/mini/TestHelpers.cs index 01ed13532a1..26f8d1276d5 100644 --- a/mono/mini/TestHelpers.cs +++ b/mono/mini/TestHelpers.cs @@ -1,5 +1,6 @@ using System; using System.Threading; +using System.Reflection; namespace MonoTests.Helpers { @@ -25,5 +26,25 @@ namespace MonoTests.Helpers { thr.Join (); } } + + public static class OOMHelpers { + public static void RunTest (string test) + { + Assembly asm = Assembly.Load (test); + + try { + // Support both (void) and (string[]) signatures + if (asm.EntryPoint.GetParameters ().Length == 1) + asm.EntryPoint.Invoke (null, new string[] { null }); + else + asm.EntryPoint.Invoke (null, null); + } catch (TargetInvocationException e) { + if (e.InnerException is OutOfMemoryException) + Console.WriteLine ("Catched oom"); + else + throw; + } + } + } }