Fixes 4.0 build
authorMarek Safar <marek.safar@gmail.com>
Fri, 13 Nov 2009 13:19:05 +0000 (13:19 -0000)
committerMarek Safar <marek.safar@gmail.com>
Fri, 13 Nov 2009 13:19:05 +0000 (13:19 -0000)
svn path=/trunk/mcs/; revision=146130

16 files changed:
1  2 
mcs/class/corlib/Test/System.Collections.Concurrent/CollectionStressTestHelper.cs
mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs
mcs/class/corlib/Test/System.Collections.Concurrent/ParallelConcurrentQueueTests.cs
mcs/class/corlib/Test/System.Collections.Concurrent/ParallelConcurrentStackTests.cs
mcs/class/corlib/Test/System.Threading.Tasks/ParallelTestHelper.cs
mcs/class/corlib/Test/System.Threading.Tasks/ParallelTests.cs
mcs/class/corlib/Test/System.Threading.Tasks/SnziTests.cs
mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs
mcs/class/corlib/Test/System.Threading/CountdownEventTests.cs
mcs/class/corlib/Test/System.Threading/ManualResetEventSlimTests.cs
mcs/class/corlib/Test/System.Threading/ParallelTestHelper.cs
mcs/class/corlib/Test/System.Threading/ParallelTests.cs
mcs/class/corlib/Test/System.Threading/SemaphoreSlimTests.cs
mcs/class/corlib/Test/System.Threading/SnziTests.cs
mcs/class/corlib/Test/System/LazyTest.cs
mcs/class/corlib/corlib_test.dll.sources

index a33eb8ef5243ac12eee36898c3be592e8c304862,a33eb8ef5243ac12eee36898c3be592e8c304862..818825d5f59ace8a56d46fbb1560030ddf9982b3
@@@ -32,6 -32,6 +32,7 @@@ using System.Collections.Concurrent
  
  using System.Threading;
  using System.Linq;
++using MonoTests.System.Threading.Tasks;
  
  using NUnit;
  using NUnit.Framework;
@@@ -113,4 -113,4 +114,4 @@@ namespace ParallelFxTest
                }
        }
  }
--#endif
++#endif
index 937c508013af7da9d164a620a230bec1545805f5,937c508013af7da9d164a620a230bec1545805f5..17aa4ccfe1d82287b5036de033fdcd974fcfeb32
@@@ -25,6 -25,6 +25,7 @@@
  
  using System;
  using System.Threading;
++using MonoTests.System.Threading.Tasks;
  using System.Collections.Concurrent;
  
  using NUnit;
index 947106b9471e63a0f4882137f487caeb17361a3f,947106b9471e63a0f4882137f487caeb17361a3f..05e3c7895af42777721586aa18c5af6ea52711fa
  //
  
  using System;
--using System.Threading;
  using System.Collections.Concurrent;
  
++using MonoTests.System.Threading.Tasks;
++
  using NUnit.Framework;
  
  namespace ParallelFxTests
index bbd802d9dc204bfaa7f01de360328cc5a2e235a3,bbd802d9dc204bfaa7f01de360328cc5a2e235a3..59a086ea601594ec4bba88a5b51d94f0a62ce4d0
@@@ -24,7 -24,7 +24,7 @@@
  //
  
  using System;
