Check bitness of dotnet under test instead of test host process

This commit is contained in:
Daniel Plaisted 2018-11-29 21:07:50 -08:00
parent c4452f06c7
commit 7d461295be
2 changed files with 14 additions and 1 deletions

View file

@ -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();
}
}