[Microsoft.Build] Ignore ThreadAbortException in BuildNodeManager
[mono-project.git] / mono / tests / bug-17590.cs
blob936c4868194d900bafc6802d8b09c97cdca350d7
1 /*
2 * The string portion of this test crashes on Boehm (and there might
3 * not be much we can do about that - I haven't looked into it), and
4 * the array portions are unbearably slow, so it's only run on SGen.
5 */
7 using System;
9 class X
11 public static void Test (Action<int> allocator)
13 for (int i = 0; i < 1000; ++i)
15 bool caught = false;
16 try
18 //Console.WriteLine ("allocating with " + i);
19 allocator (i);
21 catch (OutOfMemoryException)
23 caught = true;
26 if (!caught)
28 Console.WriteLine ("WTF?");
29 //Environment.Exit (1);
35 public static void Ignore<T> (T x)
39 public static void ProbeArray<T> (T[] a)
41 if (a == null)
42 return;
44 for (int i = 0; i < 1000; ++i)
46 a [i] = default (T);
47 a [a.Length - i - 1] = default (T);
51 public static void ProbeString (string s)
53 for (int i = 0; i < 1000; ++i)
55 if (s [s.Length - i - 1] != ' ')
56 Environment.Exit (1);
60 public static int Main ()
62 Console.WriteLine ("byte arrays");
63 Test (i => ProbeArray (new byte [int.MaxValue - i]));
64 Test (i => ProbeArray (new byte [int.MaxValue - i * 100]));
66 Console.WriteLine ("int arrays");
67 Test (i => ProbeArray (new int [int.MaxValue / 4 - i]));
68 Test (i => ProbeArray (new int [int.MaxValue / 4 - i * 100]));
70 Console.WriteLine ("large int arrays");
71 Test (i => ProbeArray (new int [int.MaxValue - i]));
72 Test (i => ProbeArray (new int [int.MaxValue - i * 100]));
74 // FIXME: This commit 4gb of memory
76 Console.WriteLine ("strings");
77 Test (i => ProbeString ("abcd".PadRight(int.MaxValue - i)));
78 Test (i => ProbeString ("abcd".PadRight(int.MaxValue - i * 100)));
81 //Console.WriteLine ("no objects allocated - all good");
82 return 0;