未验证 提交 093ea477 编写于 作者: J Jared Parsons 提交者: GitHub

Merge pull request #46383 from jaredpar/test-net50

Move unit tests to net5.0
......@@ -212,7 +212,7 @@ function BuildSolution() {
$projects = Join-Path $RepoRoot $solution
$toolsetBuildProj = InitializeToolset
$testTargetFrameworks = if ($testCoreClr) { "netcoreapp3.1" } else { "" }
$testTargetFrameworks = if ($testCoreClr) { 'net5.0%3Bnetcoreapp3.1' } else { "" }
$ibcDropName = GetIbcDropName
......@@ -406,6 +406,7 @@ function TestUsingOptimizedRunner() {
# Exclude out the multi-targetted netcore app projects
$dlls = $dlls | ?{ -not ($_.FullName -match ".*netcoreapp.*") }
$dlls = $dlls | ?{ -not ($_.FullName -match ".*net5.0.*") }
# Exclude out the ref assemblies
$dlls = $dlls | ?{ -not ($_.FullName -match ".*\\ref\\.*") }
......
......@@ -266,7 +266,7 @@ function BuildSolution {
test_runtime_args="--debug"
elif [[ "$test_core_clr" == true ]]; then
test=true
test_runtime="/p:TestRuntime=Core /p:TestTargetFrameworks=netcoreapp3.1"
test_runtime="/p:TestRuntime=Core /p:TestTargetFrameworks=net5.0%3Bnetcoreapp3.1"
mono_tool=""
fi
......
......@@ -65,7 +65,7 @@
These may be overridden by projects that need to be skipped.
-->
<TestTargetFrameworks Condition="'$(TestRuntime)' == 'Mono'">net46;net472</TestTargetFrameworks>
<TestTargetFrameworks Condition="'$(TestRuntime)' == 'Core'">netcoreapp3.1</TestTargetFrameworks>
<TestTargetFrameworks Condition="'$(TestRuntime)' == 'Core'">netcoreapp3.1;net5.0</TestTargetFrameworks>
<XUnitDesktopSettingsFile>$(MSBuildThisFileDirectory)..\config\xunit.runner.json</XUnitDesktopSettingsFile>
<XUnitCoreSettingsFile>$(MSBuildThisFileDirectory)..\config\xunit.runner.json</XUnitCoreSettingsFile>
......
......@@ -40,7 +40,7 @@ namespace Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests
{
public class CommandLineTests : CommandLineTestBase
{
#if NETCOREAPP3_1
#if NETCOREAPP
private static readonly string s_CSharpCompilerExecutable;
private static readonly string s_DotnetCscRun;
#else
......@@ -55,7 +55,7 @@ public class CommandLineTests : CommandLineTestBase
static CommandLineTests()
{
#if NETCOREAPP3_1
#if NETCOREAPP
var cscDllPath = Path.Combine(
Path.GetDirectoryName(typeof(CommandLineTests).GetTypeInfo().Assembly.Location),
Path.Combine("dependency", "csc.dll"));
......
......@@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests</RootNamespace>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks>net5.0;net472</TargetFrameworks>
<GenerateMicrosoftCodeAnalysisCommitHashAttribute>true</GenerateMicrosoftCodeAnalysisCommitHashAttribute>
</PropertyGroup>
<ItemGroup>
......
......@@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.CSharp.UnitTests</RootNamespace>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks>net5.0;net472</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup Label="Project References">
......
......@@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests</RootNamespace>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks>net5.0;net472</TargetFrameworks>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\..\..\Test\Utilities\Portable\Roslyn.Test.Utilities.csproj" />
......
......@@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests</RootNamespace>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks>net5.0;net472</TargetFrameworks>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\..\..\Test\Utilities\Portable\Roslyn.Test.Utilities.csproj" />
......
......@@ -16,6 +16,7 @@
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;
using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Semantics
{
......
......@@ -16,6 +16,7 @@
using Roslyn.Utilities;
using Microsoft.CodeAnalysis.Diagnostics;
using static Roslyn.Test.Utilities.TestMetadata;
using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests
{
......@@ -12,6 +12,7 @@
using Roslyn.Test.Utilities;
using Xunit;
using Roslyn.Utilities;
using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests
{
......
......@@ -5,7 +5,7 @@
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests</RootNamespace>
<NoStdLib>true</NoStdLib>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks>net5.0;net472</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup Label="Project References">
......
......@@ -7,7 +7,7 @@
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<NoStdLib>true</NoStdLib>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks>net5.0;net472</TargetFrameworks>
<!-- The RESX resources generator produces invalid comments when the string has a line starting with '/' -->
<NoWarn>$(NoWarn);1570;1587</NoWarn>
</PropertyGroup>
......
......@@ -5,7 +5,7 @@
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.UnitTests</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks>net5.0;net472</TargetFrameworks>
</PropertyGroup>
<ItemGroup Label="Linked Files">
<Compile Include="..\..\Shared\GlobalAssemblyCacheHelpers\FusionAssemblyIdentity.cs">
......
......@@ -342,6 +342,7 @@ public void MetadataMerge1(bool deterministic)
"MapSourceRoots.ContainsDuplicate", "SourceRoot", path1, "SourceLinkUrl", "URL1", "URL2")) + Environment.NewLine,
engine.Log);
AssertEx.NotNull(task.MappedSourceRoots);
AssertEx.Equal(new[]
{
$"'{path1}' SourceControl='git' RevisionId='RevId1' NestedRoot='NR1A' ContainingRoot='{path3}' MappedPath='{(deterministic ? "/_/NR1A/" : path1)}' SourceLinkUrl='URL1'",
......@@ -446,6 +447,7 @@ public void Error_NoTopLevelSourceRoot(bool deterministic)
}
else
{
AssertEx.NotNull(task.MappedSourceRoots);
AssertEx.Equal(new[]
{
$"'{path1}' SourceControl='' RevisionId='' NestedRoot='a/b' ContainingRoot='{path1}' MappedPath='{path1}' SourceLinkUrl=''",
......
......@@ -5,7 +5,7 @@
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.BuildTasks.UnitTests</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks>net5.0;net472</TargetFrameworks>
<Nullable>enable</Nullable>
<!-- Multiple test failures -->
......
......@@ -15,6 +15,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Xml;
using Roslyn.Test.Utilities;
using Microsoft.Build.Evaluation;
using Microsoft.Build.Execution;
using Microsoft.Build.Framework;
......@@ -265,15 +266,15 @@ public void GenerateEditorConfigCoreEvaluatesMetadata()
Assert.Equal("_GeneratedEditorConfigMetadata", item.ItemType);
var itemType = item.Metadata.SingleOrDefault(m => m.Name == "ItemType");
Assert.NotNull(itemType);
AssertEx.NotNull(itemType);
Assert.Equal("Compile", itemType.EvaluatedValue);
var metaName = item.Metadata.SingleOrDefault(m => m.Name == "MetadataName");
Assert.NotNull(metaName);
AssertEx.NotNull(metaName);
Assert.Equal("CustomMeta", metaName.EvaluatedValue);
var customMeta = item.Metadata.SingleOrDefault(m => m.Name == metaName.EvaluatedValue);
Assert.NotNull(customMeta);
AssertEx.NotNull(customMeta);
Assert.Equal("abc", customMeta.EvaluatedValue);
}
......@@ -307,15 +308,15 @@ public void GenerateEditorConfigCoreEvaluatesDynamicMetadata()
Assert.Equal("_GeneratedEditorConfigMetadata", item.ItemType);
var itemType = item.Metadata.SingleOrDefault(m => m.Name == "ItemType");
Assert.NotNull(itemType);
AssertEx.NotNull(itemType);
Assert.Equal("Compile", itemType.EvaluatedValue);
var metaName = item.Metadata.SingleOrDefault(m => m.Name == "MetadataName");
Assert.NotNull(metaName);
AssertEx.NotNull(metaName);
Assert.Equal("CustomMeta", metaName.EvaluatedValue);
var customMeta = item.Metadata.SingleOrDefault(m => m.Name == metaName.EvaluatedValue);
Assert.NotNull(customMeta);
AssertEx.NotNull(customMeta);
Assert.Equal("abc", customMeta.EvaluatedValue);
}
......@@ -347,11 +348,11 @@ public void GenerateEditorConfigCoreHandlesMissingMetadata()
Assert.Equal("_GeneratedEditorConfigMetadata", item.ItemType);
var itemType = item.Metadata.SingleOrDefault(m => m.Name == "ItemType");
Assert.NotNull(itemType);
AssertEx.NotNull(itemType);
Assert.Equal("Compile", itemType.EvaluatedValue);
var metaName = item.Metadata.SingleOrDefault(m => m.Name == "MetadataName");
Assert.NotNull(metaName);
AssertEx.NotNull(metaName);
Assert.Equal("CustomMeta", metaName.EvaluatedValue);
}
......@@ -382,11 +383,11 @@ public void GenerateEditorConfigCoreHandlesMalformedCompilerVisibleItemMetadata(
Assert.Equal("_GeneratedEditorConfigMetadata", item.ItemType);
var itemType = item.Metadata.SingleOrDefault(m => m.Name == "ItemType");
Assert.NotNull(itemType);
AssertEx.NotNull(itemType);
Assert.Equal("Compile", itemType.EvaluatedValue);
var metaName = item.Metadata.SingleOrDefault(m => m.Name == "MetadataName");
Assert.NotNull(metaName);
AssertEx.NotNull(metaName);
Assert.Equal("", metaName.EvaluatedValue);
}
......
......@@ -5,7 +5,7 @@
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.CompilerServer.UnitTests</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks>net5.0;net472</TargetFrameworks>
<!--
Currently fails on CI against old versions of mono
......@@ -29,8 +29,8 @@
<ProjectReference Include="..\..\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" Condition="'$(TargetFramework)' != 'netcoreapp3.1'" />
<Reference Include="System.Xml" Condition="'$(TargetFramework)' != 'netcoreapp3.1'" />
<Reference Include="System" Condition="'$(TargetFramework)' != 'net5.0'" />
<Reference Include="System.Xml" Condition="'$(TargetFramework)' != 'net5.0'" />
<PackageReference Include="Microsoft.DiaSymReader" Version="$(MicrosoftDiaSymReaderVersion)" />
<PackageReference Include="Moq" Version="$(MoqVersion)" />
</ItemGroup>
......
......@@ -3,7 +3,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks>net5.0;net472</TargetFrameworks>
<RootNamespace></RootNamespace>
<!-- Disabling on assumption -->
......
......@@ -3,7 +3,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks>net5.0;net472</TargetFrameworks>
<RootNamespace></RootNamespace>
</PropertyGroup>
<ItemGroup Label="Project References">
......
......@@ -3,7 +3,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks>net5.0;net472</TargetFrameworks>
<RootNamespace></RootNamespace>
<!--
......@@ -28,7 +28,7 @@
<ProjectReference Include="..\..\Portable\Microsoft.CodeAnalysis.VisualBasic.vbproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="$(SystemDrawingCommonVersion)" Condition="$(TargetFramework) == 'netcoreapp3.1'" />
<PackageReference Include="System.Drawing.Common" Version="$(SystemDrawingCommonVersion)" Condition="$(TargetFramework) == 'net5.0'" />
</ItemGroup>
<ItemGroup>
<Folder Include="My Project\" />
......
......@@ -3,7 +3,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks>net5.0;net472</TargetFrameworks>
<RootNamespace></RootNamespace>
<!-- A zillion test failures + crash. See https://github.com/mono/mono/issues/10756. -->
......
......@@ -11,7 +11,7 @@ Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Roslyn.Test.Utilities
Imports ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Symbols
......
......@@ -3,7 +3,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks>net5.0;net472</TargetFrameworks>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\..\..\Test\Utilities\Portable\Roslyn.Test.Utilities.csproj" />
......
......@@ -6,6 +6,8 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
......@@ -793,5 +795,14 @@ public static void Equal<T>(T[,] expected, Func<int, int, T> getResult, Func<T,
Assert.True(false, builder.ToString());
}
}
#nullable enable
public static void NotNull<T>([NotNull] T value)
{
Assert.NotNull(value);
Debug.Assert(value is object);
}
#nullable disable
}
}
......@@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.UnitTests</RootNamespace>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks>net5.0;netcoreapp3.1;net472</TargetFrameworks>
<UseWpf>true</UseWpf>
<IsShipping>false</IsShipping>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册