From: Davis Goodin Date: Fri, 21 Jun 2019 18:50:08 +0000 (-0500) Subject: Migrate tests to Arcade X-Git-Tag: submit/tizen/20210909.063632~11032^2~122^2~18^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ec816d8623f80683008c8b3ab8e1cf3a2c72e69;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Migrate tests to Arcade Commit migrated from https://github.com/dotnet/core-setup/commit/dd3d9f4141c7a244be29a1827e034f614b9cd2fb --- diff --git a/src/installer/TestProjects.targets b/src/installer/TestProjects.targets new file mode 100644 index 0000000..55f221e --- /dev/null +++ b/src/installer/TestProjects.targets @@ -0,0 +1,6 @@ + + + diff --git a/src/installer/test/Assets/TestProjects/Directory.Build.props b/src/installer/test/Assets/TestProjects/Directory.Build.props index da5bb19..d501b37 100644 --- a/src/installer/test/Assets/TestProjects/Directory.Build.props +++ b/src/installer/test/Assets/TestProjects/Directory.Build.props @@ -1,4 +1,16 @@ - - + + + + + + + + + + @(RestoreTestSource);@(RestoreTestFallbackSource) + $(TestRestorePackagesPath) + true + + diff --git a/src/installer/test/Assets/TestProjects/Directory.Build.targets b/src/installer/test/Assets/TestProjects/Directory.Build.targets new file mode 100644 index 0000000..103be55 --- /dev/null +++ b/src/installer/test/Assets/TestProjects/Directory.Build.targets @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/src/installer/test/Assets/TestProjects/MNADeprecationWorkaround.props b/src/installer/test/Assets/TestProjects/MNADeprecationWorkaround.props index 4ed66ef..14d9577 100644 --- a/src/installer/test/Assets/TestProjects/MNADeprecationWorkaround.props +++ b/src/installer/test/Assets/TestProjects/MNADeprecationWorkaround.props @@ -15,4 +15,8 @@ + + true + + diff --git a/src/installer/test/Assets/TestProjects/PortableApp/PortableApp.csproj b/src/installer/test/Assets/TestProjects/PortableApp/PortableApp.csproj index b4ea72e..369a294 100644 --- a/src/installer/test/Assets/TestProjects/PortableApp/PortableApp.csproj +++ b/src/installer/test/Assets/TestProjects/PortableApp/PortableApp.csproj @@ -14,60 +14,4 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/installer/test/Assets/TestProjects/PortableTestApp/PortableTestApp.csproj b/src/installer/test/Assets/TestProjects/PortableTestApp/PortableTestApp.csproj index d5f0f6c..fbd0b54 100644 --- a/src/installer/test/Assets/TestProjects/PortableTestApp/PortableTestApp.csproj +++ b/src/installer/test/Assets/TestProjects/PortableTestApp/PortableTestApp.csproj @@ -10,8 +10,6 @@ - - diff --git a/src/installer/test/Assets/TestProjects/StandaloneTestApp/StandaloneTestApp.csproj b/src/installer/test/Assets/TestProjects/StandaloneTestApp/StandaloneTestApp.csproj index 613a84e..dbc7efa 100644 --- a/src/installer/test/Assets/TestProjects/StandaloneTestApp/StandaloneTestApp.csproj +++ b/src/installer/test/Assets/TestProjects/StandaloneTestApp/StandaloneTestApp.csproj @@ -13,7 +13,6 @@ - diff --git a/src/installer/test/BundleTests/AppHost.Bundle.Tests/AppHost.Bundle.Tests.csproj b/src/installer/test/BundleTests/AppHost.Bundle.Tests/AppHost.Bundle.Tests.csproj index f88caf5..335c034 100644 --- a/src/installer/test/BundleTests/AppHost.Bundle.Tests/AppHost.Bundle.Tests.csproj +++ b/src/installer/test/BundleTests/AppHost.Bundle.Tests/AppHost.Bundle.Tests.csproj @@ -2,10 +2,13 @@ Apphost Bundle Tests - netcoreapp2.0 + $(NETCoreAppFramework) AppHost.Bundle.Tests AppHost.Bundle.Tests true + + ahb + true @@ -14,10 +17,4 @@ - - - - - - diff --git a/src/installer/test/BundleTests/Helpers/BundleHelper.csproj b/src/installer/test/BundleTests/Helpers/BundleHelper.csproj index c1b5ea0..02c9fab 100644 --- a/src/installer/test/BundleTests/Helpers/BundleHelper.csproj +++ b/src/installer/test/BundleTests/Helpers/BundleHelper.csproj @@ -12,8 +12,4 @@ - - - - diff --git a/src/installer/test/BundleTests/Microsoft.NET.HostModel.Bundle.Tests/Microsoft.NET.HostModel.Bundle.Tests.csproj b/src/installer/test/BundleTests/Microsoft.NET.HostModel.Bundle.Tests/Microsoft.NET.HostModel.Bundle.Tests.csproj index 277091b..1a0e81c 100644 --- a/src/installer/test/BundleTests/Microsoft.NET.HostModel.Bundle.Tests/Microsoft.NET.HostModel.Bundle.Tests.csproj +++ b/src/installer/test/BundleTests/Microsoft.NET.HostModel.Bundle.Tests/Microsoft.NET.HostModel.Bundle.Tests.csproj @@ -2,10 +2,13 @@ Microsoft.NET.HostModel.Bundle Tests - netcoreapp2.0 + $(NETCoreAppFramework) Microsoft.NET.HostModel.Bundle.Tests Microsoft.NET.HostModel.Bundle.Tests true + + hmb + true @@ -14,10 +17,4 @@ - - - - - - diff --git a/src/installer/test/Directory.Build.props b/src/installer/test/Directory.Build.props index 1b57cd9..43109fd 100644 --- a/src/installer/test/Directory.Build.props +++ b/src/installer/test/Directory.Build.props @@ -1,21 +1,10 @@ - - - + + - $(ProjectDir)/src/test - $(TestDir)/Assets + $(ProjectDir)src\test\ + $(TestDir)Assets\ + $(ObjDir)TestPackageCache\ - - - - - - - - - - - diff --git a/src/installer/test/Directory.Build.targets b/src/installer/test/Directory.Build.targets new file mode 100644 index 0000000..1506f15 --- /dev/null +++ b/src/installer/test/Directory.Build.targets @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + $(_HostRid) + $(MSBuildProjectName) + + $(ArtifactsDir)tests/$(ConfigurationGroup)/ + $(TestsOutputRootDir)$(TestsOutputName)/ + + + + + + + $([System.IO.Path]::DirectorySeparatorChar) + $([System.String]::Copy('$(TestsOutputDir)').Replace('/', '$(DirectorySeparatorChar)')) + $([System.String]::Copy('$(SystemPathTestsOutputDir)').Replace('\', '$(DirectorySeparatorChar)')) + + + + + + + + + + + + + + + + + + + + + + + + + <_TestEnvironment>%(TestToRun.EnvironmentDisplay) + <_TestAssembly>%(TestToRun.Identity) + <_TestRuntime>%(TestToRun.TestRuntime) + <_TestRunnerAdditionalArguments>%(TestToRun.TestRunnerAdditionalArguments) + + + <_TestRunnerTargetFramework>net472 + <_TestRunnerTargetFramework Condition="'$(_TestRuntime)' == 'Core'">netcoreapp2.0 + <_TestRunnerTargetFramework Condition="%(TestToRun.TargetFramework) == 'netcoreapp1.1' or %(TestToRun.TargetFramework) == 'netcoreapp1.0'">netcoreapp1.0 + + + + <_TargetFileNameNoExt>$([System.IO.Path]::GetFileNameWithoutExtension('$(_TestAssembly)')) + <_TargetDir>$([System.IO.Path]::GetDirectoryName('$(_TestAssembly)'))\ + <_CoreRuntimeConfigPath>$(_TargetDir)$(_TargetFileNameNoExt).runtimeconfig.json + <_CoreDepsPath>$(_TargetDir)$(_TargetFileNameNoExt).deps.json + + <_TestRunner Condition="'%(TestToRun.Architecture)'=='x86' And Exists('$(DotNetRoot)x86\dotnet.exe')">$(DotNetRoot)x86\dotnet.exe + <_TestRunner Condition="'$(_TestRunner)'==''">$(DotNetTool) + + <_TestRunnerArgs>exec --depsfile "$(_CoreDepsPath)" --runtimeconfig "$(_CoreRuntimeConfigPath)" $(TestRuntimeAdditionalArguments) "$(NuGetPackageRoot)xunit.runner.console/$(XUnitVersion)/tools/$(_TestRunnerTargetFramework)/xunit.console.dll" "$(_TestAssembly)" -noautoreporters -xml "%(TestToRun.ResultsXmlPath)" -html "%(TestToRun.ResultsHtmlPath)" $(_TestRunnerAdditionalArguments) + + + + <_XUnitConsoleExe>xunit.console.exe + <_XUnitConsoleExe Condition="'%(TestToRun.Architecture)' == 'x86'">xunit.console.x86.exe + <_XUnitConsoleExePath>$(NuGetPackageRoot)xunit.runner.console\$(XUnitVersion)\tools\$(_TestRunnerTargetFramework)\$(_XUnitConsoleExe) + + <_TestRunnerArgs>"$(_TestAssembly)" -noshadow -xml "%(TestToRun.ResultsXmlPath)" -html "%(TestToRun.ResultsHtmlPath)" $(_TestRunnerAdditionalArguments) + <_TestRunnerArgs Condition="'$(_TestRuntime)' == 'Mono'">$(TestRuntimeAdditionalArguments) "$(_XUnitConsoleExePath)" $(_TestRunnerArgs) + + <_TestRunner Condition="'$(_TestRuntime)' == 'Mono'">$(MonoTool) + <_TestRunner Condition="'$(_TestRuntime)' != 'Mono'">$(_XUnitConsoleExePath) + + + + <_TestRunnerCommand>"$(_TestRunner)" $(_TestRunnerArgs) + + + <_TestRunnerCommand Condition="'$(TestCaptureOutput)' != 'false'">$(_TestRunnerCommand) > "%(TestToRun.ResultsStdOutPath)" 2>&1 + + + + <_OutputFiles Include="%(TestToRun.ResultsXmlPath)" /> + <_OutputFiles Include="%(TestToRun.ResultsHtmlPath)" /> + <_OutputFiles Include="%(TestToRun.ResultsStdOutPath)" /> + + + + + + + + + + + + + + + + + + + + <_ResultsFileToDisplay>%(TestToRun.ResultsHtmlPath) + <_ResultsFileToDisplay Condition="!Exists('$(_ResultsFileToDisplay)')">%(TestToRun.ResultsStdOutPath) + + + + + + + + + + + + diff --git a/src/installer/test/HostActivation.Tests/HostActivation.Tests.csproj b/src/installer/test/HostActivation.Tests/HostActivation.Tests.csproj index 9693f54..0387f1f 100644 --- a/src/installer/test/HostActivation.Tests/HostActivation.Tests.csproj +++ b/src/installer/test/HostActivation.Tests/HostActivation.Tests.csproj @@ -1,11 +1,14 @@  - netcoreapp2.0 + $(NETCoreAppFramework) HostActivation.Tests HostActivation.Tests true $(DefineConstants);WINDOWS + + ha + true @@ -18,9 +21,6 @@ - - - diff --git a/src/installer/test/Microsoft.Extensions.DependencyModel.Tests/Microsoft.Extensions.DependencyModel.Tests.csproj b/src/installer/test/Microsoft.Extensions.DependencyModel.Tests/Microsoft.Extensions.DependencyModel.Tests.csproj index 5f21058..2c7d6bd 100644 --- a/src/installer/test/Microsoft.Extensions.DependencyModel.Tests/Microsoft.Extensions.DependencyModel.Tests.csproj +++ b/src/installer/test/Microsoft.Extensions.DependencyModel.Tests/Microsoft.Extensions.DependencyModel.Tests.csproj @@ -2,9 +2,9 @@ Microsoft.DotNet.Tools.Tests.Utilities Class Library - netcoreapp2.0 + $(NETCoreAppFramework) Microsoft.Extensions.DependencyModel.Tests - ../../../tools-local/setuptools/Key.snk + MicrosoftAspNetCore true true Microsoft.Extensions.DependencyModel.Tests @@ -12,9 +12,6 @@ - - - @@ -24,4 +21,15 @@ + + + + + + + diff --git a/src/installer/test/PrepareTestAssets/PrepareTestAssets.proj b/src/installer/test/PrepareTestAssets/PrepareTestAssets.proj new file mode 100644 index 0000000..3e2ab1d --- /dev/null +++ b/src/installer/test/PrepareTestAssets/PrepareTestAssets.proj @@ -0,0 +1,40 @@ + + + + + + + + $(IntermediateOutputPath)temp\ + $(_HostRid) + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/installer/test/TestUtils/RepoDirectoriesProvider.cs b/src/installer/test/TestUtils/RepoDirectoriesProvider.cs index 9cfffda..e6457c8 100644 --- a/src/installer/test/TestUtils/RepoDirectoriesProvider.cs +++ b/src/installer/test/TestUtils/RepoDirectoriesProvider.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.IO; namespace Microsoft.DotNet.CoreSetup.Test @@ -28,7 +29,9 @@ namespace Microsoft.DotNet.CoreSetup.Test { RepoRoot = repoRoot ?? GetRepoRootDirectory(); - string baseArtifactsFolder = artifacts ?? Path.Combine(RepoRoot, "bin"); + string baseArtifactsFolder = artifacts ?? Path.Combine(RepoRoot, "artifacts"); + string baseBinFolder = artifacts ?? Path.Combine(baseArtifactsFolder, "bin"); + string baseObjFolder = artifacts ?? Path.Combine(baseArtifactsFolder, "obj"); TargetRID = Environment.GetEnvironmentVariable("TEST_TARGETRID"); BuildRID = Environment.GetEnvironmentVariable("BUILDRID"); @@ -45,13 +48,13 @@ namespace Microsoft.DotNet.CoreSetup.Test throw new InvalidOperationException("ERROR: Test SDK folder not found."); } - Artifacts = Path.Combine(baseArtifactsFolder, osPlatformConfig); + Artifacts = Path.Combine(baseBinFolder, osPlatformConfig); HostArtifacts = artifacts ?? Path.Combine(Artifacts, "corehost"); NugetPackages = nugetPackages ?? Path.Combine(RepoRoot, "packages"); CorehostPackages = corehostPackages ?? Path.Combine(Artifacts, "corehost"); - BuiltDotnet = builtDotnet ?? Path.Combine(baseArtifactsFolder, "obj", osPlatformConfig, "sharedFrameworkPublish"); + BuiltDotnet = builtDotnet ?? Path.Combine(baseObjFolder, osPlatformConfig, "sharedFrameworkPublish"); } private static string GetRepoRootDirectory() diff --git a/src/installer/test/TestUtils/TestProjectFixture.cs b/src/installer/test/TestUtils/TestProjectFixture.cs index 79f420b..a421dc5 100644 --- a/src/installer/test/TestUtils/TestProjectFixture.cs +++ b/src/installer/test/TestUtils/TestProjectFixture.cs @@ -79,28 +79,35 @@ namespace Microsoft.DotNet.CoreSetup.Test private TestProject CopyTestProject(TestProject sourceTestProject) { - EnsureDirectoryBuildProps(TestArtifact.TestArtifactsPath); + EnsureDirectoryBuildFiles(TestArtifact.TestArtifactsPath); return sourceTestProject.Copy(); } - private void EnsureDirectoryBuildProps(string testArtifactDirectory) + private void EnsureDirectoryBuildFiles(string testArtifactDirectory) { - string directoryBuildPropsPath = Path.Combine(testArtifactDirectory, "Directory.Build.props"); Directory.CreateDirectory(testArtifactDirectory); - for(int i = 0; i < 3 && !File.Exists(directoryBuildPropsPath); i++) + // write an empty Directory.Build.* file to ensure that msbuild doesn't pick up + // the repo's root Directory.Build.*. + EnsureTestProjectsFileContent(testArtifactDirectory, "props"); + EnsureTestProjectsFileContent(testArtifactDirectory, "targets"); + } + + private void EnsureTestProjectsFileContent(string dir, string type) => EnsureFileWithContent( + Path.Combine(dir, $"Directory.Build.{type}"), + string.Join( + Environment.NewLine, + "", + $" ", + "")); + + private void EnsureFileWithContent(string path, string content) + { + for(int i = 0; i < 3 && !File.Exists(path); i++) { try { - StringBuilder propsFile = new StringBuilder(); - - propsFile.AppendLine(""); - propsFile.AppendLine(" "); - propsFile.AppendLine(""); - - // write an empty Directory.Build.props to ensure that msbuild doesn't pick up - // the repo's root Directory.Build.props. - File.WriteAllText(directoryBuildPropsPath, propsFile.ToString()); + File.WriteAllText(path, content); } catch (IOException) {} diff --git a/src/installer/test/dir.proj b/src/installer/test/dir.proj deleted file mode 100644 index 2784938..0000000 --- a/src/installer/test/dir.proj +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - DetermineTestOutputDirectory; - RestoreTests; - BuildTests; - RunTests; - - - - - - - - - - - $(_HostRid) - $(TestTargetRid).$(ConfigurationGroup) - $(BaseOutputPath)tests/$(TestOSPlatformConfig)/ - - - - - - - - - - $(USERPROFILE)\.dotnet\ - $(HOME)/.dotnet/ - - - - - - - - - - - - @(RestoreTestSource->'--source %(Identity)', ' ') - $(RestoreSourceArg) @(RestoreTestFallbackSource->'--source %(Identity)', ' ') - --packages "$(PackagesDir.TrimEnd('/').TrimEnd('\'))" $(RestoreSourceArg) - $(RestoreArgs) $(MSBuildPassThroughPropertyList) /p:MNAVersion=$(ProductVersion) /p:TestTargetRid=$(TestTargetRid) - DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 - - - - - - - - - --no-restore $(MSBuildPassThroughPropertyList) - - - - - - - - - - %(TestProjects.Identity) - %(TestProjects.Filename) - $([System.IO.Path]::GetDirectoryName($(TestProject))) - $([System.IO.Path]::DirectorySeparatorChar) - - $([System.String]::Copy('$(TestsOutputDir)').Replace('/', '$(DirectorySeparatorChar)')) - $([System.String]::Copy('$(SystemPathTestsOutputDir)').Replace('\', '$(DirectorySeparatorChar)')) - - - --no-restore $(MSBuildPassThroughPropertyList) - false - true - $(SystemPathTestsOutputDir)$(TestProjectFilename)-testResults.trx - - - - - - - - $(TestResultsXml) - $(_ErrorCode) - 0 - - - - - - - - - - - - - - - - - - - - - - - -