From 8ce47fb8b64ace860e0d0167eba89dd45f0dcad5 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Sat, 19 Nov 2016 04:33:08 +0000 Subject: [PATCH] Move perf, share code --- KestrelHttpServer.sln | 9 ++-- global.json | 2 +- .../configs/DefaultConfig.cs | 38 -------------- .../helpers/MockApplicationErrorLogger.cs | 51 ------------------- .../helpers/MockConnectionControl.cs | 34 ------------- .../helpers/MockKestrelTrace.cs | 33 ------------ .../helpers/SocketInputExtensions.cs | 37 -------------- .../project.json | 29 ----------- .../Properties/AssemblyInfo.cs | 1 + ...spNetCore.Server.Kestrel.Performance.xproj | 0 .../Program.cs | 4 ++ .../Readme.md | 4 +- .../RequestParsing.cs | 21 ++------ .../columns/RpsColumn.cs | 0 .../configs/CoreConfig.cs | 1 + .../global.json | 3 ++ .../project.json | 42 +++++++++++++++ .../TestHelpers => shared}/MockConnection.cs | 5 +- .../SocketInputExtensions.cs | 0 19 files changed, 68 insertions(+), 246 deletions(-) delete mode 100644 perf/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/DefaultConfig.cs delete mode 100644 perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/MockApplicationErrorLogger.cs delete mode 100644 perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/MockConnectionControl.cs delete mode 100644 perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/MockKestrelTrace.cs delete mode 100644 perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/SocketInputExtensions.cs delete mode 100644 perf/Microsoft.AspNetCore.Server.Kestrel.Performance/project.json rename {perf => test}/Microsoft.AspNetCore.Server.Kestrel.Performance/Microsoft.AspNetCore.Server.Kestrel.Performance.xproj (100%) rename {perf => test}/Microsoft.AspNetCore.Server.Kestrel.Performance/Program.cs (90%) rename {perf => test}/Microsoft.AspNetCore.Server.Kestrel.Performance/Readme.md (60%) rename {perf => test}/Microsoft.AspNetCore.Server.Kestrel.Performance/RequestParsing.cs (90%) rename {perf => test}/Microsoft.AspNetCore.Server.Kestrel.Performance/columns/RpsColumn.cs (100%) rename {perf => test}/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/CoreConfig.cs (95%) create mode 100644 test/Microsoft.AspNetCore.Server.Kestrel.Performance/global.json create mode 100644 test/Microsoft.AspNetCore.Server.Kestrel.Performance/project.json rename test/{Microsoft.AspNetCore.Server.KestrelTests/TestHelpers => shared}/MockConnection.cs (90%) rename test/{Microsoft.AspNetCore.Server.KestrelTests/TestHelpers => shared}/SocketInputExtensions.cs (100%) diff --git a/KestrelHttpServer.sln b/KestrelHttpServer.sln index e6dca6eac9..d78ceec5ad 100644 --- a/KestrelHttpServer.sln +++ b/KestrelHttpServer.sln @@ -37,7 +37,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{0EF2AC test\shared\DummyApplication.cs = test\shared\DummyApplication.cs test\shared\HttpClientSlim.cs = test\shared\HttpClientSlim.cs test\shared\LifetimeNotImplemented.cs = test\shared\LifetimeNotImplemented.cs + test\shared\MockConnection.cs = test\shared\MockConnection.cs + test\shared\MockFrameControl.cs = test\shared\MockFrameControl.cs test\shared\MockSystemClock.cs = test\shared\MockSystemClock.cs + test\shared\SocketInputExtensions.cs = test\shared\SocketInputExtensions.cs test\shared\TestApplicationErrorLogger.cs = test\shared\TestApplicationErrorLogger.cs test\shared\TestConnection.cs = test\shared\TestConnection.cs test\shared\TestKestrelTrace.cs = test\shared\TestKestrelTrace.cs @@ -45,9 +48,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{0EF2AC test\shared\TestServiceContext.cs = test\shared\TestServiceContext.cs EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "perf", "perf", "{21B17FBB-5A58-42A8-8473-43160509A9FF}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Server.Kestrel.Performance", "perf\Microsoft.AspNetCore.Server.Kestrel.Performance\Microsoft.AspNetCore.Server.Kestrel.Performance.xproj", "{70567566-524C-4B67-9B59-E5C206D6C2EB}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Server.Kestrel.Performance", "test\Microsoft.AspNetCore.Server.Kestrel.Performance\Microsoft.AspNetCore.Server.Kestrel.Performance.xproj", "{70567566-524C-4B67-9B59-E5C206D6C2EB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -100,6 +101,6 @@ Global {5F64B3C3-0C2E-431A-B820-A81BBFC863DA} = {2D5D5227-4DBD-499A-96B1-76A36B03B750} {9559A5F1-080C-4909-B6CF-7E4B3DC55748} = {D3273454-EA07-41D2-BF0B-FCC3675C2483} {0EF2ACDF-012F-4472-A13A-4272419E2903} = {D3273454-EA07-41D2-BF0B-FCC3675C2483} - {70567566-524C-4B67-9B59-E5C206D6C2EB} = {21B17FBB-5A58-42A8-8473-43160509A9FF} + {70567566-524C-4B67-9B59-E5C206D6C2EB} = {D3273454-EA07-41D2-BF0B-FCC3675C2483} EndGlobalSection EndGlobal diff --git a/global.json b/global.json index c0415c19af..d9b4ed63ae 100644 --- a/global.json +++ b/global.json @@ -1,3 +1,3 @@ { - "projects": ["src", "perf"] + "projects": [ "src" ] } diff --git a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/DefaultConfig.cs b/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/DefaultConfig.cs deleted file mode 100644 index 6b2670302c..0000000000 --- a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/DefaultConfig.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using BenchmarkDotNet.Configs; -using BenchmarkDotNet.Engines; -using BenchmarkDotNet.Environments; -using BenchmarkDotNet.Jobs; -using BenchmarkDotNet.Validators; - -namespace Microsoft.AspNetCore.Server.Kestrel.Performance -{ - public class DefaultConfig : ManualConfig - { - public DefaultConfig() - { - Add(JitOptimizationsValidator.FailOnError); - Add(new RpsColumn()); - - Add(Job.Default. - With(Platform.X64). - With(Jit.RyuJit). - With(BenchmarkDotNet.Environments.Runtime.Clr). - With(new GcMode() { Server = true }). - With(RunStrategy.Throughput). - WithLaunchCount(3). - WithWarmupCount(5). - WithTargetCount(10)); - - Add(Job.Default. - With(BenchmarkDotNet.Environments.Runtime.Core). - With(new GcMode() { Server = true }). - With(RunStrategy.Throughput). - WithLaunchCount(3). - WithWarmupCount(5). - WithTargetCount(10)); - } - } -} diff --git a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/MockApplicationErrorLogger.cs b/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/MockApplicationErrorLogger.cs deleted file mode 100644 index c126eba79c..0000000000 --- a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/MockApplicationErrorLogger.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNetCore.Server.Kestrel.Internal; -using Microsoft.Extensions.Logging; - -namespace Microsoft.AspNetCore.Server.Kestrel.Performance -{ - public class MockApplicationErrorLogger : ILogger - { - // Application errors are logged using 13 as the eventId. - private const int ApplicationErrorEventId = 13; - - public List Messages { get; } = new List(); - - public int TotalErrorsLogged => Messages.Count(message => message.LogLevel == LogLevel.Error); - - public int CriticalErrorsLogged => Messages.Count(message => message.LogLevel == LogLevel.Critical); - - public int ApplicationErrorsLogged => Messages.Count(message => message.EventId.Id == ApplicationErrorEventId); - - public IDisposable BeginScope(TState state) - { - return new Disposable(() => { }); - } - - public bool IsEnabled(LogLevel logLevel) - { - return true; - } - - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) - { -#if false - Console.WriteLine($"Log {logLevel}[{eventId}]: {formatter(state, exception)} {exception?.Message}"); -#endif - - Messages.Add(new LogMessage { LogLevel = logLevel, EventId = eventId, Exception = exception }); - } - - public class LogMessage - { - public LogLevel LogLevel { get; set; } - public EventId EventId { get; set; } - public Exception Exception { get; set; } - } - } -} diff --git a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/MockConnectionControl.cs b/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/MockConnectionControl.cs deleted file mode 100644 index b3587d81db..0000000000 --- a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/MockConnectionControl.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; - -namespace Microsoft.AspNetCore.Server.Kestrel.Performance -{ - public class MockConnectionControl : IConnectionControl - { - public void CancelTimeout() - { - } - - public void End(ProduceEndType endType) - { - } - - public void Pause() - { - } - - public void ResetTimeout(long milliseconds, TimeoutAction timeoutAction) - { - } - - public void Resume() - { - } - - public void SetTimeout(long milliseconds, TimeoutAction timeoutAction) - { - } - } -} diff --git a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/MockKestrelTrace.cs b/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/MockKestrelTrace.cs deleted file mode 100644 index 5d5bf38201..0000000000 --- a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/MockKestrelTrace.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNetCore.Server.Kestrel.Internal; - -namespace Microsoft.AspNetCore.Server.Kestrel.Performance -{ - public class MockKestrelTrace : KestrelTrace - { - public MockKestrelTrace() : this(new MockApplicationErrorLogger()) - { - } - - public MockKestrelTrace(MockApplicationErrorLogger testLogger) : base(testLogger) - { - Logger = testLogger; - } - - public MockApplicationErrorLogger Logger { get; private set; } - - public override void ConnectionRead(string connectionId, int count) - { - } - - public override void ConnectionWrite(string connectionId, int count) - { - } - - public override void ConnectionWriteCallback(string connectionId, int status) - { - } - } -} \ No newline at end of file diff --git a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/SocketInputExtensions.cs b/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/SocketInputExtensions.cs deleted file mode 100644 index af26c2994c..0000000000 --- a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/SocketInputExtensions.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; - -namespace Microsoft.AspNetCore.Server.Kestrel.Performance -{ - public static class SocketInputExtensions - { - public static void IncomingData(this SocketInput input, byte[] buffer, int offset, int count) - { - var bufferIndex = offset; - var remaining = count; - - while (remaining > 0) - { - var block = input.IncomingStart(); - - var bytesLeftInBlock = block.Data.Offset + block.Data.Count - block.End; - var bytesToCopy = remaining < bytesLeftInBlock ? remaining : bytesLeftInBlock; - - Buffer.BlockCopy(buffer, bufferIndex, block.Array, block.End, bytesToCopy); - - bufferIndex += bytesToCopy; - remaining -= bytesToCopy; - - input.IncomingComplete(bytesToCopy, null); - } - } - - public static void IncomingFin(this SocketInput input) - { - input.IncomingComplete(0, null); - } - } -} diff --git a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/project.json b/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/project.json deleted file mode 100644 index 38bb58ec76..0000000000 --- a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/project.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "version": "1.0.0-*", - "buildOptions": { - "emitEntryPoint": true - }, - - "dependencies": { - "BenchmarkDotNet": "0.10.0", - "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*" - }, - - "frameworks": { - "net46": {}, - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "version": "1.0.1-*", - "type": "platform" - } - } - } - }, - - "runtimeOptions": { - "configProperties": { - "System.GC.Server": true - } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Properties/AssemblyInfo.cs index 8989a4b649..86b8eff609 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Properties/AssemblyInfo.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Properties/AssemblyInfo.cs @@ -7,6 +7,7 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Server.Kestrel.FunctionalTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Server.KestrelTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Server.Kestrel.Performance, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: AssemblyMetadata("Serviceable", "True")] [assembly: NeutralResourcesLanguage("en-us")] [assembly: AssemblyCompany("Microsoft Corporation.")] diff --git a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/Microsoft.AspNetCore.Server.Kestrel.Performance.xproj b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/Microsoft.AspNetCore.Server.Kestrel.Performance.xproj similarity index 100% rename from perf/Microsoft.AspNetCore.Server.Kestrel.Performance/Microsoft.AspNetCore.Server.Kestrel.Performance.xproj rename to test/Microsoft.AspNetCore.Server.Kestrel.Performance/Microsoft.AspNetCore.Server.Kestrel.Performance.xproj diff --git a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/Program.cs b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/Program.cs similarity index 90% rename from perf/Microsoft.AspNetCore.Server.Kestrel.Performance/Program.cs rename to test/Microsoft.AspNetCore.Server.Kestrel.Performance/Program.cs index 688771f622..b627755d76 100644 --- a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/Program.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/Program.cs @@ -2,7 +2,11 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using BenchmarkDotNet.Environments; +using BenchmarkDotNet.Jobs; +using BenchmarkDotNet.Properties; using BenchmarkDotNet.Running; +using BenchmarkDotNet.Toolchains; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { diff --git a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/Readme.md b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/Readme.md similarity index 60% rename from perf/Microsoft.AspNetCore.Server.Kestrel.Performance/Readme.md rename to test/Microsoft.AspNetCore.Server.Kestrel.Performance/Readme.md index 4088c38007..b98f36ff5c 100644 --- a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/Readme.md +++ b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/Readme.md @@ -2,10 +2,10 @@ To run a specific benchmark add it as parameter ``` -dotnet run -c Release RequestParsing +dotnet run RequestParsing ``` To run all use `All` as parameter ``` -dotnet run -c Release All +dotnet run All ``` Using no parameter will list all available benchmarks \ No newline at end of file diff --git a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/RequestParsing.cs b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/RequestParsing.cs similarity index 90% rename from perf/Microsoft.AspNetCore.Server.Kestrel.Performance/RequestParsing.cs rename to test/Microsoft.AspNetCore.Server.Kestrel.Performance/RequestParsing.cs index b1bdbe16f9..7388c547a2 100644 --- a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/RequestParsing.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/RequestParsing.cs @@ -8,6 +8,8 @@ using BenchmarkDotNet.Attributes; using Microsoft.AspNetCore.Server.Kestrel.Internal; using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure; +using Microsoft.AspNetCore.Server.KestrelTests.TestHelpers; +using Microsoft.AspNetCore.Testing; using RequestLineStatus = Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame.RequestLineStatus; namespace Microsoft.AspNetCore.Server.Kestrel.Performance @@ -165,26 +167,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance [Setup] public void Setup() { - Trace = new KestrelTrace(new MockKestrelTrace()); + Trace = new KestrelTrace(new TestKestrelTrace()); ThreadPool = new LoggingThreadPool(Trace); MemoryPool = new MemoryPool(); SocketInput = new SocketInput(MemoryPool, ThreadPool); - var serviceContext = new ServiceContext - { - DateHeaderValueManager = new DateHeaderValueManager(), - ServerOptions = new KestrelServerOptions(), - Log = Trace - }; - var listenerContext = new ListenerContext(serviceContext) - { - ServerAddress = ServerAddress.FromUrl("http://localhost:5000") - }; - var connectionContext = new ConnectionContext(listenerContext) - { - ConnectionControl = new MockConnectionControl(), - SocketInput = SocketInput - }; + var connectionContext = new MockConnection(new KestrelServerOptions()); + connectionContext.SocketInput = SocketInput; Frame = new Frame(application: null, context: connectionContext); } diff --git a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/columns/RpsColumn.cs b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/columns/RpsColumn.cs similarity index 100% rename from perf/Microsoft.AspNetCore.Server.Kestrel.Performance/columns/RpsColumn.cs rename to test/Microsoft.AspNetCore.Server.Kestrel.Performance/columns/RpsColumn.cs diff --git a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/CoreConfig.cs b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/CoreConfig.cs similarity index 95% rename from perf/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/CoreConfig.cs rename to test/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/CoreConfig.cs index 72056a28b4..efdf192205 100644 --- a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/CoreConfig.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/CoreConfig.cs @@ -17,6 +17,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance Add(Job.Default. With(BenchmarkDotNet.Environments.Runtime.Core). + WithRemoveOutliers(false). With(new GcMode() { Server = true }). With(RunStrategy.Throughput). WithLaunchCount(3). diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/global.json b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/global.json new file mode 100644 index 0000000000..33f0f54e92 --- /dev/null +++ b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/global.json @@ -0,0 +1,3 @@ +{ + "projects": [ "..\\" ] +} diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/project.json b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/project.json new file mode 100644 index 0000000000..a74be5fefb --- /dev/null +++ b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/project.json @@ -0,0 +1,42 @@ +{ + "version": "1.0.0-*", + "dependencies": { + "BenchmarkDotNet": "0.10.0", + "Microsoft.AspNetCore.Server.Kestrel": "1.2.0-*" + }, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "version": "1.0.1-*", + "type": "platform" + } + } + } + }, + "buildOptions": { + "emitEntryPoint": true, + "compile": { + "include": [ + "../shared/SocketInputExtensions.cs", + "../shared/TestKestrelTrace.cs", + "../shared/TestApplicationErrorLogger.cs", + "../shared/MockConnection.cs" + ] + }, + "keyFile": "../../tools/Key.snk", + "copyToOutput": { + "include": "TestResources/testCert.pfx" + } + }, + "runtimeOptions": { + "configProperties": { + "System.GC.Server": true + } + }, + "publishOptions": { + "include": [ + "TestResources/testCert.pfx" + ] + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/TestHelpers/MockConnection.cs b/test/shared/MockConnection.cs similarity index 90% rename from test/Microsoft.AspNetCore.Server.KestrelTests/TestHelpers/MockConnection.cs rename to test/shared/MockConnection.cs index ee781a3935..a782f51ffd 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/TestHelpers/MockConnection.cs +++ b/test/shared/MockConnection.cs @@ -18,7 +18,10 @@ namespace Microsoft.AspNetCore.Server.KestrelTests.TestHelpers { ConnectionControl = this; RequestAbortedSource = new CancellationTokenSource(); - ListenerContext = new ListenerContext(new ServiceContext { ServerOptions = options }); + ListenerContext = new ListenerContext(new ServiceContext {ServerOptions = options}) + { + ServerAddress = ServerAddress.FromUrl("http://localhost:5000") + }; } public override void Abort(Exception error = null) diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/TestHelpers/SocketInputExtensions.cs b/test/shared/SocketInputExtensions.cs similarity index 100% rename from test/Microsoft.AspNetCore.Server.KestrelTests/TestHelpers/SocketInputExtensions.cs rename to test/shared/SocketInputExtensions.cs