--using System.Threading;
++using MonoTests.System.Threading.Tasks;
  using System.Collections.Concurrent;
  
  using NUnit.Framework;
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..e411abb14785512b9c8b83bcf961a12b944a482f
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,90 @@@
++#if NET_4_0
++// TestHelper.cs
++//
++// Copyright (c) 2008 Jérémie "Garuma" Laval
++//
++// Permission is hereby granted, free of charge, to any person obtaining a copy
++// of this software and associated documentation files (the "Software"), to deal
++// in the Software without restriction, including without limitation the rights
++// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
++// copies of the Software, and to permit persons to whom the Software is
++// furnished to do so, subject to the following conditions:
++//
++// The above copyright notice and this permission notice shall be included in
++// all copies or substantial portions of the Software.
++//
++// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
++// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
++// THE SOFTWARE.
++//
++//
++
++using System;
++using System.Threading;
++using System.Collections.Concurrent;
++
++namespace MonoTests.System.Threading.Tasks
++{
++      static class ParallelTestHelper
++      {
++              const int NumRun = 100;
++              
++              public static void Repeat (Action action)
++              {
++                      Repeat (action, NumRun);
++              }
++              
++              public static void Repeat (Action action, int numRun)
++              {
++                      for (int i = 0; i < numRun; i++) {
++                        //Console.WriteLine ("Run " + i.ToString ());
++                              action ();
++                      }
++              }
++              
++              public static void ParallelStressTest<TSource>(TSource obj, Action<TSource> action)
++              {
++                      ParallelStressTest(obj, action, Environment.ProcessorCount + 2);
++              }
++              
++              public static void ParallelStressTest<TSource>(TSource obj, Action<TSource> action, int numThread)
++              {
++                      Thread[] threads = new Thread[numThread];
++                      for (int i = 0; i < numThread; i++) {
++                              threads[i] = new Thread(new ThreadStart(delegate { action(obj); }));
++                              threads[i].Start();
++                      }
++                      
++                      // Wait for the completion
++                      for (int i = 0; i < numThread; i++)
++                              threads[i].Join();
++              }
++              
++              public static void ParallelAdder(IProducerConsumerCollection<int> collection, int numThread)
++              {
++                      int startIndex = -10;
++                      ParallelTestHelper.ParallelStressTest(collection, delegate (IProducerConsumerCollection<int> c) {
++                              int start = Interlocked.Add(ref startIndex, 10);
++                              for (int i = start; i < start + 10; i++) {
++                                      c.TryAdd(i);
++                              }
++                      }, numThread);
++              }
++              
++              public static void ParallelRemover(IProducerConsumerCollection<int> collection, int numThread, int times)
++              {
++                      int t = -1;
++                      ParallelTestHelper.ParallelStressTest(collection, delegate (IProducerConsumerCollection<int> c) {
++                              int num = Interlocked.Increment(ref t);
++                              int value;
++                              if (num < times)
++                                      c.TryTake (out value);
++                      }, numThread);
++              }
++      }
++}
++#endif
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..fbc6466e062c3ce3b202876f3e4fb980b7fe77ad
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,126 @@@
++#if NET_4_0
++// ParallelTests.cs
++//
++// Copyright (c) 2008 Jérémie "Garuma" Laval
++//
++// Permission is hereby granted, free of charge, to any person obtaining a copy
++// of this software and associated documentation files (the "Software"), to deal
++// in the Software without restriction, including without limitation the rights
++// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
++// copies of the Software, and to permit persons to whom the Software is
++// furnished to do so, subject to the following conditions:
++//
++// The above copyright notice and this permission notice shall be included in
++// all copies or substantial portions of the Software.
++//
++// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
++// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
++// THE SOFTWARE.
++//
++//
++
++using System;
++using System.Linq;
++using System.Reflection;
++using System.Threading;
++using System.Threading.Tasks;
++using System.IO;
++using System.Xml.Serialization;
++using System.Collections.Generic;
++using System.Collections.Concurrent;
++
++using NUnit;
++using NUnit.Core;
++using NUnit.Framework;
++
++namespace MonoTests.System.Threading.Tasks
++{
++      
++      [TestFixture()]
++      public class ParallelTests
++      {
++              
++              [Test]
++              public void ParallelForTestCase ()
++              {
++                      ParallelTestHelper.Repeat (() => {
++                              int[] expected = Enumerable.Range (1, 1000).Select ((e) => e * 2).ToArray ();
++                              int[] actual = Enumerable.Range (1, 1000).ToArray ();
++                              SpinWait sw = new SpinWait ();
++                              
++                              Parallel.For (0, actual.Length, (i) => { actual[i] *= 2; sw.SpinOnce (); });
++                              
++                              CollectionAssert.AreEquivalent (expected, actual, "#1, same");
++                              CollectionAssert.AreEqual (expected, actual, "#2, in order");
++                      });
++              }
++
++              [Test, ExpectedException (typeof (AggregateException))]
++              public void ParallelForExceptionTestCase ()
++              {
++                      Parallel.For(1, 100, delegate (int i) { throw new Exception("foo"); });
++              }
++              
++              [Test]
++              public void ParallelForSmallRangeTest ()
++              {
++                      ParallelTestHelper.Repeat (() => {
++                              int test = -1;
++                              Parallel.For (0, 1, (i) => test = i);
++                              
++                              Assert.AreEqual (0, test, "#1");
++                      });
++              }
++              
++              [Test]
++              public void ParallelForNoOperationTest ()
++              {
++                      bool launched = false;
++                      Parallel.For (4, 1, (i) => launched = true);
++                      Assert.IsFalse (launched, "#1");
++              }
++              
++              [Test]
++              public void ParallelForEachTestCase ()
++              {
++                      ParallelTestHelper.Repeat (() => {
++                              IEnumerable<int> e = Enumerable.Repeat(1, 500);
++                              ConcurrentQueue<int> queue = new ConcurrentQueue<int> ();
++                              SpinWait sw = new SpinWait ();
++                              int count = 0;
++                              
++                              Parallel.ForEach (e, (element) => { Interlocked.Increment (ref count); queue.Enqueue (element); sw.SpinOnce (); });
++                              
++                              Assert.AreEqual (500, count, "#1");
++                              CollectionAssert.AreEquivalent (e, queue, "#2");
++                      });
++              }
++              
++              [Test, ExpectedException (typeof (AggregateException))]
++              public void ParallelForEachExceptionTestCase ()
++              {
++                      IEnumerable<int> e = Enumerable.Repeat (1, 10);
++                      Parallel.ForEach (e, delegate (int element) { throw new Exception ("foo"); });
++              }
++              
++              /* Disabled as this is an API addition
++              [Test]
++              public void ParallelWhileTestCase()
++              {
++                      ParallelTestHelper.Repeat (() => {
++                              int i = 0;
++                              int count = 0;
++                              
++                              Parallel.While (() => Interlocked.Increment (ref i) <= 10, () => Interlocked.Increment (ref count));
++                              
++                              Assert.Greater(i, 10, "#1");
++                              Assert.AreEqual(10, count, "#2");
++                      });
++              }*/
++      }
++}
++#endif
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..a96d91bb2aecf41c3f11a4f384034e0a8399bb04
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,136 @@@
++#if NET_4_0
++// 
++// SnziTests.cs
++//  
++// Author:
++//       Jérémie "Garuma" Laval <jeremie.laval@gmail.com>
++// 
++// Copyright (c) 2009 Jérémie "Garuma" Laval
++// 
++// Permission is hereby granted, free of charge, to any person obtaining a copy
++// of this software and associated documentation files (the "Software"), to deal
++// in the Software without restriction, including without limitation the rights
++// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
++// copies of the Software, and to permit persons to whom the Software is
++// furnished to do so, subject to the following conditions:
++// 
++// The above copyright notice and this permission notice shall be included in
++// all copies or substantial portions of the Software.
++// 
++// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
++// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
++// THE SOFTWARE.
++
++using System;
++using System.Threading;
++
++using NUnit.Framework;
++
++namespace ParallelFxTests
++{
++      [TestFixtureAttribute]
++      public class SnziTests
++      {
++              Snzi snzi;
++              
++              [SetUpAttribute]
++              public void Setup ()
++              {
++                      snzi = new Snzi ();
++              }
++              
++              [Test]
++              public void InitialTest ()
++              {
++                      Assert.IsTrue (snzi.IsSet, "#1");
++                      
++              }
++              
++              [Test]
++              public void SimpleOperationTest ()
++              {
++                      snzi.Increment ();
++
++                      snzi.Decrement ();
++                      
++                      Assert.IsTrue (snzi.IsSet, "#1");
++                      
++              }
++              
++              [Test]
++              public void SimpleZeroTest ()
++              {
++                      for (int i = 0; i < 10; i++) {
++                              if (i % 2 == 0)
++                                      snzi.Increment ();
++                              else
++                                      snzi.Decrement ();
++                      }
++                      
++                      Assert.IsTrue (snzi.IsSet, "#1");
++              }
++              
++              [Test]
++              public void SimpleNonZeroTest ()
++              {
++                      snzi.Increment ();
++                      
++                      for (int i = 0; i < 20; i++) {
++                              if (i % 2 == 0)
++                                      snzi.Increment ();
++                              else
++                                      snzi.Decrement ();
++                              if (i % 5 == 0)
++                                      Thread.Sleep (0);
++                      }
++                      
++                      Assert.IsFalse (snzi.IsSet, "#1");
++              }
++              
++              [Test]
++              public void StressZeroTest ()
++              {
++                      ParallelTestHelper.Repeat (delegate {
++                              int times = 0;
++                              
++                              ParallelTestHelper.ParallelStressTest (snzi, (s) => {
++                                      int t = Interlocked.Increment (ref times);
++                                      
++                                      for (int i = 0; i < 20; i++) {
++                                              if (i % 2 == 0)
++                                                      snzi.Increment ();
++                                              else
++                                                      snzi.Decrement ();
++                                              if (i % (3 * t) == 0)
++                                                      Thread.Sleep (0);
++                                      }
++                              });
++                      
++                              Assert.IsTrue (snzi.IsSet, "#1");
++                      });
++              }
++              
++              [Test]
++              public void StressNonZeroTest ()
++              {
++                      ParallelTestHelper.Repeat (delegate {
++                              ParallelTestHelper.ParallelStressTest (snzi, (s) => {
++                                      snzi.Increment ();
++                                      for (int i = 0; i < 1; i++) {
++                                              if (i % 2 == 0)
++                                                      snzi.Increment ();
++                                              else
++                                                      snzi.Decrement ();
++                                      }
++                              });
++                      
++                              Assert.IsFalse (snzi.IsSet, "#1");
++                      });
++              }
++      }
++}
++#endif
index 519624af522612a74a93f926e0a68c2e2ad567ee,519624af522612a74a93f926e0a68c2e2ad567ee..24dc48de763b3138c81b70796c9e0e99ff949b06
@@@ -29,7 -29,7 +29,7 @@@ using System.Threading.Tasks
  
  using NUnit.Framework;
  
