Check bitness of dotnet under test instead of test host process
This commit is contained in:
parent
c4452f06c7
commit
7d461295be
2 changed files with 14 additions and 1 deletions
|
@ -41,7 +41,8 @@ namespace EndToEnd.Tests
|
|||
var dotnetRoot = Path.GetDirectoryName(RepoDirectoriesProvider.DotnetUnderTest);
|
||||
if (!string.IsNullOrEmpty(dotnetRoot))
|
||||
{
|
||||
runCommand = runCommand.WithEnvironmentVariable(Environment.Is64BitProcess ? "DOTNET_ROOT" : "DOTNET_ROOT(x86)",
|
||||
bool useX86 = RepoDirectoriesProvider.DotnetRidUnderTest.EndsWith("x86", StringComparison.InvariantCultureIgnoreCase);
|
||||
runCommand = runCommand.WithEnvironmentVariable(useX86 ? "DOTNET_ROOT(x86)" : "DOTNET_ROOT",
|
||||
dotnetRoot);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Xml.Linq;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||
|
@ -16,6 +17,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
|
||||
public readonly static string TestWorkingFolder;
|
||||
public readonly static string DotnetUnderTest;
|
||||
public readonly static string DotnetRidUnderTest;
|
||||
|
||||
static RepoDirectoriesProvider()
|
||||
{
|
||||
|
@ -58,6 +60,16 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
DotnetUnderTest = Path.Combine(RepoRoot, "artifacts", "bin", "redist", configuration, "dotnet", "dotnet" + dotnetExtension);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Resolve dotnet folder even if DotnetUnderTest doesn't have full path
|
||||
var sdkFolders = Directory.GetDirectories(Path.Combine(Path.GetDirectoryName(DotnetUnderTest), "sdk"));
|
||||
sdkFolders.Length.Should().Be(1, "Only one SDK folder is expected in the layout");
|
||||
|
||||
var sdkFolder = sdkFolders.Single();
|
||||
var versionFile = Path.Combine(sdkFolder, ".version");
|
||||
|
||||
var lines = File.ReadAllLines(versionFile);
|
||||
DotnetRidUnderTest = lines[2].Trim();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue