From 7b601bd90ccb1ece691926b0b1ef73dc1fbab9f1 Mon Sep 17 00:00:00 2001 From: stephentoub Date: Fri, 18 Mar 2016 11:23:02 -0400 Subject: [PATCH] Fix test interaction between inheritable pipes and launched processes --- .../tests/System.IO.Pipes.Tests.csproj | 1 + src/System.IO.Pipes/tests/XunitAssemblyAttributes.cs | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/System.IO.Pipes/tests/XunitAssemblyAttributes.cs diff --git a/src/System.IO.Pipes/tests/System.IO.Pipes.Tests.csproj b/src/System.IO.Pipes/tests/System.IO.Pipes.Tests.csproj index 44465c5daa1e..b70ad0a70376 100644 --- a/src/System.IO.Pipes/tests/System.IO.Pipes.Tests.csproj +++ b/src/System.IO.Pipes/tests/System.IO.Pipes.Tests.csproj @@ -42,6 +42,7 @@ + diff --git a/src/System.IO.Pipes/tests/XunitAssemblyAttributes.cs b/src/System.IO.Pipes/tests/XunitAssemblyAttributes.cs new file mode 100644 index 000000000000..6aaf2c3d5e4d --- /dev/null +++ b/src/System.IO.Pipes/tests/XunitAssemblyAttributes.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +// Some tests launch processes. If other tests that run concurrently create inheritable pipes and the launched +// process inherits it, then the lifetime of those pipes will be extended beyond when the test expects, leading +// to failures due to naming conflicts and the like. On Unix this can happen even for non-inheritable pipes, as they're +// made non-inheritable via CLOEXEC, but there's still a small window between the process being forked and that +// forked process calling exec where the handle remains open in the other process. +[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly, DisableTestParallelization = true, MaxParallelThreads = 1)]