Install previous runtimes for SDK tests

This commit is contained in:
Daniel Plaisted 2019-04-17 14:26:45 -07:00
parent 5552b276d8
commit ee7bc290b7

View file

@ -25,6 +25,7 @@
<PropertyGroup> <PropertyGroup>
<RedistLayoutPath>$(ArtifactsBinDir)redist\$(Configuration)\dotnet\</RedistLayoutPath> <RedistLayoutPath>$(ArtifactsBinDir)redist\$(Configuration)\dotnet\</RedistLayoutPath>
<DotnetToTestPath>$(ArtifactsBinDir)redist\$(Configuration)\dotnet-with-previous-runtimes\</DotnetToTestPath>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -35,9 +36,53 @@
<SdkTest Include="Rebuild" /> <SdkTest Include="Rebuild" />
<SdkTest Include="Restore" /> <SdkTest Include="Restore" />
<SdkTest Include="ToolPack" /> <SdkTest Include="ToolPack" />
<RuntimeVersionToInstall Include="1.0.5" />
<RuntimeVersionToInstall Include="1.1.2" />
<RuntimeVersionToInstall Include="2.1.0" />
<RuntimeVersionToInstall Include="2.2.4" />
</ItemGroup> </ItemGroup>
<Target Name="RunSdkTests"> <Target Name="SetupLayoutWithPreviousRuntimes">
<ItemGroup>
<LayoutFilesToCopyToDotnetToTest Include="$(RedistLayoutPath)**"/>
<LayoutFilesToCopyToDotnetToTest>
<DestinationPath>$(DotnetToTestPath)%(RecursiveDir)%(Filename)%(Extension)</DestinationPath>
</LayoutFilesToCopyToDotnetToTest>
</ItemGroup>
<Copy SourceFiles="@(LayoutFilesToCopyToDotnetToTest)"
DestinationFiles="@(LayoutFilesToCopyToDotnetToTest->'%(DestinationPath)')"
SkipUnchangedFiles="true"/>
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="InstallRuntimeToLayout"
Properties="RuntimeVersionToInstall=%(RuntimeVersionToInstall.Identity)"
BuildInParallel="false"/>
</Target>
<Target Name="InstallRuntimeToLayout">
<PropertyGroup>
<RuntimeTargetDirectory>$(DotnetToTestPath)shared\Microsoft.NETCore.App\$(RuntimeVersionToInstall)</RuntimeTargetDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(OS)' == 'Windows_NT'">
<InstallRuntimeCommand>powershell -NoLogo -NoProfile -ExecutionPolicy ByPass</InstallRuntimeCommand>
<InstallRuntimeCommand>$(InstallRuntimeCommand) $(_DotNetRoot)dotnet-install.ps1</InstallRuntimeCommand>
<InstallRuntimeCommand>$(InstallRuntimeCommand) -Version $(RuntimeVersionToInstall)</InstallRuntimeCommand>
<InstallRuntimeCommand>$(InstallRuntimeCommand) -InstallDir $(DotnetToTestPath)</InstallRuntimeCommand>
<InstallRuntimeCommand>$(InstallRuntimeCommand) -Runtime "dotnet"</InstallRuntimeCommand>
</PropertyGroup>
<PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
<InstallRuntimeCommand>$(_DotNetRoot)dotnet-install.sh</InstallRuntimeCommand>
<InstallRuntimeCommand>$(InstallRuntimeCommand) --version $(RuntimeVersionToInstall)</InstallRuntimeCommand>
<InstallRuntimeCommand>$(InstallRuntimeCommand) --install_dir $(DotnetToTestPath)</InstallRuntimeCommand>
<InstallRuntimeCommand>$(InstallRuntimeCommand) --runtime "dotnet"</InstallRuntimeCommand>
</PropertyGroup>
<Exec Command="$(InstallRuntimeCommand)"
Condition="!Exists($(RuntimeTargetDirectory))"/>
</Target>
<Target Name="RunSdkTests" DependsOnTargets="SetupLayoutWithPreviousRuntimes">
<!-- SDK tests use the $(TEMP)\dotnetSdkTests as the working directory, isolate that from any higher-level <!-- SDK tests use the $(TEMP)\dotnetSdkTests as the working directory, isolate that from any higher-level
Directory.Build files (TEMP is set to a folder in the repo when running in CI) --> Directory.Build files (TEMP is set to a folder in the repo when running in CI) -->
@ -77,7 +122,7 @@
<ResultsStdOutPath>$(ArtifactsLogDir)$(TestProjectName).log</ResultsStdOutPath> <ResultsStdOutPath>$(ArtifactsLogDir)$(TestProjectName).log</ResultsStdOutPath>
<TestArgs>-noautoreporters -noRepoInference</TestArgs> <TestArgs>-noautoreporters -noRepoInference</TestArgs>
<TestArgs>$(TestArgs) -dotnetPath $(RedistLayoutPath)\dotnet</TestArgs> <TestArgs>$(TestArgs) -dotnetPath $(DotnetToTestPath)\dotnet</TestArgs>
<TestArgs>$(TestArgs) -xml "$(ResultsXmlPath)"</TestArgs> <TestArgs>$(TestArgs) -xml "$(ResultsXmlPath)"</TestArgs>
<TestArgs>$(TestArgs) -html "$(ResultsHtmlPath)" $(TestRunnerAdditionalArguments)</TestArgs> <TestArgs>$(TestArgs) -html "$(ResultsHtmlPath)" $(TestRunnerAdditionalArguments)</TestArgs>
<TestArgs>$(TestArgs) &gt; $(ResultsStdOutPath)</TestArgs> <TestArgs>$(TestArgs) &gt; $(ResultsStdOutPath)</TestArgs>