Increase timeout and log the result for some WaitAny tests that expect AbandonedMutex...
authorKoundinya Veluri <kouvel@users.noreply.github.com>
Wed, 6 Jun 2018 17:09:29 +0000 (10:09 -0700)
committerStephen Toub <stoub@microsoft.com>
Wed, 6 Jun 2018 17:09:29 +0000 (13:09 -0400)
Follow-up to https://github.com/dotnet/coreclr/pull/13298, missed a few cases.

tests/src/baseservices/threading/waithandle/waitany/waitanyex2a.cs
tests/src/baseservices/threading/waithandle/waitany/waitanyex4.cs
tests/src/baseservices/threading/waithandle/waitany/waitanyex4a.cs

index da9115f01e8dd2dcdd39659fa49d2e565b7abc28..0f94f8064f39fa1904dc5ce510b3778c4d1c015c 100644 (file)
@@ -36,7 +36,7 @@ class WaitAnyEx
         {
             Console.WriteLine("Waiting...");
             int i = WaitHandle.WaitAny(
-                new WaitHandle[]{myMutex, myMRE});
+                new WaitHandle[]{myMutex, myMRE}, 30000);
             Console.WriteLine("WaitAny did not throw AbandonedMutexException. Result: {0}", i);
         }
         catch(AbandonedMutexException)
index a67aa329c60d48efe7f5fee9a98a10bd4b112d25..96b538550a541a11a44a40478d0bc24e11f3a2ff 100644 (file)
@@ -29,8 +29,8 @@ class WaitAnyEx
         try
         {
             Console.WriteLine("Waiting...");
-            int i = WaitHandle.WaitAny(wh, 5000);
-            Console.WriteLine("WaitAny did not throw an exception");
+            int i = WaitHandle.WaitAny(wh, 30000);
+            Console.WriteLine("WaitAny did not throw AbandonedMutexException. Result: {0}", i);
         }
         catch(AbandonedMutexException)
         {
@@ -43,10 +43,9 @@ class WaitAnyEx
 
     private void AbandonOne()
     {
-        Mutex m = new Mutex();
         foreach(WaitHandle w in wh)
         {
-            if(w.GetType() == m.GetType())
+            if(w is Mutex)
             {
                 w.WaitOne();
                 break;
index e3e45567e21192fa90583c104fe4dc82ca3ced53..5288e3572c06dd31fa863401fa61bbed2706257f 100644 (file)
@@ -29,8 +29,8 @@ class WaitAnyEx
         try
         {
             Console.WriteLine("Waiting...");
-            int i = WaitHandle.WaitAny(wh);
-            Console.WriteLine("WaitAny did not throw an exception");
+            int i = WaitHandle.WaitAny(wh, 30000);
+            Console.WriteLine("WaitAny did not throw AbandonedMutexException. Result: {0}", i);
         }
         catch(AbandonedMutexException)
         {
@@ -43,10 +43,9 @@ class WaitAnyEx
 
     private void AbandonOne()
     {
-        Mutex m = new Mutex();
         foreach(WaitHandle w in wh)
         {
-            if(w.GetType() == m.GetType())
+            if(w is Mutex)
             {
                 w.WaitOne();
                 break;