--namespace ParallelFxTests
++namespace MonoTests.System.Threading.Tasks
  {
        [TestFixture()]
        public class TaskTests
index 1bd734c921990fb10990cc6078a5e4c04c835050,1bd734c921990fb10990cc6078a5e4c04c835050..91c37de178f368f7e7c67a59f60eb3525db4b7b1
@@@ -28,7 -28,7 +28,9 @@@ using System.Threading
  
  using NUnit.Framework;
  
--namespace ParallelFxTests
++using MonoTests.System.Threading.Tasks;
++
++namespace MonoTests.System.Threading
  {
        [TestFixtureAttribute]
        public class CountdownEventTests
index 2e3e82198ea7593bba867ba136be0f7280dea306,2e3e82198ea7593bba867ba136be0f7280dea306..d70b3d78907249e71415cd21e96c31228a69f51c
@@@ -28,7 -28,7 +28,9 @@@ using System.Threading
  
  using NUnit.Framework;
  
--namespace ParallelFxTests
++using MonoTests.System.Threading.Tasks;
++
++namespace MonoTests.System.Threading
  {
        
        [TestFixture]
diff --cc mcs/class/corlib/Test/System.Threading/ParallelTestHelper.cs
index 652e76702e07677f9d43ae96f179960b82d95b20,652e76702e07677f9d43ae96f179960b82d95b20..0000000000000000000000000000000000000000
deleted file mode 100644,100644
+++ /dev/null
@@@ -1,90 -1,90 +1,0 @@@
--#if NET_4_0
--// TestHelper.cs
--//
--// Copyright (c) 2008 Jérémie "Garuma" Laval
--//
--// Permission is hereby granted, free of charge, to any person obtaining a copy
--// of this software and associated documentation files (the "Software"), to deal
--// in the Software without restriction, including without limitation the rights
--// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
--// copies of the Software, and to permit persons to whom the Software is
--// furnished to do so, subject to the following conditions:
--//
--// The above copyright notice and this permission notice shall be included in
--// all copies or substantial portions of the Software.
--//
--// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
--// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
--// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
--// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
--// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
--// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
--// THE SOFTWARE.
--//
--//
--
--using System;
--using System.Threading;
--using System.Collections.Concurrent;
--
--namespace ParallelFxTests
--{
--      public static class ParallelTestHelper
--      {
--              const int NumRun = 100;
--              
--              public static void Repeat (Action action)
--              {
--                      Repeat (action, NumRun);
--              }
--              
--              public static void Repeat (Action action, int numRun)
--              {
--                      for (int i = 0; i < numRun; i++) {
--                        //Console.WriteLine ("Run " + i.ToString ());
--                              action ();
--                      }
--              }
--              
--              public static void ParallelStressTest<TSource>(TSource obj, Action<TSource> action)
--              {
--                      ParallelStressTest(obj, action, Environment.ProcessorCount + 2);
--              }
--              
--              public static void ParallelStressTest<TSource>(TSource obj, Action<TSource> action, int numThread)
--              {
--                      Thread[] threads = new Thread[numThread];
--                      for (int i = 0; i < numThread; i++) {
--                              threads[i] = new Thread(new ThreadStart(delegate { action(obj); }));
--                              threads[i].Start();
--                      }
--                      
--                      // Wait for the completion
--                      for (int i = 0; i < numThread; i++)
--                              threads[i].Join();
--              }
--              
--              public static void ParallelAdder(IProducerConsumerCollection<int> collection, int numThread)
--              {
--                      int startIndex = -10;
--                      ParallelTestHelper.ParallelStressTest(collection, delegate (IProducerConsumerCollection<int> c) {
--                              int start = Interlocked.Add(ref startIndex, 10);
--                              for (int i = start; i < start + 10; i++) {
--                                      c.TryAdd(i);
--                              }
--                      }, numThread);
--              }
--              
--              public static void ParallelRemover(IProducerConsumerCollection<int> collection, int numThread, int times)
--              {
--                      int t = -1;
--                      ParallelTestHelper.ParallelStressTest(collection, delegate (IProducerConsumerCollection<int> c) {
--                              int num = Interlocked.Increment(ref t);
--                              int value;
--                              if (num < times)
--                                      c.TryTake (out value);
--                      }, numThread);
--              }
--      }
--}
--#endif
diff --cc mcs/class/corlib/Test/System.Threading/ParallelTests.cs
index 09bd2f6e13dac13015e8ecbc8b21146fef4306b8,09bd2f6e13dac13015e8ecbc8b21146fef4306b8..0000000000000000000000000000000000000000
deleted file mode 100644,100644
+++ /dev/null
@@@ -1,125 -1,125 +1,0 @@@
--#if NET_4_0
--// ParallelTests.cs
--//
--// Copyright (c) 2008 Jérémie "Garuma" Laval
--//
--// Permission is hereby granted, free of charge, to any person obtaining a copy
--// of this software and associated documentation files (the "Software"), to deal
--// in the Software without restriction, including without limitation the rights
--// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
--// copies of the Software, and to permit persons to whom the Software is
--// furnished to do so, subject to the following conditions:
--//
--// The above copyright notice and this permission notice shall be included in
--// all copies or substantial portions of the Software.
--//
--// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
--// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
--// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
--// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
--// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
--// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
--// THE SOFTWARE.
--//
--//
--
--using System;
--using System.Linq;
--using System.Reflection;
--using System.Threading;
--using System.IO;
--using System.Xml.Serialization;
--using System.Collections.Generic;
--using System.Collections.Concurrent;
--
--using NUnit;
--using NUnit.Core;
--using NUnit.Framework;
--
--namespace ParallelFxTests
--{
--      
--      [TestFixture()]
--      public class ParallelTests
--      {
--              
--              [Test]
--              public void ParallelForTestCase ()
--              {
--                      ParallelTestHelper.Repeat (() => {
--                              int[] expected = Enumerable.Range (1, 1000).Select ((e) => e * 2).ToArray ();
--                              int[] actual = Enumerable.Range (1, 1000).ToArray ();
--                              SpinWait sw = new SpinWait ();
--                              
--                              Parallel.For (0, actual.Length, (i) => { actual[i] *= 2; sw.SpinOnce (); });
--                              
--                              CollectionAssert.AreEquivalent (expected, actual, "#1, same");
--                              CollectionAssert.AreEqual (expected, actual, "#2, in order");
--                      });
--              }
--
--              [Test, ExpectedException (typeof (AggregateException))]
--              public void ParallelForExceptionTestCase ()
--              {
--                      Parallel.For(1, 100, delegate (int i) { throw new Exception("foo"); });
--              }
--              
--              [Test]
--              public void ParallelForSmallRangeTest ()
--              {
--                      ParallelTestHelper.Repeat (() => {
--                              int test = -1;
--                              Parallel.For (0, 1, (i) => test = i);
--                              
--                              Assert.AreEqual (0, test, "#1");
--                      });
--              }
--              
--              [Test]
--              public void ParallelForNoOperationTest ()
--              {
--                      bool launched = false;
--                      Parallel.For (4, 1, (i) => launched = true);
--                      Assert.IsFalse (launched, "#1");
--              }
--              
--              [Test]
--              public void ParallelForEachTestCase ()
--              {
--                      ParallelTestHelper.Repeat (() => {
--                              IEnumerable<int> e = Enumerable.Repeat(1, 500);
--                              ConcurrentQueue<int> queue = new ConcurrentQueue<int> ();
--                              SpinWait sw = new SpinWait ();
--                              int count = 0;
--                              
--                              Parallel.ForEach (e, (element) => { Interlocked.Increment (ref count); queue.Enqueue (element); sw.SpinOnce (); });
--                              
--                              Assert.AreEqual (500, count, "#1");
--                              CollectionAssert.AreEquivalent (e, queue, "#2");
--                      });
--              }
--              
--              [Test, ExpectedException (typeof (AggregateException))]
--              public void ParallelForEachExceptionTestCase ()
--              {
--                      IEnumerable<int> e = Enumerable.Repeat (1, 10);
--                      Parallel.ForEach (e, delegate (int element) { throw new Exception ("foo"); });
--              }
--              
--              /* Disabled as this is an API addition
--              [Test]
--              public void ParallelWhileTestCase()
--              {
--                      ParallelTestHelper.Repeat (() => {
--                              int i = 0;
--                              int count = 0;
--                              
--                              Parallel.While (() => Interlocked.Increment (ref i) <= 10, () => Interlocked.Increment (ref count));
--                              
--                              Assert.Greater(i, 10, "#1");
--                              Assert.AreEqual(10, count, "#2");
--                      });
--              }*/
--      }
--}
--#endif
index 1ec3300291662891dfd50b4b97dc0528e815c5ac,1ec3300291662891dfd50b4b97dc0528e815c5ac..1a5db8f4993201a67a04c505c22641d225f7502a
@@@ -27,9 -27,9 +27,11 @@@ using System
  using System.Linq;
  using System.Threading;
  
++using MonoTests.System.Threading.Tasks;
++
  using NUnit.Framework;
  
--namespace ParallelFxTests
++namespace MonoTests.System.Threading
  {
        [TestFixture]
        public class SemaphoreSlimTests
diff --cc mcs/class/corlib/Test/System.Threading/SnziTests.cs
index a96d91bb2aecf41c3f11a4f384034e0a8399bb04,a96d91bb2aecf41c3f11a4f384034e0a8399bb04..0000000000000000000000000000000000000000
deleted file mode 100644,100644
+++ /dev/null
@@@ -1,136 -1,136 +1,0 @@@
--#if NET_4_0
--// 
--// SnziTests.cs
--//  
--// Author:
--//       Jérémie "Garuma" Laval <jeremie.laval@gmail.com>
--// 
--// Copyright (c) 2009 Jérémie "Garuma" Laval
--// 
--// Permission is hereby granted, free of charge, to any person obtaining a copy
--// of this software and associated documentation files (the "Software"), to deal
--// in the Software without restriction, including without limitation the rights
--// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
--// copies of the Software, and to permit persons to whom the Software is
--// furnished to do so, subject to the following conditions:
--// 
--// The above copyright notice and this permission notice shall be included in
--// all copies or substantial portions of the Software.
--// 
--// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
--// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
--// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
--// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
--// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
--// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
--// THE SOFTWARE.
--
--using System;
--using System.Threading;
--
--using NUnit.Framework;
--
--namespace ParallelFxTests
--{
--      [TestFixtureAttribute]
--      public class SnziTests
--      {
--              Snzi snzi;
--              
--              [SetUpAttribute]
--              public void Setup ()
--              {
--                      snzi = new Snzi ();
--              }
--              
--              [Test]
--              public void InitialTest ()
--              {
--                      Assert.IsTrue (snzi.IsSet, "#1");
--                      
--              }
--              
--              [Test]
--              public void SimpleOperationTest ()
--              {
--                      snzi.Increment ();
--
--                      snzi.Decrement ();
--                      
--                      Assert.IsTrue (snzi.IsSet, "#1");
--                      
--              }
--              
--              [Test]
--              public void SimpleZeroTest ()
--              {
--                      for (int i = 0; i < 10; i++) {
--                              if (i % 2 == 0)
--                                      snzi.Increment ();
--                              else
--                                      snzi.Decrement ();
--                      }
--                      
--                      Assert.IsTrue (snzi.IsSet, "#1");
--              }
--              
--              [Test]
--              public void SimpleNonZeroTest ()
--              {
--                      snzi.Increment ();
--                      
--                      for (int i = 0; i < 20; i++) {
--                              if (i % 2 == 0)
--                                      snzi.Increment ();
--                              else
--                                      snzi.Decrement ();
--                              if (i % 5 == 0)
--                                      Thread.Sleep (0);
--                      }
--                      
--                      Assert.IsFalse (snzi.IsSet, "#1");
--              }
--              
--              [Test]
--              public void StressZeroTest ()
--              {
--                      ParallelTestHelper.Repeat (delegate {
--                              int times = 0;
--                              
--                              ParallelTestHelper.ParallelStressTest (snzi, (s) => {
--                                      int t = Interlocked.Increment (ref times);
--                                      
--                                      for (int i = 0; i < 20; i++) {
--                                              if (i % 2 == 0)
--                                                      snzi.Increment ();
--                                              else
--                                                      snzi.Decrement ();
--                                              if (i % (3 * t) == 0)
--                                                      Thread.Sleep (0);
--                                      }
--                              });
--                      
--                              Assert.IsTrue (snzi.IsSet, "#1");
--                      });
--              }
--              
--              [Test]
--              public void StressNonZeroTest ()
--              {
--                      ParallelTestHelper.Repeat (delegate {
--                              ParallelTestHelper.ParallelStressTest (snzi, (s) => {
--                                      snzi.Increment ();
--                                      for (int i = 0; i < 1; i++) {
--                                              if (i % 2 == 0)
--                                                      snzi.Increment ();
--                                              else
--                                                      snzi.Decrement ();
--                                      }
--                              });
--                      
--                              Assert.IsFalse (snzi.IsSet, "#1");
--                      });
--              }
--      }
--}
--#endif
index 15852c4575d59e8abf85c9df6a69111d93c266e9,15852c4575d59e8abf85c9df6a69111d93c266e9..f039f4c43eb7374b4e4c22559fca2a216eceabc3
@@@ -51,7 -51,7 +51,7 @@@ namespace MonoTests.Syste
                [Test]
                [ExpectedException (typeof (ArgumentNullException))]
                public void Ctor_Null_2 () {
--                      new Lazy<int> (null, LazyExecutionMode.NotThreadSafe);
++                      new Lazy<int> (null, false);
                }
  
                [Test]
                }
  
                [Test]
--              [ExpectedException (typeof (MissingMemberException))]
                public void NoDefaultCtor () {
                        var l1 = new Lazy<NoDefaultCtorClass> ();
                        
--                      var o = l1.Value;
++                      try {
++                              var o = l1.Value;
++                              Assert.Fail ();
++                      } catch (MissingMemberException) {
++                      }
                }
  
                class NoDefaultCtorClass {
                        counter = 42;
  
                        //var l = new Lazy<int> (delegate () { return counter ++; }, LazyExecutionMode.NotThreadSafe);
--                      var l = new Lazy<int> (delegate () { return counter ++; }, LazyExecutionMode.EnsureSingleThreadSafeExecution);
++                      var l = new Lazy<int> (delegate () { return counter ++; }, true);
  
                        object monitor = new object ();
                        var threads = new Thread [10];
                                Monitor.PulseAll (monitor);
                        
                        Assert.AreEqual (42, l.Value);
--              }                       
++              }
++              
++              [Test]
++              public void InitRecursion ()
++              {
++                      Lazy<DefaultCtorClass> c = null;
++                      c = new Lazy<DefaultCtorClass> (() => { Console.WriteLine (c.Value); return null; });
++                      
++                      try {
++                              var r = c.Value;
++                              Assert.Fail ();
++                      } catch (InvalidOperationException) {
++                      }
++              }
        }
  }
  
