Add logic in test infrastructure to get runtime for coreclr on mac
This commit is contained in:
parent
374526b270
commit
5f4f6194b8
|
|
@ -99,16 +99,31 @@ namespace Microsoft.AspNet.Server.Testing
|
||||||
|
|
||||||
protected string PopulateChosenRuntimeInformation()
|
protected string PopulateChosenRuntimeInformation()
|
||||||
{
|
{
|
||||||
// ex: runtimes/dnx-coreclr-win-x64.1.0.0-rc1-15844/bin
|
string currentRuntimeBinPath = string.Empty;
|
||||||
var currentRuntimeBinPath = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
|
if (TestPlatformHelper.IsMac && DeploymentParameters.RuntimeFlavor == RuntimeFlavor.CoreClr)
|
||||||
|
{
|
||||||
|
var path = Environment.GetEnvironmentVariable("PATH");
|
||||||
|
currentRuntimeBinPath = path.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).
|
||||||
|
Where(c => c.Contains("dnx-coreclr-darwin") || c.Contains("dnx-mono")).FirstOrDefault();
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(currentRuntimeBinPath))
|
||||||
|
{
|
||||||
|
throw new Exception("Runtime not detected on the machine.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// ex: runtimes/dnx-coreclr-win-x64.1.0.0-rc1-15844/bin
|
||||||
|
currentRuntimeBinPath = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
|
||||||
|
}
|
||||||
Logger.LogInformation($"Current runtime path is : {currentRuntimeBinPath}");
|
Logger.LogInformation($"Current runtime path is : {currentRuntimeBinPath}");
|
||||||
|
|
||||||
var targetRuntimeName = new StringBuilder()
|
var targetRuntimeName = new StringBuilder()
|
||||||
.Append("dnx")
|
.Append("dnx")
|
||||||
.Append((DeploymentParameters.RuntimeFlavor == RuntimeFlavor.CoreClr) ? "-coreclr" : "-clr")
|
.Append((DeploymentParameters.RuntimeFlavor == RuntimeFlavor.CoreClr) ? "-coreclr" : "-clr")
|
||||||
.Append($"-{OSPrefix}")
|
.Append($"-{OSPrefix}")
|
||||||
.Append((DeploymentParameters.RuntimeArchitecture == RuntimeArchitecture.x86) ? "-x86" : "-x64")
|
.Append((DeploymentParameters.RuntimeArchitecture == RuntimeArchitecture.x86) ? "-x86" : "-x64")
|
||||||
.ToString();
|
.ToString();
|
||||||
|
|
||||||
string targetRuntimeBinPath;
|
string targetRuntimeBinPath;
|
||||||
// Ex: When current runtime is Mono and the tests are being run for CoreClr
|
// Ex: When current runtime is Mono and the tests are being run for CoreClr
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue