Converted test projects to run on netcoreapp2.0

* Converted test projects to run on netcoreapp2.0
* Set DOTNET_RUNTME_ID because of an issue in corehost and RID calculation.
This commit is contained in:
David Fowler 2017-03-31 02:58:18 -07:00 committed by GitHub
parent b0bd5475cd
commit 1bf9b057d4
14 changed files with 28 additions and 20 deletions

View File

@ -9,6 +9,7 @@
<JsonNetVersion>9.0.1</JsonNetVersion> <JsonNetVersion>9.0.1</JsonNetVersion>
<MoqVersion>4.7.1</MoqVersion> <MoqVersion>4.7.1</MoqVersion>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion> <NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
<RuntimeFrameworkVersion>2.0.0-*</RuntimeFrameworkVersion>
<TestSdkVersion>15.0.0</TestSdkVersion> <TestSdkVersion>15.0.0</TestSdkVersion>
<XunitVersion>2.2.0</XunitVersion> <XunitVersion>2.2.0</XunitVersion>
</PropertyGroup> </PropertyGroup>

View File

@ -3,7 +3,7 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net46;netcoreapp1.1</TargetFrameworks> <TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>

View File

@ -3,7 +3,7 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net46</TargetFrameworks> <TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if NETCOREAPP1_1 #if NETCOREAPP2_0
using System.IO; using System.IO;
using Xunit; using Xunit;
@ -41,4 +41,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
} }
} }
#elif NET46
#else
#error Target framework needs to be updated
#endif #endif

View File

@ -3,8 +3,8 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net46</TargetFrameworks> <TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.1</TargetFrameworks> <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<PlatformTarget Condition="'$(TargetFramework)' == 'net46'">x64</PlatformTarget> <PlatformTarget Condition="'$(TargetFramework)' == 'net46'">x64</PlatformTarget>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType> <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
@ -32,7 +32,7 @@
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" /> <PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' "> <ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<ProjectReference Include="..\..\tools\CodeGenerator\CodeGenerator.csproj" /> <ProjectReference Include="..\..\tools\CodeGenerator\CodeGenerator.csproj" />
<PackageReference Include="System.Net.NetworkInformation" Version="$(CoreFxVersion)" /> <PackageReference Include="System.Net.NetworkInformation" Version="$(CoreFxVersion)" />
</ItemGroup> </ItemGroup>

View File

@ -1,8 +1,12 @@
FROM microsoft/dotnet:1.1-runtime-deps FROM microsoft/dotnet-nightly:2.0-runtime-deps
# The "container" environment variable is read by systemd. # The "container" environment variable is read by systemd.
ENV container=docker ENV container=docker
# We're copying assets from an ubuntu machine over the container make the RID
# match
ENV DOTNET_RUNTIME_ID=ubuntu.14.04-x64
# This is required by systemd and won't work without "dotnet run --privileged". # This is required by systemd and won't work without "dotnet run --privileged".
VOLUME ["/sys/fs/cgroup"] VOLUME ["/sys/fs/cgroup"]

View File

@ -5,4 +5,4 @@ Requires=activate-kestrel.socket
ExecStart=/usr/bin/dotnet SampleApp.dll ExecStart=/usr/bin/dotnet SampleApp.dll
WorkingDirectory=/publish WorkingDirectory=/publish
NonBlocking=true NonBlocking=true
Environment="DOTNET_RUNTIME_ID=ubuntu.14.04-x64"

View File

@ -3,8 +3,8 @@
set -e set -e
scriptDir=$(dirname "${BASH_SOURCE[0]}") scriptDir=$(dirname "${BASH_SOURCE[0]}")
~/.dotnet/dotnet publish -f netcoreapp1.1 ./samples/SampleApp/ ~/.dotnet/dotnet publish -f netcoreapp2.0 ./samples/SampleApp/
cp -R ./samples/SampleApp/bin/Debug/netcoreapp1.1/publish/ $scriptDir cp -R ./samples/SampleApp/bin/Debug/netcoreapp2.0/publish/ $scriptDir
cp -R ~/.dotnet/ $scriptDir cp -R ~/.dotnet/ $scriptDir
image=$(docker build -qf $scriptDir/Dockerfile $scriptDir) image=$(docker build -qf $scriptDir/Dockerfile $scriptDir)

View File

@ -3,7 +3,7 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<ServerGarbageCollection>true</ServerGarbageCollection> <ServerGarbageCollection>true</ServerGarbageCollection>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>

View File

@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
{ {
_frame.Reset(); _frame.Reset();
_frame.StatusCode = 200; _frame.StatusCode = 200;
_frame.HttpVersionEnum = HttpVersion.Http11; _frame.HttpVersionEnum = Internal.Http.HttpVersion.Http11;
_frame.KeepAlive = true; _frame.KeepAlive = true;
Task writeTask = Task.CompletedTask; Task writeTask = Task.CompletedTask;

View File

@ -90,9 +90,9 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
var stream = new FrameRequestStream(); var stream = new FrameRequestStream();
Assert.Throws<NotSupportedException>(() => stream.BeginWrite(new byte[1], 0, 1, null, null)); Assert.Throws<NotSupportedException>(() => stream.BeginWrite(new byte[1], 0, 1, null, null));
} }
#elif NETCOREAPP1_1 #elif NETCOREAPP2_0
#else #else
#error target frameworks need to be updated #error Target framework needs to be updated
#endif #endif
[Fact] [Fact]

View File

@ -61,9 +61,9 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
var stream = new FrameResponseStream(new MockFrameControl()); var stream = new FrameResponseStream(new MockFrameControl());
Assert.Throws<NotSupportedException>(() => stream.BeginRead(new byte[1], 0, 1, null, null)); Assert.Throws<NotSupportedException>(() => stream.BeginRead(new byte[1], 0, 1, null, null));
} }
#elif NETCOREAPP1_1 #elif NETCOREAPP2_0
#else #else
#error target frameworks need to be updated #error Target framework needs to be updated
#endif #endif
[Fact] [Fact]

View File

@ -3,8 +3,8 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net46</TargetFrameworks> <TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.1</TargetFrameworks> <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<PlatformTarget Condition="'$(TargetFramework)' == 'net46'">x64</PlatformTarget> <PlatformTarget Condition="'$(TargetFramework)' == 'net46'">x64</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>

View File

@ -11,10 +11,10 @@ namespace Microsoft.AspNetCore.Testing
private static readonly string _testCertificatePath = private static readonly string _testCertificatePath =
#if NET46 #if NET46
Path.Combine(Directory.GetCurrentDirectory(), "testCert.pfx"); Path.Combine(Directory.GetCurrentDirectory(), "testCert.pfx");
#elif NETCOREAPP1_1 #elif NETCOREAPP2_0
Path.Combine(AppContext.BaseDirectory, "testCert.pfx"); Path.Combine(AppContext.BaseDirectory, "testCert.pfx");
#else #else
#error Target frameworks need to be updated. #error Target framework needs to be updated
#endif #endif
public static string TestCertificatePath => _testCertificatePath; public static string TestCertificatePath => _testCertificatePath;