Skip to content

Commit 2e7c585

Browse files
authored
Add MSI Installation Tests (#38782)
2 parents 9927abb + 2b79b4b commit 2e7c585

22 files changed

+2068
-11
lines changed

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsoleVersion)" />
4040
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="$(MicrosoftExtensionsObjectPoolPackageVersion)"/>
4141
<PackageVersion Include="Microsoft.FSharp.Compiler" Version="$(MicrosoftFSharpCompilerPackageVersion)" />
42+
<PackageVersion Include="Microsoft.Management.Infrastructure" Version="3.0.0" />
4243
<PackageVersion Include="Microsoft.NET.HostModel" Version="$(MicrosoftNETHostModelVersion)" />
4344
<PackageVersion Include="Microsoft.NET.Sdk.Razor.SourceGenerators.Transport" Version="$(MicrosoftNETSdkRazorSourceGeneratorsTransportPackageVersion)" />
4445
<PackageVersion Include="Microsoft.NET.StringTools" Version="$(MicrosoftNETStringToolsPackageVersion)" />

documentation/general/workloads/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ Other documentation for workloads is in this repo:
2020
- [Grouping multiple packs into one MSI](https://github.com/dotnet/sdk/issues/21741)
2121
- [Handling workload assets across major .NET versions](cross-version-workloads.md)
2222
- [Workload Clean Command](workload-clean.md)
23+
- [Workload MSI Installation Tests](/src/Tests/dotnet-MsiInstallation.Tests/README.md)

sdk.sln

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Build.Contain
473473
EndProject
474474
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Build.Containers.UnitTests", "src\Tests\Microsoft.NET.Build.Containers.UnitTests\Microsoft.NET.Build.Containers.UnitTests.csproj", "{E54506B8-0B81-4FC4-99B5-5C67E19D4B09}"
475475
EndProject
476-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDDLTests", "src\Tests\SDDLTests\SDDLTests.csproj", "{FEA8B7B5-901B-4A3A-948F-7E5F54F09FF5}"
476+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SDDLTests", "src\Tests\SDDLTests\SDDLTests.csproj", "{FEA8B7B5-901B-4A3A-948F-7E5F54F09FF5}"
477+
EndProject
478+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-MsiInstallation.Tests", "src\Tests\dotnet-MsiInstallation.Tests\dotnet-MsiInstallation.Tests.csproj", "{36975025-857B-45F0-AB39-904B521A6713}"
477479
EndProject
478480
Global
479481
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -893,6 +895,10 @@ Global
893895
{FEA8B7B5-901B-4A3A-948F-7E5F54F09FF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
894896
{FEA8B7B5-901B-4A3A-948F-7E5F54F09FF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
895897
{FEA8B7B5-901B-4A3A-948F-7E5F54F09FF5}.Release|Any CPU.Build.0 = Release|Any CPU
898+
{36975025-857B-45F0-AB39-904B521A6713}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
899+
{36975025-857B-45F0-AB39-904B521A6713}.Debug|Any CPU.Build.0 = Debug|Any CPU
900+
{36975025-857B-45F0-AB39-904B521A6713}.Release|Any CPU.ActiveCfg = Release|Any CPU
901+
{36975025-857B-45F0-AB39-904B521A6713}.Release|Any CPU.Build.0 = Release|Any CPU
896902
EndGlobalSection
897903
GlobalSection(SolutionProperties) = preSolution
898904
HideSolutionNode = FALSE
@@ -1056,6 +1062,7 @@ Global
10561062
{7DCA2BEC-B1E1-4F2B-952A-A26B5110FDA5} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
10571063
{E54506B8-0B81-4FC4-99B5-5C67E19D4B09} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
10581064
{FEA8B7B5-901B-4A3A-948F-7E5F54F09FF5} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
1065+
{36975025-857B-45F0-AB39-904B521A6713} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
10591066
EndGlobalSection
10601067
GlobalSection(ExtensibilityGlobals) = postSolution
10611068
SolutionGuid = {FB8F26CE-4DE6-433F-B32A-79183020BBD6}

src/Tests/Directory.Build.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
66
</PropertyGroup>
77

8-
<PropertyGroup Condition="'$(IsTestProject)' == 'true' AND '$(OutputType)' == 'Exe' AND '$(DotNetBuildFromSource)' != 'true'">
8+
<PropertyGroup Condition="'$(IsTestProject)' == 'true' AND '$(CanRunTestAsTool)' != 'false' AND '$(OutputType)' == 'Exe' AND '$(DotNetBuildFromSource)' != 'true'">
99
<IsPackable>true</IsPackable>
1010
<PackAsTool>true</PackAsTool>
1111
<ToolCommandName>$(PackageId)</ToolCommandName>

src/Tests/Microsoft.NET.TestFramework/Commands/TestCommand.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,22 +132,27 @@ public virtual CommandResult Execute(IEnumerable<string> args)
132132

133133
var result = ((Command)command).Execute(ProcessStartedHandler);
134134

135-
Log.WriteLine($"> {result.StartInfo.FileName} {result.StartInfo.Arguments}");
136-
Log.WriteLine(result.StdOut);
135+
LogCommandResult(Log, result);
136+
137+
return result;
138+
}
139+
140+
public static void LogCommandResult(ITestOutputHelper log, CommandResult result)
141+
{
142+
log.WriteLine($"> {result.StartInfo.FileName} {result.StartInfo.Arguments}");
143+
log.WriteLine(result.StdOut);
137144

138145
if (!string.IsNullOrEmpty(result.StdErr))
139146
{
140-
Log.WriteLine("");
141-
Log.WriteLine("StdErr:");
142-
Log.WriteLine(result.StdErr);
147+
log.WriteLine("");
148+
log.WriteLine("StdErr:");
149+
log.WriteLine(result.StdErr);
143150
}
144151

145152
if (result.ExitCode != 0)
146153
{
147-
Log.WriteLine($"Exit Code: {result.ExitCode}");
154+
log.WriteLine($"Exit Code: {result.ExitCode}");
148155
}
149-
150-
return result;
151156
}
152157
}
153158
}

src/Tests/UnitTests.proj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.DotNet.Helix.Sdk">
1+
<Project Sdk="Microsoft.DotNet.Helix.Sdk">
22

33
<PropertyGroup>
44
<HelixType>test/product/</HelixType>
@@ -45,6 +45,9 @@
4545
<TargetFramework>net472</TargetFramework>
4646
<RuntimeTargetFramework>net472</RuntimeTargetFramework>
4747
</SDKCustomXUnitProject>
48+
49+
<!-- Don't run MSI installation tests in Helix / CI -->
50+
<SdkCustomXUnitProject Remove="dotnet-MsiInstallation.Tests\**\*" />
4851
</ItemGroup>
4952

5053
<ItemGroup Condition=" '$(_CustomHelixTargetQueue)' != '' ">

0 commit comments

Comments
 (0)