1dfee9ead8
* Reduce test target complexity [and running time] * WiP * Enable building tests via solution Remove deprecated tests Make Microsoft.DotNet.Tools.Tests.Utilities portable-only Remove MSI tests from the solution as they are the only tests that currently require dekstop. * Enable building of tests * Move migration tests to TA to allow them to self-restore * Reduce project nesting and test directory name
117 lines
4.9 KiB
XML
117 lines
4.9 KiB
XML
<Project ToolsVersion="14.0" DefaultTargets="Test">
|
|
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
|
|
|
<PropertyGroup>
|
|
<PathSeparator>/</PathSeparator>
|
|
<PathSeparator Condition=" '$(OSName)' == 'win' ">\</PathSeparator>
|
|
</PropertyGroup>
|
|
|
|
<Import Project="test/TestPackageProjects.targets" />
|
|
<Import Project="test/TestProjects.targets" />
|
|
|
|
<Target Name="Test"
|
|
Condition=" '$(CLIBUILD_SKIP_TESTS)' != 'true' "
|
|
DependsOnTargets="BuildTests;">
|
|
|
|
<PropertyGroup>
|
|
<PathListSeparator>:</PathListSeparator>
|
|
<PathListSeparator Condition=" '$(OSName)' == 'win' ">%3b</PathListSeparator>
|
|
<ExecPath>$(Stage2Directory)$(PathListSeparator)$(PATH)</ExecPath>
|
|
<ExecPath Condition=" '$(OSName)' == 'win' ">$(Stage2Directory)</ExecPath>
|
|
<TestArtifactsEnv>$(TestArtifactsDir)</TestArtifactsEnv>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<TestTaskEnvironmentVariables Include="PATH=$(ExecPath)" />
|
|
<TestTaskEnvironmentVariables Include="TEST_ARTIFACTS=$(TestArtifactsEnv)" />
|
|
</ItemGroup>
|
|
|
|
<PropertyGroup>
|
|
<RunTestEnvironmentVariables>@(TestTaskEnvironmentVariables)</RunTestEnvironmentVariables>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<ProjectsToTest Include="build/test/RunTest.proj">
|
|
<Properties>
|
|
CLIBuildDll=$(CLIBuildDll);
|
|
Configuration=$(Configuration);
|
|
EnvironmentVariables=$(RunTestEnvironmentVariables);
|
|
TestProject=%(TestProjects.Identity);
|
|
TestResultXmlDir=$(TestResultXmlDir);
|
|
ToolPath=$(Stage0Directory);
|
|
WorkingDirectory=$([System.IO.Directory]::GetParent(%(TestProjects.Identity)))
|
|
</Properties>
|
|
</ProjectsToTest>
|
|
</ItemGroup>
|
|
|
|
<Message Text="Starting test execution" Importance="High" />
|
|
|
|
<MSBuild
|
|
BuildInParallel="True"
|
|
Projects="@(ProjectsToTest)">
|
|
</MSBuild>
|
|
|
|
<Message Text="Finished test execution" Importance="High" />
|
|
</Target>
|
|
|
|
<Target Name="PrepareTests"
|
|
DependsOnTargets="Init;
|
|
SetupTestProjectData">
|
|
<PropertyGroup>
|
|
<TestPackageBuildVersionSuffix>$(CommitCount)</TestPackageBuildVersionSuffix>
|
|
<TestOutputDir>$(RepoRoot)/artifacts/testpackages/</TestOutputDir>
|
|
<TestPackagesBuildDir>$(TestOutputDir)/packagesBuild/</TestPackagesBuildDir>
|
|
<TestPackagesDir>$(TestOutputDir)/packages/</TestPackagesDir>
|
|
<TestArtifactsDir>$(TestOutputDir)/artifacts/</TestArtifactsDir>
|
|
<TestResultXmlDir>$(TestOutputDir)/results/</TestResultXmlDir>
|
|
<TestDirectory>$(RepoRoot)/test/</TestDirectory>
|
|
<DotnetUnderTest>$(Stage2Directory)</DotnetUnderTest>
|
|
</PropertyGroup>
|
|
|
|
<MakeDir Directories="$(TestPackagesDir)" Condition="!Exists('$(TestPackagesDir)')"/>
|
|
</Target>
|
|
|
|
<Target Name="RestoreTests"
|
|
DependsOnTargets="PrepareTests;
|
|
CreateTestAssetPackageNuPkgs;">
|
|
<DotNetRestore ToolPath="$(Stage0Directory)"
|
|
ProjectPath=""$(TestDirectory)/Microsoft.DotNet.Cli.Tests.sln"" />
|
|
</Target>
|
|
|
|
<Target Name="BuildTests"
|
|
DependsOnTargets="RestoreTests;">
|
|
<DotNetBuild ToolPath="$(Stage0Directory)"
|
|
ProjectPath=""$(TestDirectory)/Microsoft.DotNet.Cli.Tests.sln"" />
|
|
</Target>
|
|
|
|
<Target Name="CreateTestAssetPackageNuPkgs"
|
|
DependsOnTargets="SetupTestPackageProjectData;"
|
|
Inputs="%(TestPackageProject.PackInputs)"
|
|
Outputs="%(TestPackageProject.PackOutputs)">
|
|
|
|
<PropertyGroup>
|
|
<Framework>%(TestPackageProject.Framework)</Framework>
|
|
<DoPackRuntime Condition=" '$(Framework)' == 'net45' Or '$(Framework)' == 'net451' ">true</DoPackRuntime>
|
|
<DotNetPackMsbuildArgs>/p:TargetFramework=$(Framework)</DotNetPackMsbuildArgs>
|
|
<DotNetPackMsbuildArgs Condition=" '$(IsDesktopAvailable)' == 'True' And '%(TestPackageProject.PackRuntime)' != '' And '$(DoPackRuntime)' != '' ">/p:RuntimeIdentifier=%(TestPackageProject.PackRuntime)</DotNetPackMsbuildArgs>
|
|
</PropertyGroup>
|
|
|
|
<DotNetRestore ToolPath="$(Stage2Directory)"
|
|
Source="$(TestPackagesDir)"
|
|
ConfigFile="$(RepoRoot)\NuGet.Config"
|
|
ProjectPath="%(TestPackageProject.ProjectPath)" />
|
|
|
|
<DotNetBuild Framework="$(Framework)"
|
|
Runtime="%(TestPackageProject.Runtime)"
|
|
ProjectPath="%(TestPackageProject.ProjectPath)"
|
|
ToolPath="$(Stage0Directory)" />
|
|
|
|
<!-- https://github.com/NuGet/Home/issues/4063 -->
|
|
<DotNetPack NoBuild="True"
|
|
Output="$(TestPackagesDir)"
|
|
ProjectPath="%(TestPackageProject.ProjectPath)"
|
|
ToolPath="$(Stage0Directory)"
|
|
VersionSuffix="%(TestPackageProject.VersionSuffix)"
|
|
MsbuildArgs="$(DotNetPackMsbuildArgs) /p:SdkNuGetVersion=$(SdkNugetVersion)" />
|
|
</Target>
|
|
</Project>
|