Skip to content

Commit 2402b61

Browse files
author
Mateo Torres Ruiz
committed
Pass RID
1 parent a04b846 commit 2402b61

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/installer/tests/HostActivation.Tests/InstallLocationCommandResultExtensions.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,28 @@
77
using FluentAssertions;
88
using Microsoft.DotNet.Cli.Build.Framework;
99
using Microsoft.DotNet.CoreSetup.Test;
10+
using Xunit;
1011

1112
namespace HostActivation.Tests
1213
{
1314
internal static class InstallLocationCommandResultExtensions
1415
{
1516
private static bool IsRunningInWoW64(string rid) => OperatingSystem.IsWindows() && Environment.Is64BitOperatingSystem && rid.Equals("win-x86");
1617

17-
public static AndConstraint<CommandResultAssertions> HaveUsedDotNetRootInstallLocation(this CommandResultAssertions assertion, string installLocation)
18+
public static AndConstraint<CommandResultAssertions> HaveUsedDotNetRootInstallLocation(this CommandResultAssertions assertion, string installLocation, string rid)
1819
{
19-
return assertion.HaveUsedDotNetRootInstallLocation(installLocation, null, null);
20+
return assertion.HaveUsedDotNetRootInstallLocation(installLocation, rid, null);
2021
}
2122

2223
public static AndConstraint<CommandResultAssertions> HaveUsedDotNetRootInstallLocation(this CommandResultAssertions assertion,
2324
string installLocation,
24-
string arch,
25-
string rid)
25+
string rid,
26+
string arch)
2627
{
28+
// If no arch is passed and we are on Windows, we need the used RID for determining whether or not we are running on WoW64.
29+
if (string.IsNullOrEmpty(arch))
30+
Assert.NotNull(rid);
31+
2732
string expectedEnvironmentVariable = !string.IsNullOrEmpty(arch) ? $"DOTNET_ROOT_{arch.ToUpper()}" :
2833
IsRunningInWoW64(rid) ? "DOTNET_ROOT(x86)" : "DOTNET_ROOT";
2934

src/installer/tests/HostActivation.Tests/MultiArchInstallLocation.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void EnvironmentVariable_CurrentArchitectureIsUsedIfEnvVarSet()
3333
.DotNetRoot(fixture.BuiltDotnet.BinPath, arch)
3434
.Execute()
3535
.Should().Pass()
36-
.And.HaveUsedDotNetRootInstallLocation(fixture.BuiltDotnet.BinPath, arch, fixture.CurrentRid);
36+
.And.HaveUsedDotNetRootInstallLocation(fixture.BuiltDotnet.BinPath, fixture.CurrentRid, arch);
3737
}
3838

3939
[Fact]
@@ -49,7 +49,7 @@ public void EnvironmentVariable_IfNoArchSpecificEnvVarIsFoundDotnetRootIsUsed()
4949
.DotNetRoot(fixture.BuiltDotnet.BinPath)
5050
.Execute()
5151
.Should().Pass()
52-
.And.HaveUsedDotNetRootInstallLocation(fixture.BuiltDotnet.BinPath);
52+
.And.HaveUsedDotNetRootInstallLocation(fixture.BuiltDotnet.BinPath, fixture.CurrentRid);
5353
}
5454

5555
[Fact]
@@ -67,7 +67,7 @@ public void EnvironmentVariable_ArchSpecificDotnetRootIsUsedOverDotnetRoot()
6767
.DotNetRoot(dotnet, arch)
6868
.Execute()
6969
.Should().Pass()
70-
.And.HaveUsedDotNetRootInstallLocation(dotnet, arch, fixture.CurrentRid)
70+
.And.HaveUsedDotNetRootInstallLocation(dotnet, fixture.CurrentRid, arch)
7171
.And.NotHaveStdErrContaining("Using environment variable DOTNET_ROOT=");
7272
}
7373

0 commit comments

Comments
 (0)