Fix EventWaitHandle/Mutex/Semaphore name max length unit tests failure
authorcarlossanlop <calope@microsoft.com>
Fri, 8 Nov 2019 22:07:01 +0000 (14:07 -0800)
committerSantiago Fernandez Madero <safern@microsoft.com>
Sat, 9 Nov 2019 07:26:24 +0000 (23:26 -0800)
Commit migrated from https://github.com/dotnet/corefx/commit/87b899d5be2c95858637ab82e936770019b8a00f

src/libraries/System.Threading.AccessControl/tests/EventWaitHandleAclTests.cs
src/libraries/System.Threading.AccessControl/tests/MutexAclTests.cs
src/libraries/System.Threading.AccessControl/tests/SemaphoreAclTests.cs

index ca02c30..810c14c 100644 (file)
@@ -92,7 +92,9 @@ namespace System.Threading.Tests
         [Fact]
         public void EventWaitHandle_Create_BeyondMaxPathLength()
         {
-            string name = new string('x', Interop.Kernel32.MAX_PATH + 100);
+            // GetRandomName prevents name collision when two tests run at the same time
+            string name = GetRandomName() + new string('x', Interop.Kernel32.MAX_PATH);
+
             EventWaitHandleSecurity security = GetBasicEventWaitHandleSecurity();
             EventResetMode mode = EventResetMode.AutoReset;
 
index 2b5bf00..c1f9c42 100644 (file)
@@ -42,7 +42,8 @@ namespace System.Threading.Tests
         [Fact]
         public void Mutex_Create_BeyondMaxPathLength()
         {
-            string name = new string('x', Interop.Kernel32.MAX_PATH + 100);
+            // GetRandomName prevents name collision when two tests run at the same time
+            string name = GetRandomName() + new string('x', Interop.Kernel32.MAX_PATH);
 
             if (PlatformDetection.IsFullFramework)
             {
index 970217f..5959353 100644 (file)
@@ -90,7 +90,8 @@ namespace System.Threading.Tests
         [Fact]
         public void Semaphore_Create_BeyondMaxPathLength()
         {
-            string name = new string('x', Interop.Kernel32.MAX_PATH + 100);
+            // GetRandomName prevents name collision when two tests run at the same time
+            string name = GetRandomName() + new string('x', Interop.Kernel32.MAX_PATH);
 
             if (PlatformDetection.IsFullFramework)
             {