dotnet-installer/build/Test.targets

130 lines
5.8 KiB
Text
Raw Normal View History

<Project ToolsVersion="14.0" DefaultTargets="Test">
<Import Project="test/TestPackageProjects.targets" />
<Import Project="test/TestProjects.targets" />
2017-02-22 17:25:06 +00:00
<PropertyGroup>
<PathListSeparator>:</PathListSeparator>
<PathListSeparator Condition=" '$(OSName)' == 'win' ">%3b</PathListSeparator>
2017-02-27 19:06:44 +00:00
<ExecPath>$(OutputDirectory)$(PathListSeparator)$(PATH)</ExecPath>
<ExecPath Condition=" '$(OSName)' == 'win' ">$(OutputDirectory)</ExecPath>
<TestPackagesDir>$(TestOutputDir)/packages/</TestPackagesDir>
<TestArtifactsDir>$(TestOutputDir)/artifacts/</TestArtifactsDir>
<TestResultXmlDir>$(TestOutputDir)/results/</TestResultXmlDir>
2017-02-22 17:25:06 +00:00
</PropertyGroup>
2017-02-22 17:25:06 +00:00
<ItemGroup>
<TestTaskEnvironmentVariables Include="TEST_ARTIFACTS=$(TestArtifactsDir)" />
</ItemGroup>
2017-02-22 17:25:06 +00:00
<PropertyGroup>
<RunTestEnvironmentVariables>@(TestTaskEnvironmentVariables)</RunTestEnvironmentVariables>
</PropertyGroup>
2017-02-22 17:25:06 +00:00
<Target Name="Test"
Condition=" '$(CLIBUILD_SKIP_TESTS)' != 'true' "
DependsOnTargets="BuildTests;">
2016-08-09 22:19:34 +00:00
<ItemGroup>
<ProjectsToTest Include="build/test/RunTest.proj">
<Properties>
2017-02-27 19:06:44 +00:00
CLIBuildDll=$(CLIBuildDll);
2016-08-09 22:19:34 +00:00
Configuration=$(Configuration);
EnvironmentVariables=$(RunTestEnvironmentVariables);
TestProject=%(TestProjects.Identity);
2016-08-09 22:19:34 +00:00
TestResultXmlDir=$(TestResultXmlDir);
2017-02-27 19:06:44 +00:00
ToolPath=$(OutputDirectory);
WorkingDirectory=$([System.IO.Directory]::GetParent(%(TestProjects.Identity)))
2016-08-09 22:19:34 +00:00
</Properties>
</ProjectsToTest>
</ItemGroup>
<!-- Begin Workaround lack of a stable package version for depedencies; copy into simulated stable version folders -->
<PropertyGroup>
<StableSharedFrameworkDirectory>$(OutputDirectory)/shared/Microsoft.NETCore.App/$(SharedFrameworkStableVersion)</StableSharedFrameworkDirectory>
<StableSharedFrameworkDirectoryWithBackwardsCompatibleRuntimes>$(Stage2WithBackwardsCompatibleRuntimesOutputDirectory)/shared/Microsoft.NETCore.App/$(SharedFrameworkStableVersion)</StableSharedFrameworkDirectoryWithBackwardsCompatibleRuntimes>
</PropertyGroup>
<ItemGroup>
<Stabilize_SourceFiles_2_0 Include="$(OutputDirectory)/shared/Microsoft.NETCore.App/$(MicrosoftNETCoreAppPackageVersion)/*.*"/>
<SimulatedStableSharedFrameworkDirectories Condition=" '$(IsSharedFrameworkPreReleaseVersion)' == 'True' "
Include="$(StableSharedFrameworkDirectory)" />
<SimulatedStableSharedFrameworkDirectories Condition=" '$(IsSharedFrameworkPreReleaseVersion)' == 'True' "
Include="$(StableSharedFrameworkDirectoryWithBackwardsCompatibleRuntimes)" />
</ItemGroup>
<Copy
Condition=" '$(IsSharedFrameworkPreReleaseVersion)' == 'True' "
SourceFiles="@(Stabilize_SourceFiles_2_0)"
DestinationFiles="@(Stabilize_SourceFiles_2_0->'$(StableSharedFrameworkDirectory)/%(RecursiveDir)%(Filename)%(Extension)')"
/>
<Copy
Condition=" '$(IsSharedFrameworkPreReleaseVersion)' == 'True' "
SourceFiles="@(Stabilize_SourceFiles_2_0)"
DestinationFiles="@(Stabilize_SourceFiles_2_0->'$(StableSharedFrameworkDirectoryWithBackwardsCompatibleRuntimes)/%(RecursiveDir)%(Filename)%(Extension)')"
/>
<!-- End Workaround lack of a stable package version for depedencies; copy into simulated stable versions -->
<Message Text="Starting test execution" Importance="High" />
2016-08-09 22:19:34 +00:00
<MSBuild
BuildInParallel="True"
Projects="@(ProjectsToTest)">
</MSBuild>
<Exec Command="$(DotnetInOutputDirectory) exec $(RoslynDirectory)/bincore/VBCSCompiler.dll -shutdown" />
<Message Text="Finished test execution" Importance="High" />
<!-- Begin Workaround lack of a stable package version for depedencies; remove simulated stable version folder. -->
<RemoveDir Directories="@(SimulatedStableSharedFrameworkDirectories)" />
<!-- End Workaround lack of a stable package version for depedencies; remove simulated stable version folder. -->
</Target>
<Target Name="PrepareTests"
DependsOnTargets="Init;
SetupTestProjectData">
<MakeDir Directories="$(TestPackagesDir)" Condition="!Exists('$(TestPackagesDir)')"/>
</Target>
<Target Name="RestoreTests"
DependsOnTargets="PrepareTests;
CreateTestAssetPackageNuPkgs;">
<DotNetRestore ToolPath="$(OutputDirectory)"
2017-01-18 20:04:18 +00:00
ProjectPath="&quot;$(TestDirectory)/Microsoft.DotNet.Cli.Tests.sln&quot;" />
</Target>
<Target Name="BuildTests"
DependsOnTargets="RestoreTests;">
<DotNetBuild ToolPath="$(OutputDirectory)"
2017-03-01 03:30:43 +00:00
ProjectPath="&quot;$(TestDirectory)/Microsoft.DotNet.Cli.Tests.sln&quot;"
MaxCpuCount="1" />
</Target>
2016-08-09 22:19:34 +00:00
<Target Name="CreateTestAssetPackageNuPkgs"
DependsOnTargets="SetupTestPackageProjectData;"
2017-01-26 19:47:06 +00:00
Outputs="%(TestPackageProject.Identity)">
2017-02-27 19:06:44 +00:00
<DotNetRestore ToolPath="$(OutputDirectory)"
WorkingDirectory="$([System.IO.Directory]::GetParent('%(TestPackageProject.ProjectPath)'))"
ProjectPath="%(TestPackageProject.ProjectPath)" />
<!-- https://github.com/NuGet/Home/issues/4063 -->
<DotNetPack Output="$(TestPackagesDir)"
ProjectPath="%(TestPackageProject.ProjectPath)"
ToolPath="$(OutputDirectory)"
VersionSuffix="%(TestPackageProject.VersionSuffix)"
MsbuildArgs="%(TestPackageProject.MsbuildArgs) /p:SdkNuGetVersion=$(SdkNugetVersion)" />
</Target>
2017-01-27 08:45:59 +00:00
<Target Name="EnsureStageSeparation">
2017-02-27 19:06:44 +00:00
<DotNetMSBuild Arguments="/v:diag $(RepoRoot)/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj /p:OutputDirectory=&quot;$(OutputDirectory)&quot;"
2017-01-27 08:56:51 +00:00
ToolPath="$(Stage0Directory)" />
</Target>
</Project>