index 5a53754860e94532e32fd2321c3177823f2f628c,5a53754860e94532e32fd2321c3177823f2f628c..57001ca35810d938fcc8745230d2d2fdecdeec62
@@@ -419,10 -419,10 +419,11 @@@ System.Threading/ExecutionContextCas.c
  System.Threading/MutexCas.cs
  System.Threading/ThreadCas.cs
  System.Threading/WaitHandleCas.cs
--
  System.Threading.Tasks/TaskTest.cs
  System.Threading.Tasks/FutureTests.cs
  System.Threading.Tasks/TaskCompletionSourceTests.cs
++System.Threading.Tasks/ParallelTestHelper.cs
++System.Threading.Tasks/ParallelTests.cs
  System.Collections.Concurrent/ParallelConcurrentStackTests.cs
  System.Collections.Concurrent/ConcurrentSkipListTests.cs
  ../System.Collections.Concurrent/ConcurrentSkipList.cs
@@@ -435,8 -435,8 +436,6 @@@ System.Collections.Concurrent/ParallelC
  System.Threading/CancellationTokenTests.cs
  System.Threading/ManualResetEventSlimTests.cs
  System.Threading/SemaphoreSlimTests.cs
--System.Threading/ParallelTests.cs
  System.Threading/CountdownEventTests.cs
  System/AggregateExceptionTests.cs
  System.Threading/ThreadLazyTests.cs
--System.Threading/ParallelTestHelper.cs