Use runtime directory instead of compile directory when running tests

This commit is contained in:
Pranav K 2016-04-18 15:28:01 -07:00
parent 18ae4d4791
commit 8c6c192806
2 changed files with 10 additions and 13 deletions

View file

@ -26,15 +26,7 @@ namespace Microsoft.DotNet.Tools.Test
_dotentTestParams.BuildBasePath,
_dotentTestParams.Output);
var assemblyUnderTest = outputPaths.CompilationFiles.Assembly;
if (!string.IsNullOrEmpty(_dotentTestParams.Output) ||
!string.IsNullOrEmpty(_dotentTestParams.BuildBasePath))
{
assemblyUnderTest = outputPaths.RuntimeFiles.Assembly;
}
return assemblyUnderTest;
return outputPaths.RuntimeFiles.Assembly;
}
}
}

View file

@ -7,8 +7,9 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.Dnx.Runtime.Common.CommandLine;
using Microsoft.DotNet.ProjectModel;
using Microsoft.Dnx.Runtime.Common.CommandLine;
using Microsoft.Extensions.PlatformAbstractions;
namespace Microsoft.DotNet.Tools.Test
{
@ -42,7 +43,7 @@ namespace Microsoft.DotNet.Tools.Test
RegisterForParentProcessExit(dotnetTestParams.ParentProcessId.Value);
}
var projectContexts = CreateProjectContexts(dotnetTestParams.ProjectPath);
var projectContexts = CreateProjectContexts(dotnetTestParams.ProjectPath, dotnetTestParams.Runtime);
var projectContext = projectContexts.First();
@ -98,7 +99,7 @@ namespace Microsoft.DotNet.Tools.Test
}
}
private static IEnumerable<ProjectContext> CreateProjectContexts(string projectPath)
private static IEnumerable<ProjectContext> CreateProjectContexts(string projectPath, string runtime)
{
projectPath = projectPath ?? Directory.GetCurrentDirectory();
@ -112,7 +113,11 @@ namespace Microsoft.DotNet.Tools.Test
throw new InvalidOperationException($"{projectPath} does not exist.");
}
return ProjectContext.CreateContextForEachFramework(projectPath);
var runtimeIdentifiers = !string.IsNullOrEmpty(runtime) ?
new[] { runtime } :
PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers();
return ProjectContext.CreateContextForEachFramework(projectPath).Select(context => context.CreateRuntimeContext(runtimeIdentifiers));
}
}
}