diff options
author | Stephen Toub <stoub@microsoft.com> | 2017-04-20 20:20:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-20 20:20:08 +0300 |
commit | df12f5d35687f757107e81c2d30416c6d5fe8aca (patch) | |
tree | c3a10d8cae68e8f6e412c8a54be588ae0931befe /src | |
parent | e2ecfe4d611c6a7deb922e853651b7b75a4a2680 (diff) | |
parent | 15aea82f93b6d1c2a9e1a91cdd44a85df7ddf093 (diff) |
Merge pull request #18672 from stephentoub/security_tests
Fix/disable several System.Net.Security tests on desktop
Diffstat (limited to 'src')
5 files changed, 21 insertions, 0 deletions
diff --git a/src/Common/tests/Common.Tests.csproj b/src/Common/tests/Common.Tests.csproj index 338fd3b9dd..73b3f432bd 100644 --- a/src/Common/tests/Common.Tests.csproj +++ b/src/Common/tests/Common.Tests.csproj @@ -85,6 +85,9 @@ </Compile> <Compile Include="Tests\System\Net\VirtualNetworkTest.cs" /> <Compile Include="Tests\System\Net\VirtualNetworkStreamTest.cs" /> + <Compile Include="$(CommonPath)\System\Threading\Tasks\TaskToApm.cs"> + <Link>ProductionCode\Common\System\Threading\Tasks\TaskToApm.cs</Link> + </Compile> </ItemGroup> <ItemGroup Condition="'$(TargetsWindows)'=='true'"> <Compile Include="$(CommonPath)\System\IO\PathInternal.Windows.cs"> diff --git a/src/Common/tests/System/Net/VirtualNetwork/VirtualNetworkStream.cs b/src/Common/tests/System/Net/VirtualNetwork/VirtualNetworkStream.cs index 13efa3ae50..e04eb54ace 100644 --- a/src/Common/tests/System/Net/VirtualNetwork/VirtualNetworkStream.cs +++ b/src/Common/tests/System/Net/VirtualNetwork/VirtualNetworkStream.cs @@ -144,5 +144,17 @@ namespace System.Net.Test.Common Task.FromCanceled<int>(cancellationToken) : Task.Run(() => Write(buffer, offset, count)); } + + public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) => + TaskToApm.Begin(ReadAsync(buffer, offset, count), callback, state); + + public override int EndRead(IAsyncResult asyncResult) => + TaskToApm.End<int>(asyncResult); + + public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) => + TaskToApm.Begin(WriteAsync(buffer, offset, count), callback, state); + + public override void EndWrite(IAsyncResult asyncResult) => + TaskToApm.End(asyncResult); } } diff --git a/src/System.Net.Security/tests/FunctionalTests/NegotiateStreamStreamToStreamTest.cs b/src/System.Net.Security/tests/FunctionalTests/NegotiateStreamStreamToStreamTest.cs index aefa64ead0..0bb787983e 100644 --- a/src/System.Net.Security/tests/FunctionalTests/NegotiateStreamStreamToStreamTest.cs +++ b/src/System.Net.Security/tests/FunctionalTests/NegotiateStreamStreamToStreamTest.cs @@ -126,6 +126,7 @@ namespace System.Net.Security.Tests } [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, ".NET Core difference in behavior: https://github.com/dotnet/corefx/issues/5241")] public void NegotiateStream_StreamToStream_Authentication_EmptyCredentials_Fails() { string targetName = "testTargetName"; @@ -272,6 +273,7 @@ namespace System.Net.Security.Tests } [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Relies on FlushAsync override not available in desktop")] public void NegotiateStream_StreamToStream_FlushAsync_Propagated() { VirtualNetwork network = new VirtualNetwork(); diff --git a/src/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs b/src/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs index 0df725b8d1..8766b85b92 100644 --- a/src/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs +++ b/src/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs @@ -335,6 +335,7 @@ namespace System.Net.Security.Tests } [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Relies on FlushAsync override not available in desktop")] public void SslStream_StreamToStream_FlushAsync_Propagated() { VirtualNetwork network = new VirtualNetwork(); diff --git a/src/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj b/src/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj index 7e539386a9..be10b63edc 100644 --- a/src/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj +++ b/src/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj @@ -83,6 +83,9 @@ <Compile Include="$(CommonTestPath)\System\Threading\Tasks\TaskTimeoutExtensions.cs"> <Link>Common\System\Threading\Tasks\TaskTimeoutExtensions.cs</Link> </Compile> + <Compile Include="$(CommonPath)\System\Threading\Tasks\TaskToApm.cs"> + <Link>ProductionCode\Common\System\Threading\Tasks\TaskToApm.cs</Link> + </Compile> </ItemGroup> <ItemGroup Condition="'$(TargetGroup)'=='netcoreapp'"> <!-- TODO #13070: Add net463 to the condition after the TFM gets updated to the actual .Net 4.6.3.